Skip to content

Extensions ​

Extensions are ordinary packages built on the engine's public API. Nothing in them reaches into private code, and every one of them is built on the same four hooks: schema merging, onTransaction, addDispatchTransform and setDecorationLayer, plus keymap, inputRules, nodeViews and the suggestion trigger module.

Two kinds:

  • Schema extensions export node or mark specs you merge into your Schema: tableNodes(), imageNodes(), blockNodes(), embedNodes(), mathNodes(), trackChangesMarks().
  • Behaviour extensions attach to an editor and return a controller or a disposer: image(editor, ...), codeHighlight(editor, ...), diagram(editor, ...), createWritingAssistant(editor, ...), new TrackChanges(editor, ...).

Each page below covers one package: what it adds, the calls, and the decisions behind it that are worth knowing before you rely on them.

PackageAdds
@trevixal/extension-tableTables: structure, merge and split, header row, alignment, background, borders, sort, resize, CSV in and out, text to table and back
@trevixal/extension-imageImages: pluggable storage, drag/paste/pick upload with progress and cancellation, resize, crop, rotate, compress, captions, alignment, a floating toolbar
@trevixal/extension-blocksCallouts, toggles, columns, cards, timelines, page breaks, badges, buttons, footnotes, tabs, accordions, citations and reference lists, anchors
@trevixal/extension-embedVideo, audio, YouTube and Vimeo, allowlisted iframes, file attachments, link preview cards
@trevixal/extension-mathLaTeX to MathML for inline and display equations, the $...$ input rule, a pluggable renderer
@trevixal/extension-diagramLive diagram previews under code blocks through any renderer; a Mermaid adapter and lazy loader included
@trevixal/extension-exportDOCX and RTF writers and a DOCX reader, with their own ZIP and XML implementations
@trevixal/extension-commentsComment threads on a selection, replies, resolving, @mentions and a notifications hook, saved with the document and carried into Word
@trevixal/extension-formsFields in the text (text, tick box, drop-down, date, signature), a fillable PDF form, and mail merge from CSV or JSON
@trevixal/extension-securityPBKDF2 and AES-GCM document encryption with expiry, an encrypted storage wrapper, restrictions
@trevixal/extension-writingReadability, passive voice, repeated words, long sentences, grammar, keyword density, goals, spell-check toggle
@trevixal/extension-workspaceA document store with folders and templates, a tab strip, a workspace panel, a split preview or mirrored editor
@trevixal/extension-track-changesSuggestion mode: attributed, timestamped insertions and deletions; accept and reject; a review bar
@trevixal/extension-code-highlightFourteen bundled languages behind one Highlighter interface, language detection, copy-code buttons, numbered and picked-out lines, terminal, diff and runnable blocks
@trevixal/extension-format-codeJSON and XML pretty-printing and minification, in place
@trevixal/extension-slash-commandThe / menu: fuzzy filtering, keyboard-first, an extensible item list
@trevixal/extension-emojiThe : picker with 114 built-in emoji and search

Every one has no runtime dependencies, declares @trevixal/core as a peer dependency, and ships ESM, CJS and type declarations. The assembled @trevixal/editor-kit wires all fifteen together; its mount.ts makes every call below once, in order.

To write one of your own, start with the callout tutorial.

Apache-2.0