From: Alexander Ebert Date: Mon, 23 May 2016 15:03:10 +0000 (+0200) Subject: Fixed inserting successive block elements X-Git-Tag: 2.1.11~12 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9c22f9cd0c2a2932abfc416f11d51d406fd4a228;p=GitHub%2FWoltLab%2FWCF.git Fixed inserting successive block elements --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js index d41694bb41..8c61a5169e 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wutil.js @@ -757,7 +757,11 @@ RedactorPlugins.wutil = function() { } else { // walk tree up until we find a direct children of the editor and place the caret afterwards - var $insertAfter = $($startContainer).parentsUntil(this.$editor[0]).last(); + var $insertAfter = $startContainer; + if ($insertAfter !== this.$editor[0]) { + $startContainer = $($startContainer).parentsUntil(this.$editor[0]).last(); + } + if ($insertAfter[0] === document.body.parentElement) { // work-around if selection never has been within the editor before this.wutil.selectionEndOfEditor();