@openeditor/core
v0.0.40
Published
Canonical SDK contract for OpenEditor documents.
Readme
@openeditor/core
Canonical SDK contract for OpenEditor documents.
The package exports portable image and attachment contracts plus the shared
OpenEditorPageRuntime used by web and native page surfaces. A web host can use
File as an upload source; native hosts can use a picker asset without
introducing platform types here. Upload sources and resolved preview URLs are
runtime-only and never enter document JSON.
Public renderers default to openEditorUntrustedDocumentUrlPolicy. It permits
safe user-activated navigation but blocks every image URL so rendering an
untrusted document cannot silently contact a tracking endpoint. Hosts may opt
into remote images with openEditorExternalMediaUrlPolicy, compose a narrower
OpenEditorUrlPolicy, or use openEditorUnsafeUrlPolicy only at an explicit
trusted boundary.
Public surface
OpenEditorDocumentand related types- document creation, normalization, validation, parsing, and platform support helpers
- strict, non-repairing
parseOpenEditorDocumentfor versioned documents and explicitimportProseMirrorDocumentfor unversioned ProseMirror JSON - portable document contracts for configured node types, marks, content, attributes, custom validators, and schema versions
- structured validation diagnostics and configurable limits for untrusted document input
- deterministic canonical JSON fingerprints and revision precondition contracts
- shared authoring capabilities and page metadata runtime contracts
- platform-neutral command and transaction helpers
- top-level block transforms and text extraction
Internal notes
- Renderer implementations should adapt at their package boundary, not by inventing their own document shape.
- This package owns the stable cross-platform contract and should stay free of web/native runtime dependencies.
- Normalization and repair are explicit operations. Strict parsing never silently changes persisted input.
fingerprintOpenEditorDocumentis intended for optimistic concurrency and diff identity, not cryptographic authentication.
