8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d448486 commit 58cd3edCopy full SHA for 58cd3ed
site/src/components/CopyButton/CopyButton.tsx
@@ -34,14 +34,18 @@ export const CopyButton: React.FC<CopyButtonProps> = ({
34
}, 1000)
35
} catch (err) {
36
const input = document.createElement("input")
37
- input.hidden = true
38
input.value = text
39
document.body.appendChild(input)
40
input.focus()
41
input.select()
42
const result = document.execCommand("copy")
43
document.body.removeChild(input)
44
- if (!result) {
+ if (result) {
+ setIsCopied(true);
45
+ window.setTimeout(() => {
46
+ setIsCopied(false);
47
+ }, 1000);
48
+ } else {
49
const wrappedErr = new Error("copyToClipboard: failed to copy text to clipboard")
50
if (err instanceof Error) {
51
wrappedErr.stack = err.stack
0 commit comments