Fixed text attributes missing from blockquote components. Added more tests.

This commit is contained in:
Stefan Ceriu
2022-03-31 11:23:15 +03:00
parent a74849b79c
commit 8cefe48d36
2 changed files with 86 additions and 3 deletions
@@ -100,9 +100,9 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
var attributedString = AttributedString(attributedString[range])
// Remove trailing new lines if any
if let lastCharacter = attributedString.characters.last,
lastCharacter.isNewline {
attributedString = AttributedString(attributedString.characters.dropLast())
if attributedString.characters.last?.isNewline ?? false,
let range = attributedString.range(of: "\n", options: .backwards, locale: nil) {
attributedString.removeSubrange(range)
}
return AttributedStringBuilderComponent(attributedString: attributedString, isBlockquote: value != nil)