diff --git a/web/src/components/MemoEditor/Editor/index.tsx b/web/src/components/MemoEditor/Editor/index.tsx index e77aaedf8..c5cca4a5a 100644 --- a/web/src/components/MemoEditor/Editor/index.tsx +++ b/web/src/components/MemoEditor/Editor/index.tsx @@ -6,6 +6,19 @@ import { editorCommands } from "./commands"; import TagSuggestions from "./TagSuggestions"; import { useListAutoCompletion } from "./useListAutoCompletion"; +/** + * Editor height constraints + * - Normal mode: Limited to 50% viewport height to avoid excessive scrolling + * - Focus mode: Minimum 50vh on mobile, 60vh on desktop for immersive writing + */ +const EDITOR_HEIGHT = { + normal: "max-h-[50vh]", + focusMode: { + mobile: "min-h-[50vh]", + desktop: "md:min-h-[60vh]", + }, +} as const; + export interface EditorRefActions { getEditor: () => HTMLTextAreaElement | null; focus: FunctionType; @@ -30,10 +43,12 @@ interface Props { commands?: Command[]; onContentChange: (content: string) => void; onPaste: (event: React.ClipboardEvent) => void; + /** Whether Focus Mode is active - adjusts height constraints for immersive writing */ + isFocusMode?: boolean; } const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef) { - const { className, initialContent, placeholder, onPaste, onContentChange: handleContentChangeCallback } = props; + const { className, initialContent, placeholder, onPaste, onContentChange: handleContentChangeCallback, isFocusMode } = props; const [isInIME, setIsInIME] = useState(false); const editorRef = useRef(null); @@ -160,9 +175,18 @@ const Editor = forwardRef(function Editor(props: Props, ref: React.ForwardedRef< }); return ( -
+