Merge remote-tracking branch 'refs/remotes/origin/3.0'
authorAlexander Ebert <ebert@woltlab.com>
Fri, 29 Dec 2017 12:44:35 +0000 (13:44 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 29 Dec 2017 12:44:35 +0000 (13:44 +0100)
# Conflicts:
# wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js

wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js

index 59163536f6d5b3c470ccba17c8739c80956ae13d..2847d5a733db0c3805b76347136147d669f6c112 100644 (file)
@@ -68,6 +68,37 @@ $.Redactor.prototype.WoltLabList = function() {
                                
                                return false;
                        }).bind(this);
+                       
+                       this.list.toggle = (function(type) {
+                               if (this.utils.inBlocks(['table', 'td', 'th', 'tr'])) {
+                                       return;
+                               }
+                               
+                               type = (type === 'orderedlist') ? 'ol' : type;
+                               type = (type === 'unorderedlist') ? 'ul' : type;
+                               
+                               type = type.toLowerCase();
+                               
+                               this.buffer.set();
+                               this.selection.save();
+                               
+                               var nodes = this.list._getBlocks();
+                               var block = this.selection.block();
+                               
+                               // WoltLab modification: the selector matches lists outside the editor
+                               //var $list = $(block).parents('ul, ol').last();
+                               var $list = $(block).parent().closest('ol, ul', this.core.editor()[0]);
+                               // WoltLab modification END
+                               if (nodes.length === 0 && $list.length !== 0) {
+                                       nodes = [$list.get(0)];
+                               }
+                               
+                               nodes = (this.list._isUnformat(type, nodes)) ? this.list._unformat(type, nodes) : this.list._format(type, nodes);
+                               
+                               this.selection.restore();
+                               
+                               return nodes;
+                       }).bind(this);
                }
        };
 };
index 4806e455594af3d4bded140e1cec69d958ee4835..2badc20f23ed86e6fac4ba11412876cf1912bb4e 100644 (file)
@@ -273,7 +273,7 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict
                                        });
                                }
                                
-                               var location = window.location.href.replace(/#[^#]+$/, '');
+                               var location = window.location.href.replace(/#+[^#]*$/, '');
                                if (TabMenuSimple.getIdentifierFromHash() === name) {
                                        location += window.location.hash;
                                }
@@ -389,7 +389,7 @@ define(['Dictionary', 'EventHandler', 'Dom/Traverse', 'Dom/Util'], function(Dict
        };
        
        TabMenuSimple.getIdentifierFromHash = function () {
-               if (window.location.hash.match(/^#([^\/]+)+(?:\/.+)?/)) {
+               if (window.location.hash.match(/^#+([^\/]+)+(?:\/.+)?/)) {
                        return RegExp.$1;
                }