Trilium Frontend API
    Preparing search index...

    Class NoteContext

    Hierarchy

    • default
      • NoteContext

    Implements

    Index
    • Parameters

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

      Returns NoteContext

    _position: number
    $widget: any
    children: Component[]
    componentId: string
    getContextualShortcutHints?: ShortcutHintProvider

    Contributes this component's contextual shortcut hints. Implemented directly by legacy widgets, or via the useContextualShortcutHints hook for React components. Called on each component in the focused ancestor chain when the user requests contextual shortcut help, so the hints appear only while this widget (or a descendant) is focused.

    hoistedNoteId: string
    initialized: Promise<void>
    lastActiveNtxId?: string

    ntxId of the split most recently focused within this tab; re-activating the tab restores it. Only meaningful on a main context.

    mainNtxId: string
    noteId?: string
    notePath?: string
    ntxId: string
    parent?: TypedComponent<any>
    parentNoteId?: string
    pinned: boolean

    When true, this tab stays on its current note: navigations to a different note open a new tab instead. Only meaningful on a main context.

    viewScope?: ViewScope
    • 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

    • Parameters

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

      Returns Promise<unknown>

    • Parameters

      • ...components: Component[]

      Returns this

    • Clear specific context data.

      Parameters

      Returns void

    • 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;
          lastActiveNtxId: string;
          mainNtxId: string;
          notePath: string;
          ntxId: string;
          pinned: boolean;
          viewScope: ViewScope;
      }

    • Parameters

      • inputNotePath: string

      Returns Promise<string>

    • Returns NoteContext[]

    • Type Parameters

      Parameters

      Returns Promise<unknown>

    • Type Parameters

      Parameters

      Returns Promise<unknown>

    • Check if context data exists for a given key.

      Parameters

      Returns boolean

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

    • Type Parameters

      Parameters

      Returns void

    • Removes a child component from this component's children array. This is used for cleanup when a widget is unmounted to prevent event listener accumulation.

      Parameters

      • component: Component

      Returns void

    • Type Parameters

      Parameters

      Returns void

    • Returns void

    • Parameters

      • resolvedNotePath: string

      Returns void

    • Set metadata for this note context (e.g., table of contents, PDF pages, code outline). This data can be consumed by sidebar/toolbar components.

      Type Parameters

      Parameters

      • key: K

        Unique identifier for the data type (e.g., "toc", "pdfPages", "codeOutline")

      • value: NoteContextDataMap[K]

        The data to store (will be cleared when switching notes)

      Returns void

    • Returns void

    • Parameters

      • noteIdToHoist: string

      Returns Promise<void>

    • Returns Promise<void>

    • Parameters

      Returns Promise<NoteContext>

      the note context that ended up showing the note: usually this, or a new tab when a pinned tab redirected the navigation. undefined if nothing was navigated.

    • Parameters

      Returns this

    • Type Parameters

      • T

      Parameters

      • promise: Promise<T>

      Returns Promise<T>

    • Type Parameters

      Parameters

      Returns Promise<unknown>

    • Type Parameters

      Parameters

      Returns Promise<unknown>

    • Returns Promise<void>

    • Returns string