source: main/trunk/greenstone3/web/interfaces/oran/js/annotator/pkg/annotator.markdown.min.js@ 24771

Last change on this file since 24771 was 24771, checked in by papitha, 13 years ago

Changes to JS

File size: 1.4 KB
Line 
1(function() {
2 var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
3 for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
4 function ctor() { this.constructor = child; }
5 ctor.prototype = parent.prototype;
6 child.prototype = new ctor;
7 child.__super__ = parent.prototype;
8 return child;
9 };
10 Annotator.Plugin.Markdown = (function() {
11 __extends(Markdown, Annotator.Plugin);
12 Markdown.prototype.events = {
13 'annotationViewerTextField': 'updateTextField'
14 };
15 function Markdown(element, options) {
16 this.updateTextField = __bind(this.updateTextField, this); 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("To use the Markdown plugin, you must include Showdown into the page first.");
21 }
22 }
23 Markdown.prototype.updateTextField = function(field, annotation) {
24 var text;
25 text = Annotator.$.escape(annotation.text || '');
26 return $(field).html(this.convert(text));
27 };
28 Markdown.prototype.convert = function(text) {
29 return this.converter.makeHtml(text);
30 };
31 return Markdown;
32 })();
33}).call(this);
Note: See TracBrowser for help on using the repository browser.