返回提交历史
Modified
g4f/gui/client/static/js/highlightjs-copy.min.js
+4
-6
XFEstudio/gpt4free
Update highlightjs-copy.min.js
75e9a237
代码差异
1 个文件
+4
-6
@@ -16,16 +16,14 @@ class CopyButtonPlugin {
16
16
el.parentElement.appendChild(button);
17
17
el.parentElement.style.setProperty("--hljs-theme-background", window.getComputedStyle(el).backgroundColor);
18
18
button.onclick = async () => {
19
if (!navigator.clipboard) {
20
console.error("navigator.clipboard: Clipboard API unavailable.")
21
return;
22
}
23
19
let newText = text;
24
20
if (hook && typeof hook === "function") {
25
21
newText = hook(text, el) || text
26
22
}
27
28
try {
23
try {
24
if (!navigator.clipboard) {
25
throw new Error("navigator.clipboard: Clipboard API unavailable.");
26
}
29
27
await navigator.clipboard.writeText(newText);
30
28
} catch (e) {
31
29
console.error(e);