mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-27 02:04:09 +00:00
Fix core sidebar tab toggle command register (#1159)
This commit is contained in:
@@ -5,6 +5,7 @@ import { useWorkflowsSidebarTab } from '@/hooks/sidebarTabs/workflowsSidebarTab'
|
||||
import { SidebarTabExtension } from '@/types/extensionTypes'
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
import { useCommandStore } from '../commandStore'
|
||||
|
||||
export const useSidebarTabStore = defineStore('sidebarTab', () => {
|
||||
const sidebarTabs = ref<SidebarTabExtension[]>([])
|
||||
@@ -23,6 +24,16 @@ export const useSidebarTabStore = defineStore('sidebarTab', () => {
|
||||
|
||||
const registerSidebarTab = (tab: SidebarTabExtension) => {
|
||||
sidebarTabs.value = [...sidebarTabs.value, tab]
|
||||
useCommandStore().registerCommand({
|
||||
id: `Workspace.ToggleSidebarTab.${tab.id}`,
|
||||
icon: tab.icon,
|
||||
label: tab.tooltip,
|
||||
tooltip: tab.tooltip,
|
||||
versionAdded: '1.3.9',
|
||||
function: () => {
|
||||
toggleSidebarTab(tab.id)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const unregisterSidebarTab = (id: string) => {
|
||||
|
||||
@@ -35,16 +35,6 @@ export const useWorkspaceStore = defineStore('workspace', {
|
||||
actions: {
|
||||
registerSidebarTab(tab: SidebarTabExtension) {
|
||||
this.sidebarTab.registerSidebarTab(tab)
|
||||
useCommandStore().registerCommand({
|
||||
id: `Workspace.ToggleSidebarTab.${tab.id}`,
|
||||
icon: tab.icon,
|
||||
label: tab.tooltip,
|
||||
tooltip: tab.tooltip,
|
||||
versionAdded: '1.3.9',
|
||||
function: () => {
|
||||
this.sidebarTab.toggleSidebarTab(tab.id)
|
||||
}
|
||||
})
|
||||
},
|
||||
unregisterSidebarTab(id: string) {
|
||||
this.sidebarTab.unregisterSidebarTab(id)
|
||||
|
||||
Reference in New Issue
Block a user