define(function(require) {
'use strict';
-var $ = require('libs/jquery');
+var $ = require('libs/jquery'),
+ genericElement = require('modules/documentCanvas/canvas/genericElement'), // TODO: This should be accessible via plugin infrastructure
+ linkElement = require('./links/linkElement'),
+ imgElement = require('./img/imgElement')
+ ;
var widgets = {
footnoteHandler: function(clickHandler) {
};
-var comment = {
+var comment = Object.create(genericElement);
+$.extend(comment, {
init: function() {
- this.super.init.call(this);
+ genericElement.init.call(this);
this.commentAdnotation = widgets.commentAdnotation(this.wlxmlNode);
this.addWidget(this.commentAdnotation, 'show');
this.commentAdnotation.DOM.show();
onMetadataRemoved: function(event) {
return this.onMetadataChanged(event);
}
-};
+});
-var footnote = {
+var footnote = Object.create(genericElement);
+$.extend(footnote, {
init: function() {
- this.super.init.call(this);
+ genericElement.init.call(this);
var clickHandler = function() {
this.toggle(true);
}.bind(this);
}
this._container().toggle(toggle);
if(!options.silent) {
- this.trigger('elementToggled', toggle, this.documentElement);
+ this.trigger('elementToggled', toggle, this);
}
}
-};
+});
return [
- {tag: 'aside', klass: 'comment', prototype: comment, extending: {tag: 'div'}},
- {tag: 'aside', klass: 'footnote', prototype: footnote, extending: {tag: 'aside'}}
+ {tag: 'aside', klass: 'comment', prototype: null},
+ {tag: 'aside', klass: 'footnote', prototype: footnote},
+ {tag: 'span', klass: 'link', prototype: linkElement},
+ {tag: 'div', klass: 'img', prototype: imgElement}
];