Fix trailing whitespace not being stripped from compose reply content

This commit is contained in:
Shadowfacts 2024-01-26 11:25:29 -05:00
parent b4bdf8b0dc
commit a9a518c6c1

View File

@ -28,8 +28,13 @@ struct ComposeReplyContentView: UIViewRepresentable {
view.adjustsFontForContentSizeCategory = true
view.overrideMastodonController = mastodonController
view.attributedText = TimelineStatusCollectionViewCell.htmlConverter.convert(status.content)
let content = TimelineStatusCollectionViewCell.htmlConverter.convert(status.content)
let collapsedContent = NSMutableAttributedString(attributedString: content)
collapsedContent.collapseWhitespace()
collapsedContent.trimLeadingCharactersInSet(.whitespacesAndNewlines)
collapsedContent.trimTrailingCharactersInSet(.whitespacesAndNewlines)
view.attributedText = collapsedContent
return view
}