From 36af0dc841f3ddbcba875c1068c8945579fcf0cc Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Wed, 26 Aug 2020 22:05:21 +0200 Subject: [PATCH] fixed shortcuts for macs --- src/components/editor/app-bar/help-button/shortcuts.tsx | 9 +++++---- src/components/editor/shortcut/shortcut.ts | 9 +++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/components/editor/app-bar/help-button/shortcuts.tsx b/src/components/editor/app-bar/help-button/shortcuts.tsx index 35c83f04d..2be0cd888 100644 --- a/src/components/editor/app-bar/help-button/shortcuts.tsx +++ b/src/components/editor/app-bar/help-button/shortcuts.tsx @@ -4,13 +4,14 @@ import { Trans } from 'react-i18next' import { isMac } from '../../utils' export const Shortcut: React.FC = () => { - const modifierKey = isMac ? Cmd : Ctrl + const modifierKey = isMac ? : Ctrl + const altKey = isMac ? : Alt const shortcutMap: {[category: string]: { [functionName: string]: JSX.Element[] }} = { 'View Mode': { - 'editor.help.shortcuts.view': [modifierKey, <> + , Alt, <> + , V], - 'editor.help.shortcuts.both': [modifierKey, <> + , Alt, <> + , B], - 'editor.help.shortcuts.edit': [modifierKey, <> + , Alt, <> + , E] + 'editor.help.shortcuts.view': [Ctrl, <> + , altKey, <> + , V], + 'editor.help.shortcuts.both': [Ctrl, <> + , altKey, <> + , B], + 'editor.help.shortcuts.edit': [Ctrl, <> + , altKey, <> + , E] }, Editor: { 'editor.help.shortcuts.bold': [modifierKey, <> + , B], diff --git a/src/components/editor/shortcut/shortcut.ts b/src/components/editor/shortcut/shortcut.ts index fd71c7799..b14c1b3b8 100644 --- a/src/components/editor/shortcut/shortcut.ts +++ b/src/components/editor/shortcut/shortcut.ts @@ -1,19 +1,16 @@ import { setEditorMode } from '../../../redux/editor/methods' import { EditorMode } from '../app-bar/editor-view-mode' -import { isMac } from '../utils' export const shortcutHandler = (event: KeyboardEvent): void => { - const modifierKey = isMac ? event.metaKey : event.ctrlKey - - if (modifierKey && event.altKey && event.key === 'b') { + if (event.ctrlKey && event.altKey && event.key === 'b') { setEditorMode(EditorMode.BOTH) } - if (modifierKey && event.altKey && event.key === 'v') { + if (event.ctrlKey && event.altKey && event.key === 'v') { setEditorMode(EditorMode.PREVIEW) } - if (modifierKey && event.altKey && event.key === 'e') { + if (event.ctrlKey && event.altKey && event.key === 'e') { setEditorMode(EditorMode.EDITOR) } }