mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Various fixes
This commit is contained in:
parent
54d084b9ab
commit
b46667113c
@ -298,7 +298,7 @@ public final class HashtagListItemComponent: Component {
|
||||
guard let component = self.component else {
|
||||
return
|
||||
}
|
||||
component.action(component.hashtag, self)
|
||||
component.action("\(component.hashtag) ", self)
|
||||
}
|
||||
|
||||
func update(component: HashtagListItemComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
|
@ -2003,7 +2003,23 @@ public final class MessageInputPanelComponent: Component {
|
||||
}
|
||||
}
|
||||
case let .hashtag(hashtag):
|
||||
let _ = hashtag
|
||||
var hashtagQueryRange: NSRange?
|
||||
inner: for (range, type, _) in textInputStateContextQueryRangeAndType(inputState: inputState) {
|
||||
if type == [.hashtag] {
|
||||
hashtagQueryRange = range
|
||||
break inner
|
||||
}
|
||||
}
|
||||
|
||||
if let range = hashtagQueryRange {
|
||||
let inputText = NSMutableAttributedString(attributedString: inputState.inputText)
|
||||
|
||||
let replacementText = hashtag
|
||||
inputText.replaceCharacters(in: range, with: replacementText)
|
||||
|
||||
let selectionPosition = range.lowerBound + (replacementText as NSString).length
|
||||
textView.updateText(inputText, selectionRange: selectionPosition ..< selectionPosition)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user