mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-01-22 07:13:58 +01:00
Mac: Make shift-space scroll up even when the detail view doesn't have focus
Issue #969.
This commit is contained in:
parent
4ba2ab4baa
commit
5acce87995
@ -66,9 +66,17 @@ final class DetailViewController: NSViewController, WKUIDelegate {
|
||||
currentWebViewController.canScrollDown(callback)
|
||||
}
|
||||
|
||||
func canScrollUp(_ callback: @escaping (Bool) -> Void) {
|
||||
currentWebViewController.canScrollUp(callback)
|
||||
}
|
||||
|
||||
override func scrollPageDown(_ sender: Any?) {
|
||||
currentWebViewController.scrollPageDown(sender)
|
||||
}
|
||||
|
||||
override func scrollPageUp(_ sender: Any?) {
|
||||
currentWebViewController.scrollPageUp(sender)
|
||||
}
|
||||
|
||||
// MARK: - Navigation
|
||||
|
||||
|
@ -167,9 +167,19 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
|
||||
}
|
||||
}
|
||||
|
||||
func canScrollUp(_ completion: @escaping (Bool) -> Void) {
|
||||
fetchScrollInfo { (scrollInfo) in
|
||||
completion(scrollInfo?.canScrollUp ?? false)
|
||||
}
|
||||
}
|
||||
|
||||
override func scrollPageDown(_ sender: Any?) {
|
||||
webView.scrollPageDown(sender)
|
||||
}
|
||||
|
||||
override func scrollPageUp(_ sender: Any?) {
|
||||
webView.scrollPageUp(sender)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - WKScriptMessageHandler
|
||||
|
@ -264,6 +264,19 @@ class MainWindowController : NSWindowController, NSUserInterfaceValidations {
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func scrollUp(_ sender: Any?) {
|
||||
guard let detailViewController = detailViewController else {
|
||||
return
|
||||
}
|
||||
detailViewController.canScrollUp { (canScroll) in
|
||||
if (canScroll) {
|
||||
NSCursor.setHiddenUntilMouseMoves(true)
|
||||
detailViewController.scrollPageUp(sender)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@IBAction func openArticleInBrowser(_ sender: Any?) {
|
||||
if let link = currentLink {
|
||||
Browser.open(link, invertPreference: NSApp.currentEvent?.modifierFlags.contains(.shift) ?? false)
|
||||
|
@ -10,6 +10,16 @@
|
||||
<key>action</key>
|
||||
<string>scrollOrGoToNextUnread:</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>title</key>
|
||||
<string>Scroll or Go to Next Unread</string>
|
||||
<key>key</key>
|
||||
<string>[space]</string>
|
||||
<key>shiftModifier</key>
|
||||
<true/>
|
||||
<key>action</key>
|
||||
<string>scrollUp:</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>title</key>
|
||||
<string>Go to Previous Unread</string>
|
||||
|
Loading…
Reference in New Issue
Block a user