mirror of
https://github.com/ONLYOFFICE/onlyoffice.github.io.git
synced 2026-02-10 18:05:06 +08:00
Rework adding content control event to the new scheme
This commit is contained in:
@ -246,29 +246,6 @@
|
||||
{
|
||||
this._onCustomMenuClick("toolbarMenuEvents", id);
|
||||
};
|
||||
window.Asc.plugin.event_onContentControlButtonClick = function(data)
|
||||
{
|
||||
const eventName = "ContentControlButtonEvents";
|
||||
|
||||
let buttonId = (data && data["buttonId"] ? data["buttonId"] : null);
|
||||
let ccId = (data && data["contentControlId"] ? data["contentControlId"] : null);
|
||||
|
||||
if (!buttonId || !ccId)
|
||||
return;
|
||||
|
||||
if (this[eventName] && this[eventName][buttonId])
|
||||
this[eventName][buttonId].call(this, ccId);
|
||||
};
|
||||
window.Asc.plugin._attachContentControlButtonClickEvent = function(buttonId, action)
|
||||
{
|
||||
const eventName = "ContentControlButtonEvents";
|
||||
|
||||
if (!this[eventName])
|
||||
this[eventName] = {};
|
||||
|
||||
this[eventName][buttonId] = action;
|
||||
};
|
||||
|
||||
window.Asc.plugin.attachEvent = function(id, action)
|
||||
{
|
||||
var pluginObj = window.Asc.plugin;
|
||||
@ -408,7 +385,7 @@
|
||||
|
||||
Asc.Buttons.registerContentControl = function()
|
||||
{
|
||||
window.Asc.plugin.attachEvent("onShowContentControlTrack", function(contentControls) {
|
||||
window.Asc.plugin.attachEditorEvent("onShowContentControlTrack", function(contentControls) {
|
||||
|
||||
let buttons = {
|
||||
guid: window.Asc.plugin.guid,
|
||||
@ -430,6 +407,30 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
window.Asc.plugin._attachContentControlButtonClickEvent = function(buttonId, action)
|
||||
{
|
||||
const eventName = "ContentControlButtonEvents";
|
||||
|
||||
if (!this[eventName])
|
||||
this[eventName] = {};
|
||||
|
||||
this[eventName][buttonId] = action;
|
||||
};
|
||||
|
||||
let _plugin = window.Asc.plugin;
|
||||
window.Asc.plugin.attachEditorEvent("onContentControlButtonClick", function(data) {
|
||||
const eventName = "ContentControlButtonEvents";
|
||||
|
||||
let buttonId = (data && data["buttonId"] ? data["buttonId"] : null);
|
||||
let ccId = (data && data["contentControlId"] ? data["contentControlId"] : null);
|
||||
|
||||
if (!buttonId || !ccId)
|
||||
return;
|
||||
|
||||
if (_plugin[eventName] && _plugin[eventName][buttonId])
|
||||
_plugin[eventName][buttonId].call(_plugin, ccId);
|
||||
});
|
||||
};
|
||||
|
||||
var ToolbarButtonType = {
|
||||
|
||||
Reference in New Issue
Block a user