mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 13:01:31 +08:00 
			
		
		
		
	accept custom widgets as classes instead of instances, #4274
This commit is contained in:
		
							parent
							
								
									2e69cc8331
								
							
						
					
					
						commit
						528d94a8fb
					
				| @ -53,7 +53,15 @@ class WidgetsByParent { | ||||
|     } | ||||
| 
 | ||||
|     get(parentName) { | ||||
|         return this.byParent[parentName] || []; | ||||
|         if (!this.byParent[parentName]) { | ||||
|             return []; | ||||
|         } | ||||
| 
 | ||||
|         return this.byParent[parentName] | ||||
|             // previously, custom widgets were provided as a single instance, but that has the disadvantage
 | ||||
|             // for splits where we actually need multiple instaces and thus having a class to instantiate is better
 | ||||
|             // https://github.com/zadam/trilium/issues/4274
 | ||||
|             .map(w => w.prototype ? new w() : w); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam