Place the code and inline-code button next to each other
authorAlexander Ebert <ebert@woltlab.com>
Tue, 28 Jul 2020 16:35:22 +0000 (18:35 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 28 Jul 2020 16:35:22 +0000 (18:35 +0200)
Closes #3241

wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js

index 3ab169d94be4fa927b28a9fb67bd5d2ff2c4f2b8..15cba9f2f6283d7ac6190f4746ee144f99d88d72 100644 (file)
@@ -83,6 +83,13 @@ $.Redactor.prototype.WoltLabButton = function() {
                                }
                        }
                        
+                       // If both the "Code" and "Inline Code" button exist, then place them next to each other.
+                       var inlineCodeButtonIndex = this.opts.buttons.indexOf('tt');
+                       if (this.opts.buttons.indexOf('code') !== -1 && inlineCodeButtonIndex !== -1) {
+                               this.opts.buttons.splice(inlineCodeButtonIndex, 1);
+                               this.opts.buttons.splice(this.opts.buttons.indexOf('code') + 1, 0, 'tt');
+                       }
+                       
                        // enforce button order as provided with `opts.buttons`
                        var listItem, toolbarButtons = {}, toolbarOrder = [];
                        while (toolbar.childElementCount) {