Skip to content

IDE: PDF and image viewer tabs on a generic custom-editor seam (#256) - #280

Merged
aMonteSl merged 1 commit into
idefrom
claude/project-thread-krb4ko
Nov 27, 2026
Merged

aMonteSl merged 1 commit into
idefrom
claude/project-thread-krb4ko

Conversation

@aMonteSl

@aMonteSl aMonteSl commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #256 (epic #253).

What

  • Custom editor tabs (renderer/editor/customEditor.ts, customEditorRegistry.ts, editorGroup.ts)
    • openCustom(input) opens a tab whose content is a DOM element of its own.
    • registerCustomEditor(resolver) turns an id (a file being opened, a saved tab) into such a tab.
    • These tabs get preview, keep, close, middle-click, drag between groups, split and session restore like file tabs. Text commands see no active document on them.
    • The agent-first layout will open its chat tabs through the same seam.
  • PDF viewer (renderer/viewers/pdfViewer.ts)
    • Built on pdf.js 6.5.438, loaded as a lazy chunk with its worker bundled by Vite. The CSP is unchanged.
    • Pages are drawn near the viewport and released far from it. There is a text layer for selection.
    • Ctrl+F find highlights the exact match. The toolbar has page navigation, zoom in steps, fit width and actual size.
    • It reloads when the file changes on disk, and reports a broken, missing or password-protected file.
  • Image viewer: PNG, JPEG, GIF, WebP, BMP, ICO and AVIF. Fit, zoom, actual size, and pixel and byte size. SVG stays text.
  • Main process: Workspace.readDocument returns PDF bytes. It accepts only PDFs, checks the real path is inside the folder, and caps the size at 64 MB. It is exposed over IPC codexr:workspace:read-document.
  • Commands: a new target, hasActiveTab, so close, split, keep, copy path and reveal also work on viewer tabs.

Verification

  • npm test at the root is green: the extension passes 1288/1288 and the IDE 667 + 1 skipped, with a new viewers.test.ts.
  • ide:smoke passes.
  • Playwright on Linux, in dark and light, checked:
    • a 12-page PDF, with lazy drawing and the text layer;
    • find and highlight on page 3;
    • zoom;
    • a broken PDF;
    • the split, with session restore;
    • an external overwrite (12 then 3 pages) and a deletion;
    • an image with its size;
    • Close Editor on an image tab.

Not done

  • Password-protected PDFs.
  • Outline and thumbnails.
  • Printing.
  • CJK PDFs without embedded fonts, since no CMaps are bundled.

- editorGroup.openCustom / registerCustomEditor: a tab whose content is a
  DOM element of its own, with preview, close, drag, split and session
  restore like a file tab (agent chat tabs will use it too)
- PDF viewer on pdf.js (lazy chunk, bundled worker, CSP unchanged): lazy
  page drawing, text layer, find with highlights, zoom, fit width
- Image viewer: fit, zoom steps, actual size, dimensions and size
- Workspace.readDocument: PDF bytes, inside the folder, 64 MB cap
@aMonteSl aMonteSl self-assigned this Nov 27, 2026
@aMonteSl
aMonteSl merged commit d0ea17c into ide Nov 27, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants