-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Save image on CTRL+S #30306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Save image on CTRL+S #30306
Conversation
dbkr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments, but also this would need a test of some kind. Nice feature though.
|
Actually, having done that round of review, I've just noticed this really should be using the same code as the existing download image button on the message action bar: https://github.com/element-hq/element-web/blob/develop/src/components/views/messages/DownloadActionButton.tsx - Ithink the right way to do this would be to factor that code out and make it re-usable. |
|
Thanks for flagging this @dbkr I’ve refactored the download logic into useDownloadMedia hook. I’ve added a new test to cover the Ctrl+S keyboard shortcut in the ImageView. CTRL+S now triggers the download in the DownloadButton Looking forward for a review! |
|
@dbkr I've merged in the updates and removed the forwardRef usage. |
dbkr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, you read my mind: I was staring at the function passed back from forwardRef for quite a while trying to work out what it was doing. Thanks, I think this is much easier to understand.
Also thanks for spotting and merging in the upstream fix (which I noticed thanks to reviewing this PR!)
For the i18n check, you should just be able to run yarn i18n and it will scan all the files for translatable strings and put them in the file for you.
|
@dbkr i18n applied |
|
Thanks! I think our sonarcloud is unhappy because you're trying to contribute from your develop branch (I though we had a thing that warns you but it doesn't seem to have triggered). Would you mind changing to a different branch on your fork, then I think this is good to go. |
Enhancement: Prevent browser default behavior when pressing Ctrl + S on an open image, which would otherwise trigger image saving.
Checklist
public/exportedsymbols have accurate TSDoc documentation.