Archived
1
0
This repository has been archived on 2020-12-10. You can view files and clone it, but cannot push or open issues or pull requests.
old/assets/js/core/theme.js
2018-10-16 18:28:42 +02:00

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;