Skip to content

Commit

Permalink
Revert "Revert "Refresh the view when html changes""
Browse files Browse the repository at this point in the history
This reverts commit 5cf07b1.
  • Loading branch information
NuPlay committed Mar 1, 2022
1 parent 5cf07b1 commit f22101d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Sources/RichText/Webview.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,15 @@ struct Webview: UIViewRepresentable {
}

public func updateUIView(_ uiView: WKWebView, context: Context) {

let htmlStart = """
<HTML>
<head>
<meta name='viewport' content='width=device-width, shrink-to-fit=YES, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no'>
</head>
"""
let htmlEnd = "</BODY></HTML>"
let htmlString = "\(htmlStart)\(css(colorScheme: self.colorScheme))\(html)\(htmlEnd)"
uiView.loadHTMLString(htmlString, baseURL: nil)
}

func css(colorScheme: colorScheme) -> String {
Expand Down

0 comments on commit f22101d

Please sign in to comment.