Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ios/utils/TextInsertionUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ + (void)insertText:(NSString*)text at:(NSInteger)index additionalAttributes:(NSD
[textView.textStorage insertAttributedString:newAttrStr atIndex:index];

if(withSelection) {
if(!textView.focused) {
if(![textView isFirstResponder]) {
[textView reactFocus];
}
textView.selectedRange = NSMakeRange(index + text.length, 0);
Expand All @@ -38,7 +38,7 @@ + (void)replaceText:(NSString*)text at:(NSRange)range additionalAttributes:(NSDi
}

if(withSelection) {
if(!textView.focused) {
if(![textView isFirstResponder]) {
[textView reactFocus];
}
textView.selectedRange = NSMakeRange(range.location + text.length, 0);
Expand Down
6 changes: 2 additions & 4 deletions ios/utils/ZeroWidthSpaceUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ + (void)removeSpacesIfNeededinInput:(EnrichedTextInputView *)input {
}

// fix the selection if needed
if(input->textView.focused) {
[input->textView reactFocus];
if([input->textView isFirstResponder]) {
input->textView.selectedRange = NSMakeRange(preRemoveSelection.location + postRemoveOffset, preRemoveSelection.length);
}
}
Expand Down Expand Up @@ -112,8 +111,7 @@ + (void)addSpacesIfNeededinInput:(EnrichedTextInputView *)input {
}

// fix the selection if needed
if(input->textView.focused) {
[input->textView reactFocus];
if([input->textView isFirstResponder]) {
input->textView.selectedRange = NSMakeRange(preAddSelection.location + postAddOffset, preAddSelection.length);
}
}
Expand Down
Loading