I'm trying to implement a copy link with a thumbnail image like in VidYard,
I've implimented the exCommand and this is my code:
let selection = window.getSelection();
let container = document.querySelector('.container');
if (selection.rangeCount > 0) {
selection.removeAllRanges();
}
const range = document.createRange();
range.selectNode(container);
selection.addRange(range);
document.execCommand("copy");
selection.removeAllRanges();
But when I paste in Gmail I can't display the link since it's in a hidden span:
<span className="classClipboard">
<img
src="image/path"
className="className"
/>
<span style={{ opacity: 0 }}>{"MyLink"}</span>
</span>
Any ideas to fix this?