slate-react 0.82.2 → 0.82.3-2022819121833

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
@@ -3473,8 +3473,7 @@ function useTrackUserInput() {
3473
3473
  }
3474
3474
 
3475
3475
  var _excluded$1 = ["autoFocus", "decorate", "onDOMBeforeInput", "placeholder", "readOnly", "renderElement", "renderLeaf", "renderPlaceholder", "scrollSelectionIntoView", "style", "as"],
3476
- _excluded2 = ["text"],
3477
- _excluded3 = ["text"];
3476
+ _excluded2 = ["text"];
3478
3477
 
3479
3478
  function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
3480
3479
 
@@ -4080,12 +4079,14 @@ var Editable = function Editable(props) {
4080
4079
 
4081
4080
  if (editor.selection && slate.Range.isCollapsed(editor.selection) && marks) {
4082
4081
  var anchor = editor.selection.anchor;
4082
+ var leaf = slate.Node.leaf(editor, anchor.path);
4083
4083
 
4084
- var _Node$leaf = slate.Node.leaf(editor, anchor.path);
4085
- _Node$leaf.text;
4086
- var rest = _objectWithoutProperties(_Node$leaf, _excluded2);
4084
+ leaf.text;
4085
+ var rest = _objectWithoutProperties(leaf, _excluded2); // While marks isn't a 'complete' text, we can still use loose Text.equals
4086
+ // here which only compares marks anyway.
4087
4087
 
4088
- if (!slate.Text.equals(rest, marks, {
4088
+
4089
+ if (!slate.Text.equals(leaf, marks, {
4089
4090
  loose: true
4090
4091
  })) {
4091
4092
  state.hasMarkPlaceholder = true;
@@ -4108,11 +4109,11 @@ var Editable = function Editable(props) {
4108
4109
  if (selection) {
4109
4110
  var _anchor = selection.anchor;
4110
4111
 
4111
- var _Node$leaf2 = slate.Node.leaf(editor, _anchor.path);
4112
- _Node$leaf2.text;
4113
- var _rest = _objectWithoutProperties(_Node$leaf2, _excluded3);
4112
+ var _text = slate.Node.leaf(editor, _anchor.path); // While marks isn't a 'complete' text, we can still use loose Text.equals
4113
+ // here which only compares marks anyway.
4114
+
4114
4115
 
4115
- if (!slate.Text.equals(_rest, marks, {
4116
+ if (marks && !slate.Text.equals(_text, marks, {
4116
4117
  loose: true
4117
4118
  })) {
4118
4119
  EDITOR_TO_PENDING_INSERTION_MARKS.set(editor, marks);