From 2953a53f0e025012ecfe7630a6f16412bd955c3c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 21 Jun 2016 14:22:54 +0200 Subject: [PATCH] Fixed caret sometimes placed in front of inserted content --- .../files/js/3rdParty/redactor/plugins/wmonkeypatch.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js index dca87328b7..c34a659aa2 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js @@ -1298,7 +1298,7 @@ RedactorPlugins.wmonkeypatch = function() { var $node = null; if ((marker.id === 'selection-marker-1' && !this.$editor.find('#selection-marker-2').length) || marker.id === 'nodes-marker-1' && !this.$editor.find('#nodes-marker-2').length) { - $node = marker.previousSibling; + $node = (marker.previousSibling) ? marker.previousSibling : null; } // iOS sometimes pastes right into the marker, this work-around will unwrap the pasted content @@ -1314,8 +1314,8 @@ RedactorPlugins.wmonkeypatch = function() { if ($node !== null) { this.selection.implicitRange = document.createRange(); - this.selection.implicitRange.setStart($node, $node.length); - this.selection.implicitRange.setEnd($node, $node.length); + this.selection.implicitRange.setStartAfter($node); + this.selection.implicitRange.setEndAfter($node); getSelection().removeAllRanges(); getSelection().addRange(this.selection.implicitRange); -- 2.20.1