WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/healthy-lizards-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"slate-react": patch
---

fix: Prevent domSelection.collapseToEnd crash in setDomSelection
6 changes: 5 additions & 1 deletion packages/slate-react/src/components/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,11 @@ export const Editable = forwardRef(
selection && ReactEditor.toDOMRange(editor, selection)

if (newDomRange) {
if (ReactEditor.isComposing(editor) && !IS_ANDROID) {
if (
ReactEditor.isComposing(editor) &&
hasDomSelection &&
!IS_ANDROID
) {
domSelection.collapseToEnd()
} else if (Range.isBackward(selection!)) {
domSelection.setBaseAndExtent(
Expand Down
Loading