I need to store one image and text in clipboard. I'd like to use Clipboard API. Is it possible?
I'm using following sample to store Image or Text but is it possible to combine?
copyImgBtn.addEventListener('click', async () => {
const response = await fetch(img.src)
const blob = await response.blob()
const blob1 = new Blob([textarea.value], { type: 'text/plain' })
var data = [new ClipboardItem({[blob.type] : blob})]
navigator.clipboard.write(data).then(function() {
console.log("Copied to clipboard successfully!");
}, function() {
console.error("Unable to write to clipboard. :-(");
})
}
)
Thank you