Bug fixes

This commit is contained in:
Isaac
2024-03-28 20:01:25 +04:00
parent 12d239ebbf
commit 83de81228a
7 changed files with 55 additions and 17 deletions

View File

@@ -331,6 +331,12 @@ public final class TextFieldComponent: Component {
}
if let attributedString = attributedString {
let current = self.inputState
let range = NSMakeRange(current.selectionRange.lowerBound, current.selectionRange.count)
if !self.chatInputTextNode(shouldChangeTextIn: range, replacementText: attributedString.string) {
return false
}
self.updateInputState { current in
if let inputText = current.inputText.mutableCopy() as? NSMutableAttributedString {
inputText.replaceCharacters(in: NSMakeRange(current.selectionRange.lowerBound, current.selectionRange.count), with: attributedString)