@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.cjs +10 -0
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -1
- package/package.json +5 -5
- package/src/operations/behavior.operation.insert.block.ts +20 -0
package/lib/index.cjs
CHANGED
|
@@ -3595,6 +3595,16 @@ function insertBlock({
|
|
|
3595
3595
|
}
|
|
3596
3596
|
if (editor.isTextBlock(endBlock) && editor.isTextBlock(block)) {
|
|
3597
3597
|
const selectionStartPoint = slate.Range.start(currentSelection);
|
|
3598
|
+
if (isEqualToEmptyEditor([endBlock], schema2)) {
|
|
3599
|
+
const currentSelection2 = editor.selection;
|
|
3600
|
+
slate.Transforms.insertNodes(editor, [block], {
|
|
3601
|
+
at: endBlockPath,
|
|
3602
|
+
select: !1
|
|
3603
|
+
}), slate.Transforms.removeNodes(editor, {
|
|
3604
|
+
at: slate.Path.next(endBlockPath)
|
|
3605
|
+
}), select === "start" ? slate.Transforms.select(editor, selectionStartPoint) : select === "end" ? slate.Transforms.select(editor, slate.Editor.end(editor, endBlockPath)) : slate.Transforms.select(editor, currentSelection2);
|
|
3606
|
+
return;
|
|
3607
|
+
}
|
|
3598
3608
|
if (select === "end") {
|
|
3599
3609
|
slate.Transforms.insertFragment(editor, [block], {
|
|
3600
3610
|
voids: !0
|