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.
@@ -1079,8 +1079,18 @@
1079
1079
  * Determines wether the active element is nested within a shadowRoot
1080
1080
  */
1081
1081
 
1082
- var hasShadowRoot = function hasShadowRoot() {
1083
- return !!(window.document.activeElement && window.document.activeElement.shadowRoot);
1082
+ var hasShadowRoot = function hasShadowRoot(node) {
1083
+ var parent = node && node.parentNode;
1084
+
1085
+ while (parent) {
1086
+ if (parent.toString() === '[object ShadowRoot]') {
1087
+ return true;
1088
+ }
1089
+
1090
+ parent = parent.parentNode;
1091
+ }
1092
+
1093
+ return false;
1084
1094
  };
1085
1095
  /**
1086
1096
  * Get the nearest editable child and index at `index` in a `parent`, preferring
@@ -1256,9 +1266,7 @@
1256
1266
 
1257
1267
  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`.
1258
1268
 
1259
- var IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent); // qq browser
1260
-
1261
- var IS_QQBROWSER = typeof navigator !== 'undefined' && /.*QQBrowser/.test(navigator.userAgent); // UC mobile browser
1269
+ var IS_FIREFOX_LEGACY = typeof navigator !== 'undefined' && /^(?!.*Seamonkey)(?=.*Firefox\/(?:[0-7][0-9]|[0-8][0-6])(?:\.)).*/i.test(navigator.userAgent); // UC mobile browser
1262
1270
 
1263
1271
  var IS_UC_MOBILE = typeof navigator !== 'undefined' && /.*UCBrowser/.test(navigator.userAgent); // Wechat browser
1264
1272
 
@@ -1843,7 +1851,7 @@
1843
1851
  // (2020/08/08)
1844
1852
  // https://bugs.chromium.org/p/chromium/issues/detail?id=447523
1845
1853
 
1846
- if (IS_CHROME && hasShadowRoot()) {
1854
+ if (IS_CHROME && hasShadowRoot(anchorNode)) {
1847
1855
  isCollapsed = domRange.anchorNode === domRange.focusNode && domRange.anchorOffset === domRange.focusOffset;
1848
1856
  } else {
1849
1857
  isCollapsed = domRange.isCollapsed;
@@ -5327,7 +5335,7 @@
5327
5335
  // ends since it will already have been committed to the DOM.
5328
5336
 
5329
5337
 
5330
- if (!IS_SAFARI && !IS_FIREFOX_LEGACY && !IS_IOS && !IS_QQBROWSER && !IS_WECHATBROWSER && !IS_UC_MOBILE && event.data) {
5338
+ if (!IS_SAFARI && !IS_FIREFOX_LEGACY && !IS_IOS && !IS_WECHATBROWSER && !IS_UC_MOBILE && event.data) {
5331
5339
  var placeholderMarks = EDITOR_TO_PENDING_INSERTION_MARKS.get(editor);
5332
5340
  EDITOR_TO_PENDING_INSERTION_MARKS["delete"](editor); // Ensure we insert text with the marks the user was actually seeing
5333
5341