- Letting users touch up a document your agent just created with Doconda, without leaving your product.
- Reviewing contracts or reports with comments and tracked changes, saved in Office’s own format.
- Co-editing the same file in real time (see real-time co-editing).
- Asking an AI assistant (the ✨ button) for changes in plain words, in Word, Excel and PowerPoint (see AI assistant).
The plugin is bought separately from the API, per organization: a monthly, yearly or one-time plan, with a 7-day free
trial. On
localhost it works without a licence. See licence and domains.Install
1
Point npm at Doconda
With an active licence, go to Editor in the dashboard and copy your npm token. Save it as the environment
variable
DOCONDA_NPM_TOKEN (on your machine and in your CI), and add this .npmrc to your project:2
Install it
3
Import it
Import
@doconda/editor for React (a React 19 component) or @doconda/editor/element for any other framework
(a <doconda-editor> tag, see below).npm update @doconda/editor.
Open a file
src with its toolbar, ready to edit. It takes the height of its container, so give the
container a height.
srcis a link the browser can download: a.docx,.pptx,.xlsxor.pdffrom your own site, or from a server that allows it with CORS.- The format comes from the link’s extension. If the link has none, set
formatto"word","markdown","cell"(Excel),"slide"(PowerPoint) or"pdf". licenseKeyis your licence key (ek_eu_…orek_us_…), from Editor. Onlocalhostyou can leave it out.- Users can also drop a file onto the editor.
doconda.documents.download(id, "docx")) and serve it from a
route of yours, or pass the bytes in file. The links from GET /documents/{id}/outputs don’t work as src: your
site can’t read them from the browser, and they expire after 5 minutes.
Other formats
.mdopens in the Markdown editor,.txtin the Word one and.csvin the Excel one; they’re saved in their own format.- Older and other formats are converted when opened, with a Compatibility mode note, and saved as
.docx,.xlsxor.pptx(.xlsmfor an.xlswith macros). What doesn’t convert is listed in a bar above the document.
Password-protected
.doc, .xls and .ppt files ask for the password. An open PDF can be converted to Word, Excel or
PowerPoint from the File menu.
Markdown
A.md or .markdown file (or format="markdown") opens in the Markdown editor: the text with no pages, and only what
Markdown keeps (headings, bold, italic, strikethrough, inline code, lists, quotes, code blocks, horizontal rules, tables,
images, links and footnotes). The <> button shows the Markdown text to edit it by hand. save() returns Markdown; the
File menu also downloads Word, text or PDF. To open a .md with all of Word’s tools, set format="word".
Content-Security-Policy
The PDF editor carries everything it needs (pdf.js, its fonts and character tables) and downloads it only when a PDF opens. Converting a PDF to Excel or PowerPoint downloads PDFium as WebAssembly (about 2 MB compressed), only when you convert. If your site sets aContent-Security-Policy:
- Add
blob:toworker-srcfor PDFs. - Add
'wasm-unsafe-eval'toscript-srcfor PDF to Excel or PowerPoint.
Angular, Vue or plain JavaScript
Without React, use the<doconda-editor> tag. It works in Angular, Vue, Svelte and in a page with no framework:
- Attributes:
src,file-name,format,license-key,license-url,locale,preset,author,spell-lang,read-onlyandsimple. - Other props: set them as an object on the
optionsproperty, for exampleeditor.options = { file, theme, collab }. - Events:
doconda-ready,doconda-change,doconda-content-change(detailis{ origin }),doconda-save(detailis the file’s bytes),doconda-dirty-change(detailistrueorfalse) anddoconda-error(detailis the error code). - Methods:
editor.save(format?),editor.open(file, name)andeditor.print(), as on theref. They throw untildoconda-readyfires.editor.editorgives the rest (run,actions,engine). - Dependencies: the tag brings its own React. If your package manager doesn’t install peer dependencies (Yarn),
add
reactandreact-dom19 or later. - Angular: add
CUSTOM_ELEMENTS_SCHEMAto the component’sschemas. Vue: mark the tag as a custom element withcompilerOptions.isCustomElement: (tag) => tag === "doconda-editor".
Open from memory or with headers
If you already have the file (from an<input type="file"> or your API), pass it in file as a File, Blob,
ArrayBuffer or Uint8Array. Put its name in fileName: the format comes from it.
requestInit is passed as is to fetch:
onError receives editor_download_failed.
Save
Ask for the edited file through aref:
save() returns a Uint8Array in the file’s own format. With a format, it exports:
"png" is the current page. The ref also has open(file, name) (opens another file), replace(bytes) (replaces the document, also for everyone in the room), print(), contentVersion() (whether anything changed, without exporting), peers() (who is in the room), run(id) (presses
a button by its ID), actions(), engine() (the engine, for advanced use), discard() (throws away the recovery copy;
see below) and assistant (see AI assistant).
To react when the user saves (Ctrl/Cmd+S or File → Save), pass onSave, which receives the file’s bytes.
Without onSave, the editor saves to the file on the computer or downloads it.
onDirtyChange receives true when there are unsaved changes and false once they’re saved.
Behavior to be aware of:
- While editing, the editor keeps a recovery copy in this browser for 7 days. If the tab closes without saving, it
offers to recover it next time. Set
autosave={false}to turn it off. When the user chooses to throw their changes away, calldiscard()on therefbefore closing the editor, so the copy isn’t offered later. - Closing or reloading the page with unsaved changes asks for confirmation. Set
warnOnClose={false}to turn it off. - With
collaborreadOnly, no recovery copy is kept.
Save back to Doconda
To save the file over the same Doconda document, send it with the document’srevision to your server, and from there
to PUT /documents/{id}/file. Doconda then makes its new PDF and change report.
409 revision_conflict instead of overwriting their changes.
What it can do
The File menu downloads in other formats: Word to Markdown, text, EPUB, web page (
.zip), PDF or PNG; Excel to
CSV, PDF or PNG; PowerPoint and PDF to PDF or PNG (the current page, or every page in a .zip).
What the editor can’t edit is saved as is: styles, charts, notes or parts of the file it doesn’t touch aren’t lost.
Comments
All four editors have threaded comments: select something, leave a comment, others reply, and it’s marked resolved. Comments are saved inside the file in Office’s format, so they show the same in Word, Excel, PowerPoint or a PDF reader, and come back when the file reopens in the editor.
The
comment toolbar button adds one, signed with author. Comments the file already has always show: removing
comment from toolbar (see customize) only removes the add button.
Spelling and collaboration
- Spelling: the editor ships no dictionaries. Pass a checker in
spell: an object withcheck(words, lang)(onetrueorfalseper word) andsuggest(word, lang), plus optionaladd(word, lang)for the user’s dictionary andlanguages()for the language picker. Any of them may return a promise; for example, wrapnspellwith a Hunspell dictionary. Word and PowerPoint underline misspelled words and offer suggestions on right-click.spellLangis the language of text that doesn’t declare its own. - Real-time editing: with
collab, several people edit the same document at once, on Doconda’s server (collab={{ token, user }}, included in the licence) or on yours (collab={{ url, user }}). See real-time co-editing.
Props
Next steps
Customize the editor
Colours, language, toolbar, your own buttons and the AI assistant.
Co-edit in real time
Several people on the same file, on Doconda’s server or yours.
Set up the licence
Plans, domains, assistant edits and errors.