diff --git a/app/hooks/useKeyDown.js b/app/hooks/useKeyDown.js index ed958583..449b8806 100644 --- a/app/hooks/useKeyDown.js +++ b/app/hooks/useKeyDown.js @@ -17,7 +17,9 @@ const createKeyPredicate = (keyFilter: KeyFilter) => typeof keyFilter === "function" ? keyFilter : typeof keyFilter === "string" - ? (event: KeyboardEvent) => event.key === keyFilter + ? (event: KeyboardEvent) => + event.key === keyFilter || + event.code === `Key${keyFilter.toUpperCase()}` : keyFilter ? (_event) => true : (_event) => false; diff --git a/app/scenes/Document/components/Document.js b/app/scenes/Document/components/Document.js index 28177eb0..66f41a31 100644 --- a/app/scenes/Document/components/Document.js +++ b/app/scenes/Document/components/Document.js @@ -203,11 +203,12 @@ class DocumentScene extends React.Component { goToHistory = (ev) => { if (!this.props.readOnly) return; + if (ev.ctrlKey) return; ev.preventDefault(); - const { document, revision } = this.props; + const { document, location } = this.props; - if (revision) { + if (location.pathname.endsWith("history")) { this.props.history.push(document.url); } else { this.props.history.push(documentHistoryUrl(document)); diff --git a/app/scenes/KeyboardShortcuts.js b/app/scenes/KeyboardShortcuts.js index 5fa1c589..ded6ee72 100644 --- a/app/scenes/KeyboardShortcuts.js +++ b/app/scenes/KeyboardShortcuts.js @@ -21,6 +21,7 @@ function KeyboardShortcuts() { }, { shortcut: e, label: t("Edit current document") }, { shortcut: m, label: t("Move current document") }, + { shortcut: h, label: t("Open document history") }, { shortcut: ( <>