Skip to content

Commit

Permalink
Fix the cursor jump to an unexpected position after deleting in andro…
Browse files Browse the repository at this point in the history
…id (#5251)

* Fix the cursor jump to an unexpected position after deleting in android

* Create unlucky-chairs-promise.md

* Update unlucky-chairs-promise.md
  • Loading branch information
YaoKaiLun committed Feb 19, 2023
1 parent f2607c2 commit 6fa4b95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/unlucky-chairs-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'slate-react': patch
'slate': patch
---

Fix the cursor jump to an unexpected position after deleting in android
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,11 @@ export function createAndroidInputManager({
if (Range.isExpanded(targetRange) && type.startsWith('delete')) {
if (Path.equals(targetRange.anchor.path, targetRange.focus.path)) {
const [start, end] = Range.edges(targetRange)

const point = { path: targetRange.anchor.path, offset: start.offset }
const range = Editor.range(editor, point, point)
handleUserSelect(range)

return storeDiff(targetRange.anchor.path, {
text: '',
end: end.offset,
Expand Down

0 comments on commit 6fa4b95

Please sign in to comment.