mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-06 23:36:31 +02:00
Revert "Do NOT use exact match when updating dom selection" (#4627)
* Revert "Do NOT use exact match when updating dom selection" The change to `exactMatch: false` in https://github.com/ianstormtaylor/slate/pull/4304 was intended to fix https://github.com/ianstormtaylor/slate/issues/4293, a bug where "backwards typing" happened in nested editors. But this change has introduced at least two new bugs: - https://github.com/ianstormtaylor/slate/issues/4601 - https://github.com/ianstormtaylor/slate/issues/4626 These are (IMO) worse than the original "backwards typing" bug. From discussion in https://github.com/ianstormtaylor/slate/pull/4304, the true underlying bug is in ReactEditor.toSlateRange. I'll attempt to fix this underlying bug instead. * changeset
This commit is contained in:
5
.changeset/fair-bats-rescue.md
Normal file
5
.changeset/fair-bats-rescue.md
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
'slate-react': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixed issues where cursor jumps to wrong location
|
@@ -184,7 +184,7 @@ export const Editable = (props: EditableProps) => {
|
|||||||
// If the DOM selection is in the editor and the editor selection is already correct, we're done.
|
// If the DOM selection is in the editor and the editor selection is already correct, we're done.
|
||||||
if (hasDomSelection && hasDomSelectionInEditor && selection) {
|
if (hasDomSelection && hasDomSelectionInEditor && selection) {
|
||||||
const slateRange = ReactEditor.toSlateRange(editor, domSelection, {
|
const slateRange = ReactEditor.toSlateRange(editor, domSelection, {
|
||||||
exactMatch: false,
|
exactMatch: true,
|
||||||
|
|
||||||
// domSelection is not necessarily a valid Slate range
|
// domSelection is not necessarily a valid Slate range
|
||||||
// (e.g. when clicking on contentEditable:false element)
|
// (e.g. when clicking on contentEditable:false element)
|
||||||
|
Reference in New Issue
Block a user