mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-26 17:30:07 +00:00
[Refactor] Extract top menu bar command definitions (#1778)
This commit is contained in:
@@ -511,6 +511,36 @@ export const useCommandStore = defineStore('command', () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.Help.OpenComfyUIIssues',
|
||||
icon: 'pi pi-github',
|
||||
label: 'ComfyUI Issues',
|
||||
versionAdded: '1.5.5',
|
||||
function: () => {
|
||||
window.open(
|
||||
'https://github.com/comfyanonymous/ComfyUI/issues',
|
||||
'_blank'
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.Help.OpenComfyUIDocs',
|
||||
icon: 'pi pi-info-circle',
|
||||
label: 'ComfyUI Docs',
|
||||
versionAdded: '1.5.5',
|
||||
function: () => {
|
||||
window.open('https://docs.comfy.org/', '_blank')
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.Help.OpenComfyOrgDiscord',
|
||||
icon: 'pi pi-discord',
|
||||
label: 'Comfy-Org Discord',
|
||||
versionAdded: '1.5.5',
|
||||
function: () => {
|
||||
window.open('https://www.comfy.org/discord', '_blank')
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import type { MenuItem } from 'primevue/menuitem'
|
||||
import { ref } from 'vue'
|
||||
import { useCommandStore } from './commandStore'
|
||||
import { ComfyExtension } from '@/types/comfy'
|
||||
import { CORE_MENU_COMMANDS } from '@/constants/coreMenuCommands'
|
||||
|
||||
export const useMenuItemStore = defineStore('menuItem', () => {
|
||||
const commandStore = useCommandStore()
|
||||
@@ -77,53 +78,17 @@ export const useMenuItemStore = defineStore('menuItem', () => {
|
||||
})
|
||||
}
|
||||
|
||||
// Core menu commands
|
||||
registerCommands(['Workflow'], ['Comfy.NewBlankWorkflow'])
|
||||
|
||||
registerCommands(
|
||||
['Workflow'],
|
||||
['Comfy.OpenWorkflow', 'Comfy.BrowseTemplates']
|
||||
)
|
||||
registerCommands(
|
||||
['Workflow'],
|
||||
[
|
||||
'Comfy.SaveWorkflow',
|
||||
'Comfy.SaveWorkflowAs',
|
||||
'Comfy.ExportWorkflow',
|
||||
'Comfy.ExportWorkflowAPI'
|
||||
]
|
||||
)
|
||||
|
||||
registerCommands(['Edit'], ['Comfy.Undo', 'Comfy.Redo'])
|
||||
registerCommands(['Edit'], ['Comfy.RefreshNodeDefinitions'])
|
||||
registerCommands(['Edit'], ['Comfy.ClearWorkflow'])
|
||||
registerCommands(['Edit'], ['Comfy.OpenClipspace'])
|
||||
|
||||
registerMenuGroup(
|
||||
['Help'],
|
||||
[
|
||||
{
|
||||
icon: 'pi pi-github',
|
||||
label: 'ComfyUI Issues',
|
||||
url: 'https://github.com/comfyanonymous/ComfyUI/issues'
|
||||
},
|
||||
{
|
||||
icon: 'pi pi-info-circle',
|
||||
label: 'ComfyUI Docs',
|
||||
url: 'https://docs.comfy.org/'
|
||||
},
|
||||
{
|
||||
icon: 'pi pi-discord',
|
||||
label: 'Comfy-Org',
|
||||
url: 'https://www.comfy.org/discord'
|
||||
}
|
||||
]
|
||||
)
|
||||
const registerCoreMenuCommands = () => {
|
||||
for (const [path, commands] of CORE_MENU_COMMANDS) {
|
||||
registerCommands(path, commands)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
menuItems,
|
||||
registerMenuGroup,
|
||||
registerCommands,
|
||||
loadExtensionMenuCommands
|
||||
loadExtensionMenuCommands,
|
||||
registerCoreMenuCommands
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user