1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88 | 1×
1×
1×
1×
151×
151×
151×
151×
151×
151×
151×
151×
151×
151×
151×
151×
151×
1×
151×
151×
151×
1×
151×
151×
151×
1×
70×
70×
70×
1×
2×
1×
30×
1×
11×
1×
229×
41×
41×
65×
65×
23×
23×
66×
66×
8×
8×
20×
20×
20×
20×
3×
3×
3×
3×
1×
70×
70×
1×
1×
| define(["require", "exports", "@syncfusion/ej2-base", "./constant", "./../plugin/lists", "./../plugin/formats", "./../plugin/md-selection-formats", "./../plugin/markdown-selection", "@syncfusion/ej2-base", "./../../common/config", "./../plugin/undo", "./../plugin/link", "./../plugin/table", "./../../common/constant", "./../plugin/clearformat", "./../plugin/insert-text"], function (require, exports, ej2_base_1, CONSTANT, lists_1, formats_1, md_selection_formats_1, markdown_selection_1, ej2_base_2, config_1, undo_1, link_1, table_1, EVENTS, clearformat_1, insert_text_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MarkdownParser = (function () {
function MarkdownParser(options) {
this.initialize();
ej2_base_2.extend(this, this, options, true);
this.observer = new ej2_base_1.Observer(this);
this.markdownSelection = new markdown_selection_1.MarkdownSelection();
this.listObj = new lists_1.MDLists({ parent: this, syntax: this.listTags });
this.formatObj = new formats_1.MDFormats({ parent: this, syntax: this.formatTags });
this.undoRedoManager = new undo_1.UndoRedoCommands(this, options.options);
this.mdSelectionFormats = new md_selection_formats_1.MDSelectionFormats({ parent: this, syntax: this.selectionTags });
this.linkObj = new link_1.MDLink(this);
this.tableObj = new table_1.MDTable({ parent: this, syntaxTag: ({ Formats: this.formatTags, List: this.listTags }) });
this.clearObj = new clearformat_1.ClearFormat(this);
this.insertTextObj = new insert_text_1.MDInsertText(this);
this.wireEvents();
}
MarkdownParser.prototype.initialize = function () {
this.formatTags = config_1.markdownFormatTags;
this.listTags = config_1.markdownListsTags;
this.selectionTags = config_1.markdownSelectionTags;
};
MarkdownParser.prototype.wireEvents = function () {
this.observer.on(EVENTS.KEY_DOWN, this.editorKeyDown, this);
this.observer.on(EVENTS.KEY_UP, this.editorKeyUp, this);
this.observer.on(EVENTS.MODEL_CHANGED, this.onPropertyChanged, this);
};
MarkdownParser.prototype.unwireEvents = function () {
this.observer.off(EVENTS.KEY_DOWN, this.editorKeyDown);
this.observer.off(EVENTS.KEY_UP, this.editorKeyUp);
this.observer.off(EVENTS.MODEL_CHANGED, this.onPropertyChanged);
};
MarkdownParser.prototype.onPropertyChanged = function (props) {
this.observer.notify(EVENTS.MODEL_CHANGED_PLUGIN, props);
};
MarkdownParser.prototype.editorKeyDown = function (e) {
this.observer.notify(EVENTS.KEY_DOWN_HANDLER, e);
};
MarkdownParser.prototype.editorKeyUp = function (e) {
this.observer.notify(EVENTS.KEY_UP_HANDLER, e);
};
MarkdownParser.prototype.execCommand = function (command, value, event, callBack, text, exeValue) {
switch (command.toLocaleLowerCase()) {
case 'lists':
this.observer.notify(CONSTANT.LISTS_COMMAND, { subCommand: value, event: event, callBack: callBack });
break;
case 'formats':
this.observer.notify(EVENTS.FORMAT_TYPE, { subCommand: value, event: event, callBack: callBack });
break;
case 'actions':
this.observer.notify(EVENTS.ACTION, { subCommand: value, event: event, callBack: callBack });
break;
case 'style':
case 'effects':
case 'casing':
this.observer.notify(CONSTANT.selectionCommand, { subCommand: value, event: event, callBack: callBack });
break;
case 'links':
case 'images':
this.observer.notify(CONSTANT.LINK_COMMAND, { subCommand: value, event: event, callBack: callBack, item: exeValue });
break;
case 'table':
switch (value.toString().toLocaleLowerCase()) {
case 'createtable':
this.observer.notify(CONSTANT.MD_TABLE, { subCommand: value, item: exeValue, event: event, callBack: callBack });
break;
}
break;
case 'clear':
this.observer.notify(CONSTANT.CLEAR_COMMAND, { subCommand: value, event: event, callBack: callBack });
break;
case 'inserttext':
this.observer.notify(CONSTANT.INSERT_TEXT_COMMAND, { subCommand: value, event: event, callBack: callBack,
value: { text: exeValue } });
break;
}
};
MarkdownParser.prototype.destroy = function () {
this.observer.notify(EVENTS.INTERNAL_DESTROY, {});
this.unwireEvents();
};
return MarkdownParser;
}());
exports.MarkdownParser = MarkdownParser;
});
|