Fixed weird newlines showing up when pasting from Microsoft Word
authorAlexander Ebert <ebert@woltlab.com>
Fri, 14 Aug 2015 15:57:15 +0000 (17:57 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 14 Aug 2015 15:57:15 +0000 (17:57 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index fb0bad1d7da5a9006f791863db91aa1a36dfb336..89c1b6aaff63e2bc2160e8ffa2a5e16ff64aa4e8 100644 (file)
@@ -1552,6 +1552,11 @@ RedactorPlugins.wbbcode = function() {
                        });
                        html = html.replace(/<\/h[1-6]>/g, '[/size]');
                        
+                       // fix weird newlines found when pasting from Microsoft Word
+                       if (/<p class="MsoNormal">/.test(html)) {
+                               html = html.replace(/([^>\s])\n([^<\s])/g, '$1 $2');
+                       }
+                       
                        // fix empty paragraphs when pasting from Microsoft Word
                        html = html.replace(/<o:p>&nbsp;<\/o:p>/g, '<br>');