From 19a38ec85fc8ffae80fe266f514780359972aa56 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 21 Aug 2017 13:30:38 +0200 Subject: [PATCH] Improved handling of ampersands --- .../js/3rdParty/redactor2/plugins/WoltLabClean.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js index a104fa9a33..cb7906e4a6 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js @@ -8,12 +8,16 @@ $.Redactor.prototype.WoltLabClean = function() { html = html.replace(/\u200B/g, ''); // fix ampersands being replaced - html = html.replace(/&/g, '@@@WCF_AMPERSAND@@@'); + //html = html.replace(/&/g, '@@@WCF_AMPERSAND@@@'); + html = html.replace(/&/g, '@@@WCF_LITERAL_AMP@@@'); + html = html.replace(/&/g, '&WCF_AMPERSAND&'); html = mpOnSet.call(this, html); // restore ampersands - html = html.replace(/@@@WCF_AMPERSAND@@@/g, '&'); + //html = html.replace(/@@@WCF_AMPERSAND@@@/g, '&'); + html = html.replace(/&WCF_AMPERSAND&/g, '&'); + html = html.replace(/@@@WCF_LITERAL_AMP@@@/, '&'); var div = elCreate('div'); div.innerHTML = html; @@ -77,12 +81,14 @@ $.Redactor.prototype.WoltLabClean = function() { html = html.replace(/

\u200B<\/p>/g, '


'); // fix ampersands being replaced - html = html.replace(/&/g, '@@@WCF_AMPERSAND@@@'); + //html = html.replace(/&/g, '@@@WCF_AMPERSAND@@@'); + html = html.replace(/&/g, '&WCF_AMPERSAND&'); html = mpOnSync.call(this, html); // restore ampersands - html = html.replace(/@@@WCF_AMPERSAND@@@/g, '&'); + //html = html.replace(/@@@WCF_AMPERSAND@@@/g, '&'); + html = html.replace(/&WCF_AMPERSAND&/g, '&'); div.innerHTML = html; -- 2.20.1