X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/2bb0e6a7d19dc695f82373e568e6959c6b995eca..029c09d7b013195c31125fd7c56347e08963df6d:/modules/nodePane/nodePane.js

diff --git a/modules/nodePane/nodePane.js b/modules/nodePane/nodePane.js
index fc8284f..39afbea 100644
--- a/modules/nodePane/nodePane.js
+++ b/modules/nodePane/nodePane.js
@@ -1,35 +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) {
-            var tag = node.attr('wlxml-tag');
-            var klass = node.attr('wlxml-class');
-            view.find('.rng-module-nodePane-tagSelect').val(tag);
-            view.find('.rng-module-nodePane-classSelect').val(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('nodeChanged', attr, target.val());
+    });
+    
+    return {
+        start: function() {
+            sandbox.publish('ready');
+        },
+        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());
+
+            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