var onDocumentReady = function () {
console.log("文档准备好了");
window.connector = docEditor.createConnector();
Asc.scope.text = "Hello world!";
connector.callCommand(function() {
console.log("connector文档准备好了");
var oDocument = Api.GetDocument();
var oParagraph = Api.CreateParagraph();
oParagraph.AddText(Asc.scope.text);
oDocument.InsertContent([oParagraph]);
}, function() { console.log("callback command"); });
};
var insertText = '输入一段字符串';
function callCommand() {
connector.callCommand(function() {
console.log('点击了文档');
var oDocument = Api.GetDocument();
var oRange = oDocument.GetRangeBySelect();
if(oRange == null){
alert('请先选中文字');
}
console.log(oRange.GetText());
oRange.AddText("插入文字");
oRange.SetHighlight('yellow');
}, function() { console.log("callback command"); });
}
var config = {
"documentType": "word",
"historyList": {
"history": [],
"currentVersion": "1"
},
"document": {
"title": "ceshi.docx",
"url": "http://116.62.151.211:8002/only/download?path=111",
"permissions": {
"print": false,
"download": true
},
"key":"12434344545",
"fileType": "docx"
},
"editorConfig": {
"customization": {
"autosave": false,
"compactToolbar": true,
"forcesave": true,
"toolbarNoTabs": true,
"help": false,
"compactHeader": true,
"hideRightMenu": true,
},
"mode": "edit",
"callbackUrl": "http://116.62.151.211:8002/only/docx/save?userId=111",
"lang": "zh-CN",
"user": {
"name": "superlu",
"id": "103"
}
}
};
var docEditor;
initDocEditor();
console.log("Document is loaded");
var onAppReady = function () {
console.log("onAppReady文档准备好了");
};
/**
* 初始化编辑器
*/
function initDocEditor() {
// 初始化配置
config['events'] = {
onDocumentReady: onDocumentReady,
onAppReady:onAppReady
};
docEditor = new DocsAPI.DocEditor("placeholder", config);
}
我是社区版 为什么有这个错误提示呢