Skip to content

Commit 54090f6

Browse files
authored
Support for esc in keyboard events (#274)
1 parent 4f082ee commit 54090f6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

Sources/Navigator/EPUB/EPUBSpreadView.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,8 @@ private extension KeyEvent {
615615

616616
case "Backspace":
617617
self.key = .backspace
618+
case "Escape":
619+
self.key = .escape
618620

619621
default:
620622
guard let char = dict["key"] as? String else {

Sources/Navigator/KeyEvent.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public enum Key: Equatable, CustomStringConvertible {
5353

5454
// Others
5555
case backspace
56+
case escape
5657

5758
/// Indicates whether this key is a modifier key.
5859
public var isModifier: Bool {
@@ -95,6 +96,8 @@ public enum Key: Equatable, CustomStringConvertible {
9596
return "Shift"
9697
case .backspace:
9798
return "Backspace"
99+
case .escape:
100+
return "Escape"
98101
}
99102
}
100103
}
@@ -209,6 +212,8 @@ public extension Key {
209212
self = .option
210213
case .keyboardLeftShift, .keyboardRightShift:
211214
self = .shift
215+
case .keyboardEscape:
216+
self = .escape
212217

213218
default:
214219
let character = key.charactersIgnoringModifiers

0 commit comments

Comments
 (0)