'use strict';
-var documentElement = require('./documentElement'),
+var $ = require('libs/jquery'),
+ documentElement = require('./documentElement'),
utils = require('./utils'),
wlxmlUtils = require('utils/wlxml');
};
void(labelWidget); // for linters; labelWidget is unused on purpose for now
+var DocumentNodeElement = documentElement.DocumentNodeElement;
-var generic = {
+var generic = Object.create(DocumentNodeElement.prototype);
+
+$.extend(generic, {
onNodeAttrChange: function(event) {
if(event.meta.attr === 'class') {
this.setWlxmlClass(event.meta.newVal); //
} else {
element = this.canvas.createElement(param);
}
- this._container().prepend(element.dom());
+ this._container().prepend(element.dom);
this.refreshPath();
return element;
},
this.refreshPath();
},
init: function() {
+ DocumentNodeElement.prototype.init.call(this);
this._container()
.attr('wlxml-tag', this.wlxmlNode.getTagName());
this.setWlxmlClass(this.wlxmlNode.getClass());
this.wlxmlNode.contents().forEach(function(node) {
- this._container().append(this.canvas.createElement(node).dom());
+ this._container().append(this.canvas.createElement(node).dom);
}.bind(this));
+ this.refresh();
+
+ },
+ refresh: function() {
+ if(this.wlxmlNode.getTagName() === 'span') {
+ if(this.containsBlock()) {
+ this.displayAsBlock();
+ } else {
+ this.displayInline();
+ }
+ } else {
+ this.displayAsBlock();
+ }
},
containsBlock: function() {
return this.children()
});
return toret;
},
-};
+});
return generic;