From 89b845657dd2ad31bd065e6a141e0caf53dc9500 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 27 Nov 2016 00:40:06 +0100 Subject: [PATCH] Fixed caret position after pasting --- .../files/js/3rdParty/redactor2/plugins/WoltLabPaste.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index c328a41aad..6c014904b6 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -147,7 +147,14 @@ $.Redactor.prototype.WoltLabPaste = function() { var marker = elBySel('woltlab-selection-marker', this.$editor[0]); if (marker) { - this.caret.end(marker.previousElementSibling || marker.parentNode); + var range = document.createRange(); + range.setStartBefore(marker); + range.setEndBefore(marker); + + var selection = window.getSelection(); + selection.removeAllRanges(); + selection.addRange(range); + elRemove(marker); } -- 2.20.1