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 currentNode['set' + attr](value);
26 sandbox.publish('ready');
31 setNodeElement: function(wlxmlNodeElement) {
32 view.find('.rng-module-nodePane-tagSelect').val(wlxmlNodeElement.getTagName());
34 var escapedClassName = (wlxmlNodeElement.getClass() || '').replace(/\./g, '-');
35 view.find('.rng-module-nodePane-classSelect').val(escapedClassName);
37 var widget = metaWidget.create({attrs:wlxmlNodeElement.getMetaAttributes()});
38 widget.on('valueChanged', function(key, value) {
39 wlxmlNodeElement.setMetaAttribute(key, value);
41 view.find('.metaFields').empty().append(widget.el);
43 currentNode = wlxmlNodeElement;