Skip to content

AI-native design editor. Open-source Figma alternative.

fix: open the variables dialog from the desktop View menu (#1672)

Valery Komarovb7bbf9471eca
diff --git a/changes/1672/fixed.md b/changes/1672/fixed.md
new file mode 100644
index 000000000..aa592c481
--- /dev/null
+++ b/changes/1672/fixed.md
@@ -0,0 +1 @@
+- View → Variables… opens the variables dialog in the desktop app.
diff --git a/src/app/shell/menu/actions/editor.ts b/src/app/shell/menu/actions/editor.ts
index a116fd955..9749c7075 100644
--- a/src/app/shell/menu/actions/editor.ts
+++ b/src/app/shell/menu/actions/editor.ts
@@ -1,6 +1,7 @@
import type { SceneNode } from '@open-pencil/scene-graph'
import { useEditorStore } from '@/app/editor/active-store'
+import { openVariablesDialog } from '@/app/editor/tokens/dialog'
import {
setCommentsOnCanvas,
setDesignIssuesOnCanvas,
@@ -89,6 +90,7 @@ export function createSharedEditorMenuActions(
'insert-icon': () => {
store.state.iconPickerOpen = true
},
+ variables: () => openVariablesDialog(store),
'theme-light': () => setTheme('light'),
'theme-dark': () => setTheme('dark'),
'theme-auto': () => setTheme('auto'),
diff --git a/src/app/shell/menu/app-menu.ts b/src/app/shell/menu/app-menu.ts
index 912c1220f..9d477077f 100644
--- a/src/app/shell/menu/app-menu.ts
+++ b/src/app/shell/menu/app-menu.ts
@@ -26,7 +26,6 @@ import type {
import { openTour } from '@/app/demo/document'
import { useEditorStore } from '@/app/editor/active-store'
-import { openVariablesDialog } from '@/app/editor/tokens/dialog'
import { openSettingsDialog } from '@/app/settings/dialog'
import {
setCommentsOnCanvas,
@@ -193,7 +192,6 @@ export function useAppMenu() {
'next-tab': () => switchAdjacentTab(1),
settings: openSettingsDialog,
diagnostics: () => openSettingsDialog('diagnostics'),
- variables: () => openVariablesDialog(store),
'export-png': () => exportSelection('png'),
'export-svg': () => exportSelection('svg'),
'export-pptx': () => exportSelection('pptx'),
diff --git a/tests/app/shell/menu/actions/editor.test.ts b/tests/app/shell/menu/actions/editor.test.ts
new file mode 100644
index 000000000..46521154e
--- /dev/null
+++ b/tests/app/shell/menu/actions/editor.test.ts
@@ -0,0 +1,15 @@
+import { expect, mock, test } from 'bun:test'
+
+import { setActiveEditorStore } from '@/app/editor/active-store'
+import { createEditorStore } from '@/app/editor/session/create'
+import { createSharedEditorMenuActions } from '@/app/shell/menu/actions/editor'
+
+// The desktop menu reaches the editor through these actions, so View → Variables… needs one here.
+test('View → Variables… opens the variables dialog from the native menu as from the app menu', () => {
+ const store = createEditorStore()
+ setActiveEditorStore(store)
+ const actions: Partial<Record<string, () => void>> = createSharedEditorMenuActions(mock())
+ expect(store.state.variablesOpen).toBe(false)
+ actions.variables?.()
+ expect(store.state.variablesOpen).toBe(true)
+})