diff --git a/memento-note/components/home-client.tsx b/memento-note/components/home-client.tsx index 88d55ca..859dcb7 100644 --- a/memento-note/components/home-client.tsx +++ b/memento-note/components/home-client.tsx @@ -358,7 +358,7 @@ export function HomeClient({ initialNotes, initialSettings }: HomeClientProps) { fullPage /> ) : ( - <> +
- +
)} diff --git a/memento-note/components/note-editor.tsx b/memento-note/components/note-editor.tsx index 5c8cef8..56c59d0 100644 --- a/memento-note/components/note-editor.tsx +++ b/memento-note/components/note-editor.tsx @@ -266,6 +266,20 @@ export function NoteEditor({ note, readOnly = false, onClose, fullPage = false } el.style.height = Math.max(el.scrollHeight, 280) + 'px' }, [content]) + // Also auto-grow when switching FROM preview TO edit mode + useEffect(() => { + if (showMarkdownPreview) return // we're in preview, textarea not mounted + // Defer one frame so the textarea is in the DOM + const raf = requestAnimationFrame(() => { + const el = textareaRef.current + if (!el) return + el.style.height = 'auto' + el.style.height = Math.max(el.scrollHeight, 280) + 'px' + el.focus() + }) + return () => cancelAnimationFrame(raf) + }, [showMarkdownPreview]) + const handleRemoveImage = (index: number) => { const removedUrl = images[index] setImages(images.filter((_, i) => i !== index))