31 lines
602 B
JavaScript
31 lines
602 B
JavaScript
|
class Theme {
|
||
|
constructor(quill, options) {
|
||
|
this.quill = quill;
|
||
|
this.options = options;
|
||
|
this.modules = {};
|
||
|
}
|
||
|
|
||
|
init() {
|
||
|
Object.keys(this.options.modules).forEach((name) => {
|
||
|
if (this.modules[name] == null) {
|
||
|
this.addModule(name);
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
addModule(name) {
|
||
|
let moduleClass = this.quill.constructor.import(`modules/${name}`);
|
||
|
this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
|
||
|
return this.modules[name];
|
||
|
}
|
||
|
}
|
||
|
Theme.DEFAULTS = {
|
||
|
modules: {}
|
||
|
};
|
||
|
Theme.themes = {
|
||
|
'default': Theme
|
||
|
};
|
||
|
|
||
|
|
||
|
export default Theme;
|