Fixed quote button being enabled in source mode
authorAlexander Ebert <ebert@woltlab.com>
Wed, 27 Aug 2014 20:02:43 +0000 (22:02 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 27 Aug 2014 20:02:43 +0000 (22:02 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js

index d3b943962bb11d098a101d29aae666b41d612c95..45f9c47b3925070fe808dd434c91558b2ea5b0a7 100644 (file)
@@ -151,19 +151,23 @@ RedactorPlugins.wmonkeypatch = {
                
                var self = this;
                var $editor = this.$editor.get()[0];
-               var $toggleButtons = function(searchFor, buttonSelector, inverse, className) {
+               var $toggleButtons = function(searchFor, buttonSelector, inverse, className, skipInSourceMode) {
                        var $buttons = self.$toolbar.find(buttonSelector);
                        if (parent && parent.closest(searchFor, $editor).length != 0) {
                                $buttons[(inverse ? 'removeClass' : 'addClass')](className);
                        }
                        else {
+                               if (skipInSourceMode && !self.opts.visual) {
+                                       return;
+                               }
+                               
                                $buttons[(inverse ? 'addClass' : 'removeClass')](className);
                        }
                };
                
                $toggleButtons('ul', 'a.re-indent, a.re-outdent', true, 'redactor_button_disabled');
                $toggleButtons('inline.inlineCode', 'a.re-__wcf_tt', false, 'redactor_act');
-               $toggleButtons('blockquote.quoteBox', 'a.re-__wcf_quote', false, 'redactor_button_disabled');
+               $toggleButtons('blockquote.quoteBox', 'a.re-__wcf_quote', false, 'redactor_button_disabled', true);
                $toggleButtons('sub', 'a.re-subscript', false, 'redactor_act');
                $toggleButtons('sup', 'a.re-superscript', false, 'redactor_act');
        },