mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-07-31 12:30:11 +02: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:
6
.changeset/unlucky-chairs-promise.md
Normal file
6
.changeset/unlucky-chairs-promise.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
'slate-react': patch
|
||||||
|
'slate': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix the cursor jump to an unexpected position after deleting in android
|
@@ -392,6 +392,11 @@ export function createAndroidInputManager({
|
|||||||
if (Range.isExpanded(targetRange) && type.startsWith('delete')) {
|
if (Range.isExpanded(targetRange) && type.startsWith('delete')) {
|
||||||
if (Path.equals(targetRange.anchor.path, targetRange.focus.path)) {
|
if (Path.equals(targetRange.anchor.path, targetRange.focus.path)) {
|
||||||
const [start, end] = Range.edges(targetRange)
|
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, {
|
return storeDiff(targetRange.anchor.path, {
|
||||||
text: '',
|
text: '',
|
||||||
end: end.offset,
|
end: end.offset,
|
||||||
|
Reference in New Issue
Block a user