@portabletext/editor 1.50.0 → 1.50.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/lib/behaviors/index.d.cts +3 -0
- package/lib/behaviors/index.d.ts +3 -0
- package/lib/index.cjs +10 -0
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +3 -0
- package/lib/index.d.ts +3 -0
- package/lib/index.js +10 -0
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +3 -0
- package/lib/plugins/index.d.ts +3 -0
- package/lib/selectors/index.d.cts +3 -0
- package/lib/selectors/index.d.ts +3 -0
- package/lib/utils/index.d.cts +3 -0
- package/lib/utils/index.d.ts +3 -0
- package/package.json +5 -5
- package/src/editor/editor-machine.ts +3 -0
- package/src/operations/behavior.operation.insert.block.ts +20 -0
|
@@ -2627,6 +2627,9 @@ declare type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
|
|
|
2627
2627
|
declare type PatchesEvent = {
|
|
2628
2628
|
type: 'patches'
|
|
2629
2629
|
patches: Array<Patch>
|
|
2630
|
+
/**
|
|
2631
|
+
* @deprecated Unused by the editor
|
|
2632
|
+
*/
|
|
2630
2633
|
snapshot: Array<PortableTextBlock> | undefined
|
|
2631
2634
|
}
|
|
2632
2635
|
|
package/lib/behaviors/index.d.ts
CHANGED
|
@@ -2627,6 +2627,9 @@ declare type ObjectBlockWithOptionalKey = Omit<PortableTextObject, '_key'> & {
|
|
|
2627
2627
|
declare type PatchesEvent = {
|
|
2628
2628
|
type: 'patches'
|
|
2629
2629
|
patches: Array<Patch>
|
|
2630
|
+
/**
|
|
2631
|
+
* @deprecated Unused by the editor
|
|
2632
|
+
*/
|
|
2630
2633
|
snapshot: Array<PortableTextBlock> | undefined
|
|
2631
2634
|
}
|
|
2632
2635
|
|
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
|