slate-react 0.97.0 → 0.97.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"with-react.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/plugin/with-react.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EASX,MAAM,OAAO,CAAA;AA0Bd,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C;;;;;;;GAOG;AAEH,eAAO,MAAM,SAAS,mFAsSrB,CAAA"}
1
+ {"version":3,"file":"with-react.d.ts","sourceRoot":"","sources":["../packages/slate-react/src/plugin/with-react.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EASX,MAAM,OAAO,CAAA;AA0Bd,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAG5C;;;;;;;GAOG;AAEH,eAAO,MAAM,SAAS,mFA4SrB,CAAA"}
@@ -874,7 +874,7 @@
874
874
  return editor;
875
875
  };
876
876
 
877
- var IS_REACT_VERSION_17_OR_ABOVE = parseInt(React__default['default'].version.split('.')[0], 10) >= 17;
877
+ var REACT_MAJOR_VERSION = parseInt(React__default['default'].version.split('.')[0], 10);
878
878
  var IS_IOS = typeof navigator !== 'undefined' && typeof window !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
879
879
  var IS_APPLE = typeof navigator !== 'undefined' && /Mac OS X/.test(navigator.userAgent);
880
880
  var IS_ANDROID = typeof navigator !== 'undefined' && /Android/.test(navigator.userAgent);
@@ -6712,7 +6712,7 @@
6712
6712
  return setIsFocused(ReactEditor.isFocused(editor));
6713
6713
  };
6714
6714
 
6715
- if (IS_REACT_VERSION_17_OR_ABOVE) {
6715
+ if (REACT_MAJOR_VERSION >= 17) {
6716
6716
  // In React >= 17 onFocus and onBlur listen to the focusin and focusout events during the bubbling phase.
6717
6717
  // Therefore in order for <Editable />'s handlers to run first, which is necessary for ReactEditor.isFocused(editor)
6718
6718
  // to return the correct value, we have to listen to the focusin and focusout events without useCapture here.
@@ -34572,11 +34572,15 @@
34572
34572
  };
34573
34573
 
34574
34574
  e.onChange = function (options) {
34575
- // COMPAT: React doesn't batch `setState` hook calls, which means that the
34576
- // children and selection can get out of sync for one render pass. So we
34577
- // have to use this unstable API to ensure it batches them. (2019/12/03)
34575
+ // COMPAT: React < 18 doesn't batch `setState` hook calls, which means
34576
+ // that the children and selection can get out of sync for one render
34577
+ // pass. So we have to use this unstable API to ensure it batches them.
34578
+ // (2019/12/03)
34578
34579
  // https://github.com/facebook/react/issues/14259#issuecomment-439702367
34579
- reactDom.unstable_batchedUpdates(function () {
34580
+ var maybeBatchUpdates = REACT_MAJOR_VERSION < 18 ? reactDom.unstable_batchedUpdates : function (callback) {
34581
+ return callback();
34582
+ };
34583
+ maybeBatchUpdates(function () {
34580
34584
  var onContextChange = EDITOR_TO_ON_CHANGE.get(e);
34581
34585
 
34582
34586
  if (onContextChange) {