-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix onCompositionEnd update error #5576
Conversation
🦋 Changeset detectedLatest commit: 44f6d60 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
This needs a changeset to support our contributor workflow.
Ideally, if reasonable, please add a test for this change (we're slowly trying to add tests for slate-react).
Thanks for review. I have add a changeset now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, we'll accept and release this, but if it does raise regressions then we'll roll it back.
2023-12-11.10.43.10.movthis MR will rising another issue, which the caret will jump to the start. |
https://github.com/ianstormtaylor/slate/assets/33490722/dee594c8-4514-4e89-803b-7594b5fb4988
Same here,the caret will jump to last position 2023-12-16.11.34.42.mov |
@dylans Please review this PR again. |
Description
When user is compositing, The code-block updating is not work correctly.
Context
The onEompositionEnd Event will trigger two react update,one is
setIsComposing(false)
and anthor isEditor.insertText(editor, event.data)
,Editor.insertText(editor, event.data)
should update first or it will cause update error(selection is not update) that inslate/packages/slate-react/src/components/element.tsx
MemoizedElement。So I use Promise to delay
setIsComposing(false)
and execEditor.insertText(editor, event.data)
first to make it resolve selection correctly when onEompositionEnd is triggered.The Right
Here is the right update when user composition end