Skip to content

Commit f301b5f

Browse files
Merge pull request #1187 from OskarDamkjaer/esc_shortcut
Re-add esc as shortcut
2 parents f4fde21 + 16c9cf3 commit f301b5f

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/browser/modules/App/keyboardShortcuts.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ interface Shortcut {
1717
modifyers: ModifierKey[]
1818
key: string
1919
}
20+
export const OLD_FULLSCREEN_SHORTCUT: Shortcut = {
21+
modifyers: [],
22+
key: 'Escape'
23+
}
2024
export const FULLSCREEN_SHORTCUT: Shortcut = {
2125
modifyers: [modKey, 'altKey'],
2226
key: 'f'
@@ -65,8 +69,11 @@ export function useKeyboardShortcuts(bus: Bus): void {
6569
}
6670
}
6771

68-
const expandEditor = (e: KeyboardEvent): void => {
69-
if (matchesShortcut(e, FULLSCREEN_SHORTCUT)) {
72+
const fullscreenEditor = (e: KeyboardEvent): void => {
73+
if (
74+
matchesShortcut(e, FULLSCREEN_SHORTCUT) ||
75+
matchesShortcut(e, OLD_FULLSCREEN_SHORTCUT)
76+
) {
7077
e.preventDefault()
7178
trigger(EXPAND)
7279
}
@@ -79,7 +86,11 @@ export function useKeyboardShortcuts(bus: Bus): void {
7986
}
8087
}
8188

82-
const keyboardShortcuts = [focusEditorOnSlash, expandEditor, cardSizeShortcut]
89+
const keyboardShortcuts = [
90+
focusEditorOnSlash,
91+
fullscreenEditor,
92+
cardSizeShortcut
93+
]
8394

8495
useEffect(() => {
8596
keyboardShortcuts.forEach(shortcut =>

0 commit comments

Comments
 (0)