"use client"; import "./styles/shared.css"; import { EditorContent, EditorInstance, EditorRoot, JSONContent, Placeholder, StarterKit, TiptapUnderline, } from "novel"; import { MenuBar } from "./menu/menu-bar"; const extentions = [ TiptapUnderline, StarterKit.configure({ blockquote: false, bulletList: false, orderedList: false, code: false, codeBlock: false, horizontalRule: false, listItem: false, heading: { levels: [4, 5], }, }), Placeholder.configure({ placeholder: "Schreibe einen Kommentar …", emptyNodeClass: "first:before:absolute first:before:text-gray-400 first:before:float-left first:before:content-[attr(data-placeholder)] first:before:pointer-events-none", }), ]; const CommentEditor = ({ children, initialContent, readOnly, onContentChange, setEditor, }: { initialContent?: JSONContent; onContentChange?: (content: JSONContent) => void; readOnly?: boolean; children?: React.ReactNode; setEditor?: (editor: EditorInstance) => void; }) => { const slotAfter = (
{!readOnly && ( )} {children}
); return ( { setEditor?.(editor); }} onUpdate={({ editor }) => { onContentChange?.(editor.getJSON()); }} /> ); }; export default CommentEditor;