Skip basic bbcodes when the selection is inside a code block
authorAlexander Ebert <ebert@woltlab.com>
Mon, 17 May 2021 10:10:49 +0000 (12:10 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 17 May 2021 10:10:49 +0000 (12:10 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabButton.js

index 15cba9f2f6283d7ac6190f4746ee144f99d88d72..5cc089ab652b5dcf5e1ef5c66c4f8087b575b373 100644 (file)
@@ -156,6 +156,11 @@ $.Redactor.prototype.WoltLabButton = function() {
                        WCF.System.Event.fireEvent('com.woltlab.wcf.redactor2', 'bbcode_' + bbcode + '_' + this.$element[0].id, data);
                        
                        if (data.cancel !== true) {
+                               const block = this.selection.block();
+                               if (block && block.nodeName === "PRE") {
+                                       return;
+                               }
+
                                this.buffer.set();
                                
                                var marker = this.marker.get();