docs/Script API/classes/Frontend_Script_API._internal_.NoteContext.html
Abstract class for all components in the Trilium's frontend.
Contains also event implementation with following properties:
triggerEvent()._position$widgetchildrencomponentIdhoistedNoteIdinitializedmainNtxIdnoteId?notePath?ntxIdparent?parentNoteId?viewScope?
notenotePathArraypositionsanitizedClassName
callMethodchildentitiesReloadedEventgetCodeEditorgetContentElementgetMainContextgetNavigationTitlegetPojoStategetResolvedNotePathgetSubContextsgetTextEditorgetTypeWidgethandleEventhandleEventInChildrenhasNoteListisActiveisEmptyisMainContextisReadOnlyresetViewScopesaveToRecentNotessetEmptysetHoistedNoteIdsetHoistedNoteIfNeededsetNotesetParenttimeouttriggerCommandtriggerEventunhoistgenerateNtxId
new NoteContext(
ntxId?: null | string,
hoistedNoteId?: string,
mainNtxId?: null | string,
): NoteContext
_position: number
$widget: JQuery<HTMLElement>
children: default[]
componentId: string
hoistedNoteId: string
initialized: null | Promise<void>
mainNtxId: null | string
OptionalnoteIdnoteId?: null | string
OptionalnotePathnotePath?: null | string
ntxId: null | string
Optionalparentparent?: TypedComponent<any>
OptionalparentNoteIdparentNoteId?: null | string
OptionalviewScopeviewScope?: ViewScope
get note(): null | FNote
get notePathArray(): string[]
get position(): number
set position(newPosition: number): void
get sanitizedClassName(): string
callMethod(
fun: (arg: unknown) => Promise<unknown>,
data: unknown,
): undefined | Promise<unknown>
child(...components: default[]): NoteContext
entitiesReloadedEvent(
__namedParameters: { loadResults: default },
): Promise<void>
getCodeEditor(): Promise<CodeMirrorInstance>
getContentElement(): Promise<JQuery<HTMLElement>>
Returns a promise which will retrieve the JQuery element of the content of this note context.
Do note that retrieving the content element needs to be handled by the type widget, which is the one which provides the content element by listening to the executeWithContentElement event. Not all note types support this.
If no content could be determined null is returned instead.
getMainContext(): NoteContext
See docs for isMainContext() for better explanation.
getNavigationTitle(): Promise<null | string>
getPojoState(): | null
| {
active: boolean;
hoistedNoteId: string;
mainNtxId: null
| string;
notePath: undefined | null | string;
ntxId: null | string;
viewScope: undefined | ViewScope;
}
getResolvedNotePath(inputNotePath: string): Promise<undefined | string>
getSubContexts(): NoteContext[]
getTextEditor(callback?: GetTextEditorCallback): Promise<TextEditor>
Optionalcallback: GetTextEditorCallbackgetTypeWidget(): Promise<default>
handleEvent<T extends EventNames>(
name: T,
data: EventData<T>,
): undefined | null | Promise<unknown>
handleEventInChildren<T extends EventNames>(
name: T,
data: EventData<T>,
): null | Promise<unknown>
hasNoteList(): null | boolean
isActive(): boolean
isEmpty(): boolean
isMainContext(): boolean
A main context represents a tab and also the first split. Further splits are the children contexts of the main context. Imagine you have a tab with 3 splits, each showing notes A, B, C (in this order). In such a scenario, A context is the main context (also representing the tab as a whole), and B, C are the children of context A.
true if the context is main (= tab)
isReadOnly(): Promise<null | boolean | 0>
resetViewScope(): void
saveToRecentNotes(resolvedNotePath: string): void
setEmpty(): void
setHoistedNoteId(noteIdToHoist: string): Promise<void>
setHoistedNoteIfNeeded(): Promise<void>
setNote(inputNotePath: undefined | string, opts?: SetNoteOpts): Promise<void>
setParent(parent: TypedComponent<any>): NoteContext
timeout<T>(promise: Promise<null | T>): Promise<T>
triggerCommand<K extends keyof CommandMappings>(
name: K,
data?: CommandMappings[K],
): undefined | null | Promise<unknown>
Optionaldata: CommandMappings[K]triggerEvent<T extends EventNames>(
name: T,
data: EventData<T>,
): undefined | null | Promise<unknown>
unhoist(): Promise<void>
StaticgenerateNtxIdgenerateNtxId(): string
Member Visibility
ThemeOSLightDark
Constructors constructor Properties _position$widgetchildrencomponentIdhoistedNoteIdinitializedmainNtxIdnoteIdnotePathntxIdparentparentNoteIdviewScope Accessors notenotePathArraypositionsanitizedClassName Methods callMethodchildentitiesReloadedEventgetCodeEditorgetContentElementgetMainContextgetNavigationTitlegetPojoStategetResolvedNotePathgetSubContextsgetTextEditorgetTypeWidgethandleEventhandleEventInChildrenhasNoteListisActiveisEmptyisMainContextisReadOnlyresetViewScopesaveToRecentNotessetEmptysetHoistedNoteIdsetHoistedNoteIfNeededsetNotesetParenttimeouttriggerCommandtriggerEventunhoistgenerateNtxId