Fix lint
This commit is contained in:
@@ -277,7 +277,8 @@ export const urlB64ToUint8Array = (base64String) => {
|
|||||||
export const copyToClipboard = (text) => {
|
export const copyToClipboard = (text) => {
|
||||||
if (navigator.clipboard && window.isSecureContext) {
|
if (navigator.clipboard && window.isSecureContext) {
|
||||||
return navigator.clipboard.writeText(text);
|
return navigator.clipboard.writeText(text);
|
||||||
} else {
|
}
|
||||||
|
// Fallback to the older method if clipboard API is not supported (or on HTTP)
|
||||||
const textarea = document.createElement("textarea");
|
const textarea = document.createElement("textarea");
|
||||||
textarea.value = text;
|
textarea.value = text;
|
||||||
textarea.setAttribute("readonly", ""); // Avoid mobile keyboards from popping up
|
textarea.setAttribute("readonly", ""); // Avoid mobile keyboards from popping up
|
||||||
@@ -289,5 +290,4 @@ export const copyToClipboard = (text) => {
|
|||||||
document.execCommand("copy");
|
document.execCommand("copy");
|
||||||
document.body.removeChild(textarea);
|
document.body.removeChild(textarea);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user