feat(preview): inline .docx rendering via docx-preview (#297) #317
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/docx-preview"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First slice of #297 (office previews). Renders
.docxinline in the preview panel instead of the "No preview — use Download" card.Approach
vendor-jszip.min.js(JSZip 3.10.1, MIT, 97 KB) andvendor-docx-preview.min.js(docx-preview 0.3.5, MIT, 73 KB) live flat inweb/static/, so the releasecp web/static/*bundles them into the embeddedwebdistand Cairn serves them from its own origin (behind auth). No third-party runtime dependency..docxpreview (loadDocxLib()), so initial page load is unchanged. docx-preview's UMD reads a globalJSZipand exports globaldocx, so jszip is loaded first.window.docx.renderAsync(blob, host, …)into a scrollable container; 25 MB size guard; everyawaitre-checks thepvPath !== it.pathstaleness guard (same pattern as the text branch); any failure falls back to the existingpvNoPreviewcard.ext === "docx"..doc/.odt/.rtfstill fall through to the card (docx-preview only handles OOXML). xlsx/pptx are the next slices of #297.Verification
node --checkon all page script blocks (passed in the build workflow). Functional rendering needs a logged-in browser with a real .docx, which is the operator's visual check on the dogfood after deploy.