slate-react 0.72.4 → 0.72.6
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 +12 -0
- package/dist/components/editable.d.ts.map +1 -1
- package/dist/components/slate.d.ts.map +1 -1
- package/dist/components/string.d.ts.map +1 -1
- package/dist/index.es.js +41 -47
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +38 -48
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +38 -48
- package/dist/slate-react.min.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -201,6 +201,40 @@ module.exports["default"] = module.exports, module.exports.__esModule = true;
|
|
|
201
201
|
|
|
202
202
|
var _objectWithoutProperties = unwrapExports(objectWithoutProperties);
|
|
203
203
|
|
|
204
|
+
var IS_IOS = typeof navigator !== 'undefined' && typeof window !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
205
|
+
var IS_APPLE = typeof navigator !== 'undefined' && /Mac OS X/.test(navigator.userAgent);
|
|
206
|
+
var IS_ANDROID = typeof navigator !== 'undefined' && /Android/.test(navigator.userAgent);
|
|
207
|
+
var IS_FIREFOX = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
208
|
+
var IS_SAFARI = typeof navigator !== 'undefined' && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent); // "modern" Edge was released at 79.x
|
|
209
|
+
|
|
210
|
+
var IS_EDGE_LEGACY = typeof navigator !== 'undefined' && /Edge?\/(?:[0-6][0-9]|[0-7][0-8])/i.test(navigator.userAgent);
|
|
211
|
+
var IS_CHROME = typeof navigator !== 'undefined' && /Chrome/i.test(navigator.userAgent); // Native `beforeInput` events don't work well with react on Chrome 75
|
|
212
|
+
// and older, Chrome 76+ can use `beforeInput` though.
|
|
213
|
+
|
|
214
|
+
var IS_CHROME_LEGACY = typeof navigator !== 'undefined' && /Chrome?\/(?:[0-7][0-5]|[0-6][0-9])/i.test(navigator.userAgent); // Firefox did not support `beforeInput` until `v87`.
|
|
215
|
+
|
|
216
|
+
var IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])).*/i.test(navigator.userAgent); // qq browser
|
|
217
|
+
|
|
218
|
+
var IS_QQBROWSER = typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent); // UC mobile browser
|
|
219
|
+
|
|
220
|
+
var IS_UC_MOBILE = typeof navigator !== 'undefined' && /.*UCBrowser/.test(navigator.userAgent); // Wechat browser
|
|
221
|
+
|
|
222
|
+
var IS_WECHATBROWSER = typeof navigator !== 'undefined' && /.*Wechat/.test(navigator.userAgent); // Check if DOM is available as React does internally.
|
|
223
|
+
// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
|
|
224
|
+
|
|
225
|
+
var CAN_USE_DOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); // COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event
|
|
226
|
+
// Chrome Legacy doesn't support `beforeinput` correctly
|
|
227
|
+
|
|
228
|
+
var HAS_BEFORE_INPUT_SUPPORT = !IS_CHROME_LEGACY && !IS_EDGE_LEGACY && // globalThis is undefined in older browsers
|
|
229
|
+
typeof globalThis !== 'undefined' && globalThis.InputEvent && // @ts-ignore The `getTargetRanges` property isn't recognized.
|
|
230
|
+
typeof globalThis.InputEvent.prototype.getTargetRanges === 'function';
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Prevent warning on SSR by falling back to useEffect when DOM isn't available
|
|
234
|
+
*/
|
|
235
|
+
|
|
236
|
+
var useIsomorphicLayoutEffect = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
|
|
237
|
+
|
|
204
238
|
/**
|
|
205
239
|
* Leaf content strings.
|
|
206
240
|
*/
|
|
@@ -268,7 +302,7 @@ var TextString = function TextString(props) {
|
|
|
268
302
|
// eg makes native spellcheck opt out from checking the text node.
|
|
269
303
|
// useLayoutEffect: updating our span before browser paint
|
|
270
304
|
|
|
271
|
-
|
|
305
|
+
useIsomorphicLayoutEffect(function () {
|
|
272
306
|
// null coalescing text to make sure we're not outputing "null" as a string in the extreme case it is nullish at runtime
|
|
273
307
|
var textWithTrailing = "".concat(text !== null && text !== void 0 ? text : '').concat(isTrailing ? '\n' : '');
|
|
274
308
|
|
|
@@ -422,40 +456,6 @@ var DefaultLeaf = function DefaultLeaf(props) {
|
|
|
422
456
|
return /*#__PURE__*/React__default['default'].createElement("span", Object.assign({}, attributes), children);
|
|
423
457
|
};
|
|
424
458
|
|
|
425
|
-
var IS_IOS = typeof navigator !== 'undefined' && typeof window !== 'undefined' && /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
|
|
426
|
-
var IS_APPLE = typeof navigator !== 'undefined' && /Mac OS X/.test(navigator.userAgent);
|
|
427
|
-
var IS_ANDROID = typeof navigator !== 'undefined' && /Android/.test(navigator.userAgent);
|
|
428
|
-
var IS_FIREFOX = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent);
|
|
429
|
-
var IS_SAFARI = typeof navigator !== 'undefined' && /Version\/[\d\.]+.*Safari/.test(navigator.userAgent); // "modern" Edge was released at 79.x
|
|
430
|
-
|
|
431
|
-
var IS_EDGE_LEGACY = typeof navigator !== 'undefined' && /Edge?\/(?:[0-6][0-9]|[0-7][0-8])/i.test(navigator.userAgent);
|
|
432
|
-
var IS_CHROME = typeof navigator !== 'undefined' && /Chrome/i.test(navigator.userAgent); // Native `beforeInput` events don't work well with react on Chrome 75
|
|
433
|
-
// and older, Chrome 76+ can use `beforeInput` though.
|
|
434
|
-
|
|
435
|
-
var IS_CHROME_LEGACY = typeof navigator !== 'undefined' && /Chrome?\/(?:[0-7][0-5]|[0-6][0-9])/i.test(navigator.userAgent); // Firefox did not support `beforeInput` until `v87`.
|
|
436
|
-
|
|
437
|
-
var IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])).*/i.test(navigator.userAgent); // qq browser
|
|
438
|
-
|
|
439
|
-
var IS_QQBROWSER = typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent); // UC mobile browser
|
|
440
|
-
|
|
441
|
-
var IS_UC_MOBILE = typeof navigator !== 'undefined' && /.*UCBrowser/.test(navigator.userAgent); // Wechat browser
|
|
442
|
-
|
|
443
|
-
var IS_WECHATBROWSER = typeof navigator !== 'undefined' && /.*Wechat/.test(navigator.userAgent); // Check if DOM is available as React does internally.
|
|
444
|
-
// https://github.com/facebook/react/blob/master/packages/shared/ExecutionEnvironment.js
|
|
445
|
-
|
|
446
|
-
var CAN_USE_DOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); // COMPAT: Firefox/Edge Legacy don't support the `beforeinput` event
|
|
447
|
-
// Chrome Legacy doesn't support `beforeinput` correctly
|
|
448
|
-
|
|
449
|
-
var HAS_BEFORE_INPUT_SUPPORT = !IS_CHROME_LEGACY && !IS_EDGE_LEGACY && // globalThis is undefined in older browsers
|
|
450
|
-
typeof globalThis !== 'undefined' && globalThis.InputEvent && // @ts-ignore The `getTargetRanges` property isn't recognized.
|
|
451
|
-
typeof globalThis.InputEvent.prototype.getTargetRanges === 'function';
|
|
452
|
-
|
|
453
|
-
/**
|
|
454
|
-
* Prevent warning on SSR by falling back to useEffect when DOM isn't available
|
|
455
|
-
*/
|
|
456
|
-
|
|
457
|
-
var useIsomorphicLayoutEffect = CAN_USE_DOM ? React.useLayoutEffect : React.useEffect;
|
|
458
|
-
|
|
459
459
|
var _excluded$3 = ["anchor", "focus"],
|
|
460
460
|
_excluded2 = ["anchor", "focus"];
|
|
461
461
|
var shallowCompare = function shallowCompare(obj1, obj2) {
|
|
@@ -1310,7 +1310,7 @@ var Editable$1 = function Editable(props) {
|
|
|
1310
1310
|
|
|
1311
1311
|
|
|
1312
1312
|
state.isUpdatingSelection = true;
|
|
1313
|
-
var newDomRange = selection && ReactEditor.toDOMRange(editor, selection);
|
|
1313
|
+
var newDomRange = selection && hasDomSelectionInEditor && ReactEditor.toDOMRange(editor, selection);
|
|
1314
1314
|
|
|
1315
1315
|
if (newDomRange) {
|
|
1316
1316
|
if (slate.Range.isBackward(selection)) {
|
|
@@ -4187,20 +4187,10 @@ var Slate = function Slate(props) {
|
|
|
4187
4187
|
};
|
|
4188
4188
|
|
|
4189
4189
|
document.addEventListener('focus', fn, true);
|
|
4190
|
-
return function () {
|
|
4191
|
-
return document.removeEventListener('focus', fn, true);
|
|
4192
|
-
};
|
|
4193
|
-
}, []);
|
|
4194
|
-
useIsomorphicLayoutEffect(function () {
|
|
4195
|
-
var fn = function fn() {
|
|
4196
|
-
setTimeout(function () {
|
|
4197
|
-
setIsFocused(ReactEditor.isFocused(editor));
|
|
4198
|
-
}, 0);
|
|
4199
|
-
};
|
|
4200
|
-
|
|
4201
4190
|
document.addEventListener('blur', fn, true);
|
|
4202
4191
|
return function () {
|
|
4203
|
-
|
|
4192
|
+
document.removeEventListener('focus', fn, true);
|
|
4193
|
+
document.removeEventListener('blur', fn, true);
|
|
4204
4194
|
};
|
|
4205
4195
|
}, []);
|
|
4206
4196
|
return /*#__PURE__*/React__default['default'].createElement(SlateContext.Provider, {
|