Trilium Frontend API
    Preparing search index...

    Class NoteContext

    Abstract class for all components in the Trilium's frontend.

    Contains also event implementation with following properties:

    • event / command distribution is synchronous which among others mean that events are well-ordered - event which was sent out first will also be processed first by the component
    • execution of the event / command is asynchronous - each component executes the event on its own without regard for other components.
    • although the execution is async, we are collecting all the promises, and therefore it is possible to wait until the event / command is executed in all components - by simply awaiting the triggerEvent().

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    • Parameters

      • OptionalntxId: string
      • OptionalhoistedNoteId: string
      • OptionalmainNtxId: string

      Returns NoteContext

    Properties

    _position: number
    $widget: any
    children: default[]
    componentId: string
    hoistedNoteId: string
    initialized: Promise<void>
    mainNtxId: string
    noteId?: string
    notePath?: string
    ntxId: string
    parent?: TypedComponent<any>
    parentNoteId?: string
    viewScope?: ViewScope

    Accessors

    • get note(): FNote

      Returns FNote

    • get notePathArray(): string[]

      Returns string[]

    • get position(): number

      Returns number

    • set position(newPosition: number): void

      Parameters

      • newPosition: number

      Returns void

    • get sanitizedClassName(): string

      Returns string

    Methods

    • Parameters

      • fun: (arg: unknown) => Promise<unknown>
      • data: unknown

      Returns Promise<unknown>

    • Parameters

      Returns this

    • Parameters

      • __namedParameters: { loadResults: default }

      Returns Promise<void>

    • Returns Promise<default>

    • 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.

      Returns Promise<any>

    • See docs for isMainContext() for better explanation.

      Returns NoteContext

    • Returns Promise<string>

    • Returns {
          active: boolean;
          hoistedNoteId: string;
          mainNtxId: string;
          notePath: string;
          ntxId: string;
          viewScope: ViewScope;
      }

    • Parameters

      • inputNotePath: string

      Returns Promise<string>

    • Returns NoteContext[]

    • Returns Promise<default>

    • Returns boolean

    • Returns boolean

    • Returns 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.

      Returns boolean

      true if the context is main (= tab)

    • Returns Promise<boolean>

    • Returns void

    • Parameters

      • resolvedNotePath: string

      Returns void

    • Returns void

    • Parameters

      • noteIdToHoist: string

      Returns Promise<void>

    • Returns Promise<void>

    • Parameters

      Returns Promise<void>

    • Type Parameters

      • T

      Parameters

      • promise: Promise<T>

      Returns Promise<T>

    • Returns Promise<void>

    • Returns string