mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-01-18 05:59:13 +01: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:
parent
381f91b1dd
commit
ec01e75fff
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 (hasDomSelection && hasDomSelectionInEditor && selection) {
|
||||
const slateRange = ReactEditor.toSlateRange(editor, domSelection, {
|
||||
exactMatch: false,
|
||||
exactMatch: true,
|
||||
|
||||
// domSelection is not necessarily a valid Slate range
|
||||
// (e.g. when clicking on contentEditable:false element)
|
||||
|
Loading…
x
Reference in New Issue
Block a user