richtext
Tiptap-backed rich text editor. Lighter than the TinyMCE `wysiwyg` control — no jQuery, no global state. Renders inline on wide surfaces and as a popover/modal in the narrow block Inspector.
Stored value
string — HTML, e.g. `<p>Hello <strong>world</strong></p>`. Empty document normalises to `""`.
Supports
- Bold / italic / strike / inline code
- Bullet and numbered lists, blockquote
- Headings (configurable allowed levels)
- Links via a popover
- Image insertion via the media library
- Undo / redo
- Three display modes: inline, popover, modal
Config options
headingLevelsnumber[]default:"[2, 3, 4]"- Which heading levels appear in the block-type select.
allowImagesbooleandefault:true- Show the insert-image toolbar button. Set to `false` for caption-style fields.
displaystring — "inline" | "popover" | "modal"- Force a specific display mode. Default behaviour: `popover` in sidebar variants, `inline` on wide surfaces.
placeholderstring- Greyed-out hint shown on the collapsed button in popover/modal mode.
Example
json
{ "id": "ctrl_body",
"type": "richtext",
"label": "Body",
"attributeKey": "body",
"headingLevels": [2, 3],
"parentPanelId": "panel" }
Gotchas
Heads up
Empty editor returns `""`, not `"<p></p>"`. Required-validation works correctly.
Heads up
The TinyMCE-based `wysiwyg` control is a backwards-compat alias for this — same component, same stored HTML shape.
Notes
Consume
export default function Body({ attributes }) {
const html = attributes.body || '';
return <div className="body" dangerouslySetInnerHTML={{ __html: html }} />;
}