File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ export function useEditoroContext() {
4545 pinnedFilePaths : editorRefs . pinnedFilePaths ,
4646 showHiddenEntries : refs . preferencesRefs . showHiddenEntries ,
4747 setShowHiddenEntries : preferencesStore . setShowHiddenEntries ,
48+ selectNodeByPath : treeStore . selectNodeByPath ,
4849 treeInitialized : treeRefs . treeInitialized ,
4950 editorStore,
5051 loadTree
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ type FileSelectionOptions = {
1818 pinnedFilePaths : Ref < string [ ] >
1919 showHiddenEntries : Ref < boolean >
2020 setShowHiddenEntries : ( nextValue : boolean ) => void
21+ selectNodeByPath : ( path : string ) => void
2122 treeInitialized : Ref < boolean >
2223 editorStore : EditorStoreLike
2324 loadTree : ( preferPath ?: string ) => Promise < void >
@@ -53,8 +54,19 @@ export function useEditoroFileSelection(options: FileSelectionOptions) {
5354 return false
5455 }
5556
57+ if ( options . selectedNode . value ?. path === path ) {
58+ return true
59+ }
60+
5661 if ( hasHiddenPathSegment ( path ) && ! options . showHiddenEntries . value ) {
5762 options . setShowHiddenEntries ( true )
63+ await options . loadTree ( path )
64+ return options . selectedNode . value ?. path === path
65+ }
66+
67+ options . selectNodeByPath ( path )
68+ if ( options . selectedNode . value ?. path === path ) {
69+ return true
5870 }
5971
6072 await options . loadTree ( path )
You can’t perform that action at this time.
0 commit comments