Skip to content

Commit 21c6888

Browse files
committed
Update index.js
1 parent e9e9d95 commit 21c6888

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • rustedwarfareapicode/.vitepress/theme

rustedwarfareapicode/.vitepress/theme/index.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ async function init() {
1818

1919
for (let i = 0; i < copyBtnList.length; i++) {
2020
const btn = copyBtnList[i];
21-
btn.addEventListener("click", () => {
21+
btn.addEventListener("touchend", () => {
22+
alert("touchend");
2223
const parentDiv = btn.parentNode;
2324
const codeElem = parentDiv.querySelector("code");
2425
const spans = [...codeElem.querySelectorAll("span")];
@@ -27,7 +28,9 @@ async function init() {
2728
].join("");
2829

2930
if (navigator.clipboard) {
30-
navigator.clipboard.writeText(textToCopy);
31+
navigator.clipboard.writeText(textToCopy).then(() => {
32+
console.log("Text copied to clipboard");
33+
});
3134
} else {
3235
const textarea = document.createElement("textarea");
3336
textarea.value = textToCopy;

0 commit comments

Comments
 (0)