Experimental support for lists inside quotes/spoilers
authorAlexander Ebert <ebert@woltlab.com>
Sat, 2 Feb 2019 00:07:06 +0000 (01:07 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 2 Feb 2019 00:07:06 +0000 (01:07 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js

index 2847d5a733db0c3805b76347136147d669f6c112..bc4982be39a88d00084eca411c2b292672dfaef0 100644 (file)
@@ -2,6 +2,8 @@ $.Redactor.prototype.WoltLabList = function() {
        "use strict";
        
        return {
+               parentsQualifiedForLists: ['woltlab-quote', 'woltlab-spoiler'],
+               
                init: function () {
                        this.list.combineAfterAndBefore = (function(block) {
                                var $prev = $(block).prev();
@@ -99,6 +101,20 @@ $.Redactor.prototype.WoltLabList = function() {
                                
                                return nodes;
                        }).bind(this);
+                       
+                       this.list._getBlocks = (function() {
+                               return this.selection.blocks().filter((function(block) {
+                                       var parent = block.parentNode;
+                                       if (parent.classList.contains('redactor-in')) {
+                                               return true;
+                                       }
+                                       else if (this.WoltLabList.parentsQualifiedForLists.indexOf(parent.nodeName.toLowerCase()) !== -1) {
+                                               return true;
+                                       }
+                                       
+                                       return false;
+                               }).bind(this));
+                       }).bind(this);
                }
        };
 };