From eaa0f9b065f0f61e8c4910a384f199ecb775199e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 2 Jun 2015 01:44:31 +0200 Subject: [PATCH] Fixed an issue with U+200C/U+200D --- .../files/js/3rdParty/redactor/plugins/wbbcode.js | 8 +++++++- .../js/3rdParty/redactor/plugins/wmonkeypatch.js | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js index 4cbfcc7110..8ad7b8ef20 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js @@ -44,6 +44,9 @@ RedactorPlugins.wbbcode = function() { var $mpCleanOnSync = this.clean.onSync; this.clean.onSync = (function(html) { + html = html.replace(/\u200C/g, '__wcf_zwnj__'); + html = html.replace(/\u200D/g, '__wcf_zwj__'); + if ($skipOnSyncReplacementOnce === true) { $skipOnSyncReplacementOnce = false; } @@ -51,7 +54,10 @@ RedactorPlugins.wbbcode = function() { html = html.replace(/

]+)?><\/p>/g, '

@@@wcf_empty_line@@@

'); } - return $mpCleanOnSync.call(this, html); + html = $mpCleanOnSync.call(this, html); + + html = html.replace(/__wcf_zwnj__/g, '\u200C'); + return html.replace(/__wcf_zwj__/g, '\u200D'); }).bind(this); if (this.wutil.getOption('woltlab.autosaveOnce')) { diff --git a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js index 70ccdf695a..d0cd2e9aaf 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js +++ b/wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js @@ -417,6 +417,18 @@ RedactorPlugins.wmonkeypatch = function() { return html.replace(/$/i, ''); }; + // clean.removeSpaces + var mpRemoveSpaces = this.clean.removeSpaces; + this.clean.removeSpaces = (function(html) { + html = html.replace(/\u200C/g, '__wcf_zwnj__'); + html = html.replace(/\u200D/g, '__wcf_zwj__'); + + html = mpRemoveSpaces.call(this, html); + + html = html.replace(/__wcf_zwnj__/g, '\u200C'); + return html.replace(/__wcf_zwj__/g, '\u200D'); + }); + // clean.onSet var $mpOnSet = this.clean.onSet; this.clean.onSet = (function(html) { -- 2.20.1