Eilen Shin 81de0761ed
feat: improve file attachments and add Office artifact previews (#8009)
* feat(frontend): improve file attachment recovery and artifact presentation

* feat(extensions): add Office artifact previews with search and navigation

* fix: preserve public viewers and HTTP Office previews

* fix: address file preview and upload review findings

* fix: use typed upload errors and linear bookmark allocation

* fix(office-preview): isolate parsing and bound preview resources

* fix(ci): install Office preview fixture dependencies for E2E

* fix(ci): provision matching Playwright browsers before E2E tests

* fix(ci): isolate Python libraries and include Office documentation

* test(frontend): wait for download status to finish rendering
2026-11-12 20:30:17 +08:00

38 lines
1.1 KiB
JavaScript

export default {
apiVersion: 1,
module: "office-preview",
artifactPreviews: [
{
id: "office",
extensions: ["xlsx", "docx", "pptx"],
mount(root, context) {
const controller = new AbortController();
const abort = () => controller.abort();
context.signal.addEventListener("abort", abort, { once: true });
if (context.signal.aborted) abort();
let dispose = () => {};
import("./office.js")
.then(async ({ mountOffice }) => {
if (controller.signal.aborted) return;
dispose = await mountOffice(root, {
...context,
signal: controller.signal,
});
if (controller.signal.aborted) dispose();
})
.catch(() => {
if (!controller.signal.aborted) context.onError();
});
return {
dispose() {
controller.abort();
context.signal.removeEventListener("abort", abort);
dispose();
root.replaceChildren();
},
};
},
},
],
};