Preserve spoiler formatting when copying to pasterboard

This commit is contained in:
Ilya Laktyushin
2022-01-11 15:59:47 +03:00
parent 6724b422fa
commit bc52f5951f
2 changed files with 8 additions and 1 deletions

View File

@@ -228,7 +228,11 @@ public func stringWithAppliedEntities(_ text: String, entities: [MessageTextEnti
}
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.BankCard), value: nsString!.substring(with: range), range: range)
case .Spoiler:
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Spoiler), value: true as NSNumber, range: range)
if external {
string.addAttribute(NSAttributedString.Key.backgroundColor, value: UIColor.gray, range: range)
} else {
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Spoiler), value: true as NSNumber, range: range)
}
case let .Custom(type):
if type == ApplicationSpecificEntityType.Timecode {
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)