From: Alexander Ebert Date: Wed, 28 Oct 2015 13:55:57 +0000 (+0100) Subject: Dirty work-around for iOS Safari's selection X-Git-Tag: 2.1.9~25 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=249610d1429e8794f2cc8aec3b1d8f6d5d9fee85;p=GitHub%2FWoltLab%2FWCF.git Dirty work-around for iOS Safari's selection --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js index 72494756e4..8606c10e0a 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js @@ -1276,8 +1276,11 @@ RedactorPlugins.wmonkeypatch = function() { } // iOS sometimes pastes right into the marker, this work-around will unwrap the pasted content - if ($.browser.iOS && marker.innerHTML.length) { + var fixApple = false; + if ($.browser.iOS && marker.innerHTML.replace(/\u200b/g, '').length) { marker.outerHTML = marker.innerHTML; + + fixApple = true; } else { marker.parentNode.removeChild(marker); @@ -1291,6 +1294,12 @@ RedactorPlugins.wmonkeypatch = function() { else { this.selection.implicitRange = null; } + + if ($.browser.iOS && fixApple) { + window.setTimeout((function() { + this.focus.setEnd(); + }).bind(this), 10); + } }).bind(this); // selection.removeMarkers