Merge branch 'develop' into feature/heart
This commit is contained in:
commit
c81f979f3f
@ -128,7 +128,9 @@ extension WebView : WKUIDelegate {
|
||||
if !dynamicHeight {
|
||||
return
|
||||
}
|
||||
/* 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".
|
||||
/*
|
||||
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".
|
||||
so webView.isLoading to check load finished state
|
||||
*/
|
||||
if !webView.isLoading {
|
||||
@ -136,14 +138,18 @@ extension WebView : WKUIDelegate {
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
if let height = result as? CGFloat {
|
||||
self.webViewHeight?.constant = height
|
||||
} else {
|
||||
//if failed to get height from javascript, using scrollview.contensize's height
|
||||
let scrollHeight = self.webView?.scrollView.contentSize.height
|
||||
self.webViewHeight?.constant = scrollHeight ?? 44
|
||||
}
|
||||
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
|
||||
MVMCoreDispatchUtility.performBlock(onMainThread: { [weak self] in
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
if let height = result as? CGFloat {
|
||||
self.webViewHeight?.constant = height
|
||||
} else {
|
||||
//if failed to get height from javascript, using scrollview.contensize's height
|
||||
self.webViewHeight?.constant = webView.scrollView.contentSize.height
|
||||
}
|
||||
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user