Feature: preview composer attachments inline (click to open)#378
Open
dealerweb wants to merge 1 commit into
Open
Feature: preview composer attachments inline (click to open)#378dealerweb wants to merge 1 commit into
dealerweb wants to merge 1 commit into
Conversation
Clicking an attachment chip in the composer now opens the same FilePreviewModal the message viewer uses, instead of offering only download/remove. The chip becomes clickable once the attachment has content (a local File, or an uploaded blob for forwarded attachments) and the type is previewable. - getFileContent prefers the in-memory File (no network round-trip) and falls back to composerClient.fetchBlob for forwarded attachments (blobId only). - Previewability (isFilePreviewable) and the open-in-new-tab safety gate are handled inside the modal, so this adds no new egress/attack surface; the local download path uses an <a download> (forces a save, never executes). - No new dependencies and no new locale keys.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The message viewer already lets you click an attachment to preview it, but the composer/draft view only offered download/remove. This adds click-to-preview parity: clicking an attachment chip in the composer opens the same FilePreviewModal.
Changes
isFilePreviewable); it is never clickable mid-upload. The remove (X) button is unchanged.getFileContentprefers the in-memory File (no network round-trip) and falls back tocomposerClient.fetchBlobfor forwarded attachments (blobId only).FilePreviewModal, so all rendering (image / PDF / pdf.js-mobile / video / audio / text / html) and the open-in-new-tab inline-safe-MIME gate come for free.Type of Change
Checklist
npm run typecheck && npm run lintpassesnpm run build)locales/) - n/a, no new strings (the tooltip reuses the filename)Notes for Reviewers
<iframe sandbox="">; the open-in-new-tab button is gated byisMimeTypeSafeForInlinePreview). The local-file download path uses an<a download>(forces a save, never executes), so a script-bearing attachment can't run in-origin.next linterrors on Next 16 repo-wide (unrelated); ESLint on the changed file passes (one pre-existingexhaustive-depswarning, not from this change).