diff --git a/.changeset/shiny-eagles-swim.md b/.changeset/shiny-eagles-swim.md new file mode 100644 index 0000000000..8f74f837c3 --- /dev/null +++ b/.changeset/shiny-eagles-swim.md @@ -0,0 +1,5 @@ +--- +'slate-react': patch +--- + +Fix "cannot resolve DOM point" error when switching between multiple errors diff --git a/packages/slate-react/src/components/editable.tsx b/packages/slate-react/src/components/editable.tsx index 7cb059b9bf..b6df591a49 100644 --- a/packages/slate-react/src/components/editable.tsx +++ b/packages/slate-react/src/components/editable.tsx @@ -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!)) {