Editor config

Description

The editorConfig section allows to change the parameters pertaining to the editor interface: opening mode (viewer or editor), interface language, additional buttons, etc.).

Parameters

NameDescriptionTypeExample
actionLinkSpecifies the data received from the document editing service using the onMakeActionLink event or the onRequestSendNotify event in data.actionLink parameter, which contains the information about the action in the document that will be scrolled to.object
callbackUrl*Specifies absolute URL to the document storage service (which must be implemented by the software integrators who use ONLYOFFICE Document Server on their own server).stringhttps://example.com/url-to-callback.ashx
coEditingDefines the co-editing mode (Fast or Strict) and the possibility to change it. The object has the following parameters:
  • mode - the co-editing mode (fast or strict). The default value is fast,
    type: string,
    example: “fast”;
  • change - defines if the co-editing mode can be changed in the editor interface or not. The default value is true,
    type: boolean,
    example: true.

This parameter is used to apply the co-editing and viewing modes.

object
Please note that in case mode setting is changed in the editor interface, it will be stored in the browser local storage and will overwrite any values sent as the editorConfig.coEditing.mode parameter.
Editor - 图1
createUrlDefines the absolute URL of the document where it will be created and available after creation. If not specified, there will be no creation button. Instead of this field, you can use the onRequestCreateNew event.stringhttps://example.com/url-to-create-document/
Editor - 图2
langDefines the editor interface language (if some other languages other than English are present). Is set using the two letter (de, ru, it, etc.) language codes. The default value is “en”.string“en”
Please note that to translate the editor interface into Portuguese (Portugal) or Chinese (Traditional, Taiwan) (these languages were added in version 7.2), you need to use the four letter language codes - pt-PT or zh-TW, respectively. The two letter pt language code sets Portuguese (Brazil) and the zh code specifies Chinese (People’s Republic of China).
locationDefines the default measurement units. Specify us or ca to set inches. The default value is “”.string“”
Please note that when us or ca values are set, the default measurement units are inches.
modeDefines the editor opening mode. Can be either view to open the document for viewing, or edit to open the document in the editing mode allowing to apply changes to the document data. The default value is “edit”.string“edit”
recentDefines the presence or absence of the documents in the Open Recent… menu option where the following document parameters can be set:
  • folder - the folder where the document is stored (can be empty in case the document is stored in the root folder),
    type: string,
    example: “Example Files”;
  • title - the document title that will be displayed in the Open Recent… menu option,
    type: string,
    example: “exampledocument1.docx”;
  • url - the absolute URL to the document where it is stored,
    type: string,
    example: “https://example.com/exampledocument1.docx“.
array of object
Editor - 图3
regionDefines the default display format for currency and date and time (in the Spreadsheet Editor only). Is set using the four letter (en-US, fr-FR, etc.) language codes. For the default value the lang parameter is taken, or, if no regional setting corresponding to the lang value is available, en-US is used.string“en-US”
templatesDefines the presence or absence of the templates in the Create New… menu option where the following document parameters can be set:
  • image - the absolute URL to the image for template,
    type: string,
    example: “https://example.com/exampletemplate1.png“;
  • title - the template title that will be displayed in the Create New… menu option,
    type: string,
    example: “exampletemplate1.docx”;
  • url - the absolute URL to the document where it will be created and available after creation,
    type: string,
    example: “https://example.com/url-to-create-template1“.
array of object
Editor - 图4
userDefines the user currently viewing or editing the document:
  • firstname - the first name of the user. Deprecated since version 4.2, please use name instead,
    type: string,
    example: “John”;
  • group - the group the user belongs to,
    type: string,
    example: “Group1”;
  • id - the identification of the user. The length is limited to 128 symbols.
    This information is stored and used to distinguish co-authors, indicate the author of the last changes when saving and highlighting history (in the list of changes), and count users with access for a license based on the number of users.
    We recommend using some unique anonymized hash. Do not use sensitive data, like name or email for this field.
    type: string,
    example: “78e1e841”;
  • lastname - the last name of the user. Deprecated since version 4.2, please use name instead,
    type: string,
    example: “Smith”;
  • name - the full name of the user. The length is limited to 128 symbols. Used since version 4.2,
    type: string,
    example: “John Smith”.
object

* - required field

Example

  1. var docEditor = new DocsAPI.DocEditor("placeholder", {
  2. "editorConfig": {
  3. "actionLink": ACTION_DATA,
  4. "callbackUrl": "https://example.com/url-to-callback.ashx",
  5. "coEditing": {
  6. "mode": "fast",
  7. "change": true
  8. },
  9. "createUrl": "https://example.com/url-to-create-document/",
  10. "lang": "en",
  11. "location": "",
  12. "mode": "edit",
  13. "recent": [
  14. {
  15. "folder": "Example Files",
  16. "title": "exampledocument1.docx",
  17. "url": "https://example.com/exampledocument1.docx"
  18. },
  19. {
  20. "folder": "Example Files",
  21. "title": "exampledocument2.docx",
  22. "url": "https://example.com/exampledocument2.docx"
  23. },
  24. ...
  25. ],
  26. "region": "en-US",
  27. "templates": [
  28. {
  29. "image": "https://example.com/exampletemplate1.png",
  30. "title": "exampletemplate1.docx",
  31. "url": "https://example.com/url-to-create-template1"
  32. },
  33. {
  34. "image": "https://example.com/exampletemplate2.png",
  35. "title": "exampletemplate2.docx",
  36. "url": "https://example.com/url-to-create-template2"
  37. },
  38. ...
  39. ],
  40. "user": {
  41. "group": "Group1",
  42. "id": "78e1e841",
  43. "name": "John Smith"
  44. }
  45. },
  46. ...
  47. });

Where the example.com is the name of the server where document manager and document storage service are installed. See the How it works section to find out more on Document Server service client-server interactions.