[Refactor] Support handleAddFolder in TreeExplorer (#3101)

This commit is contained in:
Chenlei Hu
2025-03-17 14:08:23 -04:00
committed by GitHub
parent b36f748a78
commit 90053058ba
9 changed files with 192 additions and 65 deletions

View File

@@ -73,14 +73,12 @@ export const useNodeBookmarkStore = defineStore('nodeBookmark', () => {
)
}
const addNewBookmarkFolder = (parent?: ComfyNodeDefImpl) => {
const addNewBookmarkFolder = (
parent: ComfyNodeDefImpl | undefined,
folderName: string
) => {
const parentPath = parent ? parent.nodePath : ''
let newFolderPath = parentPath + 'New Folder/'
let suffix = 1
while (bookmarks.value.some((b: string) => b.startsWith(newFolderPath))) {
newFolderPath = parentPath + `New Folder ${suffix}/`
suffix++
}
const newFolderPath = parentPath + folderName + '/'
addBookmark(newFolderPath)
return newFolderPath
}