slate-react 0.77.4 → 0.78.1-202233022229

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/dist/index.js CHANGED
@@ -2089,8 +2089,20 @@ var Editable$1 = function Editable(props) {
2089
2089
  }
2090
2090
  }, [readOnly, attributes.onFocus]),
2091
2091
  onKeyDown: React.useCallback(function (event) {
2092
- if (!readOnly && hasEditableTarget(editor, event.target) && !isEventHandled(event, attributes.onKeyDown) && !state.isComposing) {
2093
- var nativeEvent = event.nativeEvent;
2092
+ if (!readOnly && hasEditableTarget(editor, event.target)) {
2093
+ var nativeEvent = event.nativeEvent; // COMPAT: The composition end event isn't fired reliably in all browsers,
2094
+ // so we sometimes might end up stuck in a composition state even though we
2095
+ // aren't composing any more.
2096
+
2097
+ if (state.isComposing && nativeEvent.isComposing === false) {
2098
+ state.isComposing = false;
2099
+ setIsComposing(false);
2100
+ }
2101
+
2102
+ if (isEventHandled(event, attributes.onKeyDown) || state.isComposing) {
2103
+ return;
2104
+ }
2105
+
2094
2106
  var selection = editor.selection;
2095
2107
  var element = editor.children[selection !== null ? selection.focus.path[0] : 0];
2096
2108
  var isRTL = getDirection__default['default'](slate.Node.string(element)) === 'rtl'; // COMPAT: Since we prevent the default behavior on