mirror of
https://github.com/zadam/trilium.git
synced 2025-12-22 23:34:25 +01:00
refactor(client/bundle): use type for parent name
This commit is contained in:
parent
e0416097e1
commit
64a770175f
@ -33,6 +33,8 @@ async function getAndExecuteBundle(noteId: string, originEntity = null, script =
|
|||||||
return await executeBundle(bundle, originEntity);
|
return await executeBundle(bundle, originEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type ParentName = "left-pane" | "center-pane" | "note-detail-pane" | "right-pane";
|
||||||
|
|
||||||
export async function executeBundle(bundle: Bundle, originEntity?: Entity | null, $container?: JQuery<HTMLElement>) {
|
export async function executeBundle(bundle: Bundle, originEntity?: Entity | null, $container?: JQuery<HTMLElement>) {
|
||||||
const apiContext = await ScriptContext(bundle.noteId, bundle.allNoteIds, originEntity, $container);
|
const apiContext = await ScriptContext(bundle.noteId, bundle.allNoteIds, originEntity, $container);
|
||||||
|
|
||||||
@ -88,7 +90,7 @@ export class WidgetsByParent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get(parentName: string) {
|
get(parentName: ParentName) {
|
||||||
if (!this.legacyWidgets[parentName]) {
|
if (!this.legacyWidgets[parentName]) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@ -102,7 +104,7 @@ export class WidgetsByParent {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPreactWidgets(parentName: string) {
|
getPreactWidgets(parentName: ParentName) {
|
||||||
return this.preactWidgets[parentName] ?? [];
|
return this.preactWidgets[parentName] ?? [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user