fix: textView break IME input issue. resolve #342
This commit is contained in:
parent
ad524b0172
commit
4614bd8692
|
@ -161,7 +161,10 @@ extension ComposeStatusContentTableViewCell: UITextViewDelegate {
|
||||||
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): text: \(textView.text ?? "<nil>")")
|
logger.debug("\((#file as NSString).lastPathComponent, privacy: .public)[\(#line, privacy: .public)], \(#function, privacy: .public): text: \(textView.text ?? "<nil>")")
|
||||||
guard textView === statusContentWarningEditorView.textView else { return }
|
guard textView === statusContentWarningEditorView.textView else { return }
|
||||||
// replace line break with space
|
// replace line break with space
|
||||||
textView.text = textView.text.replacingOccurrences(of: "\n", with: " ")
|
// needs check input state to prevent break the IME
|
||||||
|
if textView.markedTextRange == nil {
|
||||||
|
textView.text = textView.text.replacingOccurrences(of: "\n", with: " ")
|
||||||
|
}
|
||||||
contentWarningContent.send(textView.text)
|
contentWarningContent.send(textView.text)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,10 @@ public struct StatusEditorView: UIViewRepresentable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public func textViewDidChange(_ textView: UITextView) {
|
public func textViewDidChange(_ textView: UITextView) {
|
||||||
parent.string = textView.text
|
// prevent break IME input
|
||||||
|
if textView.markedTextRange == nil {
|
||||||
|
parent.string = textView.text
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateLayout(width: CGFloat) {
|
func updateLayout(width: CGFloat) {
|
||||||
|
|
Loading…
Reference in New Issue