mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-13 17:10:06 +00:00
Node library custom bookmark folder (#631)
* Add new folder button * Add tree util test * nit * Support empty folder in node library * Drag to bookmark folder * Use bookmark icon for bookmark folder * Highlight on dragover * nit * Auto-expand on item added * Extract bookmark system as store * Add context menu on bookmark folder * Add editable text * Fix reactivity * Plumb editable text * refactor * Rename node * Fix focus * Prevent name collision * nit * Add new folder * nested folder support * Change drag behavior * Add basic playwright tests * nit * Target tree-node-content instead of tree-node
This commit is contained in:
@@ -205,6 +205,14 @@ export class ComfyNodeDefImpl {
|
||||
})
|
||||
return new ComfyOutputsSpec(result)
|
||||
}
|
||||
|
||||
get nodePath(): string {
|
||||
return (this.category ? this.category + '/' : '') + this.display_name
|
||||
}
|
||||
|
||||
get isDummyFolder(): boolean {
|
||||
return this.name === ''
|
||||
}
|
||||
}
|
||||
|
||||
export const SYSTEM_NODE_DEFS: Record<string, ComfyNodeDef> = {
|
||||
@@ -244,10 +252,19 @@ export const SYSTEM_NODE_DEFS: Record<string, ComfyNodeDef> = {
|
||||
}
|
||||
|
||||
export function buildNodeDefTree(nodeDefs: ComfyNodeDefImpl[]): TreeNode {
|
||||
return buildTree(nodeDefs, (nodeDef: ComfyNodeDefImpl) => [
|
||||
...nodeDef.category.split('/').filter((s) => s !== ''),
|
||||
nodeDef.display_name
|
||||
])
|
||||
return buildTree(nodeDefs, (nodeDef: ComfyNodeDefImpl) =>
|
||||
nodeDef.nodePath.split('/')
|
||||
)
|
||||
}
|
||||
|
||||
export function createDummyFolderNodeDef(folderPath: string): ComfyNodeDefImpl {
|
||||
return plainToClass(ComfyNodeDefImpl, {
|
||||
name: '',
|
||||
display_name: '',
|
||||
category: folderPath.endsWith('/') ? folderPath.slice(0, -1) : folderPath,
|
||||
python_module: 'nodes',
|
||||
description: 'Dummy Folder Node (User should never see this string)'
|
||||
})
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
Reference in New Issue
Block a user