mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2026-11-10 05:32:05 -06:00
js: Fix copy to clipboard button stuck as "Copied" when clicked twice
This commit is contained in:
2 files changed
+5
-4
No files matched your search
@@ -14,9 +14,8 @@ async function copy_to_clipboard(button) {
|
||||
await navigator.clipboard.writeText(rawCode);
|
||||
|
||||
// TODO: maybe we could add a fancier indicator, like a flash or something
|
||||
const originalCopyText = button.innerHTML;
|
||||
button.innerHTML = "Copied!";
|
||||
setTimeout(() => {
|
||||
button.innerHTML = originalCopyText;
|
||||
button.innerHTML = "{{ i18n "copy_to_clipboard" }}";
|
||||
}, 3000);
|
||||
}
|
||||
Reference in new issue
Block a user