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
Name | Description | Type | Example |
actionLink | Specifies 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). | string | “https://example.com/url-to-callback.ashx“ |
coEditing | Defines the co-editing mode (Fast or Strict) and the possibility to change it. The object has the following parameters:
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. | |||
createUrl | Defines 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. | string | “https://example.com/url-to-create-document/“ |
lang | Defines 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). | |||
location | Defines 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. | |||
mode | Defines 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” |
recent | Defines the presence or absence of the documents in the Open Recent… menu option where the following document parameters can be set:
| array of object | |
region | Defines 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” |
templates | Defines the presence or absence of the templates in the Create New… menu option where the following document parameters can be set:
| array of object | |
user | Defines the user currently viewing or editing the document:
| object |
* - required field
Example
var docEditor = new DocsAPI.DocEditor("placeholder", {
"editorConfig": {
"actionLink": ACTION_DATA,
"callbackUrl": "https://example.com/url-to-callback.ashx",
"coEditing": {
"mode": "fast",
"change": true
},
"createUrl": "https://example.com/url-to-create-document/",
"lang": "en",
"location": "",
"mode": "edit",
"recent": [
{
"folder": "Example Files",
"title": "exampledocument1.docx",
"url": "https://example.com/exampledocument1.docx"
},
{
"folder": "Example Files",
"title": "exampledocument2.docx",
"url": "https://example.com/exampledocument2.docx"
},
...
],
"region": "en-US",
"templates": [
{
"image": "https://example.com/exampletemplate1.png",
"title": "exampletemplate1.docx",
"url": "https://example.com/url-to-create-template1"
},
{
"image": "https://example.com/exampletemplate2.png",
"title": "exampletemplate2.docx",
"url": "https://example.com/url-to-create-template2"
},
...
],
"user": {
"group": "Group1",
"id": "78e1e841",
"name": "John Smith"
}
},
...
});
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.
当前内容版权归 Onlyoffice 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 Onlyoffice .