X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e298a4a95de93951eee23d33ba7e8d1387a90a5b..16c90b3616f1645aab9fe284fd3b89641dfb42f2:/src/wlxml/wlxml.js diff --git a/src/wlxml/wlxml.js b/src/wlxml/wlxml.js index 539d792..fe0636d 100644 --- a/src/wlxml/wlxml.js +++ b/src/wlxml/wlxml.js @@ -181,6 +181,18 @@ $.extend(WLXMLDocument.prototype, { var doc = this, prefixLength = 'dc:'.length; + $(nativeNode).find('metadata').each(function() { + var metadataNode = $(this), + owner = doc.createDocumentNode(metadataNode.parent()[0]), + metadata = owner.getMetadata(); + + metadataNode.children().each(function() { + metadata.add({key: (this.tagName).toLowerCase().substr(prefixLength), value: $(this).text()}, {undoable: false}); + }); + metadataNode.remove(); + }); + nativeNode.normalize(); + $(nativeNode).find(':not(iframe)').addBack().contents() .filter(function() {return this.nodeType === Node.TEXT_NODE;}) .each(function() { @@ -264,15 +276,7 @@ $.extend(WLXMLDocument.prototype, { el.replaceWith(document.createTextNode(text.transformed)); }); - $(nativeNode).find('metadata').each(function() { - var metadataNode = $(this), - owner = doc.createDocumentNode(metadataNode.parent()[0]); - - metadataNode.children().each(function() { - owner.addMetadata({key: (this.tagName).toLowerCase().substr(prefixLength), value: $(this).text()}); - }); - metadataNode.remove(); - }); + }, registerClassTransformation: function(Transformation, className) {