Improved handling of line breaks in tables
authorAlexander Ebert <ebert@woltlab.com>
Mon, 16 Mar 2015 18:49:14 +0000 (19:49 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 16 Mar 2015 18:49:14 +0000 (19:49 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index 7601edd752b8fd7f6d012ef601ca455431529228..23ea557727bd766cad06294aa78f555b5f7b32ec 100644 (file)
@@ -1198,6 +1198,11 @@ RedactorPlugins.wbbcode = function() {
                                }
                        }
                        
+                       // fix newlines in tables represented with <p>...</p> instead of <br>
+                       data = data.replace(/<td>([\s\S]+?)<\/td>/g, function(match, content) {
+                               return '<td>' + content.replace(/<p>/g, '').replace(/<\/p>/g, '<br>').replace(/<br>$/, '') + '</td>';
+                       });
+                       
                        // insert list items
                        if ($listItems.length) {
                                for (var $i = $listItems.length - 1; $i >= 0; $i--) {