@portabletext/editor 1.50.0 → 1.50.2

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/lib/index.js CHANGED
@@ -3623,6 +3623,16 @@ function insertBlock({
3623
3623
  }
3624
3624
  if (editor.isTextBlock(endBlock) && editor.isTextBlock(block)) {
3625
3625
  const selectionStartPoint = Range.start(currentSelection);
3626
+ if (isEqualToEmptyEditor([endBlock], schema)) {
3627
+ const currentSelection2 = editor.selection;
3628
+ Transforms.insertNodes(editor, [block], {
3629
+ at: endBlockPath,
3630
+ select: !1
3631
+ }), Transforms.removeNodes(editor, {
3632
+ at: Path.next(endBlockPath)
3633
+ }), select === "start" ? Transforms.select(editor, selectionStartPoint) : select === "end" ? Transforms.select(editor, Editor.end(editor, endBlockPath)) : Transforms.select(editor, currentSelection2);
3634
+ return;
3635
+ }
3626
3636
  if (select === "end") {
3627
3637
  Transforms.insertFragment(editor, [block], {
3628
3638
  voids: !0