X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/e0aad96df245c7148966887cbcc77417a4b7675b..dec5a3d8b3a4cc70a9b2bc7bc1305ba0ae11a369:/src/editor/plugins/core/canvasElements.js diff --git a/src/editor/plugins/core/canvasElements.js b/src/editor/plugins/core/canvasElements.js index b0f51b6..229cd47 100644 --- a/src/editor/plugins/core/canvasElements.js +++ b/src/editor/plugins/core/canvasElements.js @@ -1,8 +1,10 @@ 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'); var widgets = { footnoteHandler: function(clickHandler) { @@ -53,9 +55,10 @@ var widgets = { }; -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(); @@ -70,11 +73,12 @@ var comment = { 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); @@ -100,15 +104,16 @@ var footnote = { } 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: comment}, + {tag: 'aside', klass: 'footnote', prototype: footnote}, + {tag: 'span', klass: 'link', prototype: linkElement} ];