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.js CHANGED
@@ -4867,17 +4867,21 @@ var insertFragment = function insertFragment(editor, fragment) {
4867
4867
  } else {
4868
4868
  var _Range$edges = Range.edges(at),
4869
4869
  _Range$edges2 = _slicedToArray(_Range$edges, 2),
4870
+ start = _Range$edges2[0],
4870
4871
  end = _Range$edges2[1];
4871
4872
  if (!voids && Editor["void"](editor, {
4872
4873
  at: end
4873
4874
  })) {
4874
4875
  return;
4875
4876
  }
4876
- var pointRef = Editor.pointRef(editor, end);
4877
+ var _startRef = Editor.pointRef(editor, start);
4878
+ var _endRef = Editor.pointRef(editor, end);
4877
4879
  Transforms["delete"](editor, {
4878
4880
  at: at
4879
4881
  });
4880
- at = pointRef.unref();
4882
+ var startPoint = _startRef.unref();
4883
+ var endPoint = _endRef.unref();
4884
+ at = endPoint !== null && endPoint !== void 0 ? endPoint : startPoint;
4881
4885
  }
4882
4886
  } else if (Location.isPath(at)) {
4883
4887
  at = Editor.start(editor, at);
@@ -5280,14 +5284,24 @@ var insertNodes = function insertNodes(editor, nodes) {
5280
5284
  if (Range.isCollapsed(at)) {
5281
5285
  at = at.anchor;
5282
5286
  } else {
5287
+ var _ref, _ref2;
5283
5288
  var _Range$edges = Range.edges(at),
5284
5289
  _Range$edges2 = _slicedToArray(_Range$edges, 2),
5290
+ start = _Range$edges2[0],
5285
5291
  end = _Range$edges2[1];
5286
- var pointRef = Editor.pointRef(editor, end);
5292
+ var startRef = Editor.pointRef(editor, start);
5293
+ var endRef = Editor.pointRef(editor, end);
5294
+ var before = Editor.before(editor, start, {
5295
+ voids: voids
5296
+ });
5297
+ var beforeRef = before && Editor.pointRef(editor, before);
5287
5298
  Transforms["delete"](editor, {
5288
5299
  at: at
5289
5300
  });
5290
- at = pointRef.unref();
5301
+ var startPoint = startRef.unref();
5302
+ var endPoint = endRef.unref();
5303
+ var beforePoint = beforeRef ? beforeRef.unref() : null;
5304
+ at = (_ref = (_ref2 = endPoint !== null && endPoint !== void 0 ? endPoint : startPoint) !== null && _ref2 !== void 0 ? _ref2 : beforePoint) !== null && _ref !== void 0 ? _ref : Editor.start(editor, []);
5291
5305
  }
5292
5306
  }
5293
5307
  if (Location.isPoint(at)) {
@@ -5362,9 +5376,9 @@ var insertNodes = function insertNodes(editor, nodes) {
5362
5376
  if (Node.isText(node)) {
5363
5377
  newDirtyPaths.push(path);
5364
5378
  } else {
5365
- newDirtyPaths.push.apply(newDirtyPaths, _toConsumableArray(Array.from(Node.nodes(node), function (_ref) {
5366
- var _ref2 = _slicedToArray(_ref, 2),
5367
- p = _ref2[1];
5379
+ newDirtyPaths.push.apply(newDirtyPaths, _toConsumableArray(Array.from(Node.nodes(node), function (_ref3) {
5380
+ var _ref4 = _slicedToArray(_ref3, 2),
5381
+ p = _ref4[1];
5368
5382
  return path.concat(p);
5369
5383
  })));
5370
5384
  }