fix: typo
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
export default function copyToClipboard(text: string) {
|
export default function copyToClipboard(text: string) {
|
||||||
if (navigator.clipboard)
|
if (navigator.clipboard)
|
||||||
return navigator.clipboard.writeText(text)
|
return navigator.clipboard.writeText(text)
|
||||||
return new Promise((res rej) => {
|
return new Promise((res, rej) => {
|
||||||
if (document.hasFocus()) {
|
if (document.hasFocus()) {
|
||||||
const a = document.createElement("textarea")
|
const a = document.createElement("textarea")
|
||||||
document.body.appendChild(a)
|
document.body.appendChild(a)
|
||||||
@@ -12,7 +12,7 @@ export default function copyToClipboard(text: string) {
|
|||||||
a.select()
|
a.select()
|
||||||
document.execCommand("copy", true)
|
document.execCommand("copy", true)
|
||||||
document.body.removeChild(a)
|
document.body.removeChild(a)
|
||||||
res()
|
res(null)
|
||||||
} else {
|
} else {
|
||||||
rej()
|
rej()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user