X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/039f0edb73590283bc38ef5421e670fa40ff2480..3cf3a2daadbd34576c9ae6cb4f96caef23c4e07d:/modules/nodePane/nodePane.js?ds=sidebyside diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js index 39afbea..3a4a0ef 100644 --- a/modules/nodePane/nodePane.js +++ b/modules/nodePane/nodePane.js @@ -14,7 +14,7 @@ return function(sandbox) { view.on('change', 'select', function(e) { var target = $(e.target); var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'tag' : 'class'; - sandbox.publish('nodeChanged', attr, target.val()); + sandbox.publish('nodeElementChange', attr, target.val().replace(/-/g, '.')); }); return { @@ -24,13 +24,15 @@ return function(sandbox) { getView: function() { return view; }, - setNode: function(canvasNode) { - view.find('.rng-module-nodePane-tagSelect').val(canvasNode.getTag()); - view.find('.rng-module-nodePane-classSelect').val(canvasNode.getClass()); + setNodeElement: function(nodeElement) { + view.find('.rng-module-nodePane-tagSelect').val(nodeElement.getWlxmlTag()); - var widget = metaWidget.create({attrs:canvasNode.getMetaAttrs()}); + var escapedClassName = (nodeElement.getWlxmlClass() || '').replace(/\./g, '-') + view.find('.rng-module-nodePane-classSelect').val(escapedClassName); + + var widget = metaWidget.create({attrs:nodeElement.getWlxmlMetaAttrs()}); widget.on('valueChanged', function(key, value) { - sandbox.publish('nodeChanged', key, value); + sandbox.publish('nodeElementChange', key, value); }); view.find('.metaFields').empty().append(widget.el); }