mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-06 13:40:25 +00:00
Add toggle command for each sidebar tab registered (#1108)
* Add toggle command for each sidebar tab registered * nit
This commit is contained in:
@@ -261,19 +261,6 @@ export const useCommandStore = defineStore('command', () => {
|
||||
app.queuePrompt(-1, batchCount)
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.ToggleQueueSidebarTab',
|
||||
icon: 'pi pi-history',
|
||||
label: 'Queue',
|
||||
versionAdded: '1.3.7',
|
||||
function: () => {
|
||||
const tabId = 'queue'
|
||||
const workspaceStore = useWorkspaceStore()
|
||||
workspaceStore.updateActiveSidebarTab(
|
||||
workspaceStore.activeSidebarTab === tabId ? null : tabId
|
||||
)
|
||||
}
|
||||
},
|
||||
{
|
||||
id: 'Comfy.ShowSettingsDialog',
|
||||
icon: 'pi pi-cog',
|
||||
|
||||
@@ -34,13 +34,25 @@ export const CORE_KEYBINDINGS: Keybinding[] = [
|
||||
combo: {
|
||||
key: 'q'
|
||||
},
|
||||
commandId: 'Comfy.ToggleQueueSidebarTab'
|
||||
commandId: 'Workspace.ToggleSidebarTab.queue'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'h'
|
||||
key: 'w'
|
||||
},
|
||||
commandId: 'Comfy.ToggleQueueSidebarTab'
|
||||
commandId: 'Workspace.ToggleSidebarTab.workflows'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'n'
|
||||
},
|
||||
commandId: 'Workspace.ToggleSidebarTab.node-library'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
key: 'm'
|
||||
},
|
||||
commandId: 'Workspace.ToggleSidebarTab.model-library'
|
||||
},
|
||||
{
|
||||
combo: {
|
||||
|
||||
@@ -39,8 +39,20 @@ export const useWorkspaceStore = defineStore('workspace', {
|
||||
updateActiveSidebarTab(tabId: string) {
|
||||
this.activeSidebarTab = tabId
|
||||
},
|
||||
toggleSidebarTab(tabId: string) {
|
||||
this.activeSidebarTab = this.activeSidebarTab === tabId ? null : tabId
|
||||
},
|
||||
registerSidebarTab(tab: SidebarTabExtension) {
|
||||
this.sidebarTabs = [...this.sidebarTabs, tab]
|
||||
useCommandStore().registerCommand({
|
||||
id: `Workspace.ToggleSidebarTab.${tab.id}`,
|
||||
icon: tab.icon,
|
||||
label: tab.tooltip,
|
||||
tooltip: tab.tooltip,
|
||||
function: () => {
|
||||
this.toggleSidebarTab(tab.id)
|
||||
}
|
||||
})
|
||||
},
|
||||
unregisterSidebarTab(id: string) {
|
||||
const index = this.sidebarTabs.findIndex((tab) => tab.id === id)
|
||||
|
||||
Reference in New Issue
Block a user