1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-29 11:18:25 +01:00

Fix the cursor jump to an unexpected position after deleting in android (#5251)

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

* Create unlucky-chairs-promise.md

* Update unlucky-chairs-promise.md
This commit is contained in:
kailunyao 2023-02-19 09:41:03 +08:00 committed by GitHub
parent f2607c2a52
commit 6fa4b954a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,6 @@
---
'slate-react': patch
'slate': patch
---
Fix the cursor jump to an unexpected position after deleting in android

View File

@ -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,