For the complete documentation index, see llms.txt. This page is also available as Markdown.

Clipboard

Permission settings are required

getClipboardTextYou must set clipboard permissions before using it. Please check the permission setup guide first.


1. Get clipboard text

SDK function: getClipboardText

A function that reads the text stored in the clipboard.

Signature

function getClipboardText(): Promise<string>;

Return value

  • Promise<string>

    Returns the text stored in the clipboard. If there is no text in the clipboard, returns an empty string.

Permission methods

  • getClipboardText.getPermission

    Returns the current status of clipboard read permission. allowed · denied · notDetermined · osPermissionDenied returns one of

  • getClipboardText.openPermissionDialog

    Shows a dialog to request clipboard read permission again. If allowed, allowed, if denied deniedis returned.

Error

If permission is denied GetClipboardTextPermissionErroroccurs. error instanceof GetClipboardTextPermissionErrorYou can check it with

Example


2. Copy clipboard text

SDK function: setClipboardText

A function that copies text to the clipboard. The user can paste it elsewhere.

Signature

Parameters

  • text · Required · string

    The text to copy to the clipboard.

Permission methods

  • setClipboardText.getPermission

    Returns the current status of clipboard write permission. allowed · denied · notDetermined · osPermissionDenied returns one of

  • setClipboardText.openPermissionDialog

    Shows a dialog to request clipboard write permission again. If allowed, allowed, if denied deniedis returned.

Error

If permission is denied SetClipboardTextPermissionErroroccurs. error instanceof SetClipboardTextPermissionErrorYou can check it with

Example

Last updated

Was this helpful?