From 3919fbc8caecb85a0b450afdec872e3830e5c011 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 25 Aug 2016 19:19:26 +0200 Subject: [PATCH] Fixed event handling --- com.woltlab.wcf/templates/wysiwyg.tpl | 2 +- wcfsetup/install/files/acp/templates/wysiwyg.tpl | 2 +- .../files/js/3rdParty/redactor2/plugins/WoltLabEvent.js | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/com.woltlab.wcf/templates/wysiwyg.tpl b/com.woltlab.wcf/templates/wysiwyg.tpl index c26711b263..f98501aaf2 100644 --- a/com.woltlab.wcf/templates/wysiwyg.tpl +++ b/com.woltlab.wcf/templates/wysiwyg.tpl @@ -158,6 +158,7 @@ // WoltLab specials 'WoltLabBlock', + 'WoltLabEvent', 'WoltLabKeydown', // WoltLab core @@ -169,7 +170,6 @@ 'WoltLabCode', 'WoltLabColor', 'WoltLabDropdown', - 'WoltLabEvent', 'WoltLabImage', 'WoltLabInlineCode', 'WoltLabInsert', diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index c26711b263..f98501aaf2 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -158,6 +158,7 @@ // WoltLab specials 'WoltLabBlock', + 'WoltLabEvent', 'WoltLabKeydown', // WoltLab core @@ -169,7 +170,6 @@ 'WoltLabCode', 'WoltLabColor', 'WoltLabDropdown', - 'WoltLabEvent', 'WoltLabImage', 'WoltLabInlineCode', 'WoltLabInsert', diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js index 8f52ad7e9d..c9c11e2969 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabEvent.js @@ -45,6 +45,8 @@ $.Redactor.prototype.WoltLabEvent = function() { register: function(callbackName, callback) { require(['EventHandler'], (function(EventHandler) { + var uuid = this.uuid; + if (this._callbacks.indexOf(callbackName) === -1) { this.opts.callbacks[callbackName] = (function (event) { var data = { @@ -53,7 +55,7 @@ $.Redactor.prototype.WoltLabEvent = function() { redactor: this }; - EventHandler.fire('com.woltlab.wcf.redactor2', callbackName + '_' + this.WoltLabEvent._elementId, data); + EventHandler.fire('com.woltlab.wcf.redactor2', callbackName + '_' + uuid + '_' + this.WoltLabEvent._elementId, data); return (data.cancel === false); }).bind(this); @@ -62,7 +64,7 @@ $.Redactor.prototype.WoltLabEvent = function() { } require(['EventHandler'], (function(EventHandler) { - EventHandler.add('com.woltlab.wcf.redactor2', callbackName + '_' + this.WoltLabEvent._elementId, callback); + EventHandler.add('com.woltlab.wcf.redactor2', callbackName + '_' + uuid + '_' + this.WoltLabEvent._elementId, callback); }).bind(this)); }).bind(this)); } -- 2.20.1