File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 6666 self . buildTree ( path ) ;
6767 } ) ;
6868 } ;
69-
69+
7070 FileNavigator . prototype . buildTree = function ( path ) {
7171 function recursive ( parent , item , path ) {
7272 var absName = path ? ( path + '/' + item . model . name ) : item . model . name ;
9090 } ) ;
9191 }
9292
93- ! this . history . length && this . history . push ( { name : path , nodes : [ ] } ) ;
93+ ! this . history . length && this . history . push ( { name : '' , nodes : [ ] } ) ;
94+ function flatten ( node , array ) {
95+ array . push ( node ) ;
96+ for ( var n in node . nodes ) {
97+ flatten ( node . nodes [ n ] , array ) ;
98+ }
99+ }
100+ function findNode ( data , path ) {
101+ return data . filter ( function ( n ) {
102+ return n . name === path ;
103+ } ) [ 0 ] ;
104+ }
105+ var flatNodes = [ ] ;
106+ flatten ( this . history [ 0 ] , flatNodes ) ;
107+ var selectedNode = findNode ( flatNodes , path ) ;
108+ selectedNode . nodes = [ ] ;
109+
94110 for ( var o in this . fileList ) {
95111 var item = this . fileList [ o ] ;
96112 item . isFolder ( ) && recursive ( this . history [ 0 ] , item , path ) ;
You can’t perform that action at this time.
0 commit comments