Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: enter in title should focus editor

Abdullah Attaa8164e9f6c9a
diff --git a/apps/web/src/components/editor/title-box.tsx b/apps/web/src/components/editor/title-box.tsx
index 4eaa111d9..a88064324 100644
--- a/apps/web/src/components/editor/title-box.tsx
+++ b/apps/web/src/components/editor/title-box.tsx
@@ -23,7 +23,7 @@ import { useEditorStore } from "../../stores/editor-store";
import { debounceWithId } from "@notesnook/common";
import useMobile from "../../hooks/use-mobile";
import useTablet from "../../hooks/use-tablet";
-import { useEditorConfig } from "./manager";
+import { useEditorConfig, useEditorManager } from "./manager";
import { getFontById } from "@notesnook/editor";
import { replaceDateTime } from "@notesnook/editor/dist/extensions/date-time";
import { useStore as useSettingsStore } from "../../stores/setting-store";
@@ -131,6 +131,13 @@ function TitleBox(props: TitleBoxProps) {
color: "placeholder"
}
}}
+ onKeyUp={(e) => {
+ if (e.key === "Enter") {
+ const context = useEditorManager.getState().getEditor(id);
+ if (!context) return;
+ context.editor?.focus({ scrollIntoView: true });
+ }
+ }}
onChange={(e) => {
pendingChanges.current = true;
e.target.value = replaceDateTime(