X-Git-Url: http://git.roojs.org/?p=roojs1;a=blobdiff_plain;f=docs%2Fsrc%2FRoo_htmleditor_Tidy.js.html;h=9c2f205cf4db9b0085c9aeee9dddba68f826b41f;hp=597ca0bb1007eef5d3aee5e47d08676cd7f27a91;hb=356f5ee4ec78e1c538f224acb762c98e75be3d39;hpb=0f0774d7fe6b1f6bb2e34cb961bb516159ac3a3f
diff --git a/docs/src/Roo_htmleditor_Tidy.js.html b/docs/src/Roo_htmleditor_Tidy.js.html
index 597ca0bb10..9c2f205cf4 100644
--- a/docs/src/Roo_htmleditor_Tidy.js.html
+++ b/docs/src/Roo_htmleditor_Tidy.js.html
@@ -2,7 +2,7 @@
Roo.htmleditor.Tidy.prototype = {
+ core : false,
- wrap : function(s) {
- return s.replace(/\n/g, " ").replace(/(?![^\n]{1,80}$)([^\n]{1,80})\s/g, '$1\n');
- },
tidy : function(node, indent) {
+ var ser = new Roo.htmleditor.TidySerializer({
+ indent : 2,
+ });
+ return ser.serialize(node);
- if (node.nodeType == 3) {
- return indent === false ? node.nodeValue : this.wrap(node.nodeValue.trim()).split("\n").join("\n" + indent);
-
-
- }
-
- if (node.nodeType != 1) {
- return '';
- }
-
-
-
- if (node.tagName == 'BODY') {
-
- return this.cn(node, '');
- }
-
- var ret = "<" + node.tagName + this.attr(node) ;
-
- if (['IMG', 'BR', 'HR', 'INPUT'].indexOf(node.tagName) > -1) {
- return ret + '/>';
- }
- ret += '>';
-
-
- var cindent = indent === false ? '' : (indent + ' ');
- if (['PRE', 'TEXTAREA', 'TD', 'A', 'SPAN', 'B', 'I', 'S'].indexOf(node.tagName) > -1) { cindent = false;
-
-
- }
-
- var cn = this.cn(node, cindent );
-
- return ret + cn + '</' + node.tagName + '>';
-
- },
- cn: function(node, indent)
- {
- var ret = [];
-
- var ar = Array.from(node.childNodes);
- for (var i = 0 ; i < ar.length ; i++) {
-
-
-
- if (indent !== false && i > 0
- && ar[i].nodeType == 3
- && ar[i].nodeValue.length > 0
- && ar[i].nodeValue.match(/^\s+/)
- ) {
- if (ret.length && ret[ret.length-1] == "\n" + indent) {
- ret.pop(); }
-
- ret.push(" "); }
- if (indent !== false
- && ar[i].nodeType == 1 ) {
- ret.push("\n" + indent);
- }
-
- ret.push(this.tidy(ar[i], indent));
- if (indent !== false
- && ar[i].nodeType == 3
- && ar[i].nodeValue.length > 0
- && ar[i].nodeValue.match(/\s+$/)
- ){
- ret.push("\n" + indent);
- }
-
-
-
-
- }
- return ret.join('');
- },
-
-
-
- attr : function(node)
- {
- var attr = [];
- for(i = 0; i < node.attributes.length;i++) {
-
- if (!node.attributes.item(i).value.length) {
- continue;
- }
- attr.push( node.attributes.item(i).name + '="' +
- Roo.util.Format.htmlEncode(node.attributes.item(i).value) + '"'
- );
- }
- return attr.length ? (' ' + attr.join(' ') ) : '';
}
-
-
}