From 3149b7b8a0db752aecab4d4854824a2939e052ed Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 30 Mar 2019 13:09:53 +0100 Subject: [PATCH] Workaround for links being implicitly converted into anchors --- .../js/3rdParty/redactor2/plugins/WoltLabPaste.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js index 4300e4546f..06dc4802cf 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabPaste.js @@ -327,6 +327,18 @@ $.Redactor.prototype.WoltLabPaste = function() { var div = elCreate('div'); div.innerHTML = html; + // Some browsers implicitly convert links into `` elements. + if (div.childElementCount === 1 && div.children[0].nodeName === 'A') { + var link = div.children[0]; + if (div.firstChild === link && div.lastChild === link && link.href === link.textContent) { + while (link.childNodes.length) { + div.insertBefore(link.childNodes[0], link); + } + + div.removeChild(link); + } + } + var pastedImages = []; if (!data.pre && !data.text) { elBySelAll('img', div, (function(img) { -- 2.20.1