X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/bd0c9397ecd0cccdc7af0f0b0153adf5126e1538..266a16ec421df5bc8f2565884dd410918f1f1df4:/src/wlxml/wlxml.js diff --git a/src/wlxml/wlxml.js b/src/wlxml/wlxml.js index c3ed84f..6c6c40c 100644 --- a/src/wlxml/wlxml.js +++ b/src/wlxml/wlxml.js @@ -2,13 +2,13 @@ define([ 'libs/jquery', 'libs/underscore', 'smartxml/smartxml', - 'smartxml/transformations' -], function($, _, smartxml, transformations) { + 'smartxml/transformations', + 'wlxml/extensions/metadata/metadata' +], function($, _, smartxml, transformations, metadataExtension) { 'use strict'; /* globals Node */ -var metadataKey = 'wlxml.metadata'; var AttributesList = function() {}; @@ -79,26 +79,6 @@ $.extend(WLXMLElementNode.prototype, smartxml.ElementNode.prototype, { return attrName !== 'class' &&_.contains(_.keys(this.getMetaAttributes()), attrName); }, - getMetadata: function() { - return this.getData(metadataKey) || []; - }, - - addMetadataRow: function(row) { - this.setMetadataRow(null, row); - }, - - setMetadataRow: function(index, row) { - var metadata = this.getData(metadataKey) || []; - if(typeof index !== 'number' || index > metadata.length - 1) { - metadata.push(row); - index = metadata.length - 1; - } else { - metadata[index] = _.extend(metadata[index], row); - } - this.setData(metadataKey, metadata); - this.triggerChangeEvent('metadataChange', {index: index}); - }, - _getXMLDOMToDump: function() { var DOM = this._$.clone(true, true), doc = this.document; @@ -182,7 +162,7 @@ WLXMLDocumentNode.prototype = Object.create(smartxml.DocumentNode.prototype); var WLXMLDocument = function(xml, options) { this.classMethods = {}; this.classTransformations = {}; - smartxml.Document.call(this, xml); + smartxml.Document.call(this, xml, [metadataExtension]); this.options = options; };