mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-07-31 04:20:26 +02:00
Fix: when switching between editors, Slate selection and DOM Selection can mismatch which causes React to break (#4749)
This commit is contained in:
committed by
GitHub
parent
9f3aee5536
commit
a3dfb151d4
5
.changeset/shiny-eagles-swim.md
Normal file
5
.changeset/shiny-eagles-swim.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-react': patch
|
||||
---
|
||||
|
||||
Fix "cannot resolve DOM point" error when switching between multiple errors
|
@@ -214,7 +214,10 @@ export const Editable = (props: EditableProps) => {
|
||||
// Otherwise the DOM selection is out of sync, so update it.
|
||||
state.isUpdatingSelection = true
|
||||
|
||||
const newDomRange = selection && ReactEditor.toDOMRange(editor, selection)
|
||||
const newDomRange =
|
||||
selection &&
|
||||
hasDomSelectionInEditor &&
|
||||
ReactEditor.toDOMRange(editor, selection)
|
||||
|
||||
if (newDomRange) {
|
||||
if (Range.isBackward(selection!)) {
|
||||
|
Reference in New Issue
Block a user