fix: add missing quotes around className in NoteTitleInput

This commit is contained in:
Hermes
2026-08-01 12:57:53 +00:00
parent c35ea2b175
commit ec0fb10b3e
+11 -11
View File
@@ -17,20 +17,20 @@ import { cn } from "@/lib/utils";
import type { Note, PaginatedResponse } from "@/lib/types"; import type { Note, PaginatedResponse } from "@/lib/types";
// Simple TipTap-like editor using contentEditable // Simple TipTap-like editor using contentEditable
const NoteEditor = memo(function NoteEditor({ content, onChange, placeholder = "Start writing..." }: { content: string; onChange: (html: string) => void; placeholder?: string }) { const NoteEditor = memo(function NoteEditor({ initialContent, onSave, placeholder = "Start writing..." }: { initialContent: string; onSave: (html: string) => void; placeholder?: string }) {
const editorRef = useRef<HTMLDivElement>(null); const editorRef = useRef<HTMLDivElement>(null);
const [isPlaceholder, setIsPlaceholder] = useState(!content); const [isPlaceholder, setIsPlaceholder] = useState(!initialContent);
useEffect(() => { useEffect(() => {
if (editorRef.current && !editorRef.current.innerHTML) { if (editorRef.current) {
editorRef.current.innerHTML = content || ""; editorRef.current.innerHTML = initialContent || "";
} }
}, [content]); setIsPlaceholder(!initialContent);
}, [initialContent]);
const handleInput = () => { const handleBlur = () => {
const html = editorRef.current?.innerHTML || ""; const html = editorRef.current?.innerHTML || "";
setIsPlaceholder(!html || html === "<br>"); onSave(html);
onChange(html);
}; };
return ( return (
@@ -41,9 +41,9 @@ const NoteEditor = memo(function NoteEditor({ content, onChange, placeholder = "
<div <div
ref={editorRef} ref={editorRef}
contentEditable contentEditable
className="prose prose-sm dark:prose-invert max-w-none p-3 focus:outline-none min-h-[300px]"
onInput={handleInput}
suppressContentEditableWarning suppressContentEditableWarning
className="prose prose-sm dark:prose-invert max-w-none p-3 focus:outline-none min-h-[300px]"
onBlur={handleBlur}
/> />
</div> </div>
); );
@@ -235,7 +235,7 @@ function NotesPage() {
</div> </div>
</div> </div>
<div className="flex-1 overflow-auto"> <div className="flex-1 overflow-auto">
<NoteEditor content={editorContent} onChange={handleContentChange} /> <NoteEditor initialContent={editorContent} onSave={handleContentChange} />
</div> </div>
{/* Backlinks section */} {/* Backlinks section */}
{showBacklinks && selectedNote.backlinks && selectedNote.backlinks.length > 0 && ( {showBacklinks && selectedNote.backlinks && selectedNote.backlinks.length > 0 && (