Improved pasting of <br> formatted text
authorAlexander Ebert <ebert@woltlab.com>
Tue, 28 Oct 2014 00:24:18 +0000 (01:24 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 28 Oct 2014 00:24:18 +0000 (01:24 +0100)
wcfsetup/install/files/js/3rdParty/redactor/plugins/wbbcode.js

index d36d2a58b6f87326c7d3c277476b30518acf6450..692c482a1800b6e933f85754a50bc0a6b1ebeda5 100644 (file)
@@ -926,14 +926,17 @@ RedactorPlugins.wbbcode = function() {
                 * @return      string
                 */
                _pasteCallback: function(html) {
+                       // reduce successive <br> by one
+                       html = html.replace(/<br[^>]*>(<br[^>]*>)+/g, '$1');
+                       
                        // replace <p>...</p> with <p>...</p><p><br></p>
-                       html = html.replace(/<p>([\s\S]*?)<\/p>/g, function(match, content) {
+                       /*html = html.replace(/<p>([\s\S]*?)<\/p>/g, function(match, content) {
                                if (content.match(/<br( \/)?>$/)) {
                                        return match;
                                }
                                
                                return '<p>' + content + '</p><p><br></p>';
-                       });
+                       });*/
                        
                        // restore font size
                        html = html.replace(/\[size=(\d+)\]/g, '<p><span style="font-size: $1pt">');