mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Quote improvements
This commit is contained in:
@@ -56,6 +56,25 @@ public func chatInputStateStringWithAppliedEntities(_ text: String, entities: [M
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
while true {
|
||||
var found = false
|
||||
string.enumerateAttribute(ChatTextInputAttributes.block, in: NSRange(location: 0, length: string.length), using: { value, range, stop in
|
||||
if let value = value as? ChatTextInputTextQuoteAttribute, value.isCollapsed {
|
||||
found = true
|
||||
let blockString = string.attributedSubstring(from: range)
|
||||
string.replaceCharacters(in: range, with: "")
|
||||
string.insert(NSAttributedString(string: " ", attributes: [
|
||||
ChatTextInputAttributes.collapsedBlock: blockString
|
||||
]), at: range.lowerBound)
|
||||
stop.pointee = true
|
||||
}
|
||||
})
|
||||
if !found {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return string
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user