Revert "fix: prevent default browser save behavior (#450)" (#451)

This reverts commit d07338861b6c5f17011fcf0510fcd3e7d66dfc02.
This commit is contained in:
Philip Okugbe 2024-10-30 12:23:31 +00:00 committed by GitHub
parent d07338861b
commit 4f1a97ceb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,6 @@ import PageEditor from "@/features/editor/page-editor";
import { Container } from "@mantine/core";
import { useAtom } from "jotai";
import { userAtom } from "@/features/user/atoms/current-user-atom.ts";
import { useOs } from "@mantine/hooks";
const MemoizedTitleEditor = React.memo(TitleEditor);
const MemoizedPageEditor = React.memo(PageEditor);
@ -26,21 +25,12 @@ export function FullEditor({
editable,
}: FullEditorProps) {
const [user] = useAtom(userAtom);
const os = useOs();
const fullPageWidth = user.settings?.preferences?.fullPageWidth;
// intercept ctrl+s to prevent default browser save behavior
document.addEventListener("keydown", function (e) {
if (editable && os === 'macos' ? e.metaKey : e.ctrlKey && e.code.toLowerCase() === 'keys') {
e.preventDefault();
}
}, false);
return (
<Container
fluid={fullPageWidth}
{... (fullPageWidth && { mx: 80 })}
{...(fullPageWidth && { mx: 80 })}
size={850}
className={classes.editor}
>