X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/5be499ab63f91b65065fe34f3a6d645efc9ae7b6..7dd937f65ffd6278d02561647dc5f5553debf3e6:/modules/nodePane/nodePane.js?ds=inline diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js index 037715f..a1c2a81 100644 --- a/modules/nodePane/nodePane.js +++ b/modules/nodePane/nodePane.js @@ -1,33 +1,41 @@ -define([ -'libs/text!./template.html', -'libs/jquery-1.9.1.min', -'libs/underscore-min', - -], function(templateSrc, $, _) { - -return function(sandbox) { - - view = $(_.template(templateSrc)()); - - 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()); - }); - - return { - start: function() { - sandbox.publish('ready'); - }, - getView: function() { - return view; - }, - setNode: function(node) { - view.find('.rng-module-nodePane-tagSelect').val(node.tag); - view.find('.rng-module-nodePane-classSelect').val(node.klass); - } - } - -} - +define([ +'libs/text!./template.html', +'libs/jquery-1.9.1.min', +'libs/underscore-min', +'modules/nodePane/metaWidget/metaWidget' +], function(templateSrc, $, _, metaWidget) { + +'use strict'; + +return function(sandbox) { + + var view = $(_.template(templateSrc)()); + + view.on('change', 'select', function(e) { + var target = $(e.target); + var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'tag' : 'class'; + sandbox.publish('nodeElementChange', attr, target.val()); + }); + + return { + start: function() { + sandbox.publish('ready'); + }, + getView: function() { + return view; + }, + setNodeElement: function(nodeElement) { + view.find('.rng-module-nodePane-tagSelect').val(nodeElement.getWlxmlTag()); + view.find('.rng-module-nodePane-classSelect').val(nodeElement.getWlxmlClass()); + + //var widget = metaWidget.create({attrs:canvasNode.getMetaAttrs()}); + //widget.on('valueChanged', function(key, value) { + // sandbox.publish('nodeChanged', key, value); + //}); + //view.find('.metaFields').empty().append(widget.el); + } + }; + +}; + }); \ No newline at end of file