mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Removed extra trailing new line from the generated string builder components. Fixed blockquote rendering.
This commit is contained in:
@@ -84,9 +84,9 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
removeDefaultForegroundColor(mutableAttributedString)
|
||||
addLinks(mutableAttributedString)
|
||||
removeLinkColors(mutableAttributedString)
|
||||
removeDTCoreTextArtifacts(mutableAttributedString)
|
||||
replaceMarkedBlockquotes(mutableAttributedString)
|
||||
replaceMarkedCodeBlocks(mutableAttributedString)
|
||||
removeDTCoreTextArtifacts(mutableAttributedString)
|
||||
|
||||
return try? AttributedString(mutableAttributedString, including: \.elementX)
|
||||
}
|
||||
@@ -95,10 +95,17 @@ struct AttributedStringBuilder: AttributedStringBuilderProtocol {
|
||||
guard let attributedString = attributedString else {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
return attributedString.runs[\.blockquote].map { (value, range) in
|
||||
AttributedStringBuilderComponent(attributedString: AttributedString(attributedString[range]),
|
||||
isBlockquote: value != nil)
|
||||
var attributedString = AttributedString(attributedString[range])
|
||||
|
||||
// Remove trailing new lines if any
|
||||
if let lastCharacter = attributedString.characters.last,
|
||||
lastCharacter.isNewline {
|
||||
attributedString = AttributedString(attributedString.characters.dropLast())
|
||||
}
|
||||
|
||||
return AttributedStringBuilderComponent(attributedString: attributedString, isBlockquote: value != nil)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ struct FormattedBodyText: View {
|
||||
let attributedComponents: [AttributedStringBuilderComponent]
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 0.0) {
|
||||
VStack(alignment: .leading, spacing: 8.0) {
|
||||
ForEach(attributedComponents, id: \.self) { component in
|
||||
if component.isBlockquote {
|
||||
HStack(spacing: 4.0) {
|
||||
|
||||
Reference in New Issue
Block a user