Trilium Frontend API
    Preparing search index...

    Class TypedBasicWidget<T>

    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().

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _noteId: string
    _position: number
    $widget: any
    attrs: Record<string, string>
    children: T[]
    componentId: string
    initialized: Promise<void>
    parent?: TypedComponent<any>

    Accessors

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

    • Returns boolean

    • Parameters

      • ..._components: (T | VNode<{}>)[]

      Returns this

    • Parameters

      • className: string

      Returns this

    • Returns void

    • Returns this

    • Returns this

    • Sets the CSS attribute of the given name to the given value.

      Parameters

      • name: string

        the name of the CSS attribute to set (e.g. padding-inline-start).

      • value: string

        the value of the CSS attribute to set (e.g. 12px).

      Returns this

      self for chaining.

    • Accepts a string of CSS to add with the widget.

      Parameters

      • block: string

      Returns this

      for chaining

    • Method used for rendering the widget.

      Your class should override this method. The method is expected to create a this.$widget containing jQuery object

      Returns void

    • Returns this

    • Returns string

    • Returns number

    • Parameters

      • id: string

      Returns this

    • Indicates if the widget is enabled. Widgets are enabled by default. Generally setting this to false will cause the widget not to be displayed, however it will still be available on the DOM but hidden.

      Returns boolean

      whether the widget is enabled.

    • Returns boolean

    • Returns boolean

    • Returns boolean

    • Parameters

      • e: Error

      Returns void

    • Conditionally adds the given components as children to this component.

      Parameters

      • condition: boolean

        whether to add the components.

      • ...components: (T | VNode<{}>)[]

        the components to be added as children to this component provided the condition is truthy.

      Returns this

      self for chaining.

    • Sets the CSS attribute of the given name to the given value, but only if the condition provided is truthy.

      Parameters

      • condition: boolean

        true in order to apply the CSS, false to ignore it.

      • name: string

        the name of the CSS attribute to set (e.g. padding-inline-start).

      • value: string

        the value of the CSS attribute to set (e.g. 12px).

      Returns this

      self for chaining.

    • Returns void

    • Returns any

    • Parameters

      • show: boolean | ""

      Returns void

    • Parameters

      • show: boolean

      Returns void