fix: Toggle shortcut for TOC not working
This commit is contained in:
@@ -264,20 +264,6 @@ class DocumentScene extends React.Component<Props> {
|
||||
}
|
||||
};
|
||||
|
||||
onToggleTableOfContents = (ev: KeyboardEvent) => {
|
||||
if (!this.props.readOnly) {
|
||||
return;
|
||||
}
|
||||
ev.preventDefault();
|
||||
const { ui } = this.props;
|
||||
|
||||
if (ui.tocVisible) {
|
||||
ui.hideTableOfContents();
|
||||
} else {
|
||||
ui.showTableOfContents();
|
||||
}
|
||||
};
|
||||
|
||||
onSave = async (
|
||||
options: {
|
||||
done?: boolean;
|
||||
@@ -433,14 +419,6 @@ class DocumentScene extends React.Component<Props> {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<RegisterKeyDown
|
||||
trigger="h"
|
||||
handler={(event) => {
|
||||
if (event.ctrlKey && event.altKey) {
|
||||
this.onToggleTableOfContents(event);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Background
|
||||
id="full-width-container"
|
||||
key={revision ? revision.id : document.id}
|
||||
|
||||
@@ -34,6 +34,7 @@ import { restoreRevision } from "~/actions/definitions/revisions";
|
||||
import useActionContext from "~/hooks/useActionContext";
|
||||
import useCurrentTeam from "~/hooks/useCurrentTeam";
|
||||
import useCurrentUser from "~/hooks/useCurrentUser";
|
||||
import useKeyDown from "~/hooks/useKeyDown";
|
||||
import useMobile from "~/hooks/useMobile";
|
||||
import usePolicy from "~/hooks/usePolicy";
|
||||
import useStores from "~/hooks/useStores";
|
||||
@@ -176,6 +177,14 @@ function DocumentHeader({
|
||||
</Action>
|
||||
);
|
||||
|
||||
useKeyDown(
|
||||
(event) => event.ctrlKey && event.altKey && event.key === "˙",
|
||||
ui.tocVisible ? ui.hideTableOfContents : ui.showTableOfContents,
|
||||
{
|
||||
allowInInput: true,
|
||||
}
|
||||
);
|
||||
|
||||
if (shareId) {
|
||||
return (
|
||||
<StyledHeader
|
||||
|
||||
Reference in New Issue
Block a user