mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-10-15 02:31:36 +08:00
refactor(client/ts): use separate interfaces for trigger data
This commit is contained in:
parent
be93380d03
commit
9d4841306f
@ -31,37 +31,63 @@ interface BeforeUploadListener extends Component {
|
|||||||
beforeUnloadEvent(): boolean;
|
beforeUnloadEvent(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TriggerData = {
|
interface ApiLogMessagesData {
|
||||||
noteId?: string;
|
noteId?: string;
|
||||||
noteIds?: string[];
|
noteIds?: string[];
|
||||||
messages?: unknown[];
|
messages?: unknown[];
|
||||||
} | {
|
}
|
||||||
|
|
||||||
|
interface FocusOnDetailData {
|
||||||
ntxId: string;
|
ntxId: string;
|
||||||
notePath?: string;
|
}
|
||||||
} | {
|
|
||||||
text: string;
|
interface SearchNotesData {
|
||||||
} | {
|
|
||||||
callback: (value: NoteDetailWidget | PromiseLike<NoteDetailWidget>) => void
|
|
||||||
} | {
|
|
||||||
// For "searchNotes"
|
|
||||||
searchString: string | undefined;
|
searchString: string | undefined;
|
||||||
} | {
|
}
|
||||||
// For "showDeleteNotesDialog"
|
|
||||||
|
interface ShowDeleteNotesDialogData {
|
||||||
branchIdsToDelete: string[];
|
branchIdsToDelete: string[];
|
||||||
callback: (value: ResolveOptions) => void;
|
callback: (value: ResolveOptions) => void;
|
||||||
forceDeleteAllClones: boolean;
|
forceDeleteAllClones: boolean;
|
||||||
} | {
|
}
|
||||||
// For "openedFileUpdated"
|
|
||||||
|
interface OpenedFileUpdatedData {
|
||||||
entityType: string;
|
entityType: string;
|
||||||
entityId: string;
|
entityId: string;
|
||||||
lastModifiedMs: number;
|
lastModifiedMs: number;
|
||||||
filePath: string;
|
filePath: string;
|
||||||
} | {
|
}
|
||||||
// For "focusAndSelectTitle"
|
|
||||||
|
interface FocusAndSelectTitleData {
|
||||||
isNewNote: boolean;
|
isNewNote: boolean;
|
||||||
}
|
}
|
||||||
| PromptDialogOptions // For "showPromptDialog"
|
|
||||||
| ConfirmWithMessageOptions // For "showConfirmDialog"
|
interface OpenNewNoteSplitData {
|
||||||
|
ntxId: string;
|
||||||
|
notePath: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ExecuteInActiveNoteDetailWidgetData {
|
||||||
|
callback: (value: NoteDetailWidget | PromiseLike<NoteDetailWidget>) => void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface AddTextToActiveEditorData {
|
||||||
|
text: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type TriggerData =
|
||||||
|
ApiLogMessagesData // For "api-log-messages"
|
||||||
|
| FocusOnDetailData // For "focusOnDetail"
|
||||||
|
| SearchNotesData // For "searchNotes"
|
||||||
|
| ShowDeleteNotesDialogData // For "showDeleteNotesDialog"
|
||||||
|
| OpenedFileUpdatedData // For "openedFileUpdated"
|
||||||
|
| FocusAndSelectTitleData // For "focusAndSelectTitle"
|
||||||
|
| PromptDialogOptions // For "showPromptDialog"
|
||||||
|
| ConfirmWithMessageOptions // For "showConfirmDialog"
|
||||||
|
| OpenNewNoteSplitData // For "openNewNoteSplit"
|
||||||
|
| ExecuteInActiveNoteDetailWidgetData // For "executeInActiveNoteDetailWidget"
|
||||||
|
| AddTextToActiveEditorData // For "addTextToActiveEditor"
|
||||||
|
;
|
||||||
|
|
||||||
class AppContext extends Component {
|
class AppContext extends Component {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user