fix: sticky header needs overflow-y-auto parent, textarea auto-resize on preview toggle, markdown source always visible
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user