mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-03 12:42:48 +03:00
Revert "chat, publish: avoid race condition in writeText"
This reverts commit 7febf927fa
.
This commit is contained in:
parent
ee887caced
commit
f58b3d6d0c
@ -85,17 +85,12 @@ export function writeText(str) {
|
||||
e.preventDefault();
|
||||
success = true;
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
|
||||
let copyListener = new Promise(function() {
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
document.getSelection().removeAllRanges();
|
||||
|
||||
document.getSelection().removeAllRanges();
|
||||
})
|
||||
|
||||
copyListener.then(() => {
|
||||
return success ? resolve() : reject();
|
||||
})
|
||||
success ? resolve() : reject();
|
||||
});
|
||||
};
|
@ -60,17 +60,12 @@ export function writeText(str) {
|
||||
e.preventDefault();
|
||||
success = true;
|
||||
}
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
|
||||
let copyListener = new Promise(function () {
|
||||
document.addEventListener("copy", listener);
|
||||
document.execCommand("copy");
|
||||
document.removeEventListener("copy", listener);
|
||||
document.getSelection().removeAllRanges();
|
||||
|
||||
document.getSelection().removeAllRanges();
|
||||
})
|
||||
|
||||
copyListener.then(() => {
|
||||
return success ? resolve() : reject();
|
||||
})
|
||||
success ? resolve() : reject();
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user