fix: sticky header needs overflow-y-auto parent, textarea auto-resize on preview toggle, markdown source always visible
This commit is contained in:
@@ -358,7 +358,7 @@ export function HomeClient({ initialNotes, initialSettings }: HomeClientProps) {
|
|||||||
fullPage
|
fullPage
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<div className="flex-1 overflow-y-auto min-h-0">
|
||||||
<div className={cn(
|
<div className={cn(
|
||||||
'px-12 pt-12 pb-8 flex flex-col gap-6',
|
'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' : ''
|
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 — {new Date().getFullYear()}
|
Memento — {new Date().getFullYear()}
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
</>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<MemoryEchoNotification onOpenNote={handleOpenNote} />
|
<MemoryEchoNotification onOpenNote={handleOpenNote} />
|
||||||
|
|||||||
@@ -266,6 +266,20 @@ export function NoteEditor({ note, readOnly = false, onClose, fullPage = false }
|
|||||||
el.style.height = Math.max(el.scrollHeight, 280) + 'px'
|
el.style.height = Math.max(el.scrollHeight, 280) + 'px'
|
||||||
}, [content])
|
}, [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 handleRemoveImage = (index: number) => {
|
||||||
const removedUrl = images[index]
|
const removedUrl = images[index]
|
||||||
setImages(images.filter((_, i) => i !== index))
|
setImages(images.filter((_, i) => i !== index))
|
||||||
|
|||||||
Reference in New Issue
Block a user