const copyToClipboard = (str, b64=false) => {
if (b64) str = atob(str)
const el = document.createElement('textarea');
el.value = str;
document.body.appendChild(el);
el.select();
document.execCommand('copy');
document.body.removeChild(el);
};
const copyToClipboardRich = (str, b64=false) => {
if(b64) str = atob(str)
function listener(e){
e.clipboardData.setData("text/html ", str)
e.clipboardData.setData("text/plain ", str)
e.preventDefault()
}
document.addEventListener('copy', listener)
document.execCommand('copy')
document.removeEventListener('copy', listener)
};