fix: typo

This commit is contained in:
CrescentLeaf
2025-10-02 18:30:58 +08:00
parent 65458cf491
commit 2771503b6f

View File

@@ -1,7 +1,7 @@
export default function copyToClipboard(text: string) {
if (navigator.clipboard)
return navigator.clipboard.writeText(text)
return new Promise((res rej) => {
return new Promise((res, rej) => {
if (document.hasFocus()) {
const a = document.createElement("textarea")
document.body.appendChild(a)
@@ -12,7 +12,7 @@ export default function copyToClipboard(text: string) {
a.select()
document.execCommand("copy", true)
document.body.removeChild(a)
res()
res(null)
} else {
rej()
}