From: Alexander Ebert Date: Tue, 30 Aug 2016 18:26:56 +0000 (+0200) Subject: Use more aggressive selection saving on iOS X-Git-Tag: 3.0.0_Beta_1~397 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dc99d5e1ac3edb4843d6fef6cac579cde674fad7;p=GitHub%2FWoltLab%2FWCF.git Use more aggressive selection saving on iOS --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js index 61c65f08e6..45ae8a2ac0 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js @@ -81,8 +81,8 @@ $.Redactor.prototype.WoltLabCaret = function() { internalRange = null; }; - this.$editor[0].addEventListener('keyup', saveRange); - this.$editor[0].addEventListener('mouseup', function () { + editor.addEventListener('keyup', saveRange); + editor.addEventListener('mouseup', function () { if (selection.rangeCount) { saveRange(); } @@ -125,6 +125,18 @@ $.Redactor.prototype.WoltLabCaret = function() { saveRange(); }).bind(this); + + require(['Environment'], (function (Environment) { + if (Environment.platform() === 'ios') { + editor.addEventListener('focus', function () { + document.addEventListener('selectionchange', saveRange); + }); + + editor.addEventListener('blur', function () { + document.removeEventListener('selectionchange', saveRange); + }) + } + }).bind(this)); }, _handleEditorClick: function (event) {