Fix core sidebar tab toggle command register (#1159)

This commit is contained in:
Chenlei Hu
2024-10-07 21:32:30 -04:00
committed by GitHub
parent 50a6ee27a0
commit 58dd15a662
2 changed files with 11 additions and 10 deletions

View File

@@ -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) => {

View File

@@ -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)