copytoclipboard
: Alternative to clipboard.js: Async implementation of "Copy to clipboard" in plain JS. Works in Safari, Chrome, Firefox, Opera and Edge Canary. Less than 1kb minified.
copyToClipBoard
accepts an html element and returns a Promise.
Copies the content of the html element with the format included and also as plain text (both options).
npm i -S gist:a4d873e5a450ca4681364e230498710b
import { copyToClipBoard } from 'copytoclipboard'
copyToClipBoard(element)
.then(() => console.log('✅ it worked ! ("Ctrl/Cmd + V" to paste it)'))
.catch(e => console.log('❌ something went wrong', e))