Editor overview
Embed SuperDoc v2 in a web application and keep DOCX as the document format.
Use the Editor when a person needs to read, edit, comment on, or review a DOCX file inside your application.
SuperDoc v2 is selected by package version. Install superdoc@2. There is no runtime setting that switches an installed editor between v1 and v2.
Choose how to mount the Editor
SuperDoc provides two public browser integrations:
| Application | Start with | What it owns |
|---|---|---|
| Vanilla JavaScript or another framework | SuperDoc from superdoc | Editor creation, configuration, lifecycle, and export |
| React | SuperDocEditor from @superdoc-dev/react | React mounting, updates, cleanup, and access to the SuperDoc instance |
Both integrations run the same v2 editor. Choose the one that fits your application rather than wrapping one integration in the other.
After mounting the Editor, decide who owns the controls around the document. Choose your editor interface compares the built-in UI, a configured built-in UI, and application-owned controls.
What v2 changes
The v2 engine edits the DOCX package directly. It does not convert the document to HTML and back.
For a browser integration:
- Wait for editor readiness before calling methods that depend on the open document.
- Use document modes to control whether a person views, edits, or suggests changes.
- Use the Document API when application code needs to inspect or change document content.
- Export or save through the
SuperDocinstance.
The editor lifecycle
A browser integration follows five steps:
- Install the public package and its styles.
- Give SuperDoc a DOCX file and a mount element.
- Wait for
onReadybefore changing modes or using document-dependent methods. - Let the person work in the editor or call the Document API against the open document.
- Export the result and call
destroy()when the editor is no longer needed.
The Editor quickstart implements this lifecycle with a real DOCX file and a direct edit.
Where the Document API fits
The Editor is a browser host for the document engine. The Document API is the shared contract for querying content, identifying targets, applying mutations, and inspecting receipts.
Use editor controls for direct human interaction. Use the Document API when application code needs to make an explicit document change. Both operate on the same open document state.
Start with the Document API mental model when application code needs to edit the document.