feat(editor): implement tree directory selector for file creation #110

This commit is contained in:
duorameng
2026-06-10 16:57:44 +08:00
parent 166afb1f97
commit bf2cc7da0e
3 changed files with 134 additions and 5 deletions
+16
View File
@@ -24,6 +24,21 @@ const fileTree = ref<FileNode[]>([])
const expandedDirs = ref<Set<string>>(new Set())
const selectedPath = ref<string | null>(null)
const allDirs = computed(() => {
const dirs: string[] = []
function traverse(nodes: FileNode[]) {
for (const node of nodes) {
if (node.isDir) {
dirs.push(node.path)
if (node.children) traverse(node.children)
}
}
}
traverse(fileTree.value)
return dirs
})
// State for Editor
const selectedFile = ref<string | null>(null)
const fileContent = ref('')
@@ -479,6 +494,7 @@ onUnmounted(() => {
<FileActionDialogs
ref="dialogsRef"
:file-tree="fileTree"
@create="createItem"
@delete="deleteItem"
@rename="renameItem"