From 0a3f08d1f157b3754ebb0a13c0e1d85d11d45197 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 5 Oct 2016 12:53:08 +0200 Subject: [PATCH] Fixed encoded ampersands being replaced --- .../3rdParty/redactor2/plugins/WoltLabClean.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js index 233f8bf4e1..63a367fe17 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabClean.js @@ -9,7 +9,17 @@ $.Redactor.prototype.WoltLabClean = function() { var mpOnSet = this.clean.onSet; this.clean.onSet = (function (html) { - return mpOnSet.call(this, html.replace(/\u200B/g, '')); + html = html.replace(/\u200B/g, ''); + + // fix ampersands being replaced + html = html.replace(/&/g, '@@@WCF_AMPERSAND@@@'); + + html = mpOnSet.call(this, html); + + // restore ampersands + html = html.replace(/@@@WCF_AMPERSAND@@@/g, '&'); + + return html; }).bind(this); var mpOnSync = this.clean.onSync; @@ -17,6 +27,9 @@ $.Redactor.prototype.WoltLabClean = function() { var div = elCreate('div'); var replacements = {}; + // fix ampersands being replaced + html = html.replace(/&/g, '@@@WCF_AMPERSAND@@@'); + if (html.indexOf('