Skip to content

Function: copyRichText() ​

ts
function copyRichText(html, fallbackText): Promise<boolean>;

Copies rich HTML content to the clipboard, with a plain-text fallback.

Parameters ​

ParameterTypeDescription
htmlstringThe HTML string to write to the clipboard.
fallbackTextstringPlain-text fallback used when the Clipboard API is unavailable.

Returns ​

Promise<boolean>

true when the copy succeeded.

Example ​

ts
console.log(await copyRichText('<b>Hello</b>', 'Hello'))

Since ​

1.0.0

Released under the MIT License.