Remove empty list when joining two successive lists
authorAlexander Ebert <ebert@woltlab.com>
Mon, 4 Sep 2017 11:56:34 +0000 (13:56 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 4 Sep 2017 11:56:34 +0000 (13:56 +0200)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js

index 3c144576ef189b5ac91b067c4391d5cd86b8e52c..66db75d53a6e4c4fdc74b8983b0ebf2c938d75a7 100644 (file)
@@ -88,6 +88,20 @@ $.Redactor.prototype.WoltLabList = function() {
                                        this.selection.restore();
                                }
                        }).bind(this);
+                       
+                       var mpCombineAfterAndBefore = this.list.combineAfterAndBefore;
+                       this.list.combineAfterAndBefore = (function(block) {
+                               var returnValue = mpCombineAfterAndBefore.call(this, block);
+                               
+                               if (returnValue) {
+                                       var list = block.nextElementSibling;
+                                       if ((list.nodeName === 'OL' || list.nodeName === 'UL') && list.childElementCount === 0) {
+                                               elRemove(list);
+                                       }
+                               }
+                               
+                               return returnValue;
+                       }).bind(this);
                }
        };
 };