Fix note rendering for those that contain previewable items or leading and trailing whitespaces

Changelog-Fixed: Fixed note rendering for those that contain previewable items or leading and trailing whitespaces
Closes: https://github.com/damus-io/damus/issues/2187
Signed-off-by: Terry Yiu <git@tyiu.xyz>
This commit is contained in:
2025-03-01 16:30:25 -05:00
committed by Daniel D’Aquino
parent f96647fa40
commit f1fdae5957
7 changed files with 387 additions and 66 deletions
+17 -1
View File
@@ -37,7 +37,23 @@ enum Block: Equatable {
return false
}
}
var is_previewable: Bool {
switch self {
case .mention(let m):
switch m.ref {
case .note, .nevent: return true
default: return false
}
case .invoice:
return true
case .url:
return true
default:
return false
}
}
case text(String)
case mention(Mention<MentionRef>)
case hashtag(String)