Hello,
I’m using community edition (maybe can switch to dev edition) and I’m trying to implement document comparison programmatically. I’ve been searching de api docs and found this How it works - Document comparing and it states that I need to override the event so the button appears and when user click it, it will compare with the document I’ve provided. If I dig more, I find that info is deprecated, and in event page it shows that I should use this onRequestSelectDocument. This is the code:
<script type="text/javascript" language="javascript">
var docEditor;
var сonnectEditor = function () {
docEditor = new DocsAPI.DocEditor("iframeEditor", {
events: {
onRequestSelectDocument,
},
document: {
fileType: "docx",
key: "Khirz6zTPdfd7",
title: "Example Document Title.docx",
url: "https://file-examples.com/wp-content/storage/2017/02/file-sample_100kB.docx",
permissions: {
edit: true,
review: true
}
},
documentType: "word",
token: "@ViewBag.Secret",
editorConfig: {
lang: "en",
region: "es-ES",
plugins: false
}
});
};
function onRequestSelectDocument() {
console.log(event)
docEditor.setRequestedDocument({
c: "compare",
fileType: "docx",
url: "https://file-examples.com/wp-content/storage/2017/02/file-sample_100kB.docx",
token: "@ViewBag.Secret2",
})
}
if (window.addEventListener) {
window.addEventListener("load", сonnectEditor);
} else if (window.attachEvent) {
window.attachEvent("load", сonnectEditor);
}
This have 2 problems. When I click the compare button it doesn’t work, seems that it can’t download the target comparison document. Anyway, what I’m trying to do is to remove the need of user interaction to start the comparison. I would like to achieve just opening a file then triggering comparison with target document without user interaction.
Thanks