From: Alexander Ebert Date: Sat, 24 Sep 2016 10:23:58 +0000 (+0200) Subject: Prevent content insertion while editor is inactive X-Git-Tag: 3.0.0_Beta_1~7 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e14b1a9e9c93a17ec1796aa37235f369a545eee7;p=GitHub%2FWoltLab%2FWCF.git Prevent content insertion while editor is inactive --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAttachment.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAttachment.js index 8930abf2b5..e3833dd8c0 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAttachment.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAttachment.js @@ -11,6 +11,10 @@ $.Redactor.prototype.WoltLabAttachment = function() { }, _insert: function(data) { + if (this.WoltLabSource.isActive()) { + return; + } + var attachmentId = data.attachmentId; this.buffer.set(); diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSmiley.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSmiley.js index 5fb8c2544c..20ea320528 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSmiley.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSmiley.js @@ -11,6 +11,10 @@ $.Redactor.prototype.WoltLabSmiley = function() { }, _insert: function(data) { + if (this.WoltLabSource.isActive()) { + return; + } + this.buffer.set(); var id = 'wscSmiley_' + this.uuid + '_' + _index++; diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js index d7b3f8f8f0..1ef9e05462 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js @@ -40,6 +40,10 @@ $.Redactor.prototype.WoltLabSource = function() { data.valid = false; } }).bind(this)); + }, + + isActive: function () { + return (this.$editor[0].style.getPropertyValue('display') === 'none'); } }; }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js index 593ca46340..722c91baad 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js @@ -51,6 +51,10 @@ define(['Core', 'EventHandler', 'EventKey', 'Language', 'StringUtil', 'Dom/Util' * @protected */ _insertQuote: function (data) { + if (this._editor.WoltLabSource.isActive()) { + return; + } + EventHandler.fire('com.woltlab.wcf.redactor2', 'showEditor'); var editor = this._editor.core.editor()[0];