From abac12df488dd0a9878df1a37a5d1109042c8e95 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 5 Feb 2018 17:37:34 +0100 Subject: [PATCH] Outdenting nested list caused the list item to escape the editor See #2529 --- .../redactor2/plugins/WoltLabIndent.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabIndent.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabIndent.js index b1da114841..5c60142e62 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabIndent.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabIndent.js @@ -102,6 +102,24 @@ $.Redactor.prototype.WoltLabIndent = function() { }).bind(this); } + this.indent.repositionItem = (function($item) { + var $next = $item.next(); + if ($next.length !== 0 && ($next[0].tagName !== 'UL' || $next[0].tagName !== 'OL')) { + $item.append($next); + } + + var $prev = $item.prev(); + if ($prev.length !== 0 && $prev[0].tagName !== 'LI') { + this.selection.save(); + // WoltLab modification + //var $li = $item.parents('li', this.core.editor()[0]); + var $li = $item.closest('li', this.core.editor()[0]); + // WoltLab modification END + $li.after($item); + this.selection.restore(); + } + }).bind(this); + this.indent.normalize = (function() { // `document.execCommand('outdent')` can spawn a `
` if there is whitespace in the DOM // see https://bugzilla.mozilla.org/show_bug.cgi?id=1428073 -- 2.20.1