Skip to content

feat: add session document viewers and PDF controls - #1139

Merged
wibus-wee merged 2 commits into
mainfrom
lody/9c5e6d34-23e
Sep 29, 2026
Merged

wibus-wee merged 2 commits into
mainfrom
lody/9c5e6d34-23e

Conversation

@wibus-wee

Copy link
Copy Markdown
Member

Related issue

None — internal same-repository change.

Problem / pressure

Session links could preview PDFs, but their reading controls were limited. DOCX,
XLSX, and PPTX fell back to the generic binary-file notice; CSV/TSV had only a
source-text view. Loading format engines with the file panel would also impose
work on sessions that never open these files.

Summary

  • Add PDF page thumbnails, direct page entry, rotation, fit/percentage zoom, and
    expandable text search while retaining the 64 KiB local range transport and
    8-megapixel canvas cap.
  • Add read-only DOCX, XLSX, and PPTX previews. The static Office entry waits for
    an active panel and an idle browser period, bounds reads to 25 MiB, and loads
    only the selected format engine. Parsers use workers; inactive previews do not
    request an engine.
  • Add a worker-parsed, two-axis-virtualized CSV/TSV table with search and zoom.
    Keep the existing editable Source tab and terminate its worker when hidden.
  • Preserve shared file actions, add synthetic Storybook fixtures and Playwright
    acceptance coverage, and update the bilingual Spec and implementation notes.

Visual explanation

flowchart TD
    A[Session file snapshot] --> B{File format}
    B -->|PDF| C[PDF.js page viewer]
    C --> D[64 KiB local ranges + bounded canvases]
    B -->|DOCX / XLSX / PPTX| E[Static Office preview entry]
    E -->|active + browser idle| F[Bounded read, then selected engine + worker]
    B -->|CSV / TSV| G{Preview or Source}
    G -->|Preview active + idle| H[Worker parse/search + virtual table]
    G -->|Source| I[Existing text editor]
    C --> J[Existing file actions]
    F --> J
    H --> J
Loading

Before / after

Before After
PDF preview had basic paging. Page thumbnails, direct page entry, rotation, zoom modes, and search.
Modern Office files showed a binary notice. DOCX pages, XLSX worksheets, and PPTX slides open read-only on demand.
CSV/TSV opened as source text. Virtual table by default, with Source still available for editing.

Test plan

  • Passed: pnpm format, pnpm lint, pnpm lint:i18n,
    pnpm check:public-boundary, and pnpm --filter @lody/components typecheck.
  • Passed: 8 targeted Vitest tests and 9 Playwright Storybook acceptance tests,
    including narrow PDF controls and inactive Office/CSV loading checks.
  • Passed: pnpm --filter @lody/components build-storybook; verified the Office
    engines are split into on-demand resources.
  • pnpm check is blocked at the pre-existing nested
    packages/acp-extension-claude checkout because its own node_modules and
    @tsconfig/node22 are missing in this worktree. Component checks above pass.
  • pnpm docs check reports six existing links into uninitialized ACP extension
    submodules; no changed-document link errors remain.
  • Real Electron lody-resource:// rendering remains unverified here.

Context handoff

Internal same-repository branch; the external contribution handoff does not apply.

@wibus-wee
wibus-wee merged commit 70ff134 into main Sep 29, 2026
12 checks passed
@wibus-wee
wibus-wee deleted the lody/9c5e6d34-23e branch September 29, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant