Fix for line breaks (#2224)

This commit is contained in:
Mauro
2023-12-11 16:43:31 +01:00
committed by GitHub
parent 4cba5687c6
commit a248bdbd95
5 changed files with 55 additions and 5 deletions
@@ -73,14 +73,16 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
// that could happen with the default HTML renderer of NSAttributedString which is a
// webview.
func fromHTML(_ htmlString: String?) -> AttributedString? {
guard let htmlString else {
guard var originalHTMLString = htmlString else {
return nil
}
if let cached = Self.caches[cacheKey]?.value(forKey: htmlString) {
if let cached = Self.caches[cacheKey]?.value(forKey: originalHTMLString) {
return cached
}
let htmlString = originalHTMLString.replacingHtmlBreaksOccurrences()
guard let data = htmlString.data(using: .utf8) else {
return nil
}