Skip to content

Commit

Permalink
Save current image from the gallery view by pressing 's', 'd', or 'En…
Browse files Browse the repository at this point in the history
…ter'
  • Loading branch information
pelya committed Dec 18, 2023
1 parent c6c0723 commit 52ce24a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions ts/components/Lightbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function Lightbox({
}, [setVideoTime, videoElement]);

const handleSave = (
event: React.MouseEvent<HTMLButtonElement, MouseEvent>
event: KeyboardEvent | React.MouseEvent<HTMLButtonElement, MouseEvent>
) => {
if (isViewOnce) {
return;
Expand Down Expand Up @@ -211,10 +211,16 @@ export function Lightbox({
onNext(event);
break;

case 's':
case 'd':
case 'Enter':
handleSave(event);
break;

default:
}
},
[closeLightbox, onNext, onPrevious]
[closeLightbox, onNext, onPrevious, handleSave]
);

const onClose = (event: React.MouseEvent<HTMLElement>) => {
Expand Down

0 comments on commit 52ce24a

Please sign in to comment.