Skip to content

Commit

Permalink
fix: fix onCompositionEnd update error (#5576)
Browse files Browse the repository at this point in the history
* fix: fix onCompositionEnd update error

* Update packages/slate-react/src/components/editable.tsx

* add changeset

* Update .changeset/lazy-trainers-learn.md

---------

Co-authored-by: linqirong <609413692@qq.com>
Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
  • Loading branch information
3 people authored Dec 6, 2023
1 parent 26351b9 commit 8ce52fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-trainers-learn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'slate-react': patch
---

fix onCompositionEnd update error.
6 changes: 4 additions & 2 deletions packages/slate-react/src/components/editable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1114,8 +1114,10 @@ export const Editable = (props: EditableProps) => {
(event: React.CompositionEvent<HTMLDivElement>) => {
if (ReactEditor.hasSelectableTarget(editor, event.target)) {
if (ReactEditor.isComposing(editor)) {
setIsComposing(false)
IS_COMPOSING.set(editor, false)
Promise.resolve(() => {
setIsComposing(false)
IS_COMPOSING.set(editor, false)
})
}

androidInputManagerRef.current?.handleCompositionEnd(event)
Expand Down

0 comments on commit 8ce52fd

Please sign in to comment.