Converting end of lines from crlf to lf
[fnpeditor.git] / modules / nodePane / nodePane.js
1 define([
2 'libs/text!./template.html',
3 'libs/jquery-1.9.1.min',
4 'libs/underscore-min',
5
6 ], function(templateSrc, $, _) {
7
8 'use strict';
9
10 return function(sandbox) {
11     
12     var view = $(_.template(templateSrc)());
13     
14     view.on('change', 'select', function(e) {
15         var target = $(e.target);
16         var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'tag' : 'class';
17         sandbox.publish('nodeChanged', attr, target.val());
18     });
19     
20     return {
21         start: function() {
22             sandbox.publish('ready');
23         },
24         getView: function() {
25             return view;
26         },
27         setNode: function(canvasNode) {
28             view.find('.rng-module-nodePane-tagSelect').val(canvasNode.getTag());
29             view.find('.rng-module-nodePane-classSelect').val(canvasNode.getClass());
30         }
31     };
32     
33 };
34
35 });