fix: sticky header needs overflow-y-auto parent, textarea auto-resize on preview toggle, markdown source always visible

This commit is contained in:
Antigravity
2026-05-07 23:09:45 +00:00
parent 77d6458946
commit ea62d68cdd
2 changed files with 16 additions and 2 deletions

View File

@@ -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))