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
chore(client/ts): port note_wrapper
Elian Doran2a90f4c6e984
diff --git a/src/public/app/services/load_results.ts b/src/public/app/services/load_results.tsindex f87f62ea2e..5ebfc7be5f 100644--- a/src/public/app/services/load_results.ts+++ b/src/public/app/services/load_results.ts@@ -158,7 +158,7 @@ export default class LoadResults {return Object.keys(this.noteIdToComponentId);}- isNoteReloaded(noteId: string | undefined, componentId: string | null = null) {+ isNoteReloaded(noteId: string | undefined | null, componentId: string | null = null) {if (!noteId) {return false;}diff --git a/src/public/app/widgets/note_wrapper.js b/src/public/app/widgets/note_wrapper.tssimilarity index 79%rename from src/public/app/widgets/note_wrapper.jsrename to src/public/app/widgets/note_wrapper.tsindex 9f045675c0..0dc7580a29 100644--- a/src/public/app/widgets/note_wrapper.js+++ b/src/public/app/widgets/note_wrapper.ts@@ -1,15 +1,21 @@import FlexContainer from "./containers/flex_container.js";import utils from "../services/utils.js";import attributeService from "../services/attributes.js";+import type BasicWidget from "./basic_widget.js";+import type { EventData } from "../components/app_context.js";+import type NoteContext from "../components/note_context.js";++export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {++ private noteContext?: NoteContext;-export default class NoteWrapperWidget extends FlexContainer {constructor() {super("column");this.css("flex-grow", "1").collapsible();}- setNoteContextEvent({ noteContext }) {+ setNoteContextEvent({ noteContext }: EventData<"setNoteContext">) {this.noteContext = noteContext;this.refresh();@@ -51,7 +57,7 @@ export default class NoteWrapperWidget extends FlexContainer {this.$widget.toggleClass("protected", note.isProtected);}- async entitiesReloadedEvent({ loadResults }) {+ async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {// listening on changes of note.type and CSS classconst noteId = this.noteContext?.noteId;