06 / 24
06CompactEditor
Self-contained editor variant
A lightweight editor that bundles the EditorProvider, Editor, and an inline toolbar into a single component. No wrapper needed.
CommentBox.tsx
import { CompactEditor } from "@/components/CompactEditor"
import { createEmptyContent } from "@/lib/empty-content"
export default function CommentBox() {
const initialContainer = {
id: "root",
type: "container",
children: createEmptyContent(),
attributes: {}
}
return (
<CompactEditor
initialContainer={initialContainer}
onUploadImage={async (file) => {
return URL.createObjectURL(file)
}}
/>
)
}- --Accepts the same props as Editor (readOnly, onUploadImage, notionBased) but does not require a separate EditorProvider wrapper.
- --Includes a CompactToolbar with essential formatting controls built in.
- --Ideal for comment boxes, inline editing fields, or any embedded use case where a full toolbar is too heavy.