* This is based loosely on tinymce
* @class Roo.htmleditor.TidyWriter
* https://github.com/thorn0/tinymce.html/blob/master/tinymce.html.js
+ *
+ * Known issues?
+ * - not tested much with 'PRE' formated elements.
+ * - BR insined inline?
+ *
+ *
*/
Roo.htmleditor.TidyWriter = function(settings)
* @param {String} text String to write out.
* @param {Boolean} raw Optional raw state if true the contents wont get encoded.
*/
- text: function(text )
+ text: function(text, node)
{
// if not in whitespace critical
if (text.length < 1) {
}
if (this.in_pre || this.in_inline) {
this.html[this.html.length] = text;
- return;
-
+ return;
+ }
+ // see if last element was a inline element.
+ var indentstr = this.indentstr;
+ if (node.previousSibling &&
+ node.previousSibling.nodeType == 1 &&
+ Roo.htmleditor.TidyWriter.inline_elements.indexOf(node.previousSibling.nodeName) > -1)
+ {
+ indentstr = '';
+ } else {
+ this.addLine();
}
- // see if last line is a line break
-
- this.addLine();
return;
}
if (!text.match(/\n/)) {
- this.html.push(this.indentstr + text);
+ this.html.push(indentstr + text);
return;
}