X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/275952d30bfcd6f5aecc2710a0df0cd489ea71f6..8464a511c74dff643095ce419659df60b0580b7a:/src/wlxml/wlxml.js diff --git a/src/wlxml/wlxml.js b/src/wlxml/wlxml.js index fb5b328..e6ea26b 100644 --- a/src/wlxml/wlxml.js +++ b/src/wlxml/wlxml.js @@ -1,8 +1,9 @@ define([ 'libs/jquery', 'libs/underscore', - 'smartxml/smartxml' -], function($, _, smartxml) { + 'smartxml/smartxml', + 'smartxml/transformations' +], function($, _, smartxml, transformations) { 'use strict'; @@ -49,6 +50,9 @@ $.extend(WLXMLElementNode.prototype, smartxml.ElementNode.prototype, { }.bind(this)); return toret; }, + setMetaAttribute: function(key, value) { + this.setAttr('meta-'+key, value); + }, getOtherAttributes: function() { var toret = {}; this.getAttrs().forEach(function(attr) { @@ -106,7 +110,15 @@ $.extend(WLXMLElementNode.prototype, smartxml.ElementNode.prototype, { } }); - +WLXMLElementNode.prototype.transformations.register(transformations.createContextTransformation({ + name: 'wlxml.setMetaAttribute', + impl: function(args) { + this.setMetaAttribute(args.name, args.value); + }, + getChangeRoot: function() { + return this.context; + } +}));