X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/73e8795a3d19b7221f34353799d39808d57a4d05..90a4709555ba28d2175c7a359d538e7775f9bf64:/src/smartxml/transformations.js diff --git a/src/smartxml/transformations.js b/src/smartxml/transformations.js index a78c9c9..f0b89f1 100644 --- a/src/smartxml/transformations.js +++ b/src/smartxml/transformations.js @@ -42,18 +42,40 @@ toret.createGenericTransformation = function(desc, name) { // }); // potem spr na dotychczasowych undo/redo tests; + + this.args.forEach(function(arg, idx, args) { - if(arg && arg.nodeType) { // ~ - var path = arg.getPath(); - Object.defineProperty(args, idx, { - get: function() { - if(transformation.hasRun && path) { - return transformation.document.getNodeByPath(path); - } else { - return arg; + var path; + if(arg) { + if(arg.nodeType) { // ~ + path = arg.getPath(); + Object.defineProperty(args, idx, { + get: function() { + if(transformation.hasRun && path) { + return transformation.document.getNodeByPath(path); + } else { + return arg; + } } - } - }); + }); + } else if(_.isObject(arg)) { + _.keys(arg).forEach(function(key) { + var value = arg[key], + path; + if(value && value.nodeType) { + path = value.getPath(); + Object.defineProperty(arg, key, { + get: function() { + if(transformation.hasRun && path) { + return transformation.document.getNodeByPath(path); + } else { + return value; + } + } + }); + } + }); + } } });