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})),
17 view.on('change', 'select', function(e) {
18 var target = $(e.target);
19 var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'Tag' : 'Class',
20 value = target.val().replace(/-/g, '.');
21 currentNode['set' + attr](value);
28 sandbox.publish('ready');
33 setNodeElement: function(wlxmlNodeElement) {
34 if(wlxmlNodeElement) {
37 wlxmlNodeElement.document.on('change', function(event) {
38 if(event.type === 'nodeAttrChange' && event.meta.node.sameNode(currentNode)) {
39 module.setNodeElement(currentNode);
45 view.find('.rng-module-nodePane-tagSelect').attr('disabled', false).val(wlxmlNodeElement.getTagName());
47 var escapedClassName = (wlxmlNodeElement.getClass() || '').replace(/\./g, '-');
48 view.find('.rng-module-nodePane-classSelect').attr('disabled', false).val(escapedClassName);
50 var attrs = _.extend(wlxmlNodeElement.getMetaAttributes(), wlxmlNodeElement.getOtherAttributes());
51 var widget = metaWidget.create({attrs:attrs});
52 widget.on('valueChanged', function(key, value) {
53 wlxmlNodeElement.setMetaAttribute(key, value);
54 //wlxmlNodeElement.setMetaAttribute(key, value);
56 view.find('.metaFields').empty().append(widget.el);
58 view.find('.rng-module-nodePane-tagSelect').attr('disabled', true).val('');
59 view.find('.rng-module-nodePane-classSelect').attr('disabled', true).val('');
60 view.find('.metaFields').empty();
62 currentNode = wlxmlNodeElement;