Fix TextConverter inserting newlines

This commit is contained in:
Shadowfacts 2023-12-23 10:47:40 -05:00
parent 4d183fe0b2
commit 93c859a3c4
7 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@ class StatusActivityItemSource: NSObject, UIActivityItemSource {
let metadata = LPLinkMetadata() let metadata = LPLinkMetadata()
metadata.originalURL = status.url! metadata.originalURL = status.url!
metadata.url = status.url! metadata.url = status.url!
var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
let content = converter.convert(html: status.content) let content = converter.convert(html: status.content)
metadata.title = "\(status.account.displayName): \"\(content)\"" metadata.title = "\(status.account.displayName): \"\(content)\""
if let avatar = status.account.avatar, if let avatar = status.account.avatar,

View File

@ -78,7 +78,7 @@ class TrendingLinkCardCollectionViewCell: UICollectionViewCell {
let provider = card.providerName!.trimmingCharacters(in: .whitespacesAndNewlines) let provider = card.providerName!.trimmingCharacters(in: .whitespacesAndNewlines)
providerLabel.text = provider providerLabel.text = provider
var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
descriptionLabel.text = converter.convert(html: card.description) descriptionLabel.text = converter.convert(html: card.description)
descriptionLabel.isHidden = description.isEmpty descriptionLabel.isHidden = description.isEmpty

View File

@ -161,7 +161,7 @@ class ActionNotificationGroupCollectionViewCell: UICollectionViewListCell {
actionLabel.setEmojis(pairs: people.map { ($0.displayOrUserName, $0.emojis) }, identifier: group.id) actionLabel.setEmojis(pairs: people.map { ($0.displayOrUserName, $0.emojis) }, identifier: group.id)
var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
statusContentLabel.text = converter.convert(html: status.content) statusContentLabel.text = converter.convert(html: status.content)
} }

View File

@ -124,7 +124,7 @@ class PollFinishedNotificationCollectionViewCell: UICollectionViewListCell {
updateTimestamp() updateTimestamp()
updateDisplayName(account: account) updateDisplayName(account: account)
var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
contentLabel.text = converter.convert(html: status.content) contentLabel.text = converter.convert(html: status.content)
pollView.mastodonController = mastodonController pollView.mastodonController = mastodonController

View File

@ -120,7 +120,7 @@ class StatusUpdatedNotificationCollectionViewCell: UICollectionViewListCell {
updateTimestamp() updateTimestamp()
updateDisplayName(account: account) updateDisplayName(account: account)
var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
contentLabel.text = converter.convert(html: status.content) contentLabel.text = converter.convert(html: status.content)
} }

View File

@ -134,7 +134,7 @@ class AccountCollectionViewCell: UICollectionViewListCell {
displayNameLabel.setEmojis(account.emojis, identifier: account.id) displayNameLabel.setEmojis(account.emojis, identifier: account.id)
} }
var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
noteLabel.text = converter.convert(html: account.note) noteLabel.text = converter.convert(html: account.note)
noteLabel.setEmojis(account.emojis, identifier: account.id) noteLabel.setEmojis(account.emojis, identifier: account.id)
} }

View File

@ -191,7 +191,7 @@ class StatusCardView: UIView {
titleLabel.text = title titleLabel.text = title
titleLabel.isHidden = title.isEmpty titleLabel.isHidden = title.isEmpty
var converter = TextConverter(callbacks: HTMLConverter.Callbacks.self) var converter = TextConverter(configuration: .init(insertNewlines: false), callbacks: HTMLConverter.Callbacks.self)
let description = converter.convert(html: card.description) let description = converter.convert(html: card.description)
descriptionLabel.text = description descriptionLabel.text = description
descriptionLabel.isHidden = description.isEmpty descriptionLabel.isHidden = description.isEmpty