Skip to content

Commit

Permalink
Revert "Do NOT use exact match when updating dom selection"
Browse files Browse the repository at this point in the history
The change to `exactMatch: false` in ianstormtaylor#4304
was intended to fix ianstormtaylor#4293,
a bug where "backwards typing" happened in nested editors.

But this change has introduced at least two new bugs:

- ianstormtaylor#4601
- ianstormtaylor#4626

These are (IMO) worse than the original "backwards typing" bug.

From discussion in ianstormtaylor#4304,
the true underlying bug is in ReactEditor.toSlateRange. I'll attempt to
fix this underlying bug instead.
  • Loading branch information
jameshfisher committed Oct 25, 2021
1 parent 381f91b commit 3960d09
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/slate-react/src/components/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3960d09

Please sign in to comment.