feat(research): download exact saved revisions (RP26)

This commit is contained in:
Boki 2026-10-27 23:11:22 -04:00
parent 6ce3b68b3d
commit 5434950263
7 changed files with 320 additions and 3 deletions

View file

@ -0,0 +1,15 @@
/** Save inert JSON text and release the browser URL after it consumes the click. */
export function downloadJsonText(text: string, filename: string): void {
const url = URL.createObjectURL(new Blob([text], { type: 'application/json' }));
let anchor: HTMLAnchorElement | undefined;
try {
anchor = document.createElement('a');
anchor.href = url;
anchor.download = filename;
document.body.append(anchor);
anchor.click();
} finally {
setTimeout(() => URL.revokeObjectURL(url), 0);
anchor?.remove();
}
}