Change reload so that the text size style can be used in more places.
This commit is contained in:
parent
48b2a5ca0f
commit
b43d8b6b28
|
@ -155,16 +155,12 @@ final class DetailWebViewController: NSViewController {
|
|||
|
||||
@objc func userDefaultsDidChange(_ note: Notification) {
|
||||
if articleTextSize != AppDefaults.shared.articleTextSize {
|
||||
articleTextSize = AppDefaults.shared.articleTextSize
|
||||
webView.evaluateJavaScript("updateTextSize(\"\(articleTextSize.cssClass)\");")
|
||||
reloadHTMLMaintainingScrollPosition()
|
||||
}
|
||||
}
|
||||
|
||||
@objc func currentArticleThemeDidChangeNotification(_ note: Notification) {
|
||||
fetchScrollInfo() { scrollInfo in
|
||||
self.windowScrollY = scrollInfo?.offsetY
|
||||
self.reloadHTML()
|
||||
}
|
||||
reloadHTMLMaintainingScrollPosition()
|
||||
}
|
||||
|
||||
// MARK: Media Functions
|
||||
|
@ -294,6 +290,13 @@ private extension DetailWebViewController {
|
|||
}
|
||||
}
|
||||
|
||||
func reloadHTMLMaintainingScrollPosition() {
|
||||
fetchScrollInfo() { scrollInfo in
|
||||
self.windowScrollY = scrollInfo?.offsetY
|
||||
self.reloadHTML()
|
||||
}
|
||||
}
|
||||
|
||||
func reloadHTML() {
|
||||
delegate?.mouseDidExit(self)
|
||||
|
||||
|
|
|
@ -132,12 +132,6 @@ function stopMediaPlayback() {
|
|||
});
|
||||
}
|
||||
|
||||
function updateTextSize(cssClass) {
|
||||
var bodyElement = document.getElementById("bodyContainer");
|
||||
bodyElement.classList.remove("smallText", "mediumText", "largeText", "xLargeText", "xxLargeText");
|
||||
bodyElement.classList.add(cssClass);
|
||||
}
|
||||
|
||||
function error() {
|
||||
document.body.innerHTML = "error";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue