Properly stripping CSS class names from <div>, <p> and <span> on paste
authorAlexander Ebert <ebert@woltlab.com>
Sun, 26 Apr 2015 15:27:19 +0000 (17:27 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 26 Apr 2015 15:27:19 +0000 (17:27 +0200)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index 5c2aa24c505875d81926985d7a579ec2bf87312e..e6f930857f59ea2ac17379347ac96ea9719e448d 100644 (file)
@@ -1522,6 +1522,11 @@ RedactorPlugins.wbbcode = function() {
                        html = html.replace(/<\/(div|p)><\/(div|p)>/g, '</p>');
                        //html = html.replace(/<(div|p)><br><\/(div|p)>/g, '<p>');
                        
+                       // strip classes from certain elements
+                       html = html.replace(/<(?:div|p|span)[^>]+>/gi, function(match) {
+                               return match.replace(/ class="[^"]+"/, '');
+                       });
+                       
                        // drop <wbr>
                        html = html.replace(/<\/?wbr[^>]*>/g, '');