Clean up shift-key checking and add it to more places
This commit is contained in:
parent
24338b135e
commit
1e1fc06e7b
@ -193,7 +193,7 @@ extension DetailWebViewController: WKNavigationDelegate {
|
|||||||
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
public func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||||
if navigationAction.navigationType == .linkActivated {
|
if navigationAction.navigationType == .linkActivated {
|
||||||
if let url = navigationAction.request.url {
|
if let url = navigationAction.request.url {
|
||||||
Browser.open(url.absoluteString)
|
Browser.open(url.absoluteString, invertPreference: navigationAction.modifierFlags.contains(.shift))
|
||||||
}
|
}
|
||||||
decisionHandler(.cancel)
|
decisionHandler(.cancel)
|
||||||
return
|
return
|
||||||
|
@ -264,10 +264,8 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func openArticleInBrowser(_ sender: Any?) {
|
@IBAction func openArticleInBrowser(_ sender: Any?) {
|
||||||
let invert = NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false
|
|
||||||
|
|
||||||
if let link = currentLink {
|
if let link = currentLink {
|
||||||
Browser.open(link, invertPreference: invert)
|
Browser.open(link, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@ protocol SidebarDelegate: class {
|
|||||||
guard let feed = singleSelectedWebFeed, let homePageURL = feed.homePageURL else {
|
guard let feed = singleSelectedWebFeed, let homePageURL = feed.homePageURL else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
Browser.open(homePageURL)
|
Browser.open(homePageURL, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func gotoToday(_ sender: Any?) {
|
@IBAction func gotoToday(_ sender: Any?) {
|
||||||
|
@ -296,10 +296,8 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
|||||||
// MARK: - Actions
|
// MARK: - Actions
|
||||||
|
|
||||||
@objc func openArticleInBrowser(_ sender: Any?) {
|
@objc func openArticleInBrowser(_ sender: Any?) {
|
||||||
let invert = NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false
|
|
||||||
|
|
||||||
if let link = oneSelectedArticle?.preferredLink {
|
if let link = oneSelectedArticle?.preferredLink {
|
||||||
Browser.open(link, invertPreference: invert)
|
Browser.open(link, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user