Roo/htmleditor/TidyWriter.js
[roojs1] / Roo / htmleditor / TidyWriter.js
index bfcb7cf..2654f20 100644 (file)
@@ -67,8 +67,9 @@ Roo.htmleditor.TidyWriter.prototype = {
         var is_short   = empty ? Roo.htmleditor.TidyWriter.shortend_elements.indexOf(name) > -1 : false;
         
 
-        var indentstr = this.in_inline || this.in_pre ? '' : this.indentstr;
+        var indentstr = in_inline || this.in_pre ? '' : this.indentstr;
         
+        // if this element is inline - then don't add stuff beforehand..
         if (!in_inline && !this.in_pre) {
             this.addLine();
         }
@@ -138,13 +139,15 @@ Roo.htmleditor.TidyWriter.prototype = {
     end: function(name) {
         var value;
         this.popState();
-        var indentstr = ''; 
-        if (!this.in_pre && !this.in_inline) {
+        var indentstr = '';
+        var in_inline = this.in_inline || Roo.htmleditor.TidyWriter.inline_elements.indexOf(name) > -1;
+        
+        if (!this.in_pre && !in_inline) {
             this.addLine();
             indentstr  = this.indentstr;
         }
         this.html.push(indentstr + '</', name.toLowerCase(), '>');
-       
+        this.last_inline = in_inline;
         
         // pop the indent state..
     },
@@ -164,7 +167,7 @@ Roo.htmleditor.TidyWriter.prototype = {
         if (text.length < 1) {
             return;
         }
-        if (this.in_pre || this.is_inline) {
+        if (this.in_pre || this.in_inline) {
             this.html[this.html.length] =  text;
             return;