correlation upgrades
This commit is contained in:
@@ -85,9 +85,29 @@ function CorrelationDebugTab() {
|
||||
}
|
||||
}
|
||||
|
||||
async function handleCopy() {
|
||||
function handleCopy() {
|
||||
if (!data) return;
|
||||
await navigator.clipboard.writeText(JSON.stringify(data, null, 2));
|
||||
const text = JSON.stringify(data, null, 2);
|
||||
if (navigator.clipboard) {
|
||||
navigator.clipboard.writeText(text).then(() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
}).catch(() => fallbackCopy(text));
|
||||
} else {
|
||||
fallbackCopy(text);
|
||||
}
|
||||
}
|
||||
|
||||
function fallbackCopy(text: string) {
|
||||
const ta = document.createElement("textarea");
|
||||
ta.value = text;
|
||||
ta.style.position = "fixed";
|
||||
ta.style.opacity = "0";
|
||||
document.body.appendChild(ta);
|
||||
ta.focus();
|
||||
ta.select();
|
||||
document.execCommand("copy");
|
||||
document.body.removeChild(ta);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user