slate 0.132.0 → 0.133.1

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
@@ -4186,17 +4186,20 @@ const insertFragment = (editor, fragment, options = {}) => {
4186
4186
  if (Range.isCollapsed(at)) {
4187
4187
  at = at.anchor;
4188
4188
  } else {
4189
- const [, end] = Range.edges(at);
4189
+ const [start, end] = Range.edges(at);
4190
4190
  if (!voids && Editor.void(editor, {
4191
4191
  at: end
4192
4192
  })) {
4193
4193
  return;
4194
4194
  }
4195
- const pointRef = Editor.pointRef(editor, end);
4195
+ const _startRef = Editor.pointRef(editor, start);
4196
+ const _endRef = Editor.pointRef(editor, end);
4196
4197
  Transforms.delete(editor, {
4197
4198
  at
4198
4199
  });
4199
- at = pointRef.unref();
4200
+ const startPoint = _startRef.unref();
4201
+ const endPoint = _endRef.unref();
4202
+ at = endPoint !== null && endPoint !== void 0 ? endPoint : startPoint;
4200
4203
  }
4201
4204
  } else if (Location.isPath(at)) {
4202
4205
  at = Editor.start(editor, at);
@@ -4569,12 +4572,21 @@ const insertNodes = (editor, nodes, options = {}) => {
4569
4572
  if (Range.isCollapsed(at)) {
4570
4573
  at = at.anchor;
4571
4574
  } else {
4572
- const [, end] = Range.edges(at);
4573
- const pointRef = Editor.pointRef(editor, end);
4575
+ var _ref, _ref2;
4576
+ const [start, end] = Range.edges(at);
4577
+ const startRef = Editor.pointRef(editor, start);
4578
+ const endRef = Editor.pointRef(editor, end);
4579
+ const before = Editor.before(editor, start, {
4580
+ voids
4581
+ });
4582
+ const beforeRef = before && Editor.pointRef(editor, before);
4574
4583
  Transforms.delete(editor, {
4575
4584
  at
4576
4585
  });
4577
- at = pointRef.unref();
4586
+ const startPoint = startRef.unref();
4587
+ const endPoint = endRef.unref();
4588
+ const beforePoint = beforeRef ? beforeRef.unref() : null;
4589
+ at = (_ref = (_ref2 = endPoint !== null && endPoint !== void 0 ? endPoint : startPoint) !== null && _ref2 !== void 0 ? _ref2 : beforePoint) !== null && _ref !== void 0 ? _ref : Editor.start(editor, []);
4578
4590
  }
4579
4591
  }
4580
4592
  if (Location.isPoint(at)) {