From 1a214211fa28dc3e9ed14e42960b5424f2d42f3c Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 8 Mar 2018 14:24:31 +0100 Subject: [PATCH] Convert pasted links into plain text in iOS Safari --- .../3rdParty/redactor2/plugins/WoltLabPaste.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index a92236276e..24368f0c9b 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -11,6 +11,11 @@ $.Redactor.prototype.WoltLabPaste = function() { var firefoxPlainText = null; + var isIosSafari = false; + require(['Environment'], function (Environment) { + isIosSafari = (Environment.platform() === 'ios' && Environment.browser() === 'safari'); + }); + var mpInit = this.paste.init; this.paste.init = (function (e) { firefoxPlainText = null; @@ -77,6 +82,17 @@ $.Redactor.prototype.WoltLabPaste = function() { return firefoxPlainText; } + if (isIosSafari) { + var div = elCreate('div'); + div.innerHTML = returnValue; + if (div.childElementCount === 1) { + var link = div.children[0]; + if (link.nodeName === 'A' && link.textContent === link.href) { + returnValue = link.textContent; + } + } + } + return returnValue; }).bind(this); -- 2.20.1