Feature: Adds open in background (Shift+Cmd)
This commit is contained in:
@@ -78,8 +78,7 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
||||
decisionHandler(.cancel, preferences)
|
||||
|
||||
// Start navigation in a new tab
|
||||
let tab = tabController.createNewTab(url: navigationAction.request.url)
|
||||
self.tab = tab
|
||||
createNewTab(withURL: navigationAction.request.url, loadInBackground: self.shiftKeyHeld)
|
||||
|
||||
// Reset this flag.
|
||||
commandKeyHeld = false
|
||||
@@ -140,16 +139,23 @@ extension BrowserViewController: WKNavigationDelegate, WKUIDelegate
|
||||
discoverabilityTitle: nil,
|
||||
attributes: [],
|
||||
state: .off) { [unowned self] _ in
|
||||
let newTab = tabController.createNewTab(url: elementInfo.linkURL)
|
||||
self.tab = newTab
|
||||
self.createNewTab(withURL: elementInfo.linkURL, loadInBackground: false)
|
||||
}
|
||||
|
||||
let openInBackground = UIAction(title: "Open in Background",
|
||||
image: UIImage(systemName: "plus.rectangle.on.rectangle"),
|
||||
identifier: nil,
|
||||
discoverabilityTitle: nil,
|
||||
attributes: [],
|
||||
state: .off) { [unowned self] _ in
|
||||
self.createNewTab(withURL: elementInfo.linkURL, loadInBackground: true)
|
||||
}
|
||||
|
||||
return UIMenu(title: elementInfo.linkURL?.absoluteString ?? "Link",
|
||||
image: nil,
|
||||
identifier: nil,
|
||||
options: .displayInline,
|
||||
children: [ openInNewTab ] + menuElements)
|
||||
children: [ openInNewTab, openInBackground ] + menuElements)
|
||||
}
|
||||
|
||||
completionHandler(menuConfig)
|
||||
|
||||
Reference in New Issue
Block a user