收集箱列表展示完整文案

This commit is contained in:
2026-07-16 21:44:51 +08:00
parent f888e28d15
commit 4765d48021
+2 -3
View File
@@ -246,6 +246,7 @@ extension ClipInboxViewController: UITableViewDataSource {
var config = cell.defaultContentConfiguration() var config = cell.defaultContentConfiguration()
config.text = previewText(for: clip.text) config.text = previewText(for: clip.text)
config.textProperties.numberOfLines = 0
config.secondaryText = formattedDate(clip.createdAt) config.secondaryText = formattedDate(clip.createdAt)
config.secondaryTextProperties.color = .secondaryLabel config.secondaryTextProperties.color = .secondaryLabel
cell.contentConfiguration = config cell.contentConfiguration = config
@@ -255,9 +256,7 @@ extension ClipInboxViewController: UITableViewDataSource {
} }
private func previewText(for text: String) -> String { private func previewText(for text: String) -> String {
let lines = text.components(separatedBy: .newlines) let preview = text.trimmingCharacters(in: .whitespacesAndNewlines)
let firstTwoLines = Array(lines.prefix(2))
let preview = firstTwoLines.joined(separator: " ").trimmingCharacters(in: .whitespaces)
if preview.isEmpty { if preview.isEmpty {
return "(无内容)" return "(无内容)"
} }