From c9c18146f4e5b2885075d0c01f7bad960aba5f37 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Mon, 3 Mar 2025 23:15:58 +0100 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20refactor=20serval=20?= =?UTF-8?q?event=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit refactore serval event names to follow the current usage in repo --- src/public/app/components/app_context.ts | 5 +---- src/public/app/widgets/buttons/close_pane_button.ts | 2 +- src/public/app/widgets/floating_buttons/code_buttons.ts | 2 +- src/public/app/widgets/note_context_aware_widget.ts | 2 +- src/public/app/widgets/tab_row.ts | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts index 105af75f6..cde4f217a 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 09e9aef11..1f34b6a35 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 ca6491f76..496688f9d 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 639061f38..f43030ed8 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 b2cf11fd8..0f60a9c2e 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;