Fixed an issue with U+200C/U+200D
authorAlexander Ebert <ebert@woltlab.com>
Mon, 1 Jun 2015 23:44:31 +0000 (01:44 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 1 Jun 2015 23:44:31 +0000 (01:44 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js
wcfsetup/install/files/js/3rdParty/redactor/plugins/wmonkeypatch.js

index 4cbfcc711013f3682107f9eaf39e663beda769e2..8ad7b8ef201ea9fe0cc4b957bdf06dddb41df574 100644 (file)
@@ -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><br([^>]+)?><\/p>/g, '<p>@@@wcf_empty_line@@@</p>');
                                }
                                
-                               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')) {
index 70ccdf695a97de972a7a9627f7beaf32f5042835..d0cd2e9aaf03579f07ca6b1b22a8972ccc4a5cfd 100644 (file)
@@ -417,6 +417,18 @@ RedactorPlugins.wmonkeypatch = function() {
                                return html.replace(/<br\s?\/?>$/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) {