X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0214643f72c6aaa8e85eaba2ad27f2ca03ca6401..c07709a9bea2d753c56a45079cf839da0281e724:/modules/documentCanvas/transformations.js?ds=sidebyside diff --git a/modules/documentCanvas/transformations.js b/modules/documentCanvas/transformations.js index cd20d2b..44ab78a 100644 --- a/modules/documentCanvas/transformations.js +++ b/modules/documentCanvas/transformations.js @@ -1,5 +1,7 @@ define(['libs/jquery-1.9.1.min'], function($) { + 'use strict'; + var transformations = {}; transformations.fromXML = { @@ -54,9 +56,9 @@ define(['libs/jquery-1.9.1.min'], function($) { } transformations.toXML = { - getXML: function(documentDescription) { + getXML: function(body) { - var inner = $(documentDescription.HTMLTree); + var inner = $(body); var toret = $('
'); toret.append(inner); @@ -80,25 +82,7 @@ define(['libs/jquery-1.9.1.min'], function($) { toret.append(div.contents()); return toret; }); - - var meta = $('\n'); - _.each(_.keys(documentDescription.metadata), function(key) { - meta.append('\n\t' + documentDescription.metadata[key] + ''); - }); - meta.append('\n'); - - var metadata = toret.find('metadata'); - if(metadata.length === 0) { - var section = toret.find('section'); - section = section.length ? $(section[0]) : null; - if(section) { - section.prepend(meta) - } - } else { - metadata.replaceWith(meta); - } - - + return vkbeautify.xml(toret.html()); } }