Options
All
  • Public
  • Public/Protected
  • All
Menu

joplin.views.panels

Allows creating and managing view panels. View panels currently are displayed at the right of the sidebar and allows displaying any HTML content (within a webview) and update it in real-time. For example it could be used to display a table of content for the active note, or display various metadata or graph.

View the demo plugin

Index

Methods

addScript

  • addScript(handle: ViewHandle, scriptPath: string): Promise<void>
  • Adds and loads a new JS or CSS files into the panel.

    Parameters

create

  • Creates a new panel

    Parameters

    • id: string

hide

onMessage

  • onMessage(handle: ViewHandle, callback: Function): Promise<void>
  • Called when a message is sent from the webview (using postMessage).

    To post a message from the webview to the plugin use:

    const response = await webviewApi.postMessage(message);
    • message can be any JavaScript object, string or number
    • response is whatever was returned by the onMessage handler

    Using this mechanism, you can have two-way communication between the plugin and webview.

    See the postMessage demo for more details.

    Parameters

setHtml

  • setHtml(handle: ViewHandle, html: string): Promise<string>
  • Sets the panel webview HTML

    Parameters

show

  • show(handle: ViewHandle, show?: boolean): Promise<void>
  • Shows the panel

    Parameters

    • handle: ViewHandle
    • Default value show: boolean = true

visible

  • Tells whether the panel is visible or not

    Parameters