mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 09:32:46 +00:00
Preserve spoiler formatting when copying to pasterboard
This commit is contained in:
parent
6724b422fa
commit
bc52f5951f
@ -49,6 +49,9 @@ private func chatInputStateString(attributedString: NSAttributedString) -> NSAtt
|
|||||||
string.addAttribute(ChatTextInputAttributes.monospace, value: true as NSNumber, range: range)
|
string.addAttribute(ChatTextInputAttributes.monospace, value: true as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if let value = attributes[.backgroundColor] as? UIColor, value.rgb == UIColor.gray.rgb {
|
||||||
|
string.addAttribute(ChatTextInputAttributes.spoiler, value: true as NSNumber, range: range)
|
||||||
|
}
|
||||||
if let _ = attributes[.strikethroughStyle] {
|
if let _ = attributes[.strikethroughStyle] {
|
||||||
string.addAttribute(ChatTextInputAttributes.strikethrough, value: true as NSNumber, range: range)
|
string.addAttribute(ChatTextInputAttributes.strikethrough, value: true as NSNumber, range: range)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.BankCard), value: nsString!.substring(with: range), range: range)
|
||||||
case .Spoiler:
|
case .Spoiler:
|
||||||
|
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)
|
string.addAttribute(NSAttributedString.Key(rawValue: TelegramTextAttributes.Spoiler), value: true as NSNumber, range: range)
|
||||||
|
}
|
||||||
case let .Custom(type):
|
case let .Custom(type):
|
||||||
if type == ApplicationSpecificEntityType.Timecode {
|
if type == ApplicationSpecificEntityType.Timecode {
|
||||||
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
string.addAttribute(NSAttributedString.Key.foregroundColor, value: linkColor, range: range)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user