Accessibility: Disable links parsing for now

This commit is contained in:
Thomas Ricouard 2023-03-30 16:29:44 +02:00
parent dda6ee8f8f
commit d3888d8c40

View file

@ -77,6 +77,10 @@ public struct HTMLString: Codable, Equatable, Hashable, @unchecked Sendable {
asSafeMarkdownAttributedString = AttributedString(stringLiteral: htmlValue) asSafeMarkdownAttributedString = AttributedString(stringLiteral: htmlValue)
} }
/// This somehow crash in some cases.
/// Disabling for now
/// Could be related to this: https://github.com/apple/swift/issues/61532
/*
links = asSafeMarkdownAttributedString.runs links = asSafeMarkdownAttributedString.runs
.compactMap { run in .compactMap { run in
guard let link = run.link else { guard let link = run.link else {
@ -85,6 +89,7 @@ public struct HTMLString: Codable, Equatable, Hashable, @unchecked Sendable {
return Link(link, displayString: String(self.asSafeMarkdownAttributedString[run.range].characters)) return Link(link, displayString: String(self.asSafeMarkdownAttributedString[run.range].characters))
} }
*/
} }
public init(stringValue: String, parseMarkdown: Bool = false) { public init(stringValue: String, parseMarkdown: Bool = false) {
@ -105,6 +110,7 @@ public struct HTMLString: Codable, Equatable, Hashable, @unchecked Sendable {
asSafeMarkdownAttributedString = AttributedString(stringLiteral: htmlValue) asSafeMarkdownAttributedString = AttributedString(stringLiteral: htmlValue)
} }
/*
links = asSafeMarkdownAttributedString.runs links = asSafeMarkdownAttributedString.runs
.compactMap { run in .compactMap { run in
guard let link = run.link else { guard let link = run.link else {
@ -113,6 +119,7 @@ public struct HTMLString: Codable, Equatable, Hashable, @unchecked Sendable {
return Link(link, displayString: String(self.asSafeMarkdownAttributedString[run.range].characters)) return Link(link, displayString: String(self.asSafeMarkdownAttributedString[run.range].characters))
} }
*/
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {