From 7dd596ebcece8badf18586186c9712b364fab42e Mon Sep 17 00:00:00 2001
From: kon-foo <25391223+kon-foo@users.noreply.github.com>
Date: Wed, 21 Feb 2024 16:18:44 +0000
Subject: [PATCH] docs: Fix in explorer.md (#911)
---
quartz/components/scripts/clipboard.inline.ts | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/quartz/components/scripts/clipboard.inline.ts b/quartz/components/scripts/clipboard.inline.ts
index c604c9b..87182a1 100644
--- a/quartz/components/scripts/clipboard.inline.ts
+++ b/quartz/components/scripts/clipboard.inline.ts
@@ -14,7 +14,7 @@
button.type = "button"
button.innerHTML = svgCopy
button.ariaLabel = "Copy source"
- button.addEventListener("click", () => {
+ function onClick() {
navigator.clipboard.writeText(source).then(
() => {
button.blur()
@@ -26,7 +26,9 @@
},
(error) => console.error(error),
)
- })
+ }
+ button.addEventListener("click", onClick)
+ window.addCleanup(() => button.removeEventListener("click", onClick))
els[i].prepend(button)
}
}
--
Gitblit v1.10.0