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:

    1. ...
    2. import { DocumentEditor } from "@onlyoffice/document-editor-react";
    3. ...
    4. ...
    5. var onDocumentReady = function (event) {
    6. console.log("Document is loaded");
    7. };
    8. ...
    9. <DocumentEditor
    10. documentServerUrl="http://documentserver/"
    11. config={{
    12. "document": {
    13. "fileType": "docx",
    14. "key": "Khirz6zTPdfd7",
    15. "title": "Example Document Title.docx",
    16. "url": "https://example.com/url-to-example-document.docx"
    17. },
    18. "documentType": "word",
    19. "editorConfig": {
    20. }
    21. }}
    22. />
    23. ...

    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:

    1. 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.

    2. Build Storybook with the following command:

      1. yarn build-storybook
    3. Start Storybook:

      1. yarn storybook
    1. Install the project dependencies:

      1. yarn install
    2. Test the component:

      1. yarn test
    3. Build the project:

    4. Create the package:

      1. 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.