-
Notifications
You must be signed in to change notification settings - Fork 397
/
index.js
85 lines (60 loc) · 2.11 KB
/
index.js
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
"use strict";
require("./icons/sir-trevor-icons.svg");
// ES6 shims
require('object.assign').shim();
require('array.prototype.find').shim();
require('./vendor/array-includes'); // shims ES7 Array.prototype.includes
require('es6-promise').polyfill();
// Old IE support
require('./vendor/custom-event')
require('./vendor/ie-classlist-toggle');
require('./vendor/dom-shims');
var utils = require('./utils');
var SirTrevor = {
config: require('./config'),
log: utils.log,
Locales: require('./locales'),
Events: require('./events'),
EventBus: require('./event-bus'),
EditorStore: require('./extensions/editor-store'),
Submittable: require('./extensions/submittable'),
FileUploader: require('./extensions/file-uploader'),
BlockMixins: require('./block_mixins'),
BlockPositioner: require('./block-positioner'),
BlockPositionerSelect: require('./block-positioner-select'),
BlockReorder: require('./block-reorder'),
BlockDeletion: require('./block-deletion'),
BlockValidations: require('./block-validations'),
BlockStore: require('./block-store'),
BlockManager: require('./block-manager'),
SimpleBlock: require('./simple-block'),
Block: require('./block'),
Blocks: require('./blocks'),
FormatBar: require('./format-bar'),
Editor: require('./editor'),
toMarkdown: require('./to-markdown'),
toHTML: require('./to-html'),
setDefaults: function(options) {
Object.assign(SirTrevor.config.defaults, options || {});
},
getInstance: utils.getInstance,
setBlockOptions: function(type, options) {
var block = SirTrevor.Blocks[type];
if (typeof block === "undefined") {
return;
}
Object.assign(block.prototype, options || {});
},
runOnAllInstances: function(method) {
if (SirTrevor.Editor.prototype.hasOwnProperty(method)) {
var methodArgs = Array.prototype.slice.call(arguments, 1);
Array.prototype.forEach.call(SirTrevor.config.instances, function(i) {
i[method].apply(null, methodArgs);
});
} else {
SirTrevor.log("method doesn't exist");
}
},
};
Object.assign(SirTrevor, require('./form-events'));
module.exports = SirTrevor;