This commit is contained in:
Suresh, Kamlesh 2020-08-25 19:34:25 -04:00
parent f3c3ba9799
commit dce1c5cdf2

View File

@ -129,7 +129,6 @@ extension WebView : WKUIDelegate {
return return
} }
/* /*
//TODO: Check and remove the comment
was using "document.readyState" to check the state, was using "document.readyState" to check the state,
while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred". while evaluateJavaScript "document.readyState",only works when webview contains userscrpt.otherwise, it would return WKErrorDomain Code=4 "A JavaScript exception occurred".
so webView.isLoading to check load finished state so webView.isLoading to check load finished state
@ -140,17 +139,16 @@ extension WebView : WKUIDelegate {
return return
} }
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
let scrollHeight = webView.scrollView.contentSize.height
guard let self = self else { guard let self = self else {
return return
} }
if let height = result as? CGFloat { if let height = result as? CGFloat {
self.webViewHeight?.constant = height self.webViewHeight?.constant = height
} else { } else {
//if failed to get height from javascript, using scrollview.contensize's height //if failed to get height from javascript, using scrollview.contensize's height
self.webViewHeight?.constant = scrollHeight self.webViewHeight?.constant = webView.scrollView.contentSize.height
} }
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self) self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
}) })
}) })
} }