correlation upgrades

This commit is contained in:
Logan
2026-05-17 19:05:52 -04:00
parent bcc3d3406d
commit 97ed691cd2
5 changed files with 54 additions and 15 deletions
+22 -2
View File
@@ -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);
}