slate-react 0.88.0 → 0.88.2-202301413638

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
@@ -425,8 +425,18 @@ var normalizeDOMPoint = function normalizeDOMPoint(domPoint) {
425
425
  * Determines wether the active element is nested within a shadowRoot
426
426
  */
427
427
 
428
- var hasShadowRoot = function hasShadowRoot() {
429
- return !!(window.document.activeElement && window.document.activeElement.shadowRoot);
428
+ var hasShadowRoot = function hasShadowRoot(node) {
429
+ var parent = node && node.parentNode;
430
+
431
+ while (parent) {
432
+ if (parent.toString() === '[object ShadowRoot]') {
433
+ return true;
434
+ }
435
+
436
+ parent = parent.parentNode;
437
+ }
438
+
439
+ return false;
430
440
  };
431
441
  /**
432
442
  * Get the nearest editable child and index at `index` in a `parent`, preferring
@@ -602,9 +612,7 @@ var IS_CHROME = typeof navigator !== 'undefined' && /Chrome/i.test(navigator.use
602
612
 
603
613
  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`.
604
614
 
605
- var IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent); // qq browser
606
-
607
- var IS_QQBROWSER = typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent); // UC mobile browser
615
+ var IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent); // UC mobile browser
608
616
 
609
617
  var IS_UC_MOBILE = typeof navigator !== 'undefined' && /.*UCBrowser/.test(navigator.userAgent); // Wechat browser
610
618
 
@@ -1189,7 +1197,7 @@ var ReactEditor = {
1189
1197
  // (2020/08/08)
1190
1198
  // https://bugs.chromium.org/p/chromium/issues/detail?id=447523
1191
1199
 
1192
- if (IS_CHROME && hasShadowRoot()) {
1200
+ if (IS_CHROME && hasShadowRoot(anchorNode)) {
1193
1201
  isCollapsed = domRange.anchorNode === domRange.focusNode && domRange.anchorOffset === domRange.focusOffset;
1194
1202
  } else {
1195
1203
  isCollapsed = domRange.isCollapsed;
@@ -4417,7 +4425,7 @@ var Editable = function Editable(props) {
4417
4425
  // ends since it will already have been committed to the DOM.
4418
4426
 
4419
4427
 
4420
- if (!IS_SAFARI && !IS_FIREFOX_LEGACY && !IS_IOS && !IS_QQBROWSER && !IS_WECHATBROWSER && !IS_UC_MOBILE && event.data) {
4428
+ if (!IS_SAFARI && !IS_FIREFOX_LEGACY && !IS_IOS && !IS_WECHATBROWSER && !IS_UC_MOBILE && event.data) {
4421
4429
  var placeholderMarks = EDITOR_TO_PENDING_INSERTION_MARKS.get(editor);
4422
4430
  EDITOR_TO_PENDING_INSERTION_MARKS["delete"](editor); // Ensure we insert text with the marks the user was actually seeing
4423
4431