Skip to content

feat(chat,preview): download for chat images and previewed PDFs - #2013

Open
aarontrowbridge wants to merge 2 commits into
lane/0.4.0from
image-download-040
Open

aarontrowbridge wants to merge 2 commits into
lane/0.4.0from
image-download-040

Conversation

@aarontrowbridge

@aarontrowbridge aarontrowbridge commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Important

Problem: Chat image previews (the inline frame and the full-size preview) could be copied but not saved. In the chat iframe a plain <a download> has nowhere to go, so a figure could only reach disk by pasting it somewhere first.
Approach: Add a Download button next to Copy, in the image's hover frame and in the preview header. Inside the iframe the PNG goes over the existing save-file bridge kind, so the extension host opens a native Save dialog (default ~/Downloads) on the machine the user is at. Outside the iframe it falls back to an ordinary anchor download.
Scope: Chat images (session-ui overlay, a v2 outline-download icon, the ui.message.download string in all 18 locales) and the side-panel file preview, which gets a Download control beside zoom for PDFs and images. Extension: save-file's validation moves into an exported saveFileRequest, and its allow-list grows from png/md/txt to images, PDF and markdown, each with its own dialog filter.

Details

  • The filename is the source file's basename for images loaded from disk, otherwise the alt text, otherwise image. It always ends in .png, because save, like copy, rasterizes to PNG, and PNG is the only image type the bridge accepts.
  • The download host reuses the copy-button lifecycle (data-slot="markdown-copy-button", data-action="download"), so render/dispose, the morphdom skip and label refresh all apply to it. Clicking it shows no "copied" state, since the host owns the Save dialog and its outcome.

Verification

  • Extension: chat_bridge.test.ts 73/73, including the new saveFileRequest cases (PDF bytes and filter, the run-card PNG and markdown export paths, refusals). Extension typecheck clean.
  • App preview tests: 74 pass; preview-file-routing 93 pass; preview-human-write-gate 11 pass.
  • session-ui: 472 pass, 1 fail. The failure is the CodeMirror selection-highlight test, which this change doesn't touch.
  • New imageFileName cases and frame tests in markdown-local-images.test.ts.
  • Typecheck is clean for session-ui, app and ui. The drift gate passes.
  • Deployed to the hub with ops/hub/deploy-dist.sh --override on top of the served lane/0.4.0 tip 4c44931b (bundle index-EfKEEcdi.js).

The same commit is on image-preview-copy (#1993, targets main).

Chat image frames and the full-size preview gain a Download button next to
Copy. Inside the chat iframe the PNG rides the existing save-file bridge kind,
so the extension host opens a native Save dialog (default ~/Downloads) on the
machine the user is at; unframed, an anchor download stands. The file keeps
the authored basename (or the alt text), saved as .png since both save and
copy rasterize to PNG. Adds the outline-download v2 icon and the
ui.message.download string.
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6f4b8d36-718b-48f4-87f3-91bd0622071e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The side-panel file preview gains a Download control beside zoom whenever it
holds binary content (PDF, image). Inside the webview the bytes ride the
save-file bridge to a native Save dialog on the user's machine; unframed, an
anchor download stands.

save-file's validation moves into saveFileRequest: the allow-list grows from
png/md/txt to images, PDF and markdown, each offered under its own dialog
filter; payloads stay basename-only, base64, ~18 MB max.
@aarontrowbridge aarontrowbridge changed the title feat(chat): download action for chat image previews feat(chat,preview): download for chat images and previewed PDFs Oct 30, 2026
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.

1 participant