You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					31 lines
				
				602 B
			
		
		
			
		
	
	
					31 lines
				
				602 B
			| 
								 
											4 years ago
										 
									 | 
							
								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;
							 |