Back to packages
@bayonai/rich-text-editor
v0.1.2
React 19

Block Model

Learn the durable RichTextBlock contract used for persistence, rendering, plain text extraction, and AI workflows.

Block model

The durable value is a simple `RichTextBlock[]`. That is the heart of the package: rich enough to express useful documents, small enough to persist, sanitize, diff, render, and feed into AI workflows.

type RichTextBlock =
  | { id: string; type: 'paragraph'; markdown: string }
  | { id: string; type: 'heading'; markdown: string }
  | { id: string; type: 'quote'; markdown: string }
  | { id: string; type: 'checkbox'; checked: boolean; markdown: string }
  | { id: string; type: 'code'; text: string }
  | { id: string; type: 'divider' }
  | { id: string; type: 'image'; assetId?: string; alt?: string };

Why this model matters

The host app can store blocks, render them later, extract searchable plain text, pass sanitized content to AI workflows, and avoid treating editor HTML as the source of truth.