Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions apps/playground/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
type FileInfo,
type FileType,
type HtmlTrustedPreviewRequest,
type PreviewSizePolicyConfig,
detectFileType,
detectFileMeta,
PluginPreviewRenderer,
Expand All @@ -52,6 +53,14 @@ setAssetBasePath(process.env.NEXT_PUBLIC_BASE_PATH || "");
// (PDF, DOCX, PPTX, XLSX, RTF, ZIP, EPUB and base formats).
const previewRegistry = createFullPreviewRegistry();

// Playground-only limit. Library consumers retain the default 20/50/100 MB policy.
const MB = 1024 * 1024;
const DEMO_PREVIEW_POLICY = {
warningBytes: 20 * MB,
confirmBytes: 35 * MB,
maxBytes: 50 * MB,
} satisfies PreviewSizePolicyConfig;

const FILE_TYPE_ICONS: Record<FileType, string> = {
pdf: "📄",
markdown: "📝",
Expand Down Expand Up @@ -238,6 +247,7 @@ export default function Home() {
try {
const info = await processRemoteUrl(currentUrl, {
signal: controller.signal,
maxBytes: DEMO_PREVIEW_POLICY.maxBytes,
onProgress: setRemoteProgress,
});

Expand Down Expand Up @@ -416,6 +426,9 @@ export default function Home() {
onChange={handleFileInput}
accept="*"
/>
<p className="text-center text-[11px] text-muted-foreground">
Preview files up to 50 MB each
</p>
<div className="flex gap-2">
<input
value={remoteUrl}
Expand Down Expand Up @@ -596,20 +609,14 @@ export default function Home() {
</div>
)}

{/* Preview content — PluginPreviewRenderer applies its own
LargeFileGate. Thresholds are tuned for the demo: warn at
2 MB, require confirmation at 3 MB, block at 5 MB. */}
{/* Preview content — the Demo gates files at 20/35/50 MB. */}
<div className="flex-1 min-h-0 min-w-0">
<PluginPreviewRenderer
file={activeFile}
registry={previewRegistry}
showPluginDebug={process.env.NODE_ENV === "development"}
onHtmlTrustedPreviewRequest={handleTrustedPreviewRequest}
largeFilePolicy={{
warningBytes: 2 * 1024 * 1024,
confirmBytes: 3 * 1024 * 1024,
maxBytes: 5 * 1024 * 1024,
}}
largeFilePolicy={DEMO_PREVIEW_POLICY}
/>
</div>
</>
Expand Down
22 changes: 12 additions & 10 deletions docs/github-pages-release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,22 @@ Expected:
unknown → Preview Not Available
```

## 8. Check Large File Hint
## 8. Check Demo Preview Size Limit (50 MB)

Upload a file >= 20MB of type:
The **Playground demo** has its own policy: warn at 20 MiB, require confirmation at 35 MiB, and block previews above 50 MiB (50 × 1024 × 1024 bytes). The reusable library retains its default thresholds.

```txt
PDF / DOCX / PPTX / XLSX / ZIP / EPUB
```
Test local PDF / DOCX / PPTX / XLSX / ZIP / EPUB files through both **Browse Files** and drag-and-drop:

Expected:
| File size | Expected |
| --- | --- |
| Less than 20 MiB | Preview normally |
| 20–under 35 MiB | Show a warning, continue preview |
| 35–50 MiB (inclusive) | Require explicit confirmation before preview |
| Greater than 50 MiB | Block local preview and offer download |

```txt
Large file hint appears
User can still proceed with preview
```
The **remote URL** loader must enforce the same 50 MiB cap before or during download. Verify that a remote file above the limit produces a clear error (subject to CORS). A file exactly 50 MiB must remain eligible for preview.

The limit applies per file, not to the total size of the selected files. Large-file parsing may still be slow or require significant memory even when the size policy allows it.

## 9. Check Browser Console

Expand Down
Loading