@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.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
|