apply last character font size to the attachment

This commit is contained in:
Mauro Romito
2026-05-13 11:49:44 +02:00
committed by Mauro
parent 25318175b9
commit 690a177f6b
11 changed files with 49 additions and 19 deletions
@@ -152,6 +152,15 @@ struct TimelineItemStyler_Previews: PreviewProvider, TestablePreview {
canBeRepliedTo: true,
sender: .test,
content: .init(body: "באמת! -- house!"))
static let bigEmoji = TextRoomTimelineItem(id: .randomEvent,
timestamp: .mock,
isOutgoing: true,
isEditable: false,
canBeRepliedTo: true,
shouldBoost: true,
sender: .test,
content: .init(body: "😮"))
static var testView: some View {
VStack(spacing: 0) {
@@ -172,6 +181,7 @@ struct TimelineItemStyler_Previews: PreviewProvider, TestablePreview {
TextRoomTimelineView(timelineItem: rtlStringThatContainsLtr)
TextRoomTimelineView(timelineItem: ltrStringThatFinishesInRtl)
TextRoomTimelineView(timelineItem: rtlStringThatFinishesInLtr)
TextRoomTimelineView(timelineItem: bigEmoji)
}
}
@@ -24,7 +24,7 @@ struct FormattedBodyText: View {
private var attributedComponents: [AttributedStringBuilderComponent] {
var adjustedAttributedString = attributedString
// Required to allow the underlying TextView to use body font when no font is specifie in the AttributedString.
// Required to allow the underlying TextView to use body font when no font is specified in the AttributedString.
adjustedAttributedString.mergeAttributes(defaultAttributesContainer, mergePolicy: .keepCurrent)
let string = String(attributedString.characters)