From 3d8f839456e9386549b08bd00b1966bc250c6254 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 1 Sep 2017 13:51:31 +0200 Subject: [PATCH] Fixed return key inside nested lists --- .../files/js/3rdParty/redactor/redactor.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/redactor.js b/wcfsetup/install/files/js/3rdParty/redactor/redactor.js index d65e5a06e6..7fe97816a0 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/redactor.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/redactor.js @@ -5153,6 +5153,33 @@ $list.after(node); this.caret.setStart(node); + return false; + } + } + else if (this.keydown.block.tagName === 'P' && this.keydown.block.parentNode.tagName === 'LI') { + // check if the

is empty and this is the last child + var p = this.keydown.block; + if (p.nextElementSibling === null && this.utils.isEmpty(p.innerHTML)) { + var li = p.parentNode; + + // only child of this

  • + if (p.previousElementSibling === null) { + var list = li.parentNode; + list.removeChild(li); + + var node = $(this.opts.emptyHtml)[0]; + list.parentNode.insertBefore(node, list.nextElementSibling); + this.caret.setStart(node); + + return false; + } + + li.removeChild(p); + + var node = $('
  • ' + this.opts.emptyHtml + '
  • ')[0]; + li.parentNode.insertBefore(node, li.nextElementSibling); + this.caret.setStart(node.children[0]); + return false; } } -- 2.20.1