fix: content area unified branch (text+markdown→textarea/preview, richtext→RTE), no null dead-end
This commit is contained in:
@@ -816,10 +816,10 @@ export function NoteEditor({ note, readOnly = false, onClose, fullPage = false }
|
|||||||
<RichTextEditor
|
<RichTextEditor
|
||||||
content={content}
|
content={content}
|
||||||
onChange={(v) => { setContent(v); setIsDirty(true) }}
|
onChange={(v) => { setContent(v); setIsDirty(true) }}
|
||||||
className="min-h-[300px] text-lg font-light leading-relaxed text-foreground/80"
|
className="min-h-[60vh] text-lg font-light leading-relaxed text-foreground/80"
|
||||||
onImageUpload={uploadImageFile}
|
onImageUpload={uploadImageFile}
|
||||||
/>
|
/>
|
||||||
) : noteType === 'markdown' && showMarkdownPreview ? (
|
) : (noteType === 'markdown' || noteType === 'text') && showMarkdownPreview ? (
|
||||||
<div
|
<div
|
||||||
className="min-h-[300px] cursor-text prose prose-lg dark:prose-invert max-w-none leading-relaxed"
|
className="min-h-[300px] cursor-text prose prose-lg dark:prose-invert max-w-none leading-relaxed"
|
||||||
onClick={() => !readOnly && setShowMarkdownPreview(false)}
|
onClick={() => !readOnly && setShowMarkdownPreview(false)}
|
||||||
@@ -831,7 +831,7 @@ export function NoteEditor({ note, readOnly = false, onClose, fullPage = false }
|
|||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : noteType === 'text' || noteType === 'markdown' ? (
|
) : (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<textarea
|
<textarea
|
||||||
ref={textareaRef}
|
ref={textareaRef}
|
||||||
@@ -843,13 +843,13 @@ export function NoteEditor({ note, readOnly = false, onClose, fullPage = false }
|
|||||||
disabled={readOnly}
|
disabled={readOnly}
|
||||||
className="w-full min-h-[60vh] border-0 outline-none px-0 bg-transparent text-lg leading-relaxed font-light resize-none placeholder:text-foreground/20 text-foreground/80"
|
className="w-full min-h-[60vh] border-0 outline-none px-0 bg-transparent text-lg leading-relaxed font-light resize-none placeholder:text-foreground/20 text-foreground/80"
|
||||||
/>
|
/>
|
||||||
{noteType === 'markdown' && content && !readOnly && (
|
{content && !readOnly && (
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={() => setShowMarkdownPreview(true)}
|
onClick={() => setShowMarkdownPreview(true)}
|
||||||
className="mt-2 text-[11px] text-foreground/40 hover:text-foreground flex items-center gap-1.5 transition-colors"
|
className="mt-2 text-[11px] text-foreground/40 hover:text-foreground flex items-center gap-1.5 transition-colors"
|
||||||
>
|
>
|
||||||
<Eye className="h-3 w-3" /> Preview Markdown
|
<Eye className="h-3 w-3" /> Preview
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
{!readOnly && (
|
{!readOnly && (
|
||||||
@@ -860,7 +860,7 @@ export function NoteEditor({ note, readOnly = false, onClose, fullPage = false }
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user