Action link

The reference figure and the steps below explain the process of working with links in ONLYOFFICE Docs.

Action link
  1. The user sends a request to get a link to the document which contains a bookmark in the document editor.
  2. The document editor sends the request to the document manager where the software integrators create the link.
  3. The document manager sends the link back to the document editor where the link is displayed.

How this can be done in practice

  1. Create an html file to Open the document.

  2. Specify the event handler for the Get link button to be displayed in the bookmark editing menu in the configuration script for Document Editor initialization. When the onMakeActionLink event is called, the user request is sent to the software integrators which create the link in the document storage service.

    onMakeActionLink

    function onMakeActionLink(event) {
      const ACTION_DATA = event.data
      const link = GENERATE_LINK(ACTION_DATA)
      docEditor.setActionLink(link)
    }
    
    const docEditor = new DocsAPI.DocEditor("placeholder", {
      events: {
        onMakeActionLink,
      },
    })
    
  3. In order to give the user the link to the document which contains a bookmark, the software integrators send the link to the setActionLink method:

    docEditor.setActionLink(link)
    

Opening the bookmark

Open action link
  1. The user follows the link in the document manager.
  2. The document manager sends the initialization editorConfig to the document editor.
  3. The document editor scrolls the document to the bookmark.

When the user follows the link, the document editor sends the initialization editorConfig to the document editing service. The ACTION_DATA received from the onMakeActionLink event is specified in the data.actionLink parameter of the editorConfig:

const docEditor = new DocsAPI.DocEditor("placeholder", {
  editorConfig: {
    actionLink: ACTION_DATA,
  },
})

The link is generated in the same way when mentioning users in the comments.

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).