-var generic = {
- onNodeAttrChange: function(event) {
- if(event.meta.attr === 'class') {
- this.setWlxmlClass(event.meta.newVal); //
+var generic = Object.create(DocumentNodeElement.prototype);
+
+$.extend(generic, {
+ init: function() {
+ DocumentNodeElement.prototype.init.call(this);
+ this._container()
+ .attr('wlxml-tag', this.wlxmlNode.getTagName())
+ .attr('wlxml-class', this.wlxmlNode.getClass().replace(/\./g, '-'));
+
+ this.wlxmlNode.contents().forEach(function(node) {
+ var el = this.canvas.createElement(node);
+ if(el.dom) {
+ this._container().append(el.dom);
+ }
+ }.bind(this));
+
+ this.commentsView = new CommentsView(this.wlxmlNode, this.canvas.metadata.user);
+ this.addToGutter(this.commentsView);
+ this.commentTip = $('<div class="comment-tip"><i class="icon-comment"></i></div>');
+ this.addWidget(this.commentTip);
+
+ if(!this.wlxmlNode.hasChild({klass: 'comment'})) {
+ this.commentTip.hide();