UNPKG

@modern-kit/utils

Version:
21 lines (19 loc) 540 B
function copyFallbackClipboardText(value) { const textArea = document.createElement("textarea"); textArea.value = value; textArea.style.opacity = "0"; document.body.appendChild(textArea); textArea.focus(); textArea.select(); try { document.execCommand("copy"); return value; } catch (err) { console.error(`Failed to copy to clipboard. message: ${err.message}`); throw err; } finally { document.body.removeChild(textArea); } } export { copyFallbackClipboardText }; //# sourceMappingURL=index.mjs.map