Back to Trilium

Class RightPanelWidget

docs/Script API/classes/Frontend_Script_API.RightPanelWidget.html

0.102.216.1 KB
Original Source

Class RightPanelWidget

This widget manages rendering panels in the right-hand pane.

Hierarchy (View Summary)

Index

Constructors

constructor

Properties

_noteId_position$body$widgetattrschildrencomponentIdinitializednoteContext?parent?

Accessors

helphoistedNoteIdnotenoteIdnotePathntxIdpositionsanitizedClassNamewidgetButtonswidgetTitle

Methods

activeContextChangedactiveContextChangedEventcallMethodcanBeShownchildclasscleanupcollapsiblecontentSizedcsscssBlockdoRenderdoRenderBodyfillingfrocaReloadedEventgetClosestNtxIdgetPositionhandleEventhandleEventInChildrenidisActiveNoteContextisEnabledisHiddenExtisHiddenIntisNoteisNoteContextisVisiblelogRenderingErrornoteSwitchednoteSwitchedAndActivatedEventnoteSwitchedEventnoteTypeMimeChangedEventoptChildoptCssrefreshrefreshWithNoteremoverendersetNoteContextEventsetParenttoggleExttoggleInttriggerCommandtriggerEvent

Constructors

constructor

new RightPanelWidget(): RightPanelWidget

Returns RightPanelWidget

Properties

_noteId

_noteId: string

_position

_position: number

$body

$body: JQuery<HTMLElement>

$widget

$widget: JQuery<HTMLElement>

Protectedattrs

attrs: Record<string, string>

children

children: default[]

componentId

componentId: string

initialized

initialized: null | Promise<void>

OptionalnoteContext

noteContext?: NoteContext

Optionalparent

parent?: TypedComponent<any>

Accessors

help

get help(): {}

Returns {}

hoistedNoteId

get hoistedNoteId(): undefined | string

Returns undefined | string

note

get note(): undefined | null | FNote

Returns undefined | null | FNote

noteId

get noteId(): undefined | string

Returns undefined | string

notePath

get notePath(): undefined | null | string

Returns undefined | null | string

ntxId

get ntxId(): undefined | null | string

Returns undefined | null | string

position

get position(): number

Returns number

set position(newPosition: number): void

Parameters

  • newPosition: number

Returns void

sanitizedClassName

get sanitizedClassName(): string

Returns string

widgetButtons

get widgetButtons(): default<any>[]

Returns default<any>[]

widgetTitle

get widgetTitle(): string

Title to show in the panel.

Returns string

Methods

activeContextChanged

activeContextChanged(): Promise<void>

Returns Promise<void>

activeContextChangedEvent

activeContextChangedEvent(
__namedParameters: { noteContext: NoteContext },
): Promise<void>

Parameters

Returns Promise<void>

callMethod

callMethod(
fun: (arg: unknown) => Promise<unknown>,
data: unknown,
): undefined | Promise<unknown>

Parameters

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

Returns undefined | Promise<unknown>

canBeShown

canBeShown(): boolean

Returns boolean

child

child(...components: default[]): RightPanelWidget

Parameters

Returns RightPanelWidget

class

class(className: string): RightPanelWidget

Parameters

  • className: string

Returns RightPanelWidget

cleanup

cleanup(): void

Returns void

collapsible

collapsible(): RightPanelWidget

Returns RightPanelWidget

contentSized

contentSized(): RightPanelWidget

Returns RightPanelWidget

css

css(name: string, value: string): RightPanelWidget

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 RightPanelWidget

self for chaining.

cssBlock

cssBlock(block: string): RightPanelWidget

Accepts a string of CSS to add with the widget.

Parameters

  • block: string

Returns RightPanelWidget

for chaining

doRender

doRender(): void

Do not override this method unless you know what you're doing. Do not override this method unless you know what you're doing.

Returns void

doRenderBody

doRenderBody(): Promise<void>

Method used for rendering the body of the widget (via existing this.$body)

Your class should override this method.

Returns Promise<void>

if widget needs async operation to initialize, it can return a Promise

filling

filling(): RightPanelWidget

Returns RightPanelWidget

frocaReloadedEvent

frocaReloadedEvent(): Promise<void>

Returns Promise<void>

getClosestNtxId

getClosestNtxId(): undefined | null | string

Returns undefined | null | string

getPosition

getPosition(): number

Returns number

handleEvent

handleEvent<T extends EventNames>(
name: T,
data: EventData<T>,
): undefined | null | Promise<unknown>

Type Parameters

Parameters

Returns undefined | null | Promise<unknown>

handleEventInChildren

handleEventInChildren<T extends EventNames>(
name: T,
data: EventData<T>,
): null | Promise<unknown>

Type Parameters

Parameters

Returns null | Promise<unknown>

id

id(id: string): RightPanelWidget

Parameters

  • id: string

Returns RightPanelWidget

isActiveNoteContext

isActiveNoteContext(): boolean

Returns boolean

isEnabled

isEnabled(): undefined | null | boolean

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.

If the widget is not enabled, it will not receive refreshWithNote updates.

Returns undefined | null | boolean

true when an active note exists

isHiddenExt

isHiddenExt(): boolean

Returns boolean

isHiddenInt

isHiddenInt(): boolean

Returns boolean

isNote

isNote(noteId: string): boolean

Parameters

  • noteId: string

Returns boolean

isNoteContext

isNoteContext(
ntxId: undefined | null | string | string[],
): undefined | null | boolean | ""

Parameters

  • ntxId: undefined | null | string | string[]

Returns undefined | null | boolean | ""

isVisible

isVisible(): boolean

Returns boolean

logRenderingError

logRenderingError(e: Error): void

Parameters

  • e: Error

Returns void

noteSwitched

noteSwitched(): Promise<void>

Returns Promise<void>

noteSwitchedAndActivatedEvent

noteSwitchedAndActivatedEvent(
__namedParameters: NoteSwitchedContext,
): Promise<void>

Parameters

Returns Promise<void>

noteSwitchedEvent

noteSwitchedEvent(__namedParameters: NoteSwitchedContext): Promise<void>

Parameters

Returns Promise<void>

noteTypeMimeChangedEvent

noteTypeMimeChangedEvent(__namedParameters: { noteId: string }): Promise<void>

Parameters

  • __namedParameters: { noteId: string }

Returns Promise<void>

optChild

optChild(condition: boolean, ...components: default[]): RightPanelWidget

Conditionally adds the given components as children to this component.

Parameters

  • condition: boolean

whether to add the components.

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

Returns RightPanelWidget

self for chaining.

optCss

optCss(condition: boolean, name: string, value: string): RightPanelWidget

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 RightPanelWidget

self for chaining.

refresh

refresh(): Promise<void>

Returns Promise<void>

refreshWithNote

refreshWithNote(note: undefined | null | FNote): Promise<void>

Override this method to be able to refresh your widget with each note.

Parameters

  • note: undefined | null | FNote

Returns Promise<void>

remove

remove(): void

Returns void

render

render(): JQuery<HTMLElement>

Returns JQuery<HTMLElement>

setNoteContextEvent

setNoteContextEvent(__namedParameters: { noteContext: NoteContext }): void

Parameters

Returns void

setParent

setParent(parent: TypedComponent<any>): RightPanelWidget

Parameters

Returns RightPanelWidget

toggleExt

toggleExt(show: undefined | null | boolean | ""): void

Parameters

  • show: undefined | null | boolean | ""

Returns void

toggleInt

toggleInt(show: undefined | null | boolean): void

Parameters

  • show: undefined | null | boolean

Returns void

triggerCommand

triggerCommand<K extends keyof CommandMappings>(
name: K,
data?: CommandMappings[K],
): undefined | null | Promise<unknown>

Type Parameters

Parameters

Returns undefined | null | Promise<unknown>

triggerEvent

triggerEvent<T extends EventNames>(
name: T,
data: EventData<T>,
): undefined | null | Promise<unknown>

Type Parameters

Parameters

Returns undefined | null | Promise<unknown>

Settings

Member Visibility

  • Protected
  • Inherited
  • External

ThemeOSLightDark

On This Page

Constructors constructor Properties _noteId_position$body$widgetattrschildrencomponentIdinitializednoteContextparent Accessors helphoistedNoteIdnotenoteIdnotePathntxIdpositionsanitizedClassNamewidgetButtonswidgetTitle Methods activeContextChangedactiveContextChangedEventcallMethodcanBeShownchildclasscleanupcollapsiblecontentSizedcsscssBlockdoRenderdoRenderBodyfillingfrocaReloadedEventgetClosestNtxIdgetPositionhandleEventhandleEventInChildrenidisActiveNoteContextisEnabledisHiddenExtisHiddenIntisNoteisNoteContextisVisiblelogRenderingErrornoteSwitchednoteSwitchedAndActivatedEventnoteSwitchedEventnoteTypeMimeChangedEventoptChildoptCssrefreshrefreshWithNoteremoverendersetNoteContextEventsetParenttoggleExttoggleInttriggerCommandtriggerEvent