Skip to content

Build your personal knowledge base with Trilium Notes

refactor: 💡 refactor serval event names

Jinc9c18146f4e5
diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts
index 105af75f65..cde4f217aa 100644
--- a/src/public/app/components/app_context.ts
+++ b/src/public/app/components/app_context.ts
@@ -303,9 +303,6 @@ type EventMappings = {
setNoteContext: {
noteContext: NoteContext;
};
- noteTypeMimeChangedEvent: {
- noteId: string;
- };
reEvaluateHighlightsListWidgetVisibility: {
noteId: string | undefined;
};
@@ -333,7 +330,7 @@ type EventMappings = {
noteDetailRefreshed: {
ntxId?: string | null;
};
- noteContextReorderEvent: {
+ noteContextReorder: {
oldMainNtxId: string;
newMainNtxId: string;
ntxIdsInOrder: string[];
diff --git a/src/public/app/widgets/buttons/close_pane_button.ts b/src/public/app/widgets/buttons/close_pane_button.ts
index 09e9aef119..1f34b6a352 100644
--- a/src/public/app/widgets/buttons/close_pane_button.ts
+++ b/src/public/app/widgets/buttons/close_pane_button.ts
@@ -12,7 +12,7 @@ export default class ClosePaneButton extends OnClickButtonWidget {
);
}
- async noteContextReorderEvent({ ntxIdsInOrder }: EventData<"noteContextReorderEvent">) {
+ async noteContextReorderEvent({ ntxIdsInOrder }: EventData<"noteContextReorder">) {
this.refresh();
}
diff --git a/src/public/app/widgets/floating_buttons/code_buttons.ts b/src/public/app/widgets/floating_buttons/code_buttons.ts
index ca6491f767..496688f9db 100644
--- a/src/public/app/widgets/floating_buttons/code_buttons.ts
+++ b/src/public/app/widgets/floating_buttons/code_buttons.ts
@@ -85,7 +85,7 @@ export default class CodeButtonsWidget extends NoteContextAwareWidget {
this.$openTriliumApiDocsButton.toggle(note.mime.startsWith("application/javascript;env="));
}
- async noteTypeMimeChangedEvent({ noteId }: EventData<"noteTypeMimeChangedEvent">) {
+ async noteTypeMimeChangedEvent({ noteId }: EventData<"noteTypeMimeChanged">) {
if (this.isNote(noteId)) {
await this.refresh();
}
diff --git a/src/public/app/widgets/note_context_aware_widget.ts b/src/public/app/widgets/note_context_aware_widget.ts
index 639061f38e..f43030ed86 100644
--- a/src/public/app/widgets/note_context_aware_widget.ts
+++ b/src/public/app/widgets/note_context_aware_widget.ts
@@ -119,7 +119,7 @@ class NoteContextAwareWidget extends BasicWidget {
this.noteContext = noteContext;
}
- async noteTypeMimeChangedEvent({ noteId }: EventData<"noteTypeMimeChangedEvent">) {
+ async noteTypeMimeChangedEvent({ noteId }: EventData<"noteTypeMimeChanged">) {
if (this.isNote(noteId)) {
await this.refresh();
}
diff --git a/src/public/app/widgets/tab_row.ts b/src/public/app/widgets/tab_row.ts
index b2cf11fd83..0f60a9c2e3 100644
--- a/src/public/app/widgets/tab_row.ts
+++ b/src/public/app/widgets/tab_row.ts
@@ -638,7 +638,7 @@ export default class TabRowWidget extends BasicWidget {
this.updateTabById(noteContext.mainNtxId || noteContext.ntxId);
}
- noteContextReorderEvent({ oldMainNtxId, newMainNtxId }: EventData<"noteContextReorderEvent">) {
+ noteContextReorderEvent({ oldMainNtxId, newMainNtxId }: EventData<"noteContextReorder">) {
if (!oldMainNtxId || !newMainNtxId) {
// no need to update tab row
return;