mirror of
https://github.com/EvolutionAPI/evolution-manager.git
synced 2025-12-24 21:27:44 -06:00
add fallback to all copy function
This commit is contained in:
15
src/helpers/copyToClipboard.js
Normal file
15
src/helpers/copyToClipboard.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export default (value) => {
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(value);
|
||||
} else {
|
||||
const el = document.createElement("textarea");
|
||||
el.value = value;
|
||||
el.setAttribute("readonly", "");
|
||||
el.style.position = "absolute";
|
||||
el.style.left = "-9999px";
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(el);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user