Skip to content
Merged
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
16 changes: 10 additions & 6 deletions ios/utils/ZeroWidthSpaceUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ + (void)removeSpacesIfNeededInEditor:(ReactNativeRichTextEditorView *)editor {
}
}

// fix the selection
[editor->textView reactFocus];
editor->textView.selectedRange = NSMakeRange(preRemoveSelection.location + postRemoveOffset, preRemoveSelection.length);
// fix the selection if needed
if(editor->textView.focused) {
[editor->textView reactFocus];
editor->textView.selectedRange = NSMakeRange(preRemoveSelection.location + postRemoveOffset, preRemoveSelection.length);
}
}

+ (void)addSpacesIfNeededInEditor:(ReactNativeRichTextEditorView *)editor {
Expand Down Expand Up @@ -109,9 +111,11 @@ + (void)addSpacesIfNeededInEditor:(ReactNativeRichTextEditorView *)editor {
[TextInsertionUtils insertText:@"\u200B" at:lastRange.location additionalAttributes:nullptr editor:editor withSelection:NO];
}

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

+ (BOOL)handleBackspaceInRange:(NSRange)range replacementText:(NSString *)text editor:(id)editor {
Expand Down
Loading