Change to use the correct URL when reloading an image.
This commit is contained in:
parent
3a99e6430f
commit
dd5633b5ae
|
@ -27,6 +27,17 @@ final class DetailWebViewController: NSViewController, WKUIDelegate {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
var article: Article? {
|
||||
switch state {
|
||||
case .article(let article):
|
||||
return article
|
||||
case .extracted(let article, _):
|
||||
return article
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
#if !MAC_APP_STORE
|
||||
private var webInspectorEnabled: Bool {
|
||||
|
@ -193,7 +204,8 @@ struct TemplateData: Codable {
|
|||
private extension DetailWebViewController {
|
||||
|
||||
func reloadArticleImage() {
|
||||
webView.evaluateJavaScript("reloadArticleImage()")
|
||||
guard let article = article else { return }
|
||||
webView?.evaluateJavaScript("reloadArticleImage(\"\(article.articleID)\")")
|
||||
}
|
||||
|
||||
func reloadHTML() {
|
||||
|
|
|
@ -79,9 +79,9 @@ function flattenPreElements() {
|
|||
ElementUnwrapper.unwrapAppropriateChildren("div.articleBody td > pre");
|
||||
}
|
||||
|
||||
function reloadArticleImage() {
|
||||
function reloadArticleImage(articleID) {
|
||||
var image = document.getElementById("nnwImageIcon");
|
||||
image.src = "nnwImageIcon://";
|
||||
image.src = "nnwImageIcon://" + articleID;
|
||||
}
|
||||
|
||||
function error() {
|
||||
|
|
|
@ -512,7 +512,8 @@ private extension WebViewController {
|
|||
}
|
||||
|
||||
func reloadArticleImage() {
|
||||
webView?.evaluateJavaScript("reloadArticleImage()")
|
||||
guard let article = article else { return }
|
||||
webView?.evaluateJavaScript("reloadArticleImage(\"\(article.articleID)\")")
|
||||
}
|
||||
|
||||
func imageWasClicked(body: String?) {
|
||||
|
|
Loading…
Reference in New Issue