Improved handling of code boxes incorrectly wrapped in <p>
authorAlexander Ebert <ebert@woltlab.com>
Sat, 28 Feb 2015 18:20:04 +0000 (19:20 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 28 Feb 2015 18:20:04 +0000 (19:20 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index 035d130cf3b6d2a6868add771873aa2afab6f56c..42f51e7de7421b7b3800a95037e2610dd893ed6d 100644 (file)
@@ -319,6 +319,11 @@ RedactorPlugins.wbbcode = function() {
                        html = html.replace(/<p><\/p><table/g, '<table');
                        html = html.replace(/<\/table><p><\/p>/g, '</table>');
                        
+                       // unwrap code boxes
+                       for (var $uuid in $cachedCodeListings) {
+                               html = html.replace(new RegExp('<p><\/p>@@@' + $uuid + '@@@<p><\/p>'), '@@@' + $uuid + '@@@');
+                       }
+                       
                        // handle empty paragraphs not followed by an empty one
                        html = html.replace(/<p><\/p><p>(?!<br>)/g, '<p>@@@wcf_empty_line@@@</p><p>');