Skip to content

Commit

Permalink
fix: Await copy function in CopyCodeButton
Browse files Browse the repository at this point in the history
  • Loading branch information
PuruVJ committed Jul 26, 2023
1 parent edd2642 commit 328e0aa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/khaki-islands-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/site-kit': patch
---

(fix) Await copy function in CopyCodeButton
4 changes: 2 additions & 2 deletions packages/site-kit/src/lib/docs/DocsCopyCodeButton.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
let copying = false;
function copy() {
async function copy() {
try {
navigator.clipboard.writeText(code);
await navigator.clipboard.writeText(code);
} catch {
/**
* This is the fallback deprecated way of copying text to the clipboard. Only runs if it can't find the clipboard API.
Expand Down

0 comments on commit 328e0aa

Please sign in to comment.