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('smartxml.setAttr', {name: 'class', value: value});
25 //currentNode['set' + attr](value);
30 sandbox.publish('ready');
35 setNodeElement: function(wlxmlNodeElement) {
38 wlxmlNodeElement.document.on('change', function(event) {
39 if(event.type === 'nodeAttrChange' && event.meta.node.sameNode(currentNode)) {
40 module.setNodeElement(currentNode);
45 view.find('.rng-module-nodePane-tagSelect').val(wlxmlNodeElement.getTagName());
47 var escapedClassName = (wlxmlNodeElement.getClass() || '').replace(/\./g, '-');
48 view.find('.rng-module-nodePane-classSelect').val(escapedClassName);
50 var widget = metaWidget.create({attrs:wlxmlNodeElement.getMetaAttributes()});
51 widget.on('valueChanged', function(key, value) {
52 wlxmlNodeElement.transform('wlxml.setMetaAttribute', {name: key, value: value});
53 //wlxmlNodeElement.setMetaAttribute(key, value);
55 view.find('.metaFields').empty().append(widget.el);
57 currentNode = wlxmlNodeElement;