From 249610d1429e8794f2cc8aec3b1d8f6d5d9fee85 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 28 Oct 2015 14:55:57 +0100 Subject: [PATCH] Dirty work-around for iOS Safari's selection --- .../js/3rdParty/redactor/plugins/wmonkeypatch.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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 -- 2.20.1