slate-react 0.91.9 → 0.91.10-20232824111

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
@@ -974,6 +974,16 @@ var ReactEditor = {
974
974
 
975
975
  if (anchorNode == null || focusNode == null || anchorOffset == null || focusOffset == null) {
976
976
  throw new Error("Cannot resolve a Slate range from DOM range: ".concat(domRange));
977
+ } // COMPAT: Triple-clicking a word in chrome will sometimes place the focus
978
+ // inside a `contenteditable="false"` DOM node following the word, which
979
+ // will cause `toSlatePoint` to throw an error. (2023/03/07)
980
+
981
+
982
+ if ('getAttribute' in focusNode && focusNode.getAttribute('contenteditable') === 'false') {
983
+ var _anchorNode$textConte;
984
+
985
+ focusNode = anchorNode;
986
+ focusOffset = ((_anchorNode$textConte = anchorNode.textContent) === null || _anchorNode$textConte === void 0 ? void 0 : _anchorNode$textConte.length) || 0;
977
987
  }
978
988
 
979
989
  var anchor = ReactEditor.toSlatePoint(editor, [anchorNode, anchorOffset], {
@@ -3057,7 +3067,7 @@ function createAndroidInputManager(_ref) {
3057
3067
  insertPositionHint = false;
3058
3068
  }
3059
3069
 
3060
- if (pathChanged || !hasPendingDiffs()) {
3070
+ if (pathChanged || hasPendingDiffs()) {
3061
3071
  flushTimeoutId = setTimeout(flush, FLUSH_DELAY);
3062
3072
  }
3063
3073
  };