trilium
    Preparing search index...

    This is the base widget for all other widgets.

    For information on using widgets, see the tutorial {@tutorial widget_basics}.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _noteId: string
    _position: number
    $widget: JQuery<HTMLElement>
    attrs: Record<string, string>
    children: default[]
    componentId: string
    initialized: null | Promise<void>
    parent?: TypedComponent<any>

    Accessors

    Methods

    • Parameters

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

      Returns undefined | Promise<unknown>

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

      • value: string

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

      Returns default

      self 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

    • 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: default[]

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

      Returns default

      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 default

      self for chaining.