Install the package
Use the same published version as this showcase, or review the upstream release notes before updating.
npm install @wieslawsoltes/richtextweb@0.5.0This package’s license: MIT. Retain upstream and bundled third-party notices when redistributing.
Mount your first view
Register controls through /web. Use /formats to create a document from Markdown, then assign the editor.Document property.
<div class="toolbar"><button id="undo">Undo</button><button id="redo">Redo</button><button id="inspect">Inspect document</button></div><rich-text-toolbar for="editor" mode="all"></rich-text-toolbar><rich-text-box id="editor" view-mode="continuous" aria-label="Editable field note" style="display:block;height:340px;margin-top:12px"></rich-text-box><p class="hint">Select text to format it. This is the published rich-text control and document engine.</p>The complete executable source is in the usage guide. Imports shown here are intended for a bundler or a browser import map; bare npm imports do not resolve in ordinary HTML by themselves.
Own the lifetime
Dispose owned engines and document subscriptions on teardown. A mutable document needs revision subscriptions, not just identity checks.
The playground replaces its entire isolated frame on each run. In your application, use the framework’s unmount or disposal hook instead. Do not dispose a shared model while another view still owns it.
Read the lifecycle guide →Know the contract
Source repositories can contain work newer than the published package. The showcase uses @wieslawsoltes/richtextweb@0.5.0.