X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/a22d30b71f012cf8653319e6743440abf7be52a8..70fd8f6118a3e8bf298dd9c48c310f3309b780c3:/modules/visualEditor.transformations.js?ds=inline diff --git a/modules/visualEditor.transformations.js b/modules/visualEditor.transformations.js index 9d21f5d..22deba5 100644 --- a/modules/visualEditor.transformations.js +++ b/modules/visualEditor.transformations.js @@ -52,7 +52,26 @@ if(typeof module !== 'undefined' && module.exports) { transformations.toXML = { getXML: function(documentDescription) { - return documentDescription.HTMLTree; + + var inner = $(documentDescription.HTMLTree); + var toret = $('
'); + toret.append(inner); + + toret.find('div, span').replaceWith(function() { + var div = $(this); + var tagName = div.attr('class').split('rng-')[1]; + return $('<'+tagName+'>').append(div.contents()); + }); + + var meta = $(''); + _.each(_.keys(documentDescription.metadata), function(key) { + meta.append($('' + documentDescription.metadata[key] + '')); + }); + + toret.find('document').prepend(meta); + + return toret.html(); + } }