From e14b1a9e9c93a17ec1796aa37235f369a545eee7 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 24 Sep 2016 12:23:58 +0200 Subject: [PATCH] Prevent content insertion while editor is inactive --- .../files/js/3rdParty/redactor2/plugins/WoltLabAttachment.js | 4 ++++ .../files/js/3rdParty/redactor2/plugins/WoltLabSmiley.js | 4 ++++ .../files/js/3rdParty/redactor2/plugins/WoltLabSource.js | 4 ++++ .../install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js | 4 ++++ 4 files changed, 16 insertions(+) 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]; -- 2.20.1