Get current contents of the system clipboard.
OptionalclipboardType: clipboardTypeOptionally specify a data type to fetch from the clipboard. Default: "string"
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.
a possibly-valid html string
Set the contents of the system clipboard.
the data to set in the clipboard. If a string is passed it is set in the clipboard. Optionally an object with clipboardType keys and string values can be passed to set multiple data types in the clipboard.
ReadonlyisReadonlyisReturns a window object configured representing the active window.
If able, open the requested draft in a new window. This method only functions on iPad and Mac. The ability to open new windows is not available on iPhone.
true if successful. false if unable to open a new window (as on iPhone).
ReadonlyareCheck if Live Activities are supported on the current device/platform.
Start a Live Activity for the selected Draft. Returns true if Live Activity started successfully. Returns false if Live Activity could not be started, or Live Activities are not supported on the device.
The draft to use in the Live Activity
Stop a Live Activity for the selected Draft. Returns true if Live Activity stopped successfully.
The draft to use in the Live Activity
Show error banner notification with the message passed.
Show info banner notification with the message passed.
Show success banner notification with the message passed.
Show warning banner notification with the message passed.
Is system sleep timer disabled preventing screen dimming/sleep.
ReadonlyisReturns true if app has an active Drafts Pro subscription.
ReadonlyversionVersion number of current installation of Drafts.
ReadonlycurrentReturns 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.
The current dark mode theme.
The current light mode theme.
Get or set themeMode.
term to open
Request system opens the URL passed. Returns true if URL was opened, false if the URL was invalid or no available app can open the URL on the device.
url to open
OptionaluseSafari: booleanwhether to use the Safari View Controller (true) or default browser (false).
Queues an action to run on a draft after the current action is complete.
// lookup action and draft, and queue the action to run
let a = Action.find("Copy");
let d = Draft.find("UUID");
app.queueAction(a, d);
Enable and disable the iOS system sleep timer to prevent screen dimming/sleep.
Drafts defines a single global
appobject which provides access to application level functions.Example
Toggle light-dark mode