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) {
|
@objc func userDefaultsDidChange(_ note: Notification) {
|
||||||
if articleTextSize != AppDefaults.shared.articleTextSize {
|
if articleTextSize != AppDefaults.shared.articleTextSize {
|
||||||
articleTextSize = AppDefaults.shared.articleTextSize
|
reloadHTMLMaintainingScrollPosition()
|
||||||
webView.evaluateJavaScript("updateTextSize(\"\(articleTextSize.cssClass)\");")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@objc func currentArticleThemeDidChangeNotification(_ note: Notification) {
|
@objc func currentArticleThemeDidChangeNotification(_ note: Notification) {
|
||||||
fetchScrollInfo() { scrollInfo in
|
reloadHTMLMaintainingScrollPosition()
|
||||||
self.windowScrollY = scrollInfo?.offsetY
|
|
||||||
self.reloadHTML()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: Media Functions
|
// MARK: Media Functions
|
||||||
|
@ -294,6 +290,13 @@ private extension DetailWebViewController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func reloadHTMLMaintainingScrollPosition() {
|
||||||
|
fetchScrollInfo() { scrollInfo in
|
||||||
|
self.windowScrollY = scrollInfo?.offsetY
|
||||||
|
self.reloadHTML()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func reloadHTML() {
|
func reloadHTML() {
|
||||||
delegate?.mouseDidExit(self)
|
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() {
|
function error() {
|
||||||
document.body.innerHTML = "error";
|
document.body.innerHTML = "error";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue