1 | class Theme {
|
2 | constructor(quill, options) {
|
3 | this.quill = quill;
|
4 | this.options = options;
|
5 | this.modules = {};
|
6 | }
|
7 |
|
8 | init() {
|
9 | Object.keys(this.options.modules).forEach((name) => {
|
10 | if (this.modules[name] == null) {
|
11 | this.addModule(name);
|
12 | }
|
13 | });
|
14 | }
|
15 |
|
16 | addModule(name) {
|
17 | let moduleClass = this.quill.constructor.import(`modules/${name}`);
|
18 | this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
|
19 | return this.modules[name];
|
20 | }
|
21 | }
|
22 | Theme.DEFAULTS = {
|
23 | modules: {}
|
24 | };
|
25 | Theme.themes = {
|
26 | 'default': Theme
|
27 | };
|
28 |
|
29 |
|
30 | export default Theme;
|