@doconda/editor) with readOnly: <DocondaEditor src={url} readOnly />. The .docx
shows inside your site with its styles, tables, images and comments, with no toolbars and nothing editable. The same
component shows .pptx and .xlsx, and the file opens in the user’s browser: it isn’t uploaded anywhere to be shown.
Steps
- Get the plugin in the dashboard (Editor), with a 7-day free trial. See Licence and domains.
- Install it with the command the dashboard gives you. It needs React 19 or later:
- Render the viewer in a container with a height, with
readOnly:
src is a .docx the browser can download: from your site, or from a server that allows it with CORS. If the link
needs authentication, requestInit is passed as is to fetch:
What read-only mode does
- Nothing can change the document: not typing, pasting, dragging or keyboard shortcuts.
- The toolbar, the second toolbar and the AI assistant disappear, and no recovery copy is kept.
- Users can still read, select and copy text, move between pages, slides and sheets, and present.
Switch from viewer to editor without reloading
readOnly can change at any time, without reopening the file:
FAQ
Are comments and formatting shown?
Are comments and formatting shown?
Yes. Read-only removes editing, not content: styles, tables, images and comments all show.
Can I open a file I already have in memory?
Can I open a file I already have in memory?
Yes. Pass it in
file instead of src, as a File, Blob, ArrayBuffer or Uint8Array, with its name in
fileName.Can I show a spinner while it opens?
Can I show a spinner while it opens?
Yes. Put your spinner over the editor and remove it in
onReady, which fires when the file has opened.Where does it work?
Where does it work?
On your licence’s domains (up to 5, https only), and always on
localhost for development. See
Licence and domains.