function fallbackCopyTextToClipboard(text) { var textArea = document.createElement("textarea"); textArea.value = text; textArea.style.position = 'fixed'; textArea.style.opacity = 0; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { var successful = document.execCommand('copy'); if (!successful) { console.log('Fallback: Copying text command was unsuccessful'); } } catch (err) { console.error('Fallback: Oops, unable to copy', err); } document.body.removeChild(textArea); } export function copyTextToClipboard(text) { if (!navigator.clipboard) { fallbackCopyTextToClipboard(text); return; } navigator.clipboard.writeText(text).then(function () { }, function (err) { console.error('Async: Could not copy text: ', err); }); }