Editor配置
editorConfig部分允许更改与编辑器界面相关的参数:打开模式(查看器或编辑器)、界面语言、附加按钮等。
参数
名称 | 描述 | 类型 | 样例 |
---|---|---|---|
actionLink | 指定使用中的onMakeActionLink事件或onRequestSendNotify事件从文档编辑服务接收的数据数据,其中包含有关文档中要滚动到的操作的信息。 | object | |
callbackUrl* | 指定文档存储服务的绝对URL(应用服务实现)。 | string | "http://yourdomain.com/callback" |
createUrl | 定义文档的绝对URL,文档将在其中创建,并在创建后可用。如果没有指定,将没有创建按钮。可以使用onRequestCreateNew事件代替此字段。 | string | "http://yourdomain.com/create" |
lang | 定义编辑器界面语言(如果存在英语以外的其他语言)。使用两个字母(de、ru、it等)语言代码设置。默认值为“en”。 | string | "en" |
location | 定义默认测量单位。指定us或ca设置英寸。默认值为“”。 | string | "" |
mode | 定义编辑器打开模式。可以是“查看”以打开文档进行查看,也可以是“编辑”以在允许对文档数据应用更改的编辑模式下打开文档。默认值为“编辑”。 | string | "edit" |
recent | 定义打开的最近打开的文档的存在或不存在。。。菜单选项,其中可以设置以下文档参数: | array of object | |
region | 定义货币、日期和时间的默认显示格式(仅在电子表格编辑器中)。使用四个字母(en-US、fr-fr等)语言代码设置。对于默认值,采用lang参数,或者,如果没有与lang值对应的区域设置可用,则使用en-US。 | string | "en-US" |
templates | 在“从模板”部分中为“创建新模板”定义模板的存在与否。。。菜单选项,其中可以设置以下文档参数: | array of object | |
user | 定义当前查看或编辑文档的用户 | object |
样例
var docEditor = new KlinDocsAPI.DocEditor("placeholder", {
"editorConfig": {
"actionLink": ACTION_DATA,
"callbackUrl": "https://example.com/url-to-callback.ashx",
"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": {
"id": "78e1e841",
"name": "John Smith"
}
},
...
});