copyElementToClipboard function
Copies element
text to Clipboard.
Implementation
bool copyElementToClipboard(Element element) {
var selection = window.getSelection();
// Selection not supported or blocked:
if (selection == null) return false;
var range = document.createRange();
range.selectNodeContents(element);
selection.removeAllRanges();
selection.addRange(range);
document.execCommand('copy');
window.getSelection()?.removeAllRanges();
return true;
}