Properly resetting editor toolbar
authorAlexander Ebert <ebert@woltlab.com>
Wed, 22 Feb 2017 14:04:49 +0000 (15:04 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 22 Feb 2017 14:04:55 +0000 (15:04 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCode.js

index 1c0bcd7ddf140650ccf1c40e35e2a7a68c1d3ccb..e2e5b06383ce0a7ca6effa010014f2b25eb948cb 100644 (file)
@@ -13,6 +13,16 @@ $.Redactor.prototype.WoltLabCode = function() {
                                
                                WCF.System.Event.fireEvent('com.woltlab.wcf.redactor2', 'codeStart_' + this.$element[0].id);
                        }).bind(this);
+                       
+                       var mpSet = this.code.set;
+                       this.code.set = (function(html, options) {
+                               mpSet.call(this, html, options);
+                               
+                               if (this.utils.isEmpty()) {
+                                       // reset all buttons
+                                       this.observe.toolbar();
+                               }
+                       }).bind(this);
                }
        };
 };