mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-20 22:21:20 +02:00
fix: caret jump to the start of composition string (#5443)
* fix: caret jump to the start of composition str * chore: add changeset * chore: edit changeset --------- Co-authored-by: huangyuning <huangyuning@vv.cn>
This commit is contained in:
5
.changeset/rare-glasses-tickle.md
Normal file
5
.changeset/rare-glasses-tickle.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate-react': patch
|
||||
---
|
||||
|
||||
fix wrong caret position during composition.
|
@@ -366,7 +366,9 @@ export const Editable = (props: EditableProps) => {
|
||||
selection && ReactEditor.toDOMRange(editor, selection)
|
||||
|
||||
if (newDomRange) {
|
||||
if (Range.isBackward(selection!)) {
|
||||
if (ReactEditor.isComposing(editor)) {
|
||||
domSelection.collapseToEnd()
|
||||
} else if (Range.isBackward(selection!)) {
|
||||
domSelection.setBaseAndExtent(
|
||||
newDomRange.endContainer,
|
||||
newDomRange.endOffset,
|
||||
|
Reference in New Issue
Block a user