1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-01-17 13:38:37 +01:00

fix: selection out of sync in readonly mode (#5120)

This commit is contained in:
Sihong 2022-09-10 11:14:54 +08:00 committed by GitHub
parent 8eb1972b5b
commit 9815bdabdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
'slate-react': patch
---
Fix editor selection out of sync in readonly mode

View File

@ -231,6 +231,11 @@ export const Editable = (props: EditableProps) => {
}
}
}
// Deselect the editor if the dom selection is not selectable in readonly mode
if (readOnly && (!anchorNodeSelectable || !focusNodeSelectable)) {
Transforms.deselect(editor)
}
}
}, 100),
[readOnly]