mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-01 11:36:56 +01:00
Merge pull request #2855 from stuartbreckenridge/article-view-fixes
Fixes #2823
This commit is contained in:
commit
2819dcdada
@ -53,6 +53,24 @@ final class DetailWebView: WKWebView {
|
|||||||
override func viewDidEndLiveResize() {
|
override func viewDidEndLiveResize() {
|
||||||
super.viewDidEndLiveResize()
|
super.viewDidEndLiveResize()
|
||||||
evaluateJavaScript("document.body.style.overflow = 'visible';", completionHandler: nil)
|
evaluateJavaScript("document.body.style.overflow = 'visible';", completionHandler: nil)
|
||||||
|
|
||||||
|
/*
|
||||||
|
On macOS 11, when a user exits full screen
|
||||||
|
or exits zoomed mode by disconnecting an external display
|
||||||
|
the webview's `origin.y` is offset by a sizeable amount.
|
||||||
|
|
||||||
|
This code adjusts the height of the window by -1pt/+1pt,
|
||||||
|
which puts the webview back in the correct place.
|
||||||
|
*/
|
||||||
|
if #available(macOS 11, *) {
|
||||||
|
guard var frame = window?.frame else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height - 1)
|
||||||
|
window!.setFrame(frame, display: false)
|
||||||
|
frame.size = NSSize(width: window!.frame.width, height: window!.frame.height + 1)
|
||||||
|
window!.setFrame(frame, display: false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,6 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
|
|||||||
NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(avatarDidBecomeAvailable(_:)), name: .AvatarDidBecomeAvailable, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(faviconDidBecomeAvailable(_:)), name: .FaviconDidBecomeAvailable, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(userDefaultsDidChange(_:)), name: UserDefaults.didChangeNotification, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(bigSurOffsetFix(_:)), name: NSWindow.didExitFullScreenNotification, object: nil)
|
|
||||||
|
|
||||||
webView.loadFileURL(ArticleRenderer.blank.url, allowingReadAccessTo: ArticleRenderer.blank.baseURL)
|
webView.loadFileURL(ArticleRenderer.blank.url, allowingReadAccessTo: ArticleRenderer.blank.baseURL)
|
||||||
}
|
}
|
||||||
@ -142,17 +141,6 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// On macOS 11, when a user exits full screen, the webview's origin.y is offset by a sizeable amount. This function adjusts the height of the window height by 1pt which puts the webview back in the correct place. This is an issue with SwiftUI and AppKit.
|
|
||||||
@objc func bigSurOffsetFix(_ note: Notification) {
|
|
||||||
if #available(macOS 11, *) {
|
|
||||||
guard var frame = self.view.window?.frame else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
frame.size = NSSize(width: self.view.window!.frame.width, height: self.view.window!.frame.height - 1)
|
|
||||||
self.view.window!.setFrame(frame, display: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: Media Functions
|
// MARK: Media Functions
|
||||||
|
|
||||||
func stopMediaPlayback() {
|
func stopMediaPlayback() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user