X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/0214643f72c6aaa8e85eaba2ad27f2ca03ca6401..3300786073de06446670a1779d35451c8ddef953:/modules/documentCanvas/transformations.js 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()); } }