diff --git a/App/Browser View/BrowserViewController+Keyboard.swift b/App/Browser View/BrowserViewController+Keyboard.swift index 2524250..7c3cea2 100644 --- a/App/Browser View/BrowserViewController+Keyboard.swift +++ b/App/Browser View/BrowserViewController+Keyboard.swift @@ -144,6 +144,10 @@ extension BrowserViewController: ShortcutResponder webView.reload() } + func stop(_ sender: Any?) { + webView.stopLoading() + } + override func increaseSize(_ sender: Any?) { currentTab.webView._viewScale += 0.10 } @@ -151,6 +155,10 @@ extension BrowserViewController: ShortcutResponder override func decreaseSize(_ sender: Any?) { currentTab.webView._viewScale -= 0.10 } + + func zoomToActualSize(_ sender: Any?) { + currentTab.webView._viewScale = 1.0 + } func showPreferences(_ sender: Any?) { showSettingsWindow() diff --git a/App/KeyboardShortcuts.swift b/App/KeyboardShortcuts.swift index 04c25a9..a15ec52 100644 --- a/App/KeyboardShortcuts.swift +++ b/App/KeyboardShortcuts.swift @@ -63,6 +63,9 @@ protocol ShortcutResponder: AnyObject { @objc optional func raiseScriptPolicyRestriction(_ sender: Any?) + + @objc + optional func zoomToActualSize(_ sender: Any?) } public class OpenURLEvent: UIEvent { @@ -224,6 +227,30 @@ public class KeyboardShortcuts { case .view: return [ + // Zoom + UIMenu(options: .displayInline, children: [ + // Actual Size + UIKeyCommand( + modifiers: .command, input: "0", + title: "Actual Size", + action: #selector(ShortcutResponder.zoomToActualSize) + ), + + // Increase Zoom + UIKeyCommand( + modifiers: .command, input: "=", + title: "Zoom In", + action: #selector(UIResponder.increaseSize) + ), + + // Go Forward + UIKeyCommand( + modifiers: .command, input: "-", + title: "Zoom Out", + action: #selector(UIResponder.decreaseSize) + ), + ]), + // Toggle Dark Mode UIKeyCommand( modifiers: [.command], input: "M",