"use client" import type { Value } from 'platejs'; import { BasicBlocksKit } from '@/components/editor/plugins/basic-blocks-kit'; import { BasicMarksKit } from '@/components/editor/plugins/basic-marks-kit'; import { Editor, EditorContainer } from '@/components/ui/editor'; import { FixedToolbar } from '@/components/ui/fixed-toolbar'; import { MarkToolbarButton } from '@/components/ui/mark-toolbar-button'; import { ToolbarButton } from '@/components/ui/toolbar'; import { Plate, usePlateEditor } from 'platejs/react'; const initialValue: Value = [ { children: [{ text: 'Title' }], type: 'h3', }, { children: [{ text: 'This is a quote.' }], type: 'blockquote', }, { type: 'p', children: [ { text: 'Hello! Try out the ' }, { text: 'bold', bold: true }, { text: ', ' }, { text: 'italic', italic: true }, { text: ', and ' }, { text: 'underline', underline: true }, { text: ' formatting.' }, ], }, ]; export default function TosEditor() { const editor = usePlateEditor({ plugins: [ ...BasicBlocksKit, ...BasicMarksKit, ], // Add the mark plugins value: initialValue, // Set initial content }); return ( {/* Provides editor context */} {/* Element Toolbar Buttons */} editor.tf.h1.toggle()}>H1 editor.tf.h2.toggle()}>H2 editor.tf.h3.toggle()}>H3 editor.tf.blockquote.toggle()}>Quote {/* Mark Toolbar Buttons */} B I U {/* Styles the editor area */} ); }