mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2024-12-22 06:19:03 +01:00
fix: cursor jumping when entering text before non-ascii char in share extension (#395)
This commit is contained in:
parent
6b5328946d
commit
852b91912d
@ -54,6 +54,9 @@ public struct StatusEditorView: UIViewRepresentable {
|
||||
}
|
||||
|
||||
public func updateUIView(_ textView: UITextView, context: Context) {
|
||||
// preserve currently selected text range to prevent cursor jump
|
||||
let currentlySelectedRange = textView.selectedRange
|
||||
|
||||
// update content
|
||||
// textView.attributedText = attributedString
|
||||
textView.text = string
|
||||
@ -66,6 +69,9 @@ public struct StatusEditorView: UIViewRepresentable {
|
||||
viewDidAppear = false
|
||||
textView.becomeFirstResponder()
|
||||
}
|
||||
|
||||
// restore selected text range
|
||||
textView.selectedRange = currentlySelectedRange
|
||||
}
|
||||
|
||||
public func makeCoordinator() -> Coordinator {
|
||||
|
Loading…
Reference in New Issue
Block a user