Options
All
  • Public
  • Public/Protected
  • All
Menu

App

Drafts defines a single global app object which provides access to application level functions.

Hierarchy

  • App

Index

Properties

currentThemeMode

currentThemeMode: "light" | "dark"

Returns the active theme mode, light or dark, taking into account automatic switching of themes if active. If writing scripts to branch logic based on the current mode, this is the best property to use.

isActionListVisible

isActionListVisible: boolean

Is the action list side panel is visible.

isDraftListVisible

isDraftListVisible: boolean

Is the draft list side panel is visible.

isIdleDisabled

isIdleDisabled: boolean

Is system sleep timer disabled preventing screen dimming/sleep.

themeMode

themeMode: "light" | "dark" | "automatic"

Get or set themeMode.

version

version: string

Version number of current installation of Drafts.

Methods

applyWorkspace

  • applyWorkspace(workspace: Workspace): boolean
  • Apply the Workspace as if it was selected in draft list.

    Parameters

    Returns boolean

displayErrorMessage

  • displayErrorMessage(message: string): void
  • Show error banner notification with the message passed.

    Parameters

    • message: string

    Returns void

displayInfoMessage

  • displayInfoMessage(message: string): void
  • Show info banner notification with the message passed.

    Parameters

    • message: string

    Returns void

displaySuccessMessage

  • displaySuccessMessage(message: string): void
  • Show success banner notification with the message passed.

    Parameters

    • message: string

    Returns void

displayWarningMessage

  • displayWarningMessage(message: string): void
  • Show warning banner notification with the message passed.

    Parameters

    • message: string

    Returns void

getClipboard

  • getClipboard(): string
  • Get current contents of the system clipboard.

    Returns string

hideActionList

  • hideActionList(): void
  • Close action list side bar.

    Returns void

hideDraftList

  • hideDraftList(): void
  • Close draft list side bar.

    Returns void

htmlToClipboard

  • htmlToClipboard(html: string): boolean
  • Takes HTML string and converts it to rich-text and places it in the system clipboard. Returns true if successful, false if an error occurred in conversion.

    Parameters

    • html: string

      a possibly-valid html string

    Returns boolean

loadActionGroup

  • Load the ActionGroup in the action list side bar.

    Parameters

    Returns boolean

loadKeyboardActionGroup

  • loadKeyboardActionGroup(actionGroup: ActionGroup): boolean
  • Load the ActionGroup in the extended keyboard row on iOS.

    Parameters

    Returns boolean

openURL

  • openURL(url: string, useSafari?: boolean): boolean
  • opens URL passed using iOS. Returns true if URL was opened, false if the URL was invalid or no available app can open the URL on the device.

    Parameters

    • url: string

      url to open

    • Optional useSafari: boolean

      whether to use the Safari View Controller (true) or default browser (false).

    Returns boolean

queueAction

  • Queues an action to run on a draft after the current action is complete.

    Parameters

    • action: Action

      Actions can be obtained using the Action.find(name) method.

    • draft: Draft

      A draft object.

    Returns boolean

selectDraft

  • selectDraft(): Draft | undefined
  • Open draft selection interface and wait for user to select a draft. Returns the select draft object, or undefined if user cancelled.

    Returns Draft | undefined

setClipboard

  • setClipboard(contents: string): void
  • Set the contents of the system clipboard.

    Parameters

    • contents: string

    Returns void

setIdleDisabled

  • setIdleDisabled(isDisabled: boolean): void
  • Enable and disable the iOS system sleep timer to prevent screen dimming/sleep.

    Parameters

    • isDisabled: boolean

    Returns void

showActionList

  • showActionList(): void
  • Open action list side bar.

    Returns void

showDraftList

  • showDraftList(): void
  • Open draft list side bar.

    Returns void

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc