feat: add deletion by ref - #726
Open
IslamRustamov wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new imperative deleteAtSelection API to EnrichedTextInput so consumers can trigger “backspace/delete like the native keyboard” via ref, across iOS, Android, and web (addresses issue #699).
Changes:
- Exposes
deleteAtSelection()on the publicEnrichedTextInputInstanceref API. - Wires the command through the native command/codegen layer and the native iOS/Android view implementations.
- Implements equivalent deletion behavior on the web editor implementation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/web/EnrichedTextInput.tsx | Adds web implementation of deleteAtSelection via editor command chaining. |
| src/types.ts | Extends the public ref instance type with deleteAtSelection(). |
| src/spec/EnrichedTextInputNativeComponent.ts | Adds deleteAtSelection to the native commands interface and command list. |
| src/native/EnrichedTextInput.tsx | Exposes deleteAtSelection() on the native ref by calling the native command. |
| ios/EnrichedTextInputView.mm | Handles the new command and performs deletion based on the current selectedTextRange. |
| android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputViewManager.kt | Routes the new command from the view manager to the view instance. |
| android/src/main/java/com/swmansion/enriched/textinput/EnrichedTextInputView.kt | Implements deletion logic based on current selection indices. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+381
to
+387
| const { from, to } = editor.state.selection; | ||
|
|
||
| if (from !== to) { | ||
| return c.deleteSelection(); | ||
| } else { | ||
| return c.deleteRange({ from: from - 1, to }); | ||
| } |
Comment on lines
+1340
to
+1350
| - (void)deleteAtSelection { | ||
| UITextRange *selectedRange = self.textView.selectedTextRange; | ||
|
|
||
| if (selectedRange.empty) { | ||
| [self.textView deleteBackward]; | ||
| } else { | ||
| [self.textView replaceRange:selectedRange withText:@""]; | ||
| } | ||
|
|
||
| [self anyTextMayHaveBeenModified]; | ||
| } |
Comment on lines
+1008
to
+1019
| fun deleteAtSelection() { | ||
| runAsATransaction { | ||
| val start = selectionStart | ||
| val end = selectionEnd | ||
|
|
||
| if (start != end) { | ||
| text?.delete(start, end) | ||
| } else if (start > 0) { | ||
| text?.delete(start - 1, start) | ||
| } | ||
| } | ||
| } |
IslamRustamov
force-pushed
the
feature/add-deletion-by-ref
branch
from
July 26, 2026 14:41
ad784bb to
2fd8390
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Explain the motivation for making this change: here are some points to help you:
Test Plan
To test this feature you can add manually new button that is going to call deleteAtSelection method and check it in different test case scenarios:
Screenshots / Videos
Compatibility