From 5c36d8067fbc5996016f0291b72f81ed54349f45 Mon Sep 17 00:00:00 2001 From: yu859 <15715093608@163.com> Date: Sun, 9 Aug 2026 16:31:03 +0800 Subject: [PATCH] fix(core): keep transient-context commands listed in shortcut settings --- .../views-builtin/SettingsShortcuts.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue b/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue index 60760e91..1bd6e6c9 100644 --- a/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue +++ b/packages/core/src/client/webcomponents/components/views-builtin/SettingsShortcuts.vue @@ -22,10 +22,17 @@ interface ShortcutRow { indent: boolean } -// Only offer to bind commands that are actually reachable right now — binding a -// key to something the current context rules out (e.g. the dock-mode commands -// while the dock is detached into a popup) would silently do nothing. -const availableCommands = computed(() => filterCommandsByWhen(commandsCtx.commands, props.context.when.context)) +// This page is only reachable with the dock open and the palette closed, so `when` +// is evaluated against that context rather than the live one. `dockOpen`/`paletteOpen` +// are transient dispatch state — `close-panel`'s `!paletteOpen` exists to hand Escape +// to the palette, not to say the command is unbindable — so filtering by them would +// drop permanently bindable rows the moment Ctrl+K is pressed. `popupOpen` and +// `clientType` stay live: those describe whether a command can exist at all, which is +// why the dock-mode commands still vanish while the dock is detached into a popup. +const availableCommands = computed(() => filterCommandsByWhen( + commandsCtx.commands, + { ...props.context.when.context, dockOpen: true, paletteOpen: false }, +)) const shortcutRows = computed(() => { const rows: ShortcutRow[] = []