Skip to content

Commit

Permalink
accept custom widgets as classes instead of instances, #4274
Browse files Browse the repository at this point in the history
  • Loading branch information
zadam committed Sep 25, 2023
1 parent 2e69cc8 commit 528d94a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/public/app/services/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down

0 comments on commit 528d94a

Please sign in to comment.