fnp
/
fnpeditor.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Represent empty wlxml nodes as DocumentNodeElement with empty DocumentTextElement
[fnpeditor.git]
/
modules
/
nodePane
/
nodePane.js
diff --git
a/modules/nodePane/nodePane.js
b/modules/nodePane/nodePane.js
index
39afbea
..
b723e68
100644
(file)
--- a/
modules/nodePane/nodePane.js
+++ b/
modules/nodePane/nodePane.js
@@
-2,19
+2,20
@@
define([
'libs/text!./template.html',
'libs/jquery-1.9.1.min',
'libs/underscore-min',
'libs/text!./template.html',
'libs/jquery-1.9.1.min',
'libs/underscore-min',
-'modules/nodePane/metaWidget/metaWidget'
-], function(templateSrc, $, _, metaWidget) {
+'modules/nodePane/metaWidget/metaWidget',
+'utils/wlxml'
+], function(templateSrc, $, _, metaWidget, wlxmlUtils) {
'use strict';
return function(sandbox) {
'use strict';
return function(sandbox) {
- var view = $(_.template(templateSrc)());
+ var view = $(_.template(templateSrc)(
{tagNames: wlxmlUtils.wlxmlTagNames, classNames: wlxmlUtils.wlxmlClassNames}
));
view.on('change', 'select', function(e) {
var target = $(e.target);
var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'tag' : 'class';
view.on('change', 'select', function(e) {
var target = $(e.target);
var attr = target.attr('class').split('-')[3] === 'tagSelect' ? 'tag' : 'class';
- sandbox.publish('node
Changed', attr, target.val(
));
+ sandbox.publish('node
ElementChange', attr, target.val().replace(/-/g, '.'
));
});
return {
});
return {
@@
-24,13
+25,15
@@
return function(sandbox) {
getView: function() {
return view;
},
getView: function() {
return view;
},
- setNode: function(canvasNode) {
- view.find('.rng-module-nodePane-tagSelect').val(canvasNode.getTag());
- view.find('.rng-module-nodePane-classSelect').val(canvasNode.getClass());
+ setNodeElement: function(nodeElement) {
+ view.find('.rng-module-nodePane-tagSelect').val(nodeElement.getWlxmlTag());
- var widget = metaWidget.create({attrs:canvasNode.getMetaAttrs()});
+ var escapedClassName = (nodeElement.getWlxmlClass() || '').replace(/\./g, '-')
+ view.find('.rng-module-nodePane-classSelect').val(escapedClassName);
+
+ var widget = metaWidget.create({attrs:nodeElement.getWlxmlMetaAttrs()});
widget.on('valueChanged', function(key, value) {
widget.on('valueChanged', function(key, value) {
- sandbox.publish('node
Changed
', key, value);
+ sandbox.publish('node
ElementChange
', key, value);
});
view.find('.metaFields').empty().append(widget.el);
}
});
view.find('.metaFields').empty().append(widget.el);
}