Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(note_list): use object for constructor arg
Elian Doranf8e10f36db09
diff --git a/apps/client/src/services/note_list_renderer.ts b/apps/client/src/services/note_list_renderer.tsindex 9518c3b799..3219d8d927 100644--- a/apps/client/src/services/note_list_renderer.ts+++ b/apps/client/src/services/note_list_renderer.ts@@ -12,14 +12,8 @@ export default class NoteListRenderer {private viewType: ViewTypeOptions;public viewMode: ViewMode<any> | null;- constructor($parent: JQuery<HTMLElement>, parentNote: FNote, noteIds: string[], showNotePath: boolean = false) {- this.viewType = this.#getViewType(parentNote);- const args: ViewModeArgs = {- $parent,- parentNote,- noteIds,- showNotePath- };+ constructor(args: ViewModeArgs) {+ this.viewType = this.#getViewType(args.parentNote);switch (this.viewType) {case "list":diff --git a/apps/client/src/widgets/note_list.ts b/apps/client/src/widgets/note_list.tsindex ba1a028f2f..c49e4870c1 100644--- a/apps/client/src/widgets/note_list.ts+++ b/apps/client/src/widgets/note_list.ts@@ -76,7 +76,11 @@ export default class NoteListWidget extends NoteContextAwareWidget {}async renderNoteList(note: FNote) {- const noteListRenderer = new NoteListRenderer(this.$content, note, note.getChildNoteIds());+ const noteListRenderer = new NoteListRenderer({+ $parent: this.$content,+ parentNote: note,+ noteIds: note.getChildNoteIds()+ });this.$widget.toggleClass("full-height", noteListRenderer.isFullHeight);await noteListRenderer.renderList();this.viewMode = noteListRenderer.viewMode;