Skip to content

Commit

Permalink
Merge pull request #1187 from OskarDamkjaer/esc_shortcut
Browse files Browse the repository at this point in the history
Re-add esc as shortcut
  • Loading branch information
OskarDamkjaer authored Sep 7, 2020
2 parents f4fde21 + 16c9cf3 commit f301b5f
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/browser/modules/App/keyboardShortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ interface Shortcut {
modifyers: ModifierKey[]
key: string
}
export const OLD_FULLSCREEN_SHORTCUT: Shortcut = {
modifyers: [],
key: 'Escape'
}
export const FULLSCREEN_SHORTCUT: Shortcut = {
modifyers: [modKey, 'altKey'],
key: 'f'
Expand Down Expand Up @@ -65,8 +69,11 @@ export function useKeyboardShortcuts(bus: Bus): void {
}
}

const expandEditor = (e: KeyboardEvent): void => {
if (matchesShortcut(e, FULLSCREEN_SHORTCUT)) {
const fullscreenEditor = (e: KeyboardEvent): void => {
if (
matchesShortcut(e, FULLSCREEN_SHORTCUT) ||
matchesShortcut(e, OLD_FULLSCREEN_SHORTCUT)
) {
e.preventDefault()
trigger(EXPAND)
}
Expand All @@ -79,7 +86,11 @@ export function useKeyboardShortcuts(bus: Bus): void {
}
}

const keyboardShortcuts = [focusEditorOnSlash, expandEditor, cardSizeShortcut]
const keyboardShortcuts = [
focusEditorOnSlash,
fullscreenEditor,
cardSizeShortcut
]

useEffect(() => {
keyboardShortcuts.forEach(shortcut =>
Expand Down

0 comments on commit f301b5f

Please sign in to comment.