koblog/bl-plugins/quill/quill-1.3.6/core/theme.js
2018-10-18 19:21:57 +02:00

30 lines
602 B
JavaScript
Executable file

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;