From 9c22f9cd0c2a2932abfc416f11d51d406fd4a228 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 23 May 2016 17:03:10 +0200 Subject: [PATCH] Fixed inserting successive block elements --- .../install/files/js/3rdParty/redactor/plugins/wutil.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); -- 2.20.1