Copy text to the clipboard in modern browsers
This library extends copy-text-to-clipboard, adding promise and Clipboard API support. If the current browser environment supports the Clipboard API then that will be used, otherwise it will fall back to using
$ npm install copy-text-to-clipboard-async
text to the clipboard.
Returns a promise that resolves if the text was successfully copied or rejects if the operation failed.
Must be called in response to a user gesture event, like
Specify a DOM element where the temporary, behind-the-scenes
textarea should be appended, in cases where you need to stay within a focus trap, like in a modal.
Note: This option will only have an effect if the browser environment does not support the Clipboard API.