Skip to content
QuireKit MSFE
Developer docs
v0.0.0 · Experimental
Core conceptsView Markdown ↗

Extension model and composition

Understand create, configure, extend, installation order and ownership.

Choose the owner first

Extension supplies general behavior and presets; Node describes source nodes; Mark describes inline annotations. They share authoring hooks. They do not create a ProseMirror schema or a second JSON document.

GoalEntry pointWalkthrough
Change defaults.configure()Containers
Keep syntax, replace controls.extend({ addNodeView() {} })Code blocks
Introduce syntax with writable fieldsNode.create() + defineSource()Custom nodes
Add parsing rulesaddMarkdownExtensions()Markdown plugins
Render multiline structural previewsaddProjectionLayers()Diagrams
Add transient state or input behaviorExtension.create()State, input rules

create: declare a reusable definition

ts

Definitions can be reused across editors. Options and storage are resolved independently per installation. Do not put instance state in module globals. Storage suits temporary services and counters; use defineState() for transaction mapping, history or projection dependencies.

configure: change options

ts

This returns a new definition. Plain records merge recursively; arrays replace entirely; functions and non-plain objects replace by value. Retain default container names explicitly when changing types. Configuration is not a mounted-instance hot update. Use instance methods for theme, mode and permission changes.

extend: override a hook deliberately

ts

Overridden hooks do not automatically combine results. Call the current hook's this.parent?.() to retain parent behavior and explicitly combine returned arrays. Use ordinary methods whenever a hook needs this.options, this.storage, this.editor or this.parent; arrow functions capture a different this.

Derived definitions inherit the name. Replace the corresponding preset entry instead of installing both definitions. Renaming alone does not resolve competing replacement projections.

Install one preset

ts

Use addExtensions() to compose a business preset, then install that preset once. requires names extension dependencies. Dependency-ready extensions install in descending priority, default 100. Duplicate names and missing dependencies are diagnosed before mounting; array reordering should not conceal configuration errors.

Lifecycle and ownership

PhaseAvailable contextAppropriate work
Configuration and state creationDefinitions, options and slotsRepeatable work without DOM effects
onBeforeCreateConfiguration and state, no mounted DOMLogic independent of mounting
onCreateMounted editorSubscribe to host services; optionally return a disposer
onUpdateAccepted source changesIncremental observation and dirty state
onTransactionEvery accepted transactionBounded reads, including selection/effects
onSelectionUpdateA changed selectionRefresh dependent toolbar state
onDestroyDisposal in progressCleanup in reverse installation order

Components can unmount on scrolling, source reveal or mode changes. Their lifetime is shorter than the editor's. Bind asynchronous resources to the appropriate scope. See Extension API for exact hook signatures.

Earlier descriptors

defineExtension() and defineNodeView() remain public low-level entries. Their earlier descriptor configuration does not share all modern deep-merge semantics. Prefer the authoring API for new features. Tiptap-style names do not imply support for parseHTML, renderHTML, ProseMirror schema content or direct ProseMirror plugin installation.

MSFE · QuireKitYour Markdown source stays yours.