Allow pressing escape to close the media viewer

This commit is contained in:
Jed Fox 2022-11-22 13:06:17 -05:00
parent e0d53efecc
commit 75b0f1bfb8
No known key found for this signature in database
GPG Key ID: 0B61D18EA54B47E1
1 changed files with 4 additions and 3 deletions

View File

@ -359,12 +359,12 @@ extension MediaPreviewViewController: MediaPreviewImageViewControllerDelegate {
extension MediaPreviewViewController { extension MediaPreviewViewController {
var closeKeyCommand: UIKeyCommand { func closeKeyCommand(input: String) -> UIKeyCommand {
UIKeyCommand( UIKeyCommand(
title: L10n.Scene.Preview.Keyboard.closePreview, title: L10n.Scene.Preview.Keyboard.closePreview,
image: nil, image: nil,
action: #selector(MediaPreviewViewController.closePreviewKeyCommandHandler(_:)), action: #selector(MediaPreviewViewController.closePreviewKeyCommandHandler(_:)),
input: "i", input: input,
modifierFlags: [], modifierFlags: [],
propertyList: nil, propertyList: nil,
alternates: [], alternates: [],
@ -408,7 +408,8 @@ extension MediaPreviewViewController {
override var keyCommands: [UIKeyCommand] { override var keyCommands: [UIKeyCommand] {
return [ return [
closeKeyCommand, closeKeyCommand(input: UIKeyCommand.inputEscape),
closeKeyCommand(input: "i"),
showNextKeyCommand, showNextKeyCommand,
showPreviousKeyCommand, showPreviousKeyCommand,
] ]