Deny block elements inside lists
authorAlexander Ebert <ebert@woltlab.com>
Thu, 5 Jan 2017 12:27:04 +0000 (13:27 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 5 Jan 2017 12:54:57 +0000 (13:54 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabBlock.js

index 3a240230bba274853d3931cdf8688acf55819704..9a4e1feac487c9e9cc3f5535dbe445deaac523ba 100644 (file)
@@ -31,6 +31,12 @@ $.Redactor.prototype.WoltLabBlock = function() {
                        
                        var mpFormatCollapsed = this.block.formatCollapsed;
                        this.block.formatCollapsed = (function(tag, attr, value, type) {
+                               var block = this.selection.block();
+                               if (block && block.nodeName === 'LI') {
+                                       // lists cannot contain other block elements
+                                       return;
+                               }
+                               
                                if (this.detect.isFirefox()) {
                                        var editor = this.core.editor()[0];
                                        if (document.activeElement !== editor) {