Commit 068ee68
zenggenfa
fix(slate-react): prevent premature flush during composition for Android handwriting input
Fixes #5979
On Android devices, handwriting input triggers compositionStart/compositionEnd
events per stroke. The flush() function was being called during composition,
causing DOM changes that interrupt the composition session. This resulted in
the first stroke being committed prematurely (e.g., writing '我' would produce '一我').
The fix adds IS_COMPOSING checks in flush(), scheduleAction(), and handleInput()
to prevent flushing during composition. The pending diffs are now properly
accumulated and flushed only after compositionEnd.1 parent addf0c5 commit 068ee68
File tree
2 files changed
+17
-0
lines changed- .changeset
- packages/slate-react/src/hooks/android-input-manager
2 files changed
+17
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
127 | 134 | | |
128 | 135 | | |
129 | 136 | | |
| |||
0 commit comments