From: Alexander Ebert Date: Mon, 10 Feb 2020 15:42:42 +0000 (+0100) Subject: Incorrect detection of Shift+Enter in iOS Safari X-Git-Tag: 5.2.3~37 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6311d0d3f7753e63810291091635b22af1f72464;p=GitHub%2FWoltLab%2FWCF.git Incorrect detection of Shift+Enter in iOS Safari --- diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js index 626949283a..06d0299b3b 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/redactor.js @@ -25,6 +25,15 @@ var uuid = 0; + var Environment = null; + if (typeof window.require === 'function') { + // Load the Environment class for a better browser detection, guarded by a function check + // to avoid bricking any calls to this file in a different context. + require(['Environment'], function(Env) { + Environment = Env; + }); + } + // Plugin $.fn.redactor = function (options) { var val = []; @@ -5713,9 +5722,13 @@ // on Shift+Enter or Ctrl+Enter if (key === this.keyCode.ENTER && (e.ctrlKey || e.shiftKey)) { - e.preventDefault(); - - return this.keydown.onShiftEnter(e); + // iOS Safari will report the shift key to be pressed, if the caret is at the + // front of the line and the next character should be an uppercase character. + if (Environment === null || Environment.platform() !== 'ios') { + e.preventDefault(); + + return this.keydown.onShiftEnter(e); + } } // on enter