I have copied our full code. Anything we are doing wrong in the below code. Still we are getting ‘undefined’ only in onCommandCallback . We need to get the currentPage value for doc and ppt and sheet index value for excel. Is there any other way we can get it without using ‘callCommand’ function.
We need to know immediately whenever a page is changed. So we are using ‘setInterval’ to get the currentPage each second. We have tried without ‘setInterval’ too and getting same undefined.
Thanks for helping us to resolve this issue. Now we are able to get the value in onCommandCallback for doc and excel files. But callCommand function is not executed for Presentation files(ppt) alone if we remove that line.
(function (window, undefined) {
window.Asc.plugin.event_onDocumentContentReady = function () {
window.Asc.scope.editorType = this.info.editorType;
setInterval(function () {
window.Asc.plugin.callCommand(
function () {
console.log("Line executed"); // Not executed for Presentation file
var currentPage = Asc.scope.editorType === 'cell'
? Api.GetActiveSheet().GetIndex()
: Api.GetCurrentVisiblePage();
console.log('current page audit page', currentPage); // Not executed for Presentation file
return currentPage;
});
window.Asc.plugin.onCommandCallback = function (currentPage) {
console.log('Received onCommandCallback audit result:', currentPage); // Undefined for Presentation file
};
},1000);
};
})(window, undefined);
We upgraded recently. We are using 8.2.1.38 version. We have added onDocumentContentReady to variations.events parameter in config file.
(function (window, undefined) {
window.Asc.plugin.event_onDocumentContentReady = function () {
window.Asc.plugin.info.interface = false;
window.Asc.scope.editorType = this.info.editorType;
setInterval(function () {
window.Asc.plugin.callCommand(
function () {
console.log('call command IN'); // Not executed for presentation alone. Executing in doc and excel
var currentPage = Asc.scope.editorType === 'cell'
? Api.GetActiveSheet().GetIndex()
: Api.GetCurrentVisiblePage();
return currentPage;
});
window.Asc.plugin.onCommandCallback = function (currentPage) {
console.log('Received onCommandCallback audit result:', currentPage); // Getting undefined for Presentation alone. Working fine in doc and excel
};
},1000);
};
})(window, undefined);
Above is our full code.
If we use window.Asc.plugin.info.interface = true , callCommand function is executed for Presentation, but onCommandCallback is not executed. If we use window.Asc.plugin.info.interface = false or remove the line, callCommand function is not executed for Presentation files.