fix: Clash between history and table of content shortcuts

related #2733
This commit is contained in:
Tom Moor 2021-11-08 18:03:03 -08:00
parent e170a63094
commit a600a897c3
3 changed files with 7 additions and 3 deletions

View File

@ -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;

View File

@ -203,11 +203,12 @@ class DocumentScene extends React.Component<Props> {
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));

View File

@ -21,6 +21,7 @@ function KeyboardShortcuts() {
},
{ shortcut: <Key>e</Key>, label: t("Edit current document") },
{ shortcut: <Key>m</Key>, label: t("Move current document") },
{ shortcut: <Key>h</Key>, label: t("Open document history") },
{
shortcut: (
<>