From b4ea9d269020219b97f889812e98db4969279a51 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 29 Dec 2017 13:44:35 +0100 Subject: [PATCH] Merge remote-tracking branch 'refs/remotes/origin/3.0' # Conflicts: # wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js --- .../3rdParty/redactor2/plugins/WoltLabList.js | 31 +++++++++++++++++++ .../js/WoltLabSuite/Core/Ui/TabMenu/Simple.js | 4 +-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js index 59163536f6..2847d5a733 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabList.js @@ -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); } }; }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js index 4806e45559..2badc20f23 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/TabMenu/Simple.js @@ -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; } -- 2.20.1