mirror of
https://github.com/ONLYOFFICE/onlyoffice.github.io.git
synced 2026-04-07 14:04:30 +08:00
Rework adding content control event to the new scheme
This commit is contained in:
@ -246,29 +246,6 @@
|
|||||||
{
|
{
|
||||||
this._onCustomMenuClick("toolbarMenuEvents", id);
|
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)
|
window.Asc.plugin.attachEvent = function(id, action)
|
||||||
{
|
{
|
||||||
var pluginObj = window.Asc.plugin;
|
var pluginObj = window.Asc.plugin;
|
||||||
@ -408,7 +385,7 @@
|
|||||||
|
|
||||||
Asc.Buttons.registerContentControl = function()
|
Asc.Buttons.registerContentControl = function()
|
||||||
{
|
{
|
||||||
window.Asc.plugin.attachEvent("onShowContentControlTrack", function(contentControls) {
|
window.Asc.plugin.attachEditorEvent("onShowContentControlTrack", function(contentControls) {
|
||||||
|
|
||||||
let buttons = {
|
let buttons = {
|
||||||
guid: window.Asc.plugin.guid,
|
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 = {
|
var ToolbarButtonType = {
|
||||||
|
|||||||
Reference in New Issue
Block a user