mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Only update the textView if it doesn't match text binding
This commit is contained in:
parent
539597bd5a
commit
088e5924a1
@ -29,10 +29,6 @@ class PostBodyCoordinator: NSObject, UITextViewDelegate, NSLayoutManagerDelegate
|
||||
}
|
||||
}
|
||||
|
||||
func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func textViewDidEndEditing(_ textView: UITextView) {
|
||||
self.isFirstResponder = false
|
||||
self.didBecomeFirstResponder = false
|
||||
@ -97,7 +93,9 @@ struct PostBodyTextView: UIViewRepresentable {
|
||||
}
|
||||
|
||||
func updateUIView(_ uiView: UITextView, context: UIViewRepresentableContext<PostBodyTextView>) {
|
||||
uiView.text = text
|
||||
if uiView.text != text {
|
||||
uiView.text = text
|
||||
}
|
||||
|
||||
let font = textStyle
|
||||
let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle)
|
||||
|
@ -112,7 +112,9 @@ struct PostTitleTextView: UIViewRepresentable {
|
||||
}
|
||||
|
||||
func updateUIView(_ uiView: UITextView, context: UIViewRepresentableContext<PostTitleTextView>) {
|
||||
uiView.text = text
|
||||
if uiView.text != text {
|
||||
uiView.text = text
|
||||
}
|
||||
|
||||
let font = textStyle
|
||||
let fontMetrics = UIFontMetrics(forTextStyle: .largeTitle)
|
||||
|
Loading…
Reference in New Issue
Block a user