@portabletext/editor 1.55.15 → 1.55.16

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 CHANGED
@@ -8832,7 +8832,7 @@ function createEditableAPI(editor, editorActor) {
8832
8832
  }), editor.onChange();
8833
8833
  return;
8834
8834
  }
8835
- options?.mode === "blocks" && (debug$5("Deleting blocks touched by selection"), slate.Transforms.removeNodes(editor, {
8835
+ if (options?.mode === "blocks" && (debug$5("Deleting blocks touched by selection"), slate.Transforms.removeNodes(editor, {
8836
8836
  at: range,
8837
8837
  voids: !0,
8838
8838
  match: (node) => editor.isTextBlock(node) || !editor.isTextBlock(node) && slate.Element.isElement(node)
@@ -8841,9 +8841,17 @@ function createEditableAPI(editor, editorActor) {
8841
8841
  voids: !0,
8842
8842
  match: (node) => node._type === types2.span.name || // Text children
8843
8843
  !editor.isTextBlock(node) && slate.Element.isElement(node)
8844
- })), editor.children.length === 0 && (editor.children = [editor.pteCreateTextBlock({
8845
- decorators: []
8846
- })]), editor.onChange();
8844
+ })), editor.children.length === 0) {
8845
+ const placeholderBlock = createPlaceholderBlock(editorActor.getSnapshot().context);
8846
+ editor.children = [placeholderBlock], editor.value = [placeholderBlock], buildIndexMaps({
8847
+ schema: editorActor.getSnapshot().context.schema,
8848
+ value: editor.value
8849
+ }, {
8850
+ blockIndexMap: editor.blockIndexMap,
8851
+ listIndexMap: editor.listIndexMap
8852
+ });
8853
+ }
8854
+ editor.onChange();
8847
8855
  }
8848
8856
  }
8849
8857
  },