我正在使用 Onlyoffice 文档服务器版本 5.0.3 它工作正常。在文档编辑器中查找和替换文本
Onlyoffice配置文件:editor.jsp
config = {
"document": {
"fileType": "docx",
"key": "Khirz6zTPdfd7",
"title": "sample.docx",
"url": "http://192.168.0.1:8080/onlyofficeexample/files/192.168.0.1/sample.docx"
},
"documentType": "text",
"editorConfig": {
"callbackUrl": "http://192.168.0.1:8080/onlyofficeexample/IndexServlet?type=track&fileName=sample.docx&userAddress=192.168.0.1"
}
........
.......
};
var docEditor = new DocsAPI.DocEditor("placeholder", config);
setTimeout(function(){
var text_replace = {
textsearch: "~($#effective_date#$)~",
textreplace: "23/05/1991",
matchcase: false,
matchword: false,
highlight: true
};
docEditor.onReplaceText(text_replace);
}, 30000);
我正在尝试用调用 API 替换文本,并在 Onlyoffice API 调用中创建了进一步的触发函数。
//trigger function
onReplaceText: function (data) {
$me.trigger("onreplacetext", data)
},
在这里,我想根据传递给此函数的数据查找和替换文本
onReplaceText:function(data){
}
Common.Gateway.on('onreplacetext',_.bind(me.onReplaceText, me));
谢谢你