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

@@ -358,7 +358,7 @@ export function HomeClient({ initialNotes, initialSettings }: HomeClientProps) {
fullPage
/>
) : (
<>
<div className="flex-1 overflow-y-auto min-h-0">
<div className={cn(
'px-12 pt-12 pb-8 flex flex-col gap-6',
isEditorialMode ? 'sticky top-0 bg-background/90 backdrop-blur-md z-30 border-b border-foreground/5' : ''
@@ -483,7 +483,7 @@ export function HomeClient({ initialNotes, initialSettings }: HomeClientProps) {
Memento &mdash; {new Date().getFullYear()}
</p>
</footer>
</>
</div>
)}
<MemoryEchoNotification onOpenNote={handleOpenNote} />

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