From: Alexander Ebert Date: Tue, 21 Jun 2016 12:22:54 +0000 (+0200) Subject: Fixed caret sometimes placed in front of inserted content X-Git-Tag: 3.0.0_Beta_1~117^2~66 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2953a53f0e025012ecfe7630a6f16412bd955c3c;p=GitHub%2FWoltLab%2FWCF.git Fixed caret sometimes placed in front of inserted content --- 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);