Prevent content insertion while editor is inactive
authorAlexander Ebert <ebert@woltlab.com>
Sat, 24 Sep 2016 10:23:58 +0000 (12:23 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 24 Sep 2016 10:23:58 +0000 (12:23 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabAttachment.js
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSmiley.js
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabSource.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js

index 8930abf2b5bd3ab04cb72f97a63cd91c47d1efe9..e3833dd8c023d7d7f208fdafd0afcb03ac32a228 100644 (file)
@@ -11,6 +11,10 @@ $.Redactor.prototype.WoltLabAttachment = function() {
                },
                
                _insert: function(data) {
+                       if (this.WoltLabSource.isActive()) {
+                               return;
+                       }
+                       
                        var attachmentId = data.attachmentId;
                        
                        this.buffer.set();
index 5fb8c2544ca656ff1b7169dd1af04ab0f01ee75e..20ea3205288fc8c53ccc151af05e5f5824879d93 100644 (file)
@@ -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++;
index d7b3f8f8f01d7fb579b7d3d12e34d28a1ab01d6f..1ef9e054628647fd06713e39c45dd99e24aea9b3 100644 (file)
@@ -40,6 +40,10 @@ $.Redactor.prototype.WoltLabSource = function() {
                                        data.valid = false;
                                }
                        }).bind(this));
+               },
+               
+               isActive: function () {
+                       return (this.$editor[0].style.getPropertyValue('display') === 'none');
                }
        };
 };
index 593ca463402c40e61dc6118512ea05c3bdca1eb8..722c91baadc00660a3f1c46966e9ded8e603f005 100644 (file)
@@ -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];