@portabletext/editor 7.10.19 → 7.11.0

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.
Files changed (40) hide show
  1. package/README.md +3 -0
  2. package/lib/{behavior.types.action-CYtiRDck.d.ts → behavior.types.action-DXkAaEGS.d.ts} +167 -95
  3. package/lib/behavior.types.action-DXkAaEGS.d.ts.map +1 -0
  4. package/lib/{behavior.types.behavior-B_77VtQR.js → behavior.types.behavior-BxSLb73I.js} +5 -5
  5. package/lib/behavior.types.behavior-BxSLb73I.js.map +1 -0
  6. package/lib/behaviors/index.d.ts +1 -1
  7. package/lib/behaviors/index.js +1 -1
  8. package/lib/{get-container-BeXYKpoi.js → get-container-D1nM_ww9.js} +14 -14
  9. package/lib/get-container-D1nM_ww9.js.map +1 -0
  10. package/lib/{get-parent-51Kzgaf9.js → get-parent-Ci5241qs.js} +3 -3
  11. package/lib/get-parent-Ci5241qs.js.map +1 -0
  12. package/lib/{get-path-sub-schema--2I4NJbG.js → get-path-sub-schema-CZd9VcVM.js} +10 -10
  13. package/lib/get-path-sub-schema-CZd9VcVM.js.map +1 -0
  14. package/lib/index.d.ts +2 -2
  15. package/lib/index.js +13 -12
  16. package/lib/index.js.map +1 -1
  17. package/lib/plugins/index.d.ts +4 -4
  18. package/lib/plugins/index.js +3 -3
  19. package/lib/plugins/index.js.map +1 -1
  20. package/lib/{selector.is-at-the-start-of-block-gJIMWRpU.js → selector.is-at-the-start-of-block-D0boZbDu.js} +4 -4
  21. package/lib/selector.is-at-the-start-of-block-D0boZbDu.js.map +1 -0
  22. package/lib/selectors/index.d.ts +6 -6
  23. package/lib/selectors/index.js +6 -6
  24. package/lib/selectors/index.js.map +1 -1
  25. package/lib/traversal/index.d.ts +31 -31
  26. package/lib/traversal/index.js +4 -4
  27. package/lib/traversal/index.js.map +1 -1
  28. package/lib/{util.is-equal-selections-BF4WJtz5.js → util.is-equal-selections-N1hxVUbE.js} +2 -2
  29. package/lib/{util.is-equal-selections-BF4WJtz5.js.map → util.is-equal-selections-N1hxVUbE.js.map} +1 -1
  30. package/lib/{util.slice-blocks-DQnr9X2s.js → util.slice-blocks-B2fZcNok.js} +2 -2
  31. package/lib/{util.slice-blocks-DQnr9X2s.js.map → util.slice-blocks-B2fZcNok.js.map} +1 -1
  32. package/lib/utils/index.d.ts +1 -1
  33. package/lib/utils/index.js +3 -3
  34. package/package.json +3 -3
  35. package/lib/behavior.types.action-CYtiRDck.d.ts.map +0 -1
  36. package/lib/behavior.types.behavior-B_77VtQR.js.map +0 -1
  37. package/lib/get-container-BeXYKpoi.js.map +0 -1
  38. package/lib/get-parent-51Kzgaf9.js.map +0 -1
  39. package/lib/get-path-sub-schema--2I4NJbG.js.map +0 -1
  40. package/lib/selector.is-at-the-start-of-block-gJIMWRpU.js.map +0 -1
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as EditorContext, $t as SpanRender, A as PortableTextTextBlock, At as HotkeyOptions, B as EditorSelector, Bt as RegisteredPositional, C as ListDefinition, Ct as RenderEditableFunction, D as PortableTextChild, Dt as ScrollSelectionIntoViewFunction, E as PortableTextBlock, Et as RenderStyleFunction, F as BlockOffset, Ft as EditorSchema, G as EditorConfig, Gt as Container, H as EditorProvider, Ht as BlockObject, I as useEditor, It as Containers, J as MutationEvent, Jt as InlineObject, K as EditorEvent, Kt as ContainerRender, L as defaultKeyGenerator, Lt as RegisteredBlockObject, M as StyleDefinition, Mt as resolveContainerAt, N as StyleSchemaType, O as PortableTextObject, Ot as PortableTextEditable, P as defineSchema, Qt as Span, R as usePortableTextEditorSelection, Rt as RegisteredContainer, S as InlineObjectSchemaType, St as RenderDecoratorFunction, T as Patch, Tt as RenderPlaceholderFunction, U as EditorProviderProps, Ut as BlockObjectRender, V as useEditorSelector, Vt as RegisteredSpan, W as Editor, Wt as BlockObjectRenderProps, Xt as InlineObjectRenderProps, Y as Operation, Yt as InlineObjectRender, Zt as RegistrableNode, _ as BlockObjectSchemaType, _t as RangeDecoration, an as defineContainer, at as BlockListItemRenderProps, b as FieldDefinition, bt as RenderBlockFunction, cn as defineTextBlock, ct as EditableAPIDeleteOptions, dn as ChildPath, dt as InvalidValueResolution, en as SpanRenderProps, et as EditorSnapshot, f as PatchesEvent, ft as OnCopyFn, g as BlockObjectDefinition, gt as PasteData, h as BaseDefinition, ht as OnPasteResultOrPromise, in as defineBlockObject, it as BlockDecoratorRenderProps, j as SchemaDefinition, jt as PortableTextEditor, k as PortableTextSpan, kt as PortableTextEditableProps, ln as AnnotationPath, lt as EditorSelection, m as AnnotationSchemaType, mt as OnPasteResult, nn as TextBlockRender, nt as BlockAnnotationRenderProps, on as defineInlineObject, ot as BlockRenderProps, p as AnnotationDefinition, pn as Path, pt as OnPasteFn, q as EditorEmittedEvent, qt as ContainerRenderProps, rn as TextBlockRenderProps, rt as BlockChildRenderProps, sn as defineSpan, st as BlockStyleRenderProps, tn as TextBlock, tt as AddedAnnotationPaths, un as BlockPath, ut as EditorSelectionPoint, v as DecoratorDefinition, vt as RangeDecorationOnMovedDetails, w as ListSchemaType, wt as RenderListItemFunction, x as InlineObjectDefinition, xt as RenderChildFunction, y as DecoratorSchemaType, yt as RenderAnnotationFunction, z as usePortableTextEditor, zt as RegisteredInlineObject } from "./behavior.types.action-CYtiRDck.js";
2
- export { type AddedAnnotationPaths, type AnnotationDefinition, type AnnotationPath, type AnnotationSchemaType, type BaseDefinition, type BlockAnnotationRenderProps, type BlockChildRenderProps, type BlockDecoratorRenderProps, type BlockListItemRenderProps, type BlockObject, type BlockObjectDefinition, type BlockObjectRender, type BlockObjectRenderProps, type BlockObjectSchemaType, type BlockOffset, type BlockPath, type BlockRenderProps, type BlockStyleRenderProps, type ChildPath, type Container, type ContainerRender, type ContainerRenderProps, type Containers, type DecoratorDefinition, type DecoratorSchemaType, type EditableAPIDeleteOptions, type Editor, type EditorConfig, type EditorContext, type EditorEmittedEvent, type EditorEvent, EditorProvider, type EditorProviderProps, type EditorSchema, type EditorSelection, type EditorSelectionPoint, type EditorSelector, type EditorSnapshot, type FieldDefinition, type HotkeyOptions, type InlineObject, type InlineObjectDefinition, type InlineObjectRender, type InlineObjectRenderProps, type InlineObjectSchemaType, type InvalidValueResolution, type ListDefinition, type ListSchemaType, type MutationEvent, type OnCopyFn, type OnPasteFn, type OnPasteResult, type OnPasteResultOrPromise, type Operation, type PasteData, type Patch, type PatchesEvent, type Path, type PortableTextBlock, type PortableTextChild, PortableTextEditable, type PortableTextEditableProps, PortableTextEditor, type PortableTextObject, type PortableTextSpan, type PortableTextTextBlock, type RangeDecoration, type RangeDecorationOnMovedDetails, type RegisteredBlockObject, type RegisteredContainer, type RegisteredInlineObject, type RegisteredPositional, type RegisteredSpan, type RegistrableNode, type RenderAnnotationFunction, type RenderBlockFunction, type RenderChildFunction, type RenderDecoratorFunction, type RenderEditableFunction, type RenderListItemFunction, type RenderPlaceholderFunction, type RenderStyleFunction, type SchemaDefinition, type ScrollSelectionIntoViewFunction, type Span, type SpanRender, type SpanRenderProps, type StyleDefinition, type StyleSchemaType, type TextBlock, type TextBlockRender, type TextBlockRenderProps, defineBlockObject, defineContainer, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, resolveContainerAt, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
1
+ import { $t as Span, A as PortableTextSpan, At as PortableTextEditableProps, B as usePortableTextEditor, Bt as RegisteredInlineObject, C as ListDefinition, Ct as RenderDecoratorFunction, D as PortableTextBlock, Dt as RenderStyleFunction, E as Patch, Et as RenderPlaceholderFunction, F as defineSchema, G as Editor, Gt as BlockObjectRenderProps, H as useEditorSelector, Ht as RegisteredSpan, I as BlockOffset, It as EditorSchema, J as EditorEmittedEvent, Jt as ContainerRenderProps, K as EditorConfig, Kt as Container, L as useEditor, Lt as Containers, M as SchemaDefinition, Mt as PortableTextEditor, N as StyleDefinition, Nt as resolveContainerAt, O as PortableTextChild, Ot as ScrollSelectionIntoViewFunction, P as StyleSchemaType, Qt as RegistrableNode, R as defaultKeyGenerator, Rt as RegisteredBlockObject, S as InlineObjectSchemaType, St as RenderChildFunction, T as OfDefinition, Tt as RenderListItemFunction, U as EditorProvider, Ut as BlockObject, V as EditorSelector, Vt as RegisteredPositional, W as EditorProviderProps, Wt as BlockObjectRender, X as Operation, Xt as InlineObjectRender, Y as MutationEvent, Yt as InlineObject, Zt as InlineObjectRenderProps, _ as BlockObjectSchemaType, _t as PasteData, an as defineBlockObject, at as BlockDecoratorRenderProps, b as FieldDefinition, bt as RenderAnnotationFunction, cn as defineSpan, ct as BlockStyleRenderProps, dn as BlockPath, dt as EditorSelectionPoint, en as SpanRender, et as EditorContext, f as PatchesEvent, fn as ChildPath, ft as InvalidValueResolution, g as BlockObjectDefinition, gt as OnPasteResultOrPromise, h as BaseDefinition, ht as OnPasteResult, in as TextBlockRenderProps, it as BlockChildRenderProps, j as PortableTextTextBlock, jt as HotkeyOptions, k as PortableTextObject, kt as PortableTextEditable, ln as defineTextBlock, lt as EditableAPIDeleteOptions, m as AnnotationSchemaType, mn as Path, mt as OnPasteFn, nn as TextBlock, nt as AddedAnnotationPaths, on as defineContainer, ot as BlockListItemRenderProps, p as AnnotationDefinition, pt as OnCopyFn, q as EditorEvent, qt as ContainerRender, rn as TextBlockRender, rt as BlockAnnotationRenderProps, sn as defineInlineObject, st as BlockRenderProps, tn as SpanRenderProps, tt as EditorSnapshot, un as AnnotationPath, ut as EditorSelection, v as DecoratorDefinition, vt as RangeDecoration, w as ListSchemaType, wt as RenderEditableFunction, x as InlineObjectDefinition, xt as RenderBlockFunction, y as DecoratorSchemaType, yt as RangeDecorationOnMovedDetails, z as usePortableTextEditorSelection, zt as RegisteredContainer } from "./behavior.types.action-DXkAaEGS.js";
2
+ export { type AddedAnnotationPaths, type AnnotationDefinition, type AnnotationPath, type AnnotationSchemaType, type BaseDefinition, type BlockAnnotationRenderProps, type BlockChildRenderProps, type BlockDecoratorRenderProps, type BlockListItemRenderProps, type BlockObject, type BlockObjectDefinition, type BlockObjectRender, type BlockObjectRenderProps, type BlockObjectSchemaType, type BlockOffset, type BlockPath, type BlockRenderProps, type BlockStyleRenderProps, type ChildPath, type Container, type ContainerRender, type ContainerRenderProps, type Containers, type DecoratorDefinition, type DecoratorSchemaType, type EditableAPIDeleteOptions, type Editor, type EditorConfig, type EditorContext, type EditorEmittedEvent, type EditorEvent, EditorProvider, type EditorProviderProps, type EditorSchema, type EditorSelection, type EditorSelectionPoint, type EditorSelector, type EditorSnapshot, type FieldDefinition, type HotkeyOptions, type InlineObject, type InlineObjectDefinition, type InlineObjectRender, type InlineObjectRenderProps, type InlineObjectSchemaType, type InvalidValueResolution, type ListDefinition, type ListSchemaType, type MutationEvent, type OfDefinition, type OnCopyFn, type OnPasteFn, type OnPasteResult, type OnPasteResultOrPromise, type Operation, type PasteData, type Patch, type PatchesEvent, type Path, type PortableTextBlock, type PortableTextChild, PortableTextEditable, type PortableTextEditableProps, PortableTextEditor, type PortableTextObject, type PortableTextSpan, type PortableTextTextBlock, type RangeDecoration, type RangeDecorationOnMovedDetails, type RegisteredBlockObject, type RegisteredContainer, type RegisteredInlineObject, type RegisteredPositional, type RegisteredSpan, type RegistrableNode, type RenderAnnotationFunction, type RenderBlockFunction, type RenderChildFunction, type RenderDecoratorFunction, type RenderEditableFunction, type RenderListItemFunction, type RenderPlaceholderFunction, type RenderStyleFunction, type SchemaDefinition, type ScrollSelectionIntoViewFunction, type Span, type SpanRender, type SpanRenderProps, type StyleDefinition, type StyleSchemaType, type TextBlock, type TextBlockRender, type TextBlockRenderProps, defineBlockObject, defineContainer, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, resolveContainerAt, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
package/lib/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import { a as getNodeChildren, i as getChildren, l as serializePath, n as parentPath, r as getNode, t as getParent, u as isKeyedSegment } from "./get-parent-51Kzgaf9.js";
2
- import { C as getAncestors, S as hasNode, _ as comparePoints, a as isInline, b as isEditableContainer, c as isSpanNode, d as resolveChildEntryIndex, f as isAncestorPath, g as isAfterPoint, h as isBackwardRange, i as getEnclosingBlock, l as getSibling, m as rangeEdges, n as getEnclosingContainer, o as getBlock, p as isTextBlockNode, s as isBlock, t as getPathSubSchema, u as getNodes, v as comparePaths, x as resolveContainerAt, y as isObject } from "./get-path-sub-schema--2I4NJbG.js";
3
- import { _ as getAncestor, a as getTextBlock, c as pathContains, d as isRange, f as isPoint, g as isLeafObject, h as getLeaf, i as getFirstChild, l as getSpan, m as isPath, n as getUnionSchema, o as rangeIntersects, p as isObject$1, r as getLastChild, s as isBeforePoint, t as getContainer, u as getText } from "./get-container-BeXYKpoi.js";
4
- import { a as parseBlocks, b as childAtTextOffset, c as parseSpan, d as getSelectionEndPoint, f as isSelectionCollapsed, g as isEqualSelectionPoints, h as getBlockKeyFromSelectionPoint, i as parseBlock, l as defaultKeyGenerator, m as getBlockEndPoint, n as isListBlock, o as parseInlineObject, p as getBlockStartPoint, r as parseAnnotation, s as parseMarkDefs, u as getSelectionStartPoint, v as blockOffsetToSpanSelectionPoint, x as textOffsetOfChild } from "./util.slice-blocks-DQnr9X2s.js";
5
- import { A as isSelectingEntireBlocks, B as getFocusTextBlock, C as getActiveAnnotationsMarks, D as getSelectionStartPoint$1, E as getPreviousSpan, F as getSelectionStartBlock, H as getFocusSpan, I as getSelectionEndBlock, K as rangesOverlap, L as getFragment, M as isSelectionExpanded, N as isSelectionCollapsed$1, O as getNextSpan, P as isOverlappingSelection, R as getSelectedValue, S as getSelectedTextBlocks, U as getFocusInlineObject, V as getFocusBlock, W as getFocusChild, a as isActiveDecorator, b as isActiveAnnotation, c as getPreviousBlock, d as getFocusListBlock, f as getFocusBlockObject, i as isActiveListItem, j as getSelectedBlocks, k as getSelectionEndPoint$1, l as getNextBlock, n as isAtTheEndOfBlock, o as getSelectionStartChild, p as getCaretWordSelection, r as isActiveStyle, s as getSelectionEndChild, t as isAtTheStartOfBlock, u as getLastBlock, w as getMarkState, x as getActiveDecorators, y as getActiveAnnotations, z as getRootAcceptedTypes } from "./selector.is-at-the-start-of-block-gJIMWRpU.js";
6
- import { n as isEmptyTextBlock, r as getTextBlockText, t as isEqualSelections } from "./util.is-equal-selections-BF4WJtz5.js";
7
- import { a as raise$1, i as forward, n as effect, t as defineBehavior } from "./behavior.types.behavior-B_77VtQR.js";
1
+ import { a as getNodeChildren, i as getChildren, l as serializePath, n as parentPath, r as getNode, t as getParent, u as isKeyedSegment } from "./get-parent-Ci5241qs.js";
2
+ import { C as getAncestors, S as hasNode, _ as comparePoints, a as isInline, b as isEditableContainer, c as isSpanNode, d as resolveChildEntryIndex, f as isAncestorPath, g as isAfterPoint, h as isBackwardRange, i as getEnclosingBlock, l as getSibling, m as rangeEdges, n as getEnclosingContainer, o as getBlock, p as isTextBlockNode, s as isBlock, t as getPathSubSchema, u as getNodes, v as comparePaths, x as resolveContainerAt, y as isObject } from "./get-path-sub-schema-CZd9VcVM.js";
3
+ import { _ as getAncestor, a as getTextBlock, c as pathContains, d as isRange, f as isPoint, g as isLeafObject, h as getLeaf, i as getFirstChild, l as getSpan, m as isPath, n as getUnionSchema, o as rangeIntersects, p as isObject$1, r as getLastChild, s as isBeforePoint, t as getContainer, u as getText } from "./get-container-D1nM_ww9.js";
4
+ import { a as parseBlocks, b as childAtTextOffset, c as parseSpan, d as getSelectionEndPoint, f as isSelectionCollapsed, g as isEqualSelectionPoints, h as getBlockKeyFromSelectionPoint, i as parseBlock, l as defaultKeyGenerator, m as getBlockEndPoint, n as isListBlock, o as parseInlineObject, p as getBlockStartPoint, r as parseAnnotation, s as parseMarkDefs, u as getSelectionStartPoint, v as blockOffsetToSpanSelectionPoint, x as textOffsetOfChild } from "./util.slice-blocks-B2fZcNok.js";
5
+ import { A as isSelectingEntireBlocks, B as getFocusTextBlock, C as getActiveAnnotationsMarks, D as getSelectionStartPoint$1, E as getPreviousSpan, F as getSelectionStartBlock, H as getFocusSpan, I as getSelectionEndBlock, K as rangesOverlap, L as getFragment, M as isSelectionExpanded, N as isSelectionCollapsed$1, O as getNextSpan, P as isOverlappingSelection, R as getSelectedValue, S as getSelectedTextBlocks, U as getFocusInlineObject, V as getFocusBlock, W as getFocusChild, a as isActiveDecorator, b as isActiveAnnotation, c as getPreviousBlock, d as getFocusListBlock, f as getFocusBlockObject, i as isActiveListItem, j as getSelectedBlocks, k as getSelectionEndPoint$1, l as getNextBlock, n as isAtTheEndOfBlock, o as getSelectionStartChild, p as getCaretWordSelection, r as isActiveStyle, s as getSelectionEndChild, t as isAtTheStartOfBlock, u as getLastBlock, w as getMarkState, x as getActiveDecorators, y as getActiveAnnotations, z as getRootAcceptedTypes } from "./selector.is-at-the-start-of-block-D0boZbDu.js";
6
+ import { n as isEmptyTextBlock, r as getTextBlockText, t as isEqualSelections } from "./util.is-equal-selections-N1hxVUbE.js";
7
+ import { a as raise$1, i as forward, n as effect, t as defineBehavior } from "./behavior.types.behavior-BxSLb73I.js";
8
8
  import { n as EditorContext$1, t as useEditor } from "./use-editor-CwNeVwVC.js";
9
9
  import { c } from "react/compiler-runtime";
10
10
  import { useActorRef, useSelector } from "@xstate/react";
@@ -11185,6 +11185,7 @@ const coreDndBehaviors = [
11185
11185
  };
11186
11186
  },
11187
11187
  actions: [(_, { draggingEntireBlocks, draggedNodes, dragOrigin, dropPosition, originEvent, fittedBlocks, movedInlineObjectKey }) => {
11188
+ if (fittedBlocks.length === 0) return [];
11188
11189
  let movedInlineObjectPath = movedInlineObjectKey ? [
11189
11190
  ...dropPosition.anchor.path.slice(0, -2),
11190
11191
  "children",
@@ -17279,7 +17280,7 @@ const usePortableTextEditorSelection = () => {
17279
17280
  }, t1 = [editorActor], $[0] = editorActor, $[1] = t0, $[2] = t1), useEffect(t0, t1), selection;
17280
17281
  };
17281
17282
  /**
17282
- * @alpha
17283
+ * @public
17283
17284
  *
17284
17285
  * Define a container renderer. The returned registration is mounted via
17285
17286
  * the `<NodePlugin>` component at the top level, or nested inside
@@ -17317,7 +17318,7 @@ function defineContainer(config) {
17317
17318
  };
17318
17319
  }
17319
17320
  /**
17320
- * @alpha
17321
+ * @public
17321
17322
  *
17322
17323
  * Define a span renderer. The returned registration is mounted via the
17323
17324
  * `<NodePlugin>` component at the top level, or nested inside a
@@ -17345,7 +17346,7 @@ function defineSpan(config) {
17345
17346
  };
17346
17347
  }
17347
17348
  /**
17348
- * @alpha
17349
+ * @public
17349
17350
  *
17350
17351
  * Define a non-editable block-level object renderer for a `_type`
17351
17352
  * declared in the schema's `blockObjects` array.
@@ -17375,7 +17376,7 @@ function defineBlockObject(config) {
17375
17376
  };
17376
17377
  }
17377
17378
  /**
17378
- * @alpha
17379
+ * @public
17379
17380
  *
17380
17381
  * Define a non-editable inline object renderer for a `_type` declared
17381
17382
  * in the schema's `inlineObjects` array.
@@ -17405,7 +17406,7 @@ function defineInlineObject(config) {
17405
17406
  };
17406
17407
  }
17407
17408
  /**
17408
- * @alpha
17409
+ * @public
17409
17410
  *
17410
17411
  * Define a text block renderer. The returned registration is mounted
17411
17412
  * via the `<NodePlugin>` component, or nested inside a container's