Options
All
  • Public
  • Public/Protected
  • All
Menu

joplin.views.dialogs

Allows creating and managing dialogs. A dialog is modal window that contains a webview and a row of buttons. You can update the webview using the setHtml method. Dialogs are hidden by default and you need to call open() to open them. Once the user clicks on a button, the open call will return an object indicating what button was clicked on.

Retrieving form values

If your HTML content included one or more forms, a formData object will also be included with the key/value for each form.

Special button IDs

The following buttons IDs have a special meaning:

  • ok, yes, submit, confirm: They are considered "submit" buttons
  • cancel, no, reject: They are considered "dismiss" buttons

This information is used by the application to determine what action should be done when the user presses "Enter" or "Escape" within the dialog. If they press "Enter", the first "submit" button will be automatically clicked. If they press "Escape" the first "dismiss" button will be automatically clicked.

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 dialog.

    Parameters

create

  • Creates a new dialog

    Parameters

    • id: string

open

setButtons

setFitToContent

  • setFitToContent(handle: ViewHandle, status: boolean): Promise<boolean>
  • Toggle on whether to fit the dialog size to the content or not. When set to false, the dialog is set to 90vw and 80vh

    default

    true

    Parameters

setHtml

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

    Parameters

showMessageBox

  • showMessageBox(message: string): Promise<number>
  • Displays a message box with OK/Cancel buttons. Returns the button index that was clicked - "0" for OK and "1" for "Cancel"

    Parameters

    • message: string

showOpenDialog

  • showOpenDialog(options: any): Promise<any>