trilium
    Preparing search index...

    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: JQuery<HTMLElement>
    attrs: Record<string, string>
    children: T[]
    componentId: string
    initialized: null | Promise<void>
    parent?: TypedComponent<any>

    Accessors

    Methods

    • 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

    • 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 undefined | null | boolean

      whether the widget is enabled.

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

      Parameters

      • condition: boolean

        whether to add the components.

      • ...components: T[]

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

      Returns TypedBasicWidget<T>

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

      • value: string

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

      Returns TypedBasicWidget<T>

      self for chaining.