slate-react 0.97.0 → 0.97.1-2023521181748
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.es.js +8 -6
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/plugin/with-react.d.ts.map +1 -1
- package/dist/slate-react.js +10 -6
- package/dist/slate-react.min.js +1 -1
- package/dist/utils/environment.d.ts +1 -1
- package/dist/utils/environment.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -76,7 +76,7 @@ var useSlateStatic = () => {
|
|
|
76
76
|
return editor;
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
-
var
|
|
79
|
+
var REACT_MAJOR_VERSION = parseInt(React.version.split('.')[0], 10);
|
|
80
80
|
var IS_IOS = typeof navigator !== 'undefined' && typeof window !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
81
81
|
var IS_APPLE = typeof navigator !== 'undefined' && /Mac OS X/.test(navigator.userAgent);
|
|
82
82
|
var IS_ANDROID = typeof navigator !== 'undefined' && /Android/.test(navigator.userAgent);
|
|
@@ -4755,7 +4755,7 @@ var Slate = props => {
|
|
|
4755
4755
|
useIsomorphicLayoutEffect(() => {
|
|
4756
4756
|
var fn = () => setIsFocused(ReactEditor.isFocused(editor));
|
|
4757
4757
|
|
|
4758
|
-
if (
|
|
4758
|
+
if (REACT_MAJOR_VERSION >= 17) {
|
|
4759
4759
|
// In React >= 17 onFocus and onBlur listen to the focusin and focusout events during the bubbling phase.
|
|
4760
4760
|
// Therefore in order for <Editable />'s handlers to run first, which is necessary for ReactEditor.isFocused(editor)
|
|
4761
4761
|
// to return the correct value, we have to listen to the focusin and focusout events without useCapture here.
|
|
@@ -5157,11 +5157,13 @@ var withReact = function withReact(editor) {
|
|
|
5157
5157
|
};
|
|
5158
5158
|
|
|
5159
5159
|
e.onChange = options => {
|
|
5160
|
-
// COMPAT: React doesn't batch `setState` hook calls, which means
|
|
5161
|
-
// children and selection can get out of sync for one render
|
|
5162
|
-
// have to use this unstable API to ensure it batches them.
|
|
5160
|
+
// COMPAT: React < 18 doesn't batch `setState` hook calls, which means
|
|
5161
|
+
// that the children and selection can get out of sync for one render
|
|
5162
|
+
// pass. So we have to use this unstable API to ensure it batches them.
|
|
5163
|
+
// (2019/12/03)
|
|
5163
5164
|
// https://github.com/facebook/react/issues/14259#issuecomment-439702367
|
|
5164
|
-
ReactDOM.unstable_batchedUpdates
|
|
5165
|
+
var maybeBatchUpdates = REACT_MAJOR_VERSION < 18 ? ReactDOM.unstable_batchedUpdates : callback => callback();
|
|
5166
|
+
maybeBatchUpdates(() => {
|
|
5165
5167
|
var onContextChange = EDITOR_TO_ON_CHANGE.get(e);
|
|
5166
5168
|
|
|
5167
5169
|
if (onContextChange) {
|