Implement PDF viewer to the current filepreview - #34928
Draft
ZacksBot wants to merge 5 commits into
Draft
Conversation
setCard's "same phase, new state" branch swapped the state of the card at the top of the history but left the panel's own isOpen alone. If the panel had been closed, the card was updated behind it and nothing appeared, so the action looked like it had done nothing. Show the panel in that branch, as the other two branches already do. Also drop the unguarded index into a possibly empty history while we are here: a matching phase can only have come from this room's own history, so guard on it rather than trusting `hist[hist.length - 1]` to exist.
Open a PDF attachment in the right panel instead of having to download it first. The viewer is pdf.js, rendering continuously with fit-to-width zoom, pinch and ctrl-wheel zoom, and a page selector; the reading position is remembered per file so reopening a document comes back where you left off. The file body gains an optional "open" control next to download, which the view model only asks for on PDFs shown as files in a timeline — not in an export, and not in the download-only panels. FileBodyView renders nothing for it otherwise, so every other file body is unchanged. Encrypted attachments work unchanged: the handle the viewer is given reads the bytes through MediaEventHelper's sourceBlob, which decrypts first. The card stores only the source event id, so a restored panel re-derives the media and drops the card if the event is no longer in the room.
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.
Checklist
public/exportedsymbols have accurate TSDoc documentation.