fix: recognize raw editor backslash shortcut

This commit is contained in:
lucaronin
2026-06-05 18:49:14 +02:00
parent 057c73376c
commit cc52a52216
3 changed files with 13 additions and 1 deletions

View File

@@ -138,6 +138,7 @@ describe('appCommandDispatcher', () => {
expect(findShortcutCommandId('command-or-ctrl', 'z', 'KeyZ')).toBe(APP_COMMAND_IDS.editUndo)
expect(findShortcutCommandId('command-or-ctrl-shift', 'z', 'KeyZ')).toBe(APP_COMMAND_IDS.editRedo)
expect(findShortcutCommandId('command-or-ctrl', '\\')).toBe(APP_COMMAND_IDS.editToggleRawEditor)
expect(findShortcutCommandId('command-or-ctrl', '§', 'Backslash')).toBe(APP_COMMAND_IDS.editToggleRawEditor)
expect(findShortcutCommandId('command-or-ctrl-shift', '¬', 'KeyL')).toBe(APP_COMMAND_IDS.viewToggleAiChat)
expect(findShortcutCommandId('command-or-ctrl-shift', 'T', 'KeyT')).toBe(APP_COMMAND_IDS.viewToggleTableOfContents)
expect(findShortcutCommandId('command-or-ctrl-shift', 'v', 'KeyV')).toBe(APP_COMMAND_IDS.editPastePlainText)
@@ -197,6 +198,7 @@ describe('appCommandDispatcher', () => {
it('resolves event modifiers through the shared shortcut catalog', () => {
expectShortcutEventCommand({ key: 'o', code: 'KeyO', metaKey: true }, APP_COMMAND_IDS.fileQuickOpen)
expectShortcutEventCommand({ key: '§', code: 'Backslash', metaKey: true }, APP_COMMAND_IDS.editToggleRawEditor)
expectShortcutEventCommand({ key: '¬', code: 'KeyL', metaKey: true, shiftKey: true }, APP_COMMAND_IDS.viewToggleAiChat)
expectShortcutEventCommand({ key: 'I', code: 'KeyI', metaKey: true, shiftKey: true }, APP_COMMAND_IDS.viewToggleProperties)
expectShortcutEventCommand({ key: 'ArrowLeft', code: 'ArrowLeft', metaKey: true }, APP_COMMAND_IDS.viewGoBack)

View File

@@ -142,6 +142,7 @@
"shortcut": {
"combo": "command-or-ctrl",
"key": "\\",
"code": "Backslash",
"display": "⌘\\",
"accelerator": "CmdOrCtrl+\\"
}

View File

@@ -225,7 +225,16 @@ test.describe('keyboard command routing', () => {
await openAlphaProjectInEditor(page)
await triggerShortcutCommand(page, APP_COMMAND_IDS.editToggleRawEditor)
await dispatchShortcutEvent(page, {
key: '§',
code: 'Backslash',
ctrlKey: false,
metaKey: true,
shiftKey: false,
altKey: false,
bubbles: true,
cancelable: true,
})
await expect(page.getByTestId('raw-editor-codemirror')).toBeVisible({ timeout: 5_000 })
await expectRuntimeStyleNonce(page)