X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a1c752a1fd15569e947246924254c2a072462fb8..3862e230ab784fa164875fd594c277da9ad87315:/modules/documentCanvas/canvas/canvas.js diff --git a/modules/documentCanvas/canvas/canvas.js b/modules/documentCanvas/canvas/canvas.js index 96206c3..19c2a3f 100644 --- a/modules/documentCanvas/canvas/canvas.js +++ b/modules/documentCanvas/canvas/canvas.js @@ -320,35 +320,9 @@ $.extend(Canvas.prototype, { }, toXML: function() { - var d = function(element, parent, level) { - console.log(element.getText ? 'text: ' + element.getText() : 'node: ' + element.getWlxmlTag()); - var isElementNode = element instanceof documentElement.DocumentNodeElement; - var parentChildren = parent.contents(); - var dom; - - var elXML = element.toXML(level); - if(parentChildren.length > 2 && parentChildren[0].nodeType === Node.TEXT_NODE && parentChildren[1].nodeType == Node.TEXT_NODE) { - $(parentChildren[0]).after(elXML); - } else { - parent.prepend(elXML); - } - - - if(isElementNode) { - elXML.each(function() { - if(this.nodeType === Node.ELEMENT_NODE) { - dom = $(this); - return; - } - }); - var elementChildren = element.children(); - for(var i = elementChildren.length - 1; i >= 0; i--) { - d(elementChildren[i], dom, level + 1); - } - } - } - var parent = $('
'); - d(this.doc(), parent, 0); + var parent = $('
'), + parts = this.doc().toXML(0); + parent.append(parts); return parent.html(); } });