23 lines
576 B
TypeScript
23 lines
576 B
TypeScript
/* Copyright (C) 2024-2025 LibreWeddingPlanner contributors*/
|
|
|
|
'use client'
|
|
|
|
import { useEditor, EditorContent } from '@tiptap/react'
|
|
import StarterKit from '@tiptap/starter-kit'
|
|
|
|
const Tiptap = ({ content, onUpdate }: { content: string, onUpdate: (newContent:string) => void }) => {
|
|
|
|
const editor = useEditor({
|
|
extensions: [StarterKit],
|
|
content: content || '<p>Type something here...</p>',
|
|
onUpdate({ editor }) {
|
|
onUpdate(editor.getHTML());
|
|
},
|
|
immediatelyRender: false,
|
|
})
|
|
|
|
return <EditorContent editor={editor} />
|
|
}
|
|
|
|
export default Tiptap
|