@portabletext/editor 1.49.13 → 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.
@@ -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
 
@@ -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
@@ -950,7 +950,13 @@ function RenderTextBlock(props) {
950
950
  schemaType: legacyListItemSchemaType
951
951
  }) : console.error(`Unable to find Schema type for text block list item ${props.textBlock.listItem}`);
952
952
  }
953
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props.attributes, className: ["pt-block", "pt-text-block", ...props.textBlock.style ? [`pt-text-block-style-${props.textBlock.style}`] : [], ...props.textBlock.listItem ? ["pt-list-item", `pt-list-item-${props.textBlock.listItem}`, `pt-list-item-level-${props.textBlock.level ?? 1}`] : []].join(" "), spellCheck: props.spellCheck, "data-block-key": props.textBlock._key, "data-block-name": props.textBlock._type, "data-block-type": "text", children: [
953
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { ...props.attributes, className: ["pt-block", "pt-text-block", ...props.textBlock.style ? [`pt-text-block-style-${props.textBlock.style}`] : [], ...props.textBlock.listItem ? ["pt-list-item", `pt-list-item-${props.textBlock.listItem}`, `pt-list-item-level-${props.textBlock.level ?? 1}`] : []].join(" "), spellCheck: props.spellCheck, "data-block-key": props.textBlock._key, "data-block-name": props.textBlock._type, "data-block-type": "text", ...props.textBlock.listItem !== void 0 ? {
954
+ "data-list-item": props.textBlock.listItem
955
+ } : {}, ...props.textBlock.level !== void 0 ? {
956
+ "data-level": props.textBlock.level
957
+ } : {}, ...props.textBlock.style !== void 0 ? {
958
+ "data-style": props.textBlock.style
959
+ } : {}, children: [
954
960
  dragPositionBlock === "start" ? /* @__PURE__ */ jsxRuntime.jsx(DropIndicator, {}) : null,
955
961
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref: blockRef, children: props.renderBlock ? props.renderBlock({
956
962
  children,
@@ -3589,6 +3595,16 @@ function insertBlock({
3589
3595
  }
3590
3596
  if (editor.isTextBlock(endBlock) && editor.isTextBlock(block)) {
3591
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
+ }
3592
3608
  if (select === "end") {
3593
3609
  slate.Transforms.insertFragment(editor, [block], {
3594
3610
  voids: !0