Skip to content

Commit

Permalink
Fix core sidebar tab toggle command register (#1159)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Oct 8, 2024
1 parent 50a6ee2 commit 58dd15a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
11 changes: 11 additions & 0 deletions src/stores/workspace/sidebarTabStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[]>([])
Expand All @@ -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) => {
Expand Down
10 changes: 0 additions & 10 deletions src/stores/workspaceStateStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 58dd15a

Please sign in to comment.