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"
|
typeof keyFilter === "function"
|
||||||
? keyFilter
|
? keyFilter
|
||||||
: typeof keyFilter === "string"
|
: typeof keyFilter === "string"
|
||||||
? (event: KeyboardEvent) => event.key === keyFilter
|
? (event: KeyboardEvent) =>
|
||||||
|
event.key === keyFilter ||
|
||||||
|
event.code === `Key${keyFilter.toUpperCase()}`
|
||||||
: keyFilter
|
: keyFilter
|
||||||
? (_event) => true
|
? (_event) => true
|
||||||
: (_event) => false;
|
: (_event) => false;
|
||||||
|
|
|
@ -203,11 +203,12 @@ class DocumentScene extends React.Component<Props> {
|
||||||
|
|
||||||
goToHistory = (ev) => {
|
goToHistory = (ev) => {
|
||||||
if (!this.props.readOnly) return;
|
if (!this.props.readOnly) return;
|
||||||
|
if (ev.ctrlKey) return;
|
||||||
|
|
||||||
ev.preventDefault();
|
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);
|
this.props.history.push(document.url);
|
||||||
} else {
|
} else {
|
||||||
this.props.history.push(documentHistoryUrl(document));
|
this.props.history.push(documentHistoryUrl(document));
|
||||||
|
|
|
@ -21,6 +21,7 @@ function KeyboardShortcuts() {
|
||||||
},
|
},
|
||||||
{ shortcut: <Key>e</Key>, label: t("Edit current document") },
|
{ shortcut: <Key>e</Key>, label: t("Edit current document") },
|
||||||
{ shortcut: <Key>m</Key>, label: t("Move current document") },
|
{ shortcut: <Key>m</Key>, label: t("Move current document") },
|
||||||
|
{ shortcut: <Key>h</Key>, label: t("Open document history") },
|
||||||
{
|
{
|
||||||
shortcut: (
|
shortcut: (
|
||||||
<>
|
<>
|
||||||
|
|
Reference in New Issue