Roo/htmleditor/TidyWriter.js
authorAlan <alan@roojs.com>
Fri, 7 Jan 2022 07:23:40 +0000 (15:23 +0800)
committerAlan <alan@roojs.com>
Fri, 7 Jan 2022 07:23:40 +0000 (15:23 +0800)
Roo/htmleditor/TidyWriter.js

index 93c4829..4d23dcd 100644 (file)
@@ -227,6 +227,14 @@ Roo.htmleditor.TidyWriter.prototype = {
                 {
                     text = this.indentstr +  text.replace(/^\s+/g,'');
                 }
+                // repace long lines
+                text = this.indentstr + text.replace(
+                    /(?![^\n]{1,64}$)([^\n]{1,64})\s/g, '$1\n' + this.indentstr
+                );
+                // remoeve the last whitespace / line break.
+                text = text.replace(/\s+$/,''); 
+                
+                
                 
             }
             this.html[this.html.length] =  text;