Shortcuts: close tab keyboard shortcut

This commit is contained in:
James Magahern
2020-11-10 11:57:40 -06:00
parent 5e0f1d252a
commit 9344e3c32d
3 changed files with 24 additions and 0 deletions

View File

@@ -597,6 +597,20 @@ class BrowserViewController: UIViewController, WKNavigationDelegate, WKUIDelegat
}
}
func closeTab(_ sender: Any?) {
if tabController.tabs.count > 1 {
tabController.closeTab(self.tab)
} else {
#if targetEnvironment(macCatalyst)
if let originWindowScene = self.view.window?.windowScene {
UIApplication.shared.requestSceneSessionDestruction(originWindowScene.session, options: nil) { error in
print("Error when requesting scene destruction: " + error.localizedDescription)
}
}
#endif
}
}
func findOnPage(_ sender: Any?) {
browserView.setFindOnPageVisible(true, animated: true)
findOnPageController.findOnPageView.textField.becomeFirstResponder()