ONLYOFFICE Docs React component
Install ONLYOFFICE Docs React component from npm in your project. Run:
or
Using ONLYOFFICE Docs React component
Find below the component usage example:
...
import { DocumentEditor } from "@onlyoffice/document-editor-react";
...
...
var onDocumentReady = function (event) {
console.log("Document is loaded");
};
...
<DocumentEditor
documentServerUrl="http://documentserver/"
config={{
"document": {
"fileType": "docx",
"key": "Khirz6zTPdfd7",
"title": "Example Document Title.docx",
"url": "https://example.com/url-to-example-document.docx"
},
"documentType": "word",
"editorConfig": {
}
}}
/>
...
where example.com is the name of the server where document manager and document storage service are installed and the documentserver is the name of the server with ONLYOFFICE Docs installed.
Properties
Installing Storybook
Install Storybook to develop UI components in isolation:
Change the address of the document server in the config/default.json file:
where documentserver is the name of the server with ONLYOFFICE Docs installed.
Build Storybook with the following command:
yarn build-storybook
Start Storybook:
yarn storybook
Install the project dependencies:
yarn install
Test the component:
yarn test
Build the project:
Create the package:
npm pack
Feedback and support
In case you have any issues, questions, or suggestions for the ONLYOFFICE Docs React component, please refer to the section.