Fix for pasting from Word was too defensive, removed bogus anchors
authorAlexander Ebert <ebert@woltlab.com>
Fri, 16 Oct 2015 19:53:00 +0000 (21:53 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 16 Oct 2015 19:53:11 +0000 (21:53 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index f8ca8804cb026b359e11f0352bb63e4978d0b616..37425b840e2726fe66bb49a0d09ec1232d4da2a9 100644 (file)
@@ -1570,9 +1570,13 @@ 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)) {
+                       // some fixes for paste from Microsoft Word / OpenOffice
+                       if (/<p class="MsoNormal/.test(html)) {
+                               // fix weird newlines
                                html = html.replace(/([^>\s])\n([^<\s])/g, '$1 $2');
+                               
+                               // remove bogus anchors
+                               html = html.replace(/<a name="[^"]+">/g, '');
                        }
                        
                        // fix empty paragraphs when pasting from Microsoft Word