fix: Clash between history and table of content shortcuts
related #2733
This commit is contained in:
parent
e170a63094
commit
a600a897c3
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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: (
|
||||
<>
|
||||
|
|
Reference in New Issue