We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3d9cf6a commit e9e9d95Copy full SHA for e9e9d95
1 file changed
rustedwarfareapicode/.vitepress/theme/index.js
@@ -25,7 +25,18 @@ async function init() {
25
const textToCopy = [
26
...new Set(spans.map((span) => span.textContent)),
27
].join("");
28
- navigator.clipboard.writeText(textToCopy);
+
29
+ if (navigator.clipboard) {
30
+ navigator.clipboard.writeText(textToCopy);
31
+ } else {
32
+ const textarea = document.createElement("textarea");
33
+ textarea.value = textToCopy;
34
+ document.body.appendChild(textarea);
35
+ textarea.select();
36
+ document.execCommand("copy");
37
+ document.body.removeChild(textarea);
38
+ }
39
40
console.log(textToCopy);
41
});
42
}
0 commit comments