slate-react 0.83.0 → 0.83.1-20229315647

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 CHANGED
@@ -128,6 +128,7 @@ var MARK_PLACEHOLDER_SYMBOL = Symbol('mark-placeholder');
128
128
  /**
129
129
  * Types.
130
130
  */
131
+ var DOMText = globalThis.Text;
131
132
  /**
132
133
  * Returns the host window of a DOM node
133
134
  */
@@ -642,7 +643,13 @@ var ReactEditor = {
642
643
  if (point.offset === end && nextText !== null && nextText !== void 0 && nextText.hasAttribute('data-slate-mark-placeholder')) {
643
644
  var _nextText$textContent;
644
645
 
645
- domPoint = [nextText, (_nextText$textContent = nextText.textContent) !== null && _nextText$textContent !== void 0 && _nextText$textContent.startsWith('\uFEFF') ? 1 : 0];
646
+ var domText = nextText.childNodes[0];
647
+ domPoint = [// COMPAT: If we don't explicity set the dom point to be on the actual
648
+ // dom text element, chrome will put the selection behind the actual dom
649
+ // text element, causing domRange.getBoundingClientRect() calls on a collapsed
650
+ // selection to return incorrect zero values (https://bugs.chromium.org/p/chromium/issues/detail?id=435438)
651
+ // which will cause issues when scrolling to it.
652
+ domText instanceof DOMText ? domText : nextText, (_nextText$textContent = nextText.textContent) !== null && _nextText$textContent !== void 0 && _nextText$textContent.startsWith('\uFEFF') ? 1 : 0];
646
653
  break;
647
654
  }
648
655