richtext-dom
v1.0.0
Published
The native interactive editor handles incremental AST rendering, DOM mapping, input, selection, and history. `src/public-api.ts` exports `createEditor` and `createDomRenderer`.
Readme
richtext-dom
The native interactive editor handles incremental AST rendering, DOM mapping, input, selection, and history. src/public-api.ts exports createEditor and createDomRenderer.
The canonical model is independent of the DOM. This private experimental package uses browser APIs and the native engine. richtext-formats parses and filters imported HTML, then validates it as an AST. The renderer uses that AST to build the DOM.
The editor exposes run, can, isActiveCommand, loadHtml, insertHtml, getHtml, and getText. Capability and active-state queries are silent and leave focus and editor state intact. loadHtml resets history and is silent by default. insertHtml edits the current canonical selection in one undoable action. HTML results report diagnostics and loss. Paste operations also emit contentDiagnostics when they lose content. Pasting from an empty clipboard preserves the selection.
options.extensions replaces the built-in rich-text preset. Call custom commands with run({ type: 'extension', name, args }). Extensions can supply keymaps and hooks. The editor rejects collisions before mounting and supports the native v1 schema. options.formats configures limits and can enforce onLoss: 'reject'.
The clipboard supports sanitized HTML and plain text. Real IME composition, qualification across browser engines, and rich internal drag and drop remain subjects for further work. Phase 3 report · Command contracts
