2 'libs/text!./template.html',
5 'modules/nodePane/metaWidget/metaWidget',
7 ], function(templateSrc, $, _, metaWidget, wlxmlUtils) {
11 return function(sandbox) {
13 var view = $(_.template(templateSrc)({tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames})),
16 view.on('change', 'select', function(e) {
17 var target = $(e.target);
18 var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'Tag' : 'Class',
19 value = target.val().replace(/-/g, '.');
21 if(attr === 'Class') {
22 //currentNode.document.transform('setClass', {node: currentNode, klass: value});
23 currentNode.transform('setAttr', {name: 'class', value: value});
25 //currentNode['set' + attr](value);
30 sandbox.publish('ready');
35 setNodeElement: function(wlxmlNodeElement) {
36 view.find('.rng-module-nodePane-tagSelect').val(wlxmlNodeElement.getTagName());
38 var escapedClassName = (wlxmlNodeElement.getClass() || '').replace(/\./g, '-');
39 view.find('.rng-module-nodePane-classSelect').val(escapedClassName);
41 var widget = metaWidget.create({attrs:wlxmlNodeElement.getMetaAttributes()});
42 widget.on('valueChanged', function(key, value) {
43 wlxmlNodeElement.setMetaAttribute(key, value);
45 view.find('.metaFields').empty().append(widget.el);
47 currentNode = wlxmlNodeElement;