2 'libs/text!./template.html',
5 'modules/nodePane/metaWidget/metaWidget',
7 ], function(templateSrc, $, _, metaWidget, wlxmlUtils) {
11 return function(sandbox) {
13 var view = $(_.template(templateSrc)({utils: wlxmlUtils})),
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, '.');
20 currentNode['set' + attr](value);
25 sandbox.publish('ready');
30 setNodeElement: function(wlxmlNodeElement) {
33 wlxmlNodeElement.document.on('change', function(event) {
34 if(event.type === 'nodeAttrChange' && event.meta.node.sameNode(currentNode)) {
35 module.setNodeElement(currentNode);
40 view.find('.rng-module-nodePane-tagSelect').val(wlxmlNodeElement.getTagName());
42 var escapedClassName = (wlxmlNodeElement.getClass() || '').replace(/\./g, '-');
43 view.find('.rng-module-nodePane-classSelect').val(escapedClassName);
45 var attrs = _.extend(wlxmlNodeElement.getMetaAttributes(), wlxmlNodeElement.getOtherAttributes());
46 var widget = metaWidget.create({attrs:attrs});
47 widget.on('valueChanged', function(key, value) {
48 wlxmlNodeElement.setMetaAttribute(key, value);
49 //wlxmlNodeElement.setMetaAttribute(key, value);
51 view.find('.metaFields').empty().append(widget.el);
53 currentNode = wlxmlNodeElement;