From: Alexander Ebert Date: Fri, 1 Sep 2017 11:51:31 +0000 (+0200) Subject: Fixed return key inside nested lists X-Git-Tag: 3.1.0_Alpha_3~4^2~9^2 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3d8f839456e9386549b08bd00b1966bc250c6254;p=GitHub%2FWoltLab%2FWCF.git Fixed return key inside nested lists --- 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; } }