slate-react 0.72.4-2022011154352 → 0.72.4-20220121801

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # slate-react
2
2
 
3
- ## 0.72.4-2022011154352
3
+ ## 0.72.4-20220121801
4
4
 
5
5
  ### Patch Changes
6
6
 
@@ -11,7 +11,10 @@
11
11
  - Remove logic to delay handling of text insertion
12
12
  - Call Transforms.setSelection before Editor.insertText to adjust position
13
13
 
14
- - [#4755](https://github.com/ianstormtaylor/slate/pull/4755) [`8daa77e9`](https://github.com/ianstormtaylor/slate/commit/8daa77e9fab6b222ad796b420b86f3ec88999a39) Thanks [@jhurwitz](https://github.com/jhurwitz)! - fix useFocused hook
14
+ - [#4786](https://github.com/ianstormtaylor/slate/pull/4786) [`67aa1f10`](https://github.com/ianstormtaylor/slate/commit/67aa1f10106e15486031b4103285c7fae4373056) Thanks [@alessiogaldy](https://github.com/alessiogaldy)! - - Restore logic to delay text insertion on android
15
+ - Always call Trasform.setSelection before calling Editor.insertText
16
+
17
+ * [#4755](https://github.com/ianstormtaylor/slate/pull/4755) [`8daa77e9`](https://github.com/ianstormtaylor/slate/commit/8daa77e9fab6b222ad796b420b86f3ec88999a39) Thanks [@jhurwitz](https://github.com/jhurwitz)! - fix useFocused hook
15
18
 
16
19
  ## 0.72.2
17
20
 
@@ -1 +1 @@
1
- {"version":3,"file":"android-editable.d.ts","sourceRoot":"","sources":["../../packages/slate-react/src/components/android/android-editable.tsx"],"names":[],"mappings":";AACA,OAAO,EAAU,OAAO,EAAuC,MAAM,OAAO,CAAA;AA2B5E,OAAO,EAAE,aAAa,EAAa,MAAM,aAAa,CAAA;AAqBtD,eAAO,MAAM,eAAe,UAAW,aAAa,KAAG,GAAG,CAAC,OAshB1D,CAAA"}
1
+ {"version":3,"file":"android-editable.d.ts","sourceRoot":"","sources":["../../packages/slate-react/src/components/android/android-editable.tsx"],"names":[],"mappings":";AACA,OAAO,EAAU,OAAO,EAAuC,MAAM,OAAO,CAAA;AA+B5E,OAAO,EAAE,aAAa,EAAa,MAAM,aAAa,CAAA;AAqBtD,eAAO,MAAM,eAAe,UAAW,aAAa,KAAG,GAAG,CAAC,OA6jB1D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"android-input-manager.d.ts","sourceRoot":"","sources":["../../packages/slate-react/src/components/android/android-input-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAmBvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qBAAa,mBAAmB;IAClB,OAAO,CAAC,MAAM;IAAe,OAAO,CAAC,UAAU;gBAAvC,MAAM,EAAE,WAAW,EAAU,UAAU,EAAE,MAAM,IAAI;IAKvE;;;;OAIG;IAEH,KAAK,cAAe,cAAc,EAAE,UAYnC;IAED;;;;OAIG;IAEH,OAAO,CAAC,kBAAkB,CAkBzB;IAED;;OAEG;IAEH,OAAO,CAAC,UAAU,CAsBjB;IAED;;OAEG;IAEH,OAAO,CAAC,WAAW,CAoBlB;IAED;;OAEG;IAEH,OAAO,CAAC,wBAAwB,CAY/B;IAED;;OAEG;IAEH,OAAO,CAAC,cAAc,CAOrB;IAED;;OAEG;IACH,OAAO,CAAC,eAAe,CAWtB;CACF;AAED,eAAe,mBAAmB,CAAA"}
1
+ {"version":3,"file":"android-input-manager.d.ts","sourceRoot":"","sources":["../../packages/slate-react/src/components/android/android-input-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AA2BvD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,qBAAa,mBAAmB;IAClB,OAAO,CAAC,MAAM;IAAe,OAAO,CAAC,UAAU;gBAAvC,MAAM,EAAE,WAAW,EAAU,UAAU,EAAE,MAAM,IAAI;IAKvE;;;;OAIG;IAEH,KAAK,cAAe,cAAc,EAAE,UAYnC;IAED;;;;OAIG;IAEH,OAAO,CAAC,kBAAkB,CAkBzB;IAED;;OAEG;IAEH,OAAO,CAAC,UAAU,CAiCjB;IAED;;OAEG;IAEH,OAAO,CAAC,WAAW,CAoBlB;IAED;;OAEG;IAEH,OAAO,CAAC,wBAAwB,CAY/B;IAED;;OAEG;IAEH,OAAO,CAAC,cAAc,CAOrB;IAED;;OAEG;IACH,OAAO,CAAC,eAAe,CAWtB;CACF;AAED,eAAe,mBAAmB,CAAA"}
package/dist/index.es.js CHANGED
@@ -181,6 +181,13 @@ var EDITOR_TO_KEY_TO_ELEMENT = new WeakMap();
181
181
 
182
182
  var IS_READ_ONLY = new WeakMap();
183
183
  var IS_FOCUSED = new WeakMap();
184
+ var IS_COMPOSING = new WeakMap();
185
+ var IS_ON_COMPOSITION_END = new WeakMap();
186
+ /**
187
+ * Weak maps for saving text on composition stage.
188
+ */
189
+
190
+ var EDITOR_ON_COMPOSITION_TEXT = new WeakMap();
184
191
  /**
185
192
  * Weak map for associating the context `onChange` context with the plugin.
186
193
  */
@@ -2155,6 +2162,233 @@ var isDOMEventHandled = (event, handler) => {
2155
2162
  return event.defaultPrevented;
2156
2163
  };
2157
2164
 
2165
+ /**
2166
+ * Returns the number of characters that are the same at the beginning of the
2167
+ * String.
2168
+ *
2169
+ * @param prev the previous text
2170
+ * @param next the next text
2171
+ * @returns the offset of the start of the difference; null if there is no difference
2172
+ */
2173
+
2174
+ function getDiffStart(prev, next) {
2175
+ var length = Math.min(prev.length, next.length);
2176
+
2177
+ for (var i = 0; i < length; i++) {
2178
+ if (prev.charAt(i) !== next.charAt(i)) return i;
2179
+ }
2180
+
2181
+ if (prev.length !== next.length) return length;
2182
+ return null;
2183
+ }
2184
+ /**
2185
+ * Returns the number of characters that are the same at the end of the String
2186
+ * up to `max`. Max prevents double-counting characters when there are
2187
+ * multiple duplicate characters around the diff area.
2188
+ *
2189
+ * @param prev the previous text
2190
+ * @param next the next text
2191
+ * @param max the max length to test.
2192
+ * @returns number of characters that are the same at the end of the string
2193
+ */
2194
+
2195
+
2196
+ function getDiffEnd(prev, next, max) {
2197
+ var prevLength = prev.length;
2198
+ var nextLength = next.length;
2199
+ var length = Math.min(prevLength, nextLength, max);
2200
+
2201
+ for (var i = 0; i < length; i++) {
2202
+ var prevChar = prev.charAt(prevLength - i - 1);
2203
+ var nextChar = next.charAt(nextLength - i - 1);
2204
+ if (prevChar !== nextChar) return i;
2205
+ }
2206
+
2207
+ if (prev.length !== next.length) return length;
2208
+ return null;
2209
+ }
2210
+ /**
2211
+ * Takes two strings and returns an object representing two offsets. The
2212
+ * first, `start` represents the number of characters that are the same at
2213
+ * the front of the String. The `end` represents the number of characters
2214
+ * that are the same at the end of the String.
2215
+ *
2216
+ * Returns null if they are identical.
2217
+ *
2218
+ * @param prev the previous text
2219
+ * @param next the next text
2220
+ * @returns the difference text range; null if there are no differences.
2221
+ */
2222
+
2223
+
2224
+ function getDiffOffsets(prev, next) {
2225
+ if (prev === next) return null;
2226
+ var start = getDiffStart(prev, next);
2227
+ if (start === null) return null;
2228
+ var maxEnd = Math.min(prev.length - start, next.length - start);
2229
+ var end = getDiffEnd(prev, next, maxEnd);
2230
+ if (end === null) return null;
2231
+ return {
2232
+ start,
2233
+ end
2234
+ };
2235
+ }
2236
+ /**
2237
+ * Takes a text string and returns a slice from the string at the given text range
2238
+ *
2239
+ * @param text the text
2240
+ * @param offsets the text range
2241
+ * @returns the text slice at text range
2242
+ */
2243
+
2244
+
2245
+ function sliceText(text, offsets) {
2246
+ return text.slice(offsets.start, text.length - offsets.end);
2247
+ }
2248
+ /**
2249
+ * Takes two strings and returns a smart diff that can be used to describe the
2250
+ * change in a way that can be used as operations like inserting, removing or
2251
+ * replacing text.
2252
+ *
2253
+ * @param prev the previous text
2254
+ * @param next the next text
2255
+ * @returns the text difference
2256
+ */
2257
+
2258
+
2259
+ function diffText(prev, next) {
2260
+ if (prev === undefined || next === undefined) return null;
2261
+ var offsets = getDiffOffsets(prev, next);
2262
+ if (offsets == null) return null;
2263
+ var insertText = sliceText(next, offsets);
2264
+ var removeText = sliceText(prev, offsets);
2265
+ return {
2266
+ start: offsets.start,
2267
+ end: prev.length - offsets.end,
2268
+ insertText,
2269
+ removeText
2270
+ };
2271
+ }
2272
+ function combineInsertedText(insertedText) {
2273
+ return insertedText.reduce((acc, _ref) => {
2274
+ var {
2275
+ text
2276
+ } = _ref;
2277
+ return "".concat(acc).concat(text.insertText);
2278
+ }, '');
2279
+ }
2280
+ function getTextInsertion(editor, domNode) {
2281
+ var node = ReactEditor.toSlateNode(editor, domNode);
2282
+
2283
+ if (!Text$1.isText(node)) {
2284
+ return undefined;
2285
+ }
2286
+
2287
+ var prevText = node.text;
2288
+ var nextText = domNode.textContent; // textContent will pad an extra \n when the textContent ends with an \n
2289
+
2290
+ if (nextText.endsWith('\n')) {
2291
+ nextText = nextText.slice(0, nextText.length - 1);
2292
+ } // If the text is no different, there is no diff.
2293
+
2294
+
2295
+ if (nextText !== prevText) {
2296
+ var textDiff = diffText(prevText, nextText);
2297
+
2298
+ if (textDiff !== null) {
2299
+ var textPath = ReactEditor.findPath(editor, node);
2300
+ return {
2301
+ text: textDiff,
2302
+ path: textPath
2303
+ };
2304
+ }
2305
+ }
2306
+
2307
+ return undefined;
2308
+ }
2309
+ function normalizeTextInsertionRange(editor, range, _ref2) {
2310
+ var {
2311
+ path,
2312
+ text
2313
+ } = _ref2;
2314
+ var insertionRange = {
2315
+ anchor: {
2316
+ path,
2317
+ offset: text.start
2318
+ },
2319
+ focus: {
2320
+ path,
2321
+ offset: text.end
2322
+ }
2323
+ };
2324
+
2325
+ if (!range || !Range.isCollapsed(range)) {
2326
+ return insertionRange;
2327
+ }
2328
+
2329
+ var {
2330
+ insertText,
2331
+ removeText
2332
+ } = text;
2333
+ var isSingleCharacterInsertion = insertText.length === 1 || removeText.length === 1;
2334
+ /**
2335
+ * This code handles edge cases that arise from text diffing when the
2336
+ * inserted or removed character is a single character, and the character
2337
+ * right before or after the anchor is the same as the one being inserted or
2338
+ * removed.
2339
+ *
2340
+ * Take this example: hello|o
2341
+ *
2342
+ * If another `o` is inserted at the selection's anchor in the example above,
2343
+ * it should be inserted at the anchor, but using text diffing, we actually
2344
+ * detect that the character was inserted after the second `o`:
2345
+ *
2346
+ * helloo[o]|
2347
+ *
2348
+ * Instead, in these very specific edge cases, we assume that the character
2349
+ * needs to be inserted after the anchor rather than where the diff was found:
2350
+ *
2351
+ * hello[o]|o
2352
+ */
2353
+
2354
+ if (isSingleCharacterInsertion && Path.equals(range.anchor.path, path)) {
2355
+ var [_text] = Array.from(Editor.nodes(editor, {
2356
+ at: range,
2357
+ match: Text$1.isText
2358
+ }));
2359
+
2360
+ if (_text) {
2361
+ var [node] = _text;
2362
+ var {
2363
+ anchor
2364
+ } = range;
2365
+ var characterBeforeAnchor = node.text[anchor.offset - 1];
2366
+ var characterAfterAnchor = node.text[anchor.offset];
2367
+
2368
+ if (insertText.length === 1 && insertText === characterAfterAnchor) {
2369
+ // Assume text should be inserted at the anchor
2370
+ return range;
2371
+ }
2372
+
2373
+ if (removeText.length === 1 && removeText === characterBeforeAnchor) {
2374
+ // Assume text should be removed right before the anchor
2375
+ return {
2376
+ anchor: {
2377
+ path,
2378
+ offset: anchor.offset - 1
2379
+ },
2380
+ focus: {
2381
+ path,
2382
+ offset: anchor.offset
2383
+ }
2384
+ };
2385
+ }
2386
+ }
2387
+ }
2388
+
2389
+ return insertionRange;
2390
+ }
2391
+
2158
2392
  /**
2159
2393
  * An auto-incrementing identifier for keys.
2160
2394
  */
@@ -2724,233 +2958,6 @@ var ReactEditor = {
2724
2958
 
2725
2959
  };
2726
2960
 
2727
- /**
2728
- * Returns the number of characters that are the same at the beginning of the
2729
- * String.
2730
- *
2731
- * @param prev the previous text
2732
- * @param next the next text
2733
- * @returns the offset of the start of the difference; null if there is no difference
2734
- */
2735
-
2736
- function getDiffStart(prev, next) {
2737
- var length = Math.min(prev.length, next.length);
2738
-
2739
- for (var i = 0; i < length; i++) {
2740
- if (prev.charAt(i) !== next.charAt(i)) return i;
2741
- }
2742
-
2743
- if (prev.length !== next.length) return length;
2744
- return null;
2745
- }
2746
- /**
2747
- * Returns the number of characters that are the same at the end of the String
2748
- * up to `max`. Max prevents double-counting characters when there are
2749
- * multiple duplicate characters around the diff area.
2750
- *
2751
- * @param prev the previous text
2752
- * @param next the next text
2753
- * @param max the max length to test.
2754
- * @returns number of characters that are the same at the end of the string
2755
- */
2756
-
2757
-
2758
- function getDiffEnd(prev, next, max) {
2759
- var prevLength = prev.length;
2760
- var nextLength = next.length;
2761
- var length = Math.min(prevLength, nextLength, max);
2762
-
2763
- for (var i = 0; i < length; i++) {
2764
- var prevChar = prev.charAt(prevLength - i - 1);
2765
- var nextChar = next.charAt(nextLength - i - 1);
2766
- if (prevChar !== nextChar) return i;
2767
- }
2768
-
2769
- if (prev.length !== next.length) return length;
2770
- return null;
2771
- }
2772
- /**
2773
- * Takes two strings and returns an object representing two offsets. The
2774
- * first, `start` represents the number of characters that are the same at
2775
- * the front of the String. The `end` represents the number of characters
2776
- * that are the same at the end of the String.
2777
- *
2778
- * Returns null if they are identical.
2779
- *
2780
- * @param prev the previous text
2781
- * @param next the next text
2782
- * @returns the difference text range; null if there are no differences.
2783
- */
2784
-
2785
-
2786
- function getDiffOffsets(prev, next) {
2787
- if (prev === next) return null;
2788
- var start = getDiffStart(prev, next);
2789
- if (start === null) return null;
2790
- var maxEnd = Math.min(prev.length - start, next.length - start);
2791
- var end = getDiffEnd(prev, next, maxEnd);
2792
- if (end === null) return null;
2793
- return {
2794
- start,
2795
- end
2796
- };
2797
- }
2798
- /**
2799
- * Takes a text string and returns a slice from the string at the given text range
2800
- *
2801
- * @param text the text
2802
- * @param offsets the text range
2803
- * @returns the text slice at text range
2804
- */
2805
-
2806
-
2807
- function sliceText(text, offsets) {
2808
- return text.slice(offsets.start, text.length - offsets.end);
2809
- }
2810
- /**
2811
- * Takes two strings and returns a smart diff that can be used to describe the
2812
- * change in a way that can be used as operations like inserting, removing or
2813
- * replacing text.
2814
- *
2815
- * @param prev the previous text
2816
- * @param next the next text
2817
- * @returns the text difference
2818
- */
2819
-
2820
-
2821
- function diffText(prev, next) {
2822
- if (prev === undefined || next === undefined) return null;
2823
- var offsets = getDiffOffsets(prev, next);
2824
- if (offsets == null) return null;
2825
- var insertText = sliceText(next, offsets);
2826
- var removeText = sliceText(prev, offsets);
2827
- return {
2828
- start: offsets.start,
2829
- end: prev.length - offsets.end,
2830
- insertText,
2831
- removeText
2832
- };
2833
- }
2834
- function combineInsertedText(insertedText) {
2835
- return insertedText.reduce((acc, _ref) => {
2836
- var {
2837
- text
2838
- } = _ref;
2839
- return "".concat(acc).concat(text.insertText);
2840
- }, '');
2841
- }
2842
- function getTextInsertion(editor, domNode) {
2843
- var node = ReactEditor.toSlateNode(editor, domNode);
2844
-
2845
- if (!Text$1.isText(node)) {
2846
- return undefined;
2847
- }
2848
-
2849
- var prevText = node.text;
2850
- var nextText = domNode.textContent; // textContent will pad an extra \n when the textContent ends with an \n
2851
-
2852
- if (nextText.endsWith('\n')) {
2853
- nextText = nextText.slice(0, nextText.length - 1);
2854
- } // If the text is no different, there is no diff.
2855
-
2856
-
2857
- if (nextText !== prevText) {
2858
- var textDiff = diffText(prevText, nextText);
2859
-
2860
- if (textDiff !== null) {
2861
- var textPath = ReactEditor.findPath(editor, node);
2862
- return {
2863
- text: textDiff,
2864
- path: textPath
2865
- };
2866
- }
2867
- }
2868
-
2869
- return undefined;
2870
- }
2871
- function normalizeTextInsertionRange(editor, range, _ref2) {
2872
- var {
2873
- path,
2874
- text
2875
- } = _ref2;
2876
- var insertionRange = {
2877
- anchor: {
2878
- path,
2879
- offset: text.start
2880
- },
2881
- focus: {
2882
- path,
2883
- offset: text.end
2884
- }
2885
- };
2886
-
2887
- if (!range || !Range.isCollapsed(range)) {
2888
- return insertionRange;
2889
- }
2890
-
2891
- var {
2892
- insertText,
2893
- removeText
2894
- } = text;
2895
- var isSingleCharacterInsertion = insertText.length === 1 || removeText.length === 1;
2896
- /**
2897
- * This code handles edge cases that arise from text diffing when the
2898
- * inserted or removed character is a single character, and the character
2899
- * right before or after the anchor is the same as the one being inserted or
2900
- * removed.
2901
- *
2902
- * Take this example: hello|o
2903
- *
2904
- * If another `o` is inserted at the selection's anchor in the example above,
2905
- * it should be inserted at the anchor, but using text diffing, we actually
2906
- * detect that the character was inserted after the second `o`:
2907
- *
2908
- * helloo[o]|
2909
- *
2910
- * Instead, in these very specific edge cases, we assume that the character
2911
- * needs to be inserted after the anchor rather than where the diff was found:
2912
- *
2913
- * hello[o]|o
2914
- */
2915
-
2916
- if (isSingleCharacterInsertion && Path.equals(range.anchor.path, path)) {
2917
- var [_text] = Array.from(Editor.nodes(editor, {
2918
- at: range,
2919
- match: Text$1.isText
2920
- }));
2921
-
2922
- if (_text) {
2923
- var [node] = _text;
2924
- var {
2925
- anchor
2926
- } = range;
2927
- var characterBeforeAnchor = node.text[anchor.offset - 1];
2928
- var characterAfterAnchor = node.text[anchor.offset];
2929
-
2930
- if (insertText.length === 1 && insertText === characterAfterAnchor) {
2931
- // Assume text should be inserted at the anchor
2932
- return range;
2933
- }
2934
-
2935
- if (removeText.length === 1 && removeText === characterBeforeAnchor) {
2936
- // Assume text should be removed right before the anchor
2937
- return {
2938
- anchor: {
2939
- path,
2940
- offset: anchor.offset - 1
2941
- },
2942
- focus: {
2943
- path,
2944
- offset: anchor.offset
2945
- }
2946
- };
2947
- }
2948
- }
2949
- }
2950
-
2951
- return insertionRange;
2952
- }
2953
-
2954
2961
  function gatherMutationData(editor, mutations) {
2955
2962
  var addedNodes = [];
2956
2963
  var removedNodes = [];
@@ -3172,7 +3179,15 @@ class AndroidInputManager {
3172
3179
  var {
3173
3180
  selection,
3174
3181
  marks
3175
- } = this.editor; // Insert the batched text diffs
3182
+ } = this.editor; // If it is in composing or after `onCompositionend`, set `EDITOR_ON_COMPOSITION_TEXT` and return.
3183
+ // Text will be inserted on compositionend event.
3184
+
3185
+ if (IS_COMPOSING.get(this.editor) || IS_ON_COMPOSITION_END.get(this.editor)) {
3186
+ EDITOR_ON_COMPOSITION_TEXT.set(this.editor, insertedText);
3187
+ IS_ON_COMPOSITION_END.set(this.editor, false);
3188
+ return;
3189
+ } // Insert the batched text diffs
3190
+
3176
3191
 
3177
3192
  insertedText.forEach(insertion => {
3178
3193
  var text = insertion.text.insertText;
@@ -3799,6 +3814,40 @@ var AndroidEditable = props => {
3799
3814
  setTimeout(() => {
3800
3815
  state.isComposing && setIsComposing(false);
3801
3816
  state.isComposing = false;
3817
+ IS_COMPOSING.set(editor, false);
3818
+ IS_ON_COMPOSITION_END.set(editor, true);
3819
+ var insertedText = EDITOR_ON_COMPOSITION_TEXT.get(editor) || []; // `insertedText` is set in `MutationObserver` constructor.
3820
+ // If open phone keyboard association function, `CompositionEvent` will be triggered.
3821
+
3822
+ if (!insertedText.length) {
3823
+ return;
3824
+ }
3825
+
3826
+ EDITOR_ON_COMPOSITION_TEXT.set(editor, []);
3827
+ var {
3828
+ selection,
3829
+ marks
3830
+ } = editor;
3831
+ insertedText.forEach(insertion => {
3832
+ var text = insertion.text.insertText;
3833
+ var at = normalizeTextInsertionRange(editor, selection, insertion);
3834
+
3835
+ if (marks) {
3836
+ var node = _objectSpread({
3837
+ text
3838
+ }, marks);
3839
+
3840
+ Transforms.insertNodes(editor, node, {
3841
+ match: Text$1.isText,
3842
+ at,
3843
+ select: true
3844
+ });
3845
+ editor.marks = null;
3846
+ } else {
3847
+ Transforms.setSelection(editor, at);
3848
+ Editor.insertText(editor, text);
3849
+ }
3850
+ });
3802
3851
  }, RESOLVE_DELAY);
3803
3852
  }
3804
3853
  }, [attributes.onCompositionEnd]),
@@ -3806,12 +3855,14 @@ var AndroidEditable = props => {
3806
3855
  if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionUpdate)) {
3807
3856
  !state.isComposing && setIsComposing(true);
3808
3857
  state.isComposing = true;
3858
+ IS_COMPOSING.set(editor, true);
3809
3859
  }
3810
3860
  }, [attributes.onCompositionUpdate]),
3811
3861
  onCompositionStart: useCallback(event => {
3812
3862
  if (hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onCompositionStart)) {
3813
3863
  !state.isComposing && setIsComposing(true);
3814
3864
  state.isComposing = true;
3865
+ IS_COMPOSING.set(editor, true);
3815
3866
  }
3816
3867
  }, [attributes.onCompositionStart]),
3817
3868
  onPaste: useCallback(event => {