25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
feat(plugins): toggle sidebar shortcuts from context menus
二丫讲梵bb1628187b10
diff --git a/apps/desktop/src/components/plugins/PluginShortcutBar.spec.ts b/apps/desktop/src/components/plugins/PluginShortcutBar.spec.tsindex 93f6ca104b..c3eaf53a34 100644--- a/apps/desktop/src/components/plugins/PluginShortcutBar.spec.ts+++ b/apps/desktop/src/components/plugins/PluginShortcutBar.spec.ts@@ -5,11 +5,11 @@ import { OPEN_PLUGIN_SETTINGS } from "@/lib/plugins/pluginCenterNavigation";import PluginShortcutBar from "./PluginShortcutBar.vue";import { normalizePluginShortcutSettings, type PluginShortcutPosition } from "@/lib/plugins/pluginShortcuts";-const mocks = vi.hoisted(() => ({ openSettings: vi.fn(), open: vi.fn(), save: vi.fn(), toast: vi.fn(), state: null as any, entries: null as any }));+const mocks = vi.hoisted(() => ({ openSettings: vi.fn(), open: vi.fn(), save: vi.fn(), toast: vi.fn(), state: null as any, entries: null as any, allEntries: null as any }));vi.mock("vue-i18n", () => ({ useI18n: () => ({ t: (key: string) => key }) }));vi.mock("@/stores/settingsStore", () => ({ useSettingsStore: () => mocks.state }));vi.mock("@/composables/useToast", () => ({ useToast: () => ({ toast: mocks.toast }) }));-vi.mock("@/composables/usePluginShortcuts", () => ({ usePluginShortcuts: () => ({ entries: mocks.entries, open: mocks.open, isActive: (entry: any) => entry.id === "b" }) }));+vi.mock("@/composables/usePluginShortcuts", () => ({ usePluginShortcuts: () => ({ entries: mocks.entries, allEntries: mocks.allEntries, open: mocks.open, isActive: (entry: any) => entry.id === "b" }) }));vi.mock("./PluginIcon.vue", () => ({ default: { template: "<span />" } }));vi.mock("@/components/ui/LightTooltip.vue", () => ({ default: { props: ["text", "disabled"], template: "<span :data-tooltip='text'><slot /></span>" } }));@@ -45,6 +45,7 @@ beforeEach(() => {vi.clearAllMocks();mocks.state = reactive({ isEditorSettingsLoaded: true, editorSettings: { pluginShortcuts: normalizePluginShortcutSettings({ showSettingsEntry: false }) }, updateEditorSettingsAndPersist: mocks.save });mocks.entries = ref(["a", "b", "c"].map((id) => ({ id, pluginId: id, label: `Function ${id}`, pluginName: `Plugin ${id}`, kind: "workbench", targetId: id, disabled: false })));+ mocks.allEntries = ref([...mocks.entries.value]);mocks.save.mockResolvedValue(undefined);});afterEach(() => {@@ -54,6 +55,60 @@ afterEach(() => {});describe("plugin shortcut bar", () => {+ it("keeps the visibility menu open for repeated toggles and reflects failed saves", async () => {+ mocks.save.mockImplementation(async (patch: any) => {+ mocks.state.editorSettings.pluginShortcuts = patch.pluginShortcuts;+ });+ mount("right-top");+ container.querySelector("nav")!.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true }));+ await flush();+ const buttons = () => [...document.querySelectorAll<HTMLButtonElement>("[data-dbx-context-menu] button")];+ buttons()[0].click();+ await flush();+ expect(buttons()[0].getAttribute("aria-pressed")).toBe("false");+ buttons()[1].click();+ await flush();+ expect(mocks.state.editorSettings.pluginShortcuts.hiddenPluginIds).toEqual(["a", "b"]);+ buttons()[0].click();+ await flush();+ expect(buttons()[0].getAttribute("aria-pressed")).toBe("true");+ expect(mocks.state.editorSettings.pluginShortcuts.hiddenPluginIds).toEqual(["b"]);+ mocks.save.mockRejectedValueOnce(new Error("disk full"));+ buttons()[1].click();+ await flush();+ expect(buttons()[1].getAttribute("aria-pressed")).toBe("false");+ expect(mocks.toast).toHaveBeenCalledWith(expect.stringContaining("disk full"), 5000);+ document.dispatchEvent(new KeyboardEvent("keydown", { key: "Escape", bubbles: true }));+ await flush();+ expect(buttons()).toHaveLength(0);+ });++ it("lists hidden plugins on blank-area right-click and restores them", async () => {+ mocks.state.editorSettings.pluginShortcuts.hiddenPluginIds = ["b"];+ mocks.entries.value = mocks.entries.value.filter((entry: any) => entry.pluginId !== "b");+ mount("right-top");+ container.querySelector("nav")!.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true }));+ await flush();+ const buttons = [...document.querySelectorAll<HTMLButtonElement>("[data-dbx-context-menu] button")];+ expect(buttons.map((button) => button.textContent?.trim())).toEqual(["Plugin a", "Plugin b", "Plugin c"]);+ buttons[1].click();+ await flush();+ expect(mocks.save).toHaveBeenCalledWith({ pluginShortcuts: { ...mocks.state.editorSettings.pluginShortcuts, hiddenPluginIds: [] } });+ expect(mocks.open).not.toHaveBeenCalled();+ });++ it("retains the context-menu surface when every plugin is hidden", async () => {+ mount("right-top");+ mocks.entries.value = [];+ mocks.state.editorSettings.pluginShortcuts.hiddenPluginIds = ["a", "b", "c"];+ await flush();+ const bar = container.querySelector("nav")!;+ expect(bar).not.toBeNull();+ bar.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true }));+ await flush();+ expect(document.querySelectorAll("[data-dbx-context-menu] button")).toHaveLength(3);+ });+it.each(["left-top", "right-top", "sidebar-bottom"] as const)("keeps the measured preview inside both edges at %s", async (position) => {const original = HTMLElement.prototype.getBoundingClientRect;vi.spyOn(HTMLElement.prototype, "getBoundingClientRect").mockImplementation(function (this: HTMLElement) {@@ -92,6 +147,7 @@ describe("plugin shortcut bar", () => {button.click();expect(mocks.openSettings).toHaveBeenCalledOnce();mocks.entries.value = [];+ mocks.allEntries.value = [];await flush();expect(container.querySelector("[data-plugin-shortcut-settings]")).toBeNull();expect(container.querySelector("nav")).toBeNull();@@ -179,6 +235,7 @@ describe("plugin shortcut bar", () => {expect(container.querySelector("nav")).toBeNull();mocks.state.editorSettings.pluginShortcuts.enabled = true;mocks.entries.value = [];+ mocks.allEntries.value = [];await nextTick();expect(container.querySelector("nav")).toBeNull();});diff --git a/apps/desktop/src/components/plugins/PluginShortcutBar.vue b/apps/desktop/src/components/plugins/PluginShortcutBar.vueindex 8d1f18689c..01a688664f 100644--- a/apps/desktop/src/components/plugins/PluginShortcutBar.vue+++ b/apps/desktop/src/components/plugins/PluginShortcutBar.vue@@ -14,6 +14,7 @@ import { usePluginShortcutHeight } from "@/composables/usePluginShortcutHeight";import { useSettingsStore } from "@/stores/settingsStore";import { useToast } from "@/composables/useToast";import { movePluginShortcut, type PluginShortcutEntry, type PluginShortcutPosition } from "@/lib/plugins/pluginShortcuts";+import CustomContextMenu, { type ContextMenuItem } from "@/components/ui/CustomContextMenu.vue";const props = defineProps<{ position: PluginShortcutPosition }>();const { t } = useI18n();@@ -21,7 +22,7 @@ const settings = useSettingsStore();const openSettings = inject(OPEN_PLUGIN_SETTINGS, () => {});const showSettingsEntry = computed(() => settings.editorSettings.pluginShortcuts.showSettingsEntry);const { toast } = useToast();-const { entries, open, isActive } = usePluginShortcuts();+const { entries, allEntries, open, isActive } = usePluginShortcuts();const { update, saving } = usePluginShortcutPreferences();const section = ref<HTMLElement | null>(null);const scroll = ref<HTMLElement | null>(null);@@ -76,97 +77,134 @@ function activate(entry: PluginShortcutEntry) {function activateSettings() {if (!sorting.suppressClick()) openSettings();}+function togglePluginVisibility(pluginId: string, visible: boolean) {+ return update((current) => ({+ hiddenPluginIds: visible ? current.hiddenPluginIds.filter((id) => id !== pluginId) : [...new Set([...current.hiddenPluginIds, pluginId])],+ })).catch(saveError);+}+function pluginContextMenuItems(entry: PluginShortcutEntry): ContextMenuItem[] {+ const visible = !settings.editorSettings.pluginShortcuts.hiddenPluginIds.includes(entry.pluginId);+ return [+ {+ label: t("pluginPlatform.shortcutsShowInSidebar"),+ checked: visible,+ checkedStyle: "switch",+ action: () => void togglePluginVisibility(entry.pluginId, !visible),+ },+ ];+}+function sidebarContextMenuItems(): ContextMenuItem[] {+ const plugins = new Map<string, PluginShortcutEntry>();+ for (const entry of allEntries.value) if (!plugins.has(entry.pluginId)) plugins.set(entry.pluginId, entry);+ return [...plugins.values()].map((entry) => {+ return {+ label: entry.pluginName,+ get checked() {+ return !settings.editorSettings.pluginShortcuts.hiddenPluginIds.includes(entry.pluginId);+ },+ checkedStyle: "switch" as const,+ closeOnSelect: false,+ disabled: () => saving.value,+ action: () => void togglePluginVisibility(entry.pluginId, settings.editorSettings.pluginShortcuts.hiddenPluginIds.includes(entry.pluginId)),+ };+ });+}</script><template>- <nav- v-if="settings.isEditorSettingsLoaded && settings.editorSettings.pluginShortcuts.enabled && entries.length"- ref="section"- :aria-label="t('pluginPlatform.shortcutsTitle')"- :data-plugin-shortcut-position="position"- class="plugin-shortcut-bar flex shrink-0 flex-col"- :class="sidebarList ? 'min-w-0' : ['min-h-0 w-10 self-stretch bg-muted/30', left ? 'border-r' : 'border-l']"- @dragstart.prevent- >- <div- v-if="sidebarList && entries.length"- data-shortcut-resize- role="separator"- tabindex="0"- aria-orientation="horizontal"- :aria-label="t('pluginPlatform.shortcutsResize')"- :aria-valuenow="Math.round(sizing.height.value)"- :title="t('pluginPlatform.shortcutsResize')"- class="h-1.5 shrink-0 cursor-row-resize touch-none border-t border-border transition-colors hover:bg-primary/30 focus-visible:bg-primary/30 focus-visible:outline-none"- @pointerdown="!saving && sizing.start($event)"- @dblclick="!saving && sizing.reset()"- @keydown="!saving && sizing.resizeWithKeyboard($event)"- />- <div v-if="sidebarList" data-shortcut-header class="flex h-8 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3" :class="{ 'border-t': !entries.length }">- <span class="min-w-0 truncate text-xs font-medium text-muted-foreground">{{ t("pluginPlatform.shortcutsHeading") }}</span>- <LightTooltip v-if="showSettingsEntry" :text="t('pluginPlatform.shortcutsSettings')" :disabled="drag.active || sizing.resizing.value" side="top">- <Button variant="ghost" size="icon" data-plugin-shortcut-settings class="shortcut-button size-6 shrink-0" :aria-label="t('pluginPlatform.shortcutsSettings')" @click="activateSettings">- <Settings2 class="size-3.5 text-foreground" />- </Button>- </LightTooltip>- </div>- <div v-show="!sidebarList || entries.length" ref="scroll" data-shortcut-scroll class="min-h-0 overflow-y-auto overflow-x-hidden p-1" :class="sidebarList ? 'shrink-0' : 'flex-1'" :style="sidebarList ? { height: `${sizing.height.value}px` } : undefined">- <div class="shortcut-items flex flex-col" :class="sidebarList ? 'gap-0' : ['min-h-full gap-1', { 'shortcut-items--bottom': bottom }]">- <LightTooltip v-for="(entry, index) in entries" :key="entry.id" :text="entry.label" :disabled="drag.active || sizing.resizing.value" :side="sidebarList ? 'top' : left ? 'right' : 'left'" content-class="shortcut-tooltip">- <span- class="shortcut-item relative flex shrink-0 touch-none"- :class="{- 'w-full min-w-0': sidebarList,- 'mt-auto': bottom && index === 0,- 'drop-before': drag.target === entry.id && !drag.after && drag.source !== entry.id,- 'drop-after': drag.target === entry.id && drag.after && drag.source !== entry.id,- 'opacity-40': drag.active && drag.source === entry.id,- }"- :data-shortcut-id="entry.id"- @pointerdown="sorting.start($event, entry.id)"- >- <Button- variant="ghost"- size="icon"- class="shortcut-button relative shrink-0"- :class="[sidebarList ? 'shortcut-list-button h-auto min-h-7 w-full min-w-0 justify-start gap-2 rounded-none px-2 py-1 text-left font-normal' : 'size-8', { 'shortcut-button--active': isActive(entry) }]"- :style="sidebarList ? { fontSize: `${settings.editorSettings.sidebarFontSize}px` } : undefined"- :aria-label="entry.label"- :aria-pressed="isActive(entry)"- :disabled="entry.disabled"- @click="activate(entry)"- >- <PluginIcon :plugin-id="entry.pluginId" :icon="entry.icon" :class="sidebarList ? 'size-3.5' : 'size-4'" class="shrink-0 [&_svg]:text-current [&_img]:pointer-events-none" />- <span v-if="sidebarList" data-shortcut-label class="min-w-0 flex-1 truncate">{{ entry.label }}</span>- <span v-if="isActive(entry)" data-shortcut-active-indicator :class="sidebarList ? 'size-1.5 shrink-0 rounded-full bg-green-500' : 'absolute left-0 h-3 w-0.5 rounded-full bg-primary'" aria-hidden="true" />- </Button>- </span>- </LightTooltip>- <LightTooltip v-if="showSettingsEntry && !sidebarList" :text="t('pluginPlatform.shortcutsSettings')" :disabled="drag.active || sizing.resizing.value" :side="left ? 'right' : 'left'" content-class="shortcut-tooltip">- <span class="relative flex shrink-0" :class="{ 'mt-auto': bottom && !entries.length, 'pt-2': entries.length > 0 }">- <span v-if="entries.length" class="pointer-events-none absolute inset-x-2 top-0 z-10 h-px bg-border/60" aria-hidden="true" />- <Button variant="ghost" size="icon" data-plugin-shortcut-settings class="shortcut-button size-8 shrink-0" :aria-label="t('pluginPlatform.shortcutsSettings')" @click="activateSettings">- <Settings2 class="size-4 shrink-0 text-foreground" />- </Button>- </span>+ <CustomContextMenu v-if="settings.isEditorSettingsLoaded && settings.editorSettings.pluginShortcuts.enabled && allEntries.length" :items="sidebarContextMenuItems" v-slot="{ onContextMenu }">+ <nav+ ref="section"+ :aria-label="t('pluginPlatform.shortcutsTitle')"+ :data-plugin-shortcut-position="position"+ class="plugin-shortcut-bar flex shrink-0 flex-col"+ :class="sidebarList ? 'min-w-0' : ['min-h-0 w-10 self-stretch bg-muted/30', left ? 'border-r' : 'border-l']"+ @dragstart.prevent+ @contextmenu="onContextMenu"+ >+ <div+ v-if="sidebarList && entries.length"+ data-shortcut-resize+ role="separator"+ tabindex="0"+ aria-orientation="horizontal"+ :aria-label="t('pluginPlatform.shortcutsResize')"+ :aria-valuenow="Math.round(sizing.height.value)"+ :title="t('pluginPlatform.shortcutsResize')"+ class="h-1.5 shrink-0 cursor-row-resize touch-none border-t border-border transition-colors hover:bg-primary/30 focus-visible:bg-primary/30 focus-visible:outline-none"+ @pointerdown="!saving && sizing.start($event)"+ @dblclick="!saving && sizing.reset()"+ @keydown="!saving && sizing.resizeWithKeyboard($event)"+ />+ <div v-if="sidebarList" data-shortcut-header class="flex h-8 shrink-0 items-center justify-between gap-2 border-b border-border/60 px-3" :class="{ 'border-t': !entries.length }">+ <span class="min-w-0 truncate text-xs font-medium text-muted-foreground">{{ t("pluginPlatform.shortcutsHeading") }}</span>+ <LightTooltip v-if="showSettingsEntry" :text="t('pluginPlatform.shortcutsSettings')" :disabled="drag.active || sizing.resizing.value" side="top">+ <Button variant="ghost" size="icon" data-plugin-shortcut-settings class="shortcut-button size-6 shrink-0" :aria-label="t('pluginPlatform.shortcutsSettings')" @click="activateSettings">+ <Settings2 class="size-3.5 text-foreground" />+ </Button></LightTooltip></div>- </div>- <Teleport to="body">- <div v-if="drag.active || sizing.resizing.value" class="shortcut-pointer-overlay fixed inset-0 select-none touch-none" :style="{ cursor: drag.active ? 'grabbing' : 'row-resize' }" aria-hidden="true" />- <div- v-if="drag.active && draggedEntry"- ref="preview"- data-shortcut-drag-preview- class="shortcut-drag-preview pointer-events-none fixed flex w-max max-w-xs overflow-hidden items-center gap-2 rounded-md border border-primary/50 bg-popover px-2 py-1.5 text-xs text-popover-foreground shadow-md"- :style="previewStyle"- aria-hidden="true"- >- <PluginIcon :plugin-id="draggedEntry.pluginId" :icon="draggedEntry.icon" class="size-4 [&_svg]:text-current" />- <span class="truncate">{{ draggedEntry.label }}</span>+ <div v-show="!sidebarList || entries.length" ref="scroll" data-shortcut-scroll class="min-h-0 overflow-y-auto overflow-x-hidden p-1" :class="sidebarList ? 'shrink-0' : 'flex-1'" :style="sidebarList ? { height: `${sizing.height.value}px` } : undefined">+ <div class="shortcut-items flex flex-col" :class="sidebarList ? 'gap-0' : ['min-h-full gap-1', { 'shortcut-items--bottom': bottom }]">+ <CustomContextMenu v-for="(entry, index) in entries" :key="entry.id" :items="() => pluginContextMenuItems(entry)" v-slot="{ onContextMenu }">+ <LightTooltip :text="entry.label" :disabled="drag.active || sizing.resizing.value" :side="sidebarList ? 'top' : left ? 'right' : 'left'" content-class="shortcut-tooltip">+ <span+ class="shortcut-item relative flex shrink-0 touch-none"+ :class="{+ 'w-full min-w-0': sidebarList,+ 'mt-auto': bottom && index === 0,+ 'drop-before': drag.target === entry.id && !drag.after && drag.source !== entry.id,+ 'drop-after': drag.target === entry.id && drag.after && drag.source !== entry.id,+ 'opacity-40': drag.active && drag.source === entry.id,+ }"+ :data-shortcut-id="entry.id"+ @pointerdown="sorting.start($event, entry.id)"+ @contextmenu="onContextMenu"+ >+ <Button+ variant="ghost"+ size="icon"+ class="shortcut-button relative shrink-0"+ :class="[sidebarList ? 'shortcut-list-button h-auto min-h-7 w-full min-w-0 justify-start gap-2 rounded-none px-2 py-1 text-left font-normal' : 'size-8', { 'shortcut-button--active': isActive(entry) }]"+ :style="sidebarList ? { fontSize: `${settings.editorSettings.sidebarFontSize}px` } : undefined"+ :aria-label="entry.label"+ :aria-pressed="isActive(entry)"+ :disabled="entry.disabled"+ @click="activate(entry)"+ >+ <PluginIcon :plugin-id="entry.pluginId" :icon="entry.icon" :class="sidebarList ? 'size-3.5' : 'size-4'" class="shrink-0 [&_svg]:text-current [&_img]:pointer-events-none" />+ <span v-if="sidebarList" data-shortcut-label class="min-w-0 flex-1 truncate">{{ entry.label }}</span>+ <span v-if="isActive(entry)" data-shortcut-active-indicator :class="sidebarList ? 'size-1.5 shrink-0 rounded-full bg-green-500' : 'absolute left-0 h-3 w-0.5 rounded-full bg-primary'" aria-hidden="true" />+ </Button>+ </span>+ </LightTooltip>+ </CustomContextMenu>+ <LightTooltip v-if="showSettingsEntry && !sidebarList" :text="t('pluginPlatform.shortcutsSettings')" :disabled="drag.active || sizing.resizing.value" :side="left ? 'right' : 'left'" content-class="shortcut-tooltip">+ <span class="relative flex shrink-0" :class="{ 'mt-auto': bottom && !entries.length, 'pt-2': entries.length > 0 }">+ <span v-if="entries.length" class="pointer-events-none absolute inset-x-2 top-0 z-10 h-px bg-border/60" aria-hidden="true" />+ <Button variant="ghost" size="icon" data-plugin-shortcut-settings class="shortcut-button size-8 shrink-0" :aria-label="t('pluginPlatform.shortcutsSettings')" @click="activateSettings">+ <Settings2 class="size-4 shrink-0 text-foreground" />+ </Button>+ </span>+ </LightTooltip>+ </div></div>- </Teleport>- </nav>+ <Teleport to="body">+ <div v-if="drag.active || sizing.resizing.value" class="shortcut-pointer-overlay fixed inset-0 select-none touch-none" :style="{ cursor: drag.active ? 'grabbing' : 'row-resize' }" aria-hidden="true" />+ <div+ v-if="drag.active && draggedEntry"+ ref="preview"+ data-shortcut-drag-preview+ class="shortcut-drag-preview pointer-events-none fixed flex w-max max-w-xs overflow-hidden items-center gap-2 rounded-md border border-primary/50 bg-popover px-2 py-1.5 text-xs text-popover-foreground shadow-md"+ :style="previewStyle"+ aria-hidden="true"+ >+ <PluginIcon :plugin-id="draggedEntry.pluginId" :icon="draggedEntry.icon" class="size-4 [&_svg]:text-current" />+ <span class="truncate">{{ draggedEntry.label }}</span>+ </div>+ </Teleport>+ </nav>+ </CustomContextMenu></template><style scoped>diff --git a/apps/desktop/src/components/ui/CustomContextMenu.vue b/apps/desktop/src/components/ui/CustomContextMenu.vueindex 2e6514ea30..939bc95f0a 100644--- a/apps/desktop/src/components/ui/CustomContextMenu.vue+++ b/apps/desktop/src/components/ui/CustomContextMenu.vue@@ -105,13 +105,13 @@ onMounted(() => {function handleItemClick(item: ContextMenuItem) {if (itemIsDisabled(item)) return;if (item.children?.length) return; // submenu trigger — do nothing on click- close();+ if (item.closeOnSelect !== false) close();item.action?.();}function handleSubItemClick(item: ContextMenuItem) {if (itemIsDisabled(item)) return;- close();+ if (item.closeOnSelect !== false) close();item.action?.();}@@ -282,12 +282,24 @@ onBeforeUnmount(() => {<div v-if="item.separator" class="-mx-1 my-1 flex items-center px-1"><div class="h-px flex-1 bg-border/70" /></div>- <button v-else :disabled="itemIsDisabled(item)" :title="item.title" :class="[...itemButtonClass(item.variant), activeSubmenuTriggerClass(item, index)]" @click="handleItemClick(item)" @mouseenter="(e) => onItemMouseEnter(index, e)" @mouseleave="onItemMouseLeave">- <span class="flex size-4 shrink-0 items-center justify-center">+ <button+ v-else+ :disabled="itemIsDisabled(item)"+ :aria-pressed="item.checkedStyle === 'switch' ? !!item.checked : undefined"+ :title="item.title"+ :class="[...itemButtonClass(item.variant), activeSubmenuTriggerClass(item, index)]"+ @click="handleItemClick(item)"+ @mouseenter="(e) => onItemMouseEnter(index, e)"+ @mouseleave="onItemMouseLeave"+ >+ <span v-if="item.checkedStyle !== 'switch'" class="flex size-4 shrink-0 items-center justify-center"><Check v-if="item.checked" class="size-4 text-primary" /><component :is="item.icon" v-else-if="item.icon" :class="['size-4', item.iconClass]" /></span><span class="flex-1 whitespace-nowrap">{{ item.label }}</span>+ <span v-if="item.checkedStyle === 'switch'" aria-hidden="true" class="ml-3 flex h-3.5 w-6 shrink-0 items-center rounded-full p-0.5 transition-colors" :class="item.checked ? 'bg-primary' : 'bg-input'">+ <span class="size-2.5 rounded-full bg-primary-foreground shadow-xs transition-transform" :class="item.checked ? 'translate-x-2.5' : 'translate-x-0'" />+ </span><span v-if="item.shortcut" class="ml-8 inline-flex shrink-0 items-center gap-1 text-muted-foreground"><kbd v-for="key in shortcutKeys(item.shortcut)" :key="key" class="min-w-4 rounded border border-border/70 bg-muted/60 px-1 py-0.5 text-center font-mono text-[10px] leading-none text-muted-foreground shadow-xs">{{ key }}</kbd></span>@@ -313,12 +325,23 @@ onBeforeUnmount(() => {<div v-if="child.separator" class="-mx-1 my-1 flex items-center px-1"><div class="h-px flex-1 bg-border/70" /></div>- <button v-else :disabled="itemIsDisabled(child)" :title="child.title" :class="itemButtonClass(child.variant)" :style="{ paddingInlineStart: `${0.5 + (child.indentLevel ?? 0) * 0.75}rem` }" @click="handleSubItemClick(child)">- <span class="flex size-4 shrink-0 items-center justify-center">+ <button+ v-else+ :disabled="itemIsDisabled(child)"+ :aria-pressed="child.checkedStyle === 'switch' ? !!child.checked : undefined"+ :title="child.title"+ :class="itemButtonClass(child.variant)"+ :style="{ paddingInlineStart: `${0.5 + (child.indentLevel ?? 0) * 0.75}rem` }"+ @click="handleSubItemClick(child)"+ >+ <span v-if="child.checkedStyle !== 'switch'" class="flex size-4 shrink-0 items-center justify-center"><Check v-if="child.checked" class="size-4 text-primary" /><component :is="child.icon" v-else-if="child.icon" :class="['size-4', child.iconClass]" /></span><span class="flex-1 whitespace-nowrap">{{ child.label }}</span>+ <span v-if="child.checkedStyle === 'switch'" aria-hidden="true" class="ml-3 flex h-3.5 w-6 shrink-0 items-center rounded-full p-0.5 transition-colors" :class="child.checked ? 'bg-primary' : 'bg-input'">+ <span class="size-2.5 rounded-full bg-primary-foreground shadow-xs transition-transform" :class="child.checked ? 'translate-x-2.5' : 'translate-x-0'" />+ </span><span v-if="child.shortcut" class="ml-8 inline-flex shrink-0 items-center gap-1 text-muted-foreground"><kbd v-for="key in shortcutKeys(child.shortcut)" :key="key" class="min-w-4 rounded border border-border/70 bg-muted/60 px-1 py-0.5 text-center font-mono text-[10px] leading-none text-muted-foreground shadow-xs">{{ key }}</kbd></span>diff --git a/apps/desktop/src/components/ui/customContextMenuRegistry.ts b/apps/desktop/src/components/ui/customContextMenuRegistry.tsindex d3a24bfb62..acb5518167 100644--- a/apps/desktop/src/components/ui/customContextMenuRegistry.ts+++ b/apps/desktop/src/components/ui/customContextMenuRegistry.ts@@ -10,6 +10,8 @@ export interface ContextMenuItem {title?: string;indentLevel?: number;checked?: boolean;+ closeOnSelect?: boolean;+ checkedStyle?: "check" | "switch";// Raw shortcut syntax such as `Mod+C` or `Shift+Alt+U`; display formatting stays in this component.shortcut?: string;variant?: "default" | "destructive";diff --git a/apps/desktop/src/i18n/locales/az.ts b/apps/desktop/src/i18n/locales/az.tsindex cee49d01a6..fd3577616d 100644--- a/apps/desktop/src/i18n/locales/az.ts+++ b/apps/desktop/src/i18n/locales/az.ts@@ -103,6 +103,7 @@ export default withEnglishFallback({shortcutsRightTop: "Sağ · Yuxarı",shortcutsRightBottom: "Sağ · Aşağı",shortcutsVisiblePlugins: "Görünən plaginlər",+ shortcutsShowInSidebar: "Yan paneldə göstər",shortcutsResize: "Hündürlüyü dəyişmək üçün sürükləyin; avtomatik hündürlük üçün iki dəfə klikləyin",},cellTransform: {diff --git a/apps/desktop/src/i18n/locales/en.ts b/apps/desktop/src/i18n/locales/en.tsindex e78aa01265..32b3a42059 100644--- a/apps/desktop/src/i18n/locales/en.ts+++ b/apps/desktop/src/i18n/locales/en.ts@@ -207,6 +207,7 @@ export default {shortcutsRightTop: "Right · Top first",shortcutsRightBottom: "Right · Bottom first",shortcutsVisiblePlugins: "Visible plugins",+ shortcutsShowInSidebar: "Show in sidebar",shortcutsResize: "Drag to resize; double-click for automatic height",globalSettingsTitle: "Global settings",shortcutsTitle: "Plugin shortcuts",diff --git a/apps/desktop/src/i18n/locales/es.ts b/apps/desktop/src/i18n/locales/es.tsindex 1a0ca082b9..d2844f589b 100644--- a/apps/desktop/src/i18n/locales/es.ts+++ b/apps/desktop/src/i18n/locales/es.ts@@ -209,6 +209,7 @@ export default withEnglishFallback({shortcutsRightTop: "Derecha · Arriba",shortcutsRightBottom: "Derecha · Abajo",shortcutsVisiblePlugins: "Complementos visibles",+ shortcutsShowInSidebar: "Mostrar en la barra lateral",shortcutsResize: "Arrastra para ajustar la altura; haz doble clic para restaurar la altura automática",globalSettingsTitle: "Configuración global",shortcutsTitle: "Accesos a complementos",diff --git a/apps/desktop/src/i18n/locales/id.ts b/apps/desktop/src/i18n/locales/id.tsindex 38ed3d27e5..ac3f40e9c8 100644--- a/apps/desktop/src/i18n/locales/id.ts+++ b/apps/desktop/src/i18n/locales/id.ts@@ -129,6 +129,7 @@ export default withEnglishFallback({shortcutsRightTop: "Kanan · Atas dahulu",shortcutsRightBottom: "Kanan · Bawah dahulu",shortcutsVisiblePlugins: "Plugin yang terlihat",+ shortcutsShowInSidebar: "Tampilkan di bilah samping",shortcutsResize: "Seret untuk mengubah ukuran; klik dua kali untuk tinggi otomatis",globalSettingsTitle: "Pengaturan global",shortcutsTitle: "Pintasan plugin",diff --git a/apps/desktop/src/i18n/locales/it.ts b/apps/desktop/src/i18n/locales/it.tsindex fd336cb44c..733c8762c0 100644--- a/apps/desktop/src/i18n/locales/it.ts+++ b/apps/desktop/src/i18n/locales/it.ts@@ -207,6 +207,7 @@ export default withEnglishFallback({shortcutsRightTop: "Destra · In alto",shortcutsRightBottom: "Destra · In basso",shortcutsVisiblePlugins: "Plugin visibili",+ shortcutsShowInSidebar: "Mostra nella barra laterale",shortcutsResize: "Trascina per ridimensionare; doppio clic per l’altezza automatica",globalSettingsTitle: "Impostazioni globali",shortcutsTitle: "Scorciatoie dei plugin",diff --git a/apps/desktop/src/i18n/locales/ja.ts b/apps/desktop/src/i18n/locales/ja.tsindex 24ac4e2dc8..56359b0b28 100644--- a/apps/desktop/src/i18n/locales/ja.ts+++ b/apps/desktop/src/i18n/locales/ja.ts@@ -208,6 +208,7 @@ export default withEnglishFallback({shortcutsRightTop: "右側・上寄せ",shortcutsRightBottom: "右側・下寄せ",shortcutsVisiblePlugins: "表示するプラグイン",+ shortcutsShowInSidebar: "サイドバーに表示",shortcutsResize: "ドラッグで高さを変更、ダブルクリックで自動調整に戻す",globalSettingsTitle: "グローバル設定",shortcutsTitle: "プラグインショートカット",diff --git a/apps/desktop/src/i18n/locales/ko.ts b/apps/desktop/src/i18n/locales/ko.tsindex a07e4e774c..db662437a2 100644--- a/apps/desktop/src/i18n/locales/ko.ts+++ b/apps/desktop/src/i18n/locales/ko.ts@@ -207,6 +207,7 @@ export default withEnglishFallback({shortcutsRightTop: "오른쪽 · 위쪽 정렬",shortcutsRightBottom: "오른쪽 · 아래쪽 정렬",shortcutsVisiblePlugins: "표시할 플러그인",+ shortcutsShowInSidebar: "사이드바에 표시",shortcutsResize: "드래그하여 높이 조절, 두 번 클릭하여 자동 높이 복원",globalSettingsTitle: "전역 설정",shortcutsTitle: "플러그인 바로가기",diff --git a/apps/desktop/src/i18n/locales/pt-BR.ts b/apps/desktop/src/i18n/locales/pt-BR.tsindex 29057d12f5..236d37a760 100644--- a/apps/desktop/src/i18n/locales/pt-BR.ts+++ b/apps/desktop/src/i18n/locales/pt-BR.ts@@ -208,6 +208,7 @@ export default withEnglishFallback({shortcutsRightTop: "Direita · Superior",shortcutsRightBottom: "Direita · Inferior",shortcutsVisiblePlugins: "Plugins visíveis",+ shortcutsShowInSidebar: "Mostrar na barra lateral",shortcutsResize: "Arraste para ajustar a altura; clique duas vezes para altura automática",globalSettingsTitle: "Configurações globais",shortcutsTitle: "Atalhos de plugins",diff --git a/apps/desktop/src/i18n/locales/ru.ts b/apps/desktop/src/i18n/locales/ru.tsindex c74ad3925d..1e02a27826 100644--- a/apps/desktop/src/i18n/locales/ru.ts+++ b/apps/desktop/src/i18n/locales/ru.ts@@ -178,6 +178,7 @@ export default withEnglishFallback({shortcutsRightTop: "Справа · Сверху",shortcutsRightBottom: "Справа · Снизу",shortcutsVisiblePlugins: "Видимые плагины",+ shortcutsShowInSidebar: "Показывать на боковой панели",shortcutsResize: "Перетащите для изменения высоты; двойной щелчок — автоматическая высота",globalSettingsTitle: "Общие настройки",shortcutsTitle: "Быстрый доступ к плагинам",diff --git a/apps/desktop/src/i18n/locales/tr.ts b/apps/desktop/src/i18n/locales/tr.tsindex acb924d6f4..4f0a96c6f0 100644--- a/apps/desktop/src/i18n/locales/tr.ts+++ b/apps/desktop/src/i18n/locales/tr.ts@@ -103,6 +103,7 @@ export default withEnglishFallback({shortcutsRightTop: "Sağ · Üst",shortcutsRightBottom: "Sağ · Alt",shortcutsVisiblePlugins: "Görünür eklentiler",+ shortcutsShowInSidebar: "Kenar çubuğunda göster",shortcutsResize: "Yüksekliği ayarlamak için sürükleyin; otomatik yükseklik için çift tıklayın",},cellTransform: {diff --git a/apps/desktop/src/i18n/locales/zh-CN.ts b/apps/desktop/src/i18n/locales/zh-CN.tsindex 7ba224c5da..2426bc2671 100644--- a/apps/desktop/src/i18n/locales/zh-CN.ts+++ b/apps/desktop/src/i18n/locales/zh-CN.ts@@ -153,6 +153,7 @@ export default withEnglishFallback({shortcutsRightTop: "右侧·顶部优先",shortcutsRightBottom: "右侧·底部优先",shortcutsVisiblePlugins: "显示的插件",+ shortcutsShowInSidebar: "在侧边栏显示",shortcutsResize: "拖动调整高度,双击恢复自动高度",globalSettingsTitle: "全局配置",shortcutsTitle: "插件快捷入口",diff --git a/apps/desktop/src/i18n/locales/zh-TW.ts b/apps/desktop/src/i18n/locales/zh-TW.tsindex c18caede37..25141bc351 100644--- a/apps/desktop/src/i18n/locales/zh-TW.ts+++ b/apps/desktop/src/i18n/locales/zh-TW.ts@@ -210,6 +210,7 @@ export default withEnglishFallback({shortcutsRightTop: "右側·頂部優先",shortcutsRightBottom: "右側·底部優先",shortcutsVisiblePlugins: "顯示的外掛程式",+ shortcutsShowInSidebar: "在側邊欄顯示",shortcutsResize: "拖曳調整高度,按兩下恢復自動高度",globalSettingsTitle: "全域設定",shortcutsTitle: "外掛程式快捷入口",