@polycrest/document-editor
v0.4.0
Published
Browser document editor engine — TipTap 3 behind a document-core facade. No engine types in the public API.
Readme
@polycrest/document-editor
The browser editing engine behind the facade: TipTap 3 (MIT packages only,
ProseMirror via @tiptap/pm), canonical↔editor mapping, the stable-ID
extension (split keeps the first half's ID; paste mints copies with
copiedFromId), managed-region chrome + policy enforcement, embedded-element
node views delegated to the host registry, suggestion decorations, and the op
compiler that turns validated operations into one atomic transaction.
Engine cage: only src/internal/ may import @tiptap/* — enforced by
scripts/check-api-boundary.mjs. Every exported signature uses
@polycrest/document-core formats.
import { createDocumentEditor, blankDocument } from "@polycrest/document-editor";
import "@polycrest/document-editor/styles.css";
const editor = createDocumentEditor({
mount: element,
document: initialDocument, // StructuredDocument
automation: false, // true → seeded IDs, no animations, parity asserts
elementRegistry, dataProviders, // host-supplied seams
});The parity invariant: after every applied change set, the editor state maps
back to a document deep-equal to core's applyChangeSetToDocument output.
Automation mode asserts it on every apply.
