File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,9 +62,11 @@ + (void)removeSpacesIfNeededInEditor:(ReactNativeRichTextEditorView *)editor {
6262 }
6363 }
6464
65- // fix the selection
66- [editor->textView reactFocus ];
67- editor->textView .selectedRange = NSMakeRange (preRemoveSelection.location + postRemoveOffset, preRemoveSelection.length );
65+ // fix the selection if needed
66+ if (editor->textView .focused ) {
67+ [editor->textView reactFocus ];
68+ editor->textView .selectedRange = NSMakeRange (preRemoveSelection.location + postRemoveOffset, preRemoveSelection.length );
69+ }
6870}
6971
7072+ (void )addSpacesIfNeededInEditor : (ReactNativeRichTextEditorView *)editor {
@@ -109,9 +111,11 @@ + (void)addSpacesIfNeededInEditor:(ReactNativeRichTextEditorView *)editor {
109111 [TextInsertionUtils insertText: @" \u200B " at: lastRange.location additionalAttributes: nullptr editor: editor withSelection: NO ];
110112 }
111113
112- // fix the selection
113- [editor->textView reactFocus ];
114- editor->textView .selectedRange = NSMakeRange (preAddSelection.location + postAddOffset, preAddSelection.length );
114+ // fix the selection if needed
115+ if (editor->textView .focused ) {
116+ [editor->textView reactFocus ];
117+ editor->textView .selectedRange = NSMakeRange (preAddSelection.location + postAddOffset, preAddSelection.length );
118+ }
115119}
116120
117121+ (BOOL )handleBackspaceInRange : (NSRange )range replacementText : (NSString *)text editor : (id )editor {
You can’t perform that action at this time.
0 commit comments