source: OKFNAnnotator (for Zope)/annotator_files/lib/plugin/markdown.js @ 4:6979313586cf

Last change on this file since 4:6979313586cf was 4:6979313586cf, checked in by casties, 12 years ago

new version of annotator.

File size: 1.4 KB
Line 
1// Generated by CoffeeScript 1.3.3
2var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
3  __hasProp = {}.hasOwnProperty,
4  __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
5
6Annotator.Plugin.Markdown = (function(_super) {
7
8  __extends(Markdown, _super);
9
10  Markdown.prototype.events = {
11    'annotationViewerTextField': 'updateTextField'
12  };
13
14  function Markdown(element, options) {
15    this.updateTextField = __bind(this.updateTextField, this);
16    if ((typeof Showdown !== "undefined" && Showdown !== null ? Showdown.converter : void 0) != null) {
17      Markdown.__super__.constructor.apply(this, arguments);
18      this.converter = new Showdown.converter();
19    } else {
20      console.error(Annotator._t("To use the Markdown plugin, you must include Showdown into the page first."));
21    }
22  }
23
24  Markdown.prototype.updateTextField = function(field, annotation) {
25    var text;
26    text = Annotator.$.escape(annotation.text || '');
27    return $(field).html(this.convert(text));
28  };
29
30  Markdown.prototype.convert = function(text) {
31    return this.converter.makeHtml(text);
32  };
33
34  return Markdown;
35
36})(Annotator.Plugin);
Note: See TracBrowser for help on using the repository browser.