UNPKG

@modern-kit/utils

Version:
23 lines (20 loc) 580 B
'use strict'; 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); } } exports.copyFallbackClipboardText = copyFallbackClipboardText; //# sourceMappingURL=index.cjs.map