mirror of
https://github.com/ONLYOFFICE/onlyoffice.github.io.git
synced 2026-04-07 14:04:30 +08:00
Add methods for toolbar buttons
This commit is contained in:
@ -162,17 +162,16 @@
|
|||||||
else
|
else
|
||||||
window.attachEvent("onmessage", onMessage);
|
window.attachEvent("onmessage", onMessage);
|
||||||
|
|
||||||
window.Asc.plugin.attachContextMenuClickEvent = function(id, action)
|
window.Asc.plugin._attachCustomMenuClickEvent = function(type, id, action)
|
||||||
{
|
{
|
||||||
var pluginObj = window.Asc.plugin;
|
if (!this[type])
|
||||||
if (!pluginObj.contextMenuEvents)
|
this[type] = {};
|
||||||
pluginObj.contextMenuEvents = {};
|
|
||||||
|
|
||||||
pluginObj.contextMenuEvents[id] = action;
|
this[type][id] = action;
|
||||||
};
|
};
|
||||||
window.Asc.plugin.event_onContextMenuClick = function(id)
|
window.Asc.plugin._onCustomMenuClick = function(type, id)
|
||||||
{
|
{
|
||||||
var pluginObj = window.Asc.plugin;
|
// parse data from id: text from item.
|
||||||
var itemId = id;
|
var itemId = id;
|
||||||
var itemData = undefined;
|
var itemData = undefined;
|
||||||
var itemPos = itemId.indexOf("_oo_sep_");
|
var itemPos = itemId.indexOf("_oo_sep_");
|
||||||
@ -182,8 +181,26 @@
|
|||||||
itemId = itemId.substring(0, itemPos);
|
itemId = itemId.substring(0, itemPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pluginObj.contextMenuEvents && pluginObj.contextMenuEvents[itemId])
|
if (this[type] && this[type][itemId])
|
||||||
pluginObj.contextMenuEvents[itemId].call(pluginObj, itemData);
|
this[type][itemId].call(this, itemData);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.Asc.plugin.attachContextMenuClickEvent = function(id, action)
|
||||||
|
{
|
||||||
|
this._attachCustomMenuClickEvent("contextMenuEvents", id, action);
|
||||||
|
};
|
||||||
|
window.Asc.plugin.event_onContextMenuClick = function(id)
|
||||||
|
{
|
||||||
|
this._onCustomMenuClick("contextMenuEvents", id);
|
||||||
|
};
|
||||||
|
|
||||||
|
window.Asc.plugin.attachToolbarMenuClickEvent = function(id, action)
|
||||||
|
{
|
||||||
|
this._attachCustomMenuClickEvent("toolbarMenuEvents", id, action);
|
||||||
|
};
|
||||||
|
window.Asc.plugin.event_onToolbarMenuClick = function(id)
|
||||||
|
{
|
||||||
|
this._onCustomMenuClick("toolbarMenuEvents", id);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.Asc.plugin.attachEvent = function(id, action)
|
window.Asc.plugin.attachEvent = function(id, action)
|
||||||
|
|||||||
Reference in New Issue
Block a user