I am trying to reproduce an example from the doc: Plugin examples - ONLYOFFICE Api Documentation
But when i select item 1 or 2 nothing happens. Do i miss something or there is a bug?
Here is my plugin for reproduction - Dropbox
i follow 插件示例 - ONLYOFFICE Api 文档 — Plugin examples - ONLYOFFICE Api Documentation
copy all code and the contextmenu is showing.
but when i clicked the onClickItem2, the function not called. this is my code:
(function(window, undefined){
console.log(window);
window.Asc.plugin.init = function()
{
};
window.Asc.plugin.button = function(id)
{
this.executeCommand("close", "");
};
window.Asc.plugin.event_onContextMenuShow = function(options) {
switch (options.type)
{
case "Target":
{
this.executeMethod("AddContextMenuItem", [{
guid : this.guid,
items : [
{
id : "onClickItem1",
text : { en : "Item 1", de : "Menü 1" },
items : [
{
id : "onClickItem1Sub1",
text : { en : "Subitem 1", de : "Untermenü 1" },
disabled : true
},
{
id : "onClickItem1Sub2",
text : { en : "Subitem 2", de : "Untermenü 2" },
separator: true
}
]
},
{
id : "onClickItem2",
text : { en : "Item 2", de : "Menü 2" }
}
]
}]);
break;
}
case "Selection":
{
this.executeMethod("AddContextMenuItem", [{
guid : this.guid,
items : [
{
id : "onClickItem3",
text : { en : "Item 3", de : "Menü 3" }
}
]
}]);
break;
}
case 'Image':
case 'Shape':
{
this.executeMethod("AddContextMenuItem", [{
guid : this.guid,
items : [
{
id : "onClickItem4",
text : { en : "Item 4", de : "Menü 4" }
}
]
}]);
break;
}
default:
break;
}
};
window.Asc.plugin.attachContextMenuClickEvent("onClickItem1Sub1", function(){
window.Asc.plugin.executeMethod("InputText", ["clicked: onClickItem1Sub1"]);
});
window.Asc.plugin.attachContextMenuClickEvent("onClickItem1Sub2", function(){
window.Asc.plugin.executeMethod("InputText", ["clicked: onClickItem1Sub2"]);
});
window.Asc.plugin.attachContextMenuClickEvent("onClickItem2", function(){
//not woring
console.log('onClickItem2')
window.Asc.plugin.executeMethod("InputText", ["clicked: onClickItem2"]);
});
window.Asc.plugin.attachContextMenuClickEvent("onClickItem3", function(){
window.Asc.plugin.executeMethod("InputText", ["clicked: onClickItem3"]);
});
window.Asc.plugin.attachContextMenuClickEvent("onClickItem4", function(){
console.log("clicked: onClickItem4");
});
window.Asc.plugin.event_onTargetPositionChanged = function()
{
console.log("event: onTargetPositionChanged");
};
})(window, undefined);
Thank you for the reports, we are analyzing the issue.
(post deleted by author)