This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
Add partial backspace support to editOnInput for Android devices #1067
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
This pr addresses two parts of the problem raised in #1066.
The first part is that it adds support for entity deletion within editOnInput. It does this by detecting whether the start of the selection is a mutable entity, and if it's not, falling back to the backspace method normally used as part of the keyDown event handler.
The second part is that it identifies cases where the selection is incorrect and then corrects it before falling back on the backspace method. The correction is performed by using the end of the DOM's selection as the start of the selection to evaluate, and the end of the last editor state's selection as the end of the selection to evaluate.
Known issues
The backspace selection range cannot be correctly determined when the starting selection edge is in the middle of a span. In such cases, the span containing the starting selection edge does not have any of its contents deleted, and temporarily the DOM selection understanding is incorrect until the cursor is moved.