mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-12 10:14:02 +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
@@ -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