@portabletext/editor 3.3.18 → 3.3.19

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.
@@ -1,2 +1,2 @@
1
- import { J as defineBehavior, Y as BehaviorGuard, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, q as Behavior, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../_chunks-dts/behavior.types.action.js";
2
- export { type Behavior, type BehaviorAction, type BehaviorActionSet, type BehaviorEvent, type BehaviorGuard, type CustomBehaviorEvent, type InsertPlacement, type NativeBehaviorEvent, type SyntheticBehaviorEvent, defineBehavior, effect, execute, forward, raise };
1
+ import { J as defineBehavior, Y as BehaviorGuard, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, q as Behavior, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../_chunks-dts/index.js";
2
+ export { Behavior, BehaviorAction, BehaviorActionSet, BehaviorEvent, BehaviorGuard, CustomBehaviorEvent, InsertPlacement, NativeBehaviorEvent, SyntheticBehaviorEvent, defineBehavior, effect, execute, forward, raise };
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as BlockAnnotationRenderProps, $t as AnnotationPath, A as PortableTextTextBlock, At as ReadyChange, B as EditorSelector, Bt as ScrollSelectionIntoViewFunction, C as ListDefinition, Ct as OnPasteResultOrPromise, D as PortableTextChild, Dt as PortableTextMemberSchemaTypes, E as PortableTextBlock, Et as PatchObservable, F as BlockOffset, Ft as RenderDecoratorFunction, G as EditorConfig, Gt as PortableTextEditable, H as EditorProvider, Ht as UndoChange, I as useEditor, It as RenderEditableFunction, Jt as PortableTextEditor, K as EditorEvent, Kt as PortableTextEditableProps, L as defaultKeyGenerator, Lt as RenderListItemFunction, M as StyleDefinition, Mt as RenderAnnotationFunction, N as StyleSchemaType, Nt as RenderBlockFunction, O as PortableTextObject, Ot as RangeDecoration, P as defineSchema, Pt as RenderChildFunction, Q as AddedAnnotationPaths, Qt as EditorSchema, R as usePortableTextEditorSelection, Rt as RenderPlaceholderFunction, S as InlineObjectSchemaType, St as OnPasteResult, T as Patch, Tt as PatchChange, U as EditorProviderProps, Ut as UnsetChange, V as useEditorSelector, Vt as SelectionChange, W as Editor, Wt as ValueChange, X as EditorContext, Xt as EditorEmittedEvent, Yt as PortableTextEditorProps, Z as EditorSnapshot, Zt as MutationEvent, _ as BlockObjectSchemaType, _t as LoadingChange, at as BlurChange, b as FieldDefinition, bt as OnCopyFn, ct as EditableAPIDeleteOptions, dt as EditorSelection, en as BlockPath, et as BlockChildRenderProps, f as PatchesEvent, ft as EditorSelectionPoint, g as BlockObjectDefinition, gt as InvalidValueResolution, h as BaseDefinition, ht as InvalidValue, it as BlockStyleRenderProps, j as SchemaDefinition, jt as RedoChange, k as PortableTextSpan, kt as RangeDecorationOnMovedDetails, lt as EditorChange, m as AnnotationSchemaType, mt as FocusChange, nt as BlockListItemRenderProps, ot as ConnectionChange, p as AnnotationDefinition, pt as ErrorChange, qt as HotkeyOptions, rt as BlockRenderProps, st as EditableAPI, tn as ChildPath, tt as BlockDecoratorRenderProps, ut as EditorChanges, v as DecoratorDefinition, vt as MutationChange, w as ListSchemaType, wt as PasteData, x as InlineObjectDefinition, xt as OnPasteFn, y as DecoratorSchemaType, yt as OnBeforeInputFn, z as usePortableTextEditor, zt as RenderStyleFunction } from "./_chunks-dts/behavior.types.action.js";
1
+ import { $ as BlockAnnotationRenderProps, $t as AnnotationPath, A as PortableTextTextBlock, At as ReadyChange, B as EditorSelector, Bt as ScrollSelectionIntoViewFunction, C as ListDefinition, Ct as OnPasteResultOrPromise, D as PortableTextChild, Dt as PortableTextMemberSchemaTypes, E as PortableTextBlock, Et as PatchObservable, F as BlockOffset, Ft as RenderDecoratorFunction, G as EditorConfig, Gt as PortableTextEditable, H as EditorProvider, Ht as UndoChange, I as useEditor, It as RenderEditableFunction, Jt as PortableTextEditor, K as EditorEvent, Kt as PortableTextEditableProps, L as defaultKeyGenerator, Lt as RenderListItemFunction, M as StyleDefinition, Mt as RenderAnnotationFunction, N as StyleSchemaType, Nt as RenderBlockFunction, O as PortableTextObject, Ot as RangeDecoration, P as defineSchema, Pt as RenderChildFunction, Q as AddedAnnotationPaths, Qt as EditorSchema, R as usePortableTextEditorSelection, Rt as RenderPlaceholderFunction, S as InlineObjectSchemaType, St as OnPasteResult, T as Patch, Tt as PatchChange, U as EditorProviderProps, Ut as UnsetChange, V as useEditorSelector, Vt as SelectionChange, W as Editor, Wt as ValueChange, X as EditorContext, Xt as EditorEmittedEvent, Yt as PortableTextEditorProps, Z as EditorSnapshot, Zt as MutationEvent, _ as BlockObjectSchemaType, _t as LoadingChange, at as BlurChange, b as FieldDefinition, bt as OnCopyFn, ct as EditableAPIDeleteOptions, dt as EditorSelection, en as BlockPath, et as BlockChildRenderProps, f as PatchesEvent, ft as EditorSelectionPoint, g as BlockObjectDefinition, gt as InvalidValueResolution, h as BaseDefinition, ht as InvalidValue, it as BlockStyleRenderProps, j as SchemaDefinition, jt as RedoChange, k as PortableTextSpan, kt as RangeDecorationOnMovedDetails, lt as EditorChange, m as AnnotationSchemaType, mt as FocusChange, nt as BlockListItemRenderProps, ot as ConnectionChange, p as AnnotationDefinition, pt as ErrorChange, qt as HotkeyOptions, rt as BlockRenderProps, st as EditableAPI, tn as ChildPath, tt as BlockDecoratorRenderProps, ut as EditorChanges, v as DecoratorDefinition, vt as MutationChange, w as ListSchemaType, wt as PasteData, x as InlineObjectDefinition, xt as OnPasteFn, y as DecoratorSchemaType, yt as OnBeforeInputFn, z as usePortableTextEditor, zt as RenderStyleFunction } from "./_chunks-dts/index.js";
2
2
  export { AddedAnnotationPaths, AnnotationDefinition, AnnotationPath, AnnotationSchemaType, BaseDefinition, BlockAnnotationRenderProps, BlockChildRenderProps, BlockDecoratorRenderProps, BlockListItemRenderProps, BlockObjectDefinition, BlockObjectSchemaType, BlockOffset, BlockPath, BlockRenderProps, BlockStyleRenderProps, BlurChange, ChildPath, ConnectionChange, DecoratorDefinition, DecoratorSchemaType, EditableAPI, EditableAPIDeleteOptions, Editor, EditorChange, EditorChanges, EditorConfig, EditorContext, EditorEmittedEvent, EditorEvent, EditorProvider, EditorProviderProps, EditorSchema, EditorSelection, EditorSelectionPoint, EditorSelector, EditorSnapshot, ErrorChange, FieldDefinition, FocusChange, HotkeyOptions, InlineObjectDefinition, InlineObjectSchemaType, InvalidValue, InvalidValueResolution, ListDefinition, ListSchemaType, LoadingChange, MutationChange, MutationEvent, OnBeforeInputFn, OnCopyFn, OnPasteFn, OnPasteResult, OnPasteResultOrPromise, PasteData, Patch, PatchChange, PatchObservable, PatchesEvent, PortableTextBlock, PortableTextChild, PortableTextEditable, PortableTextEditableProps, PortableTextEditor, PortableTextEditorProps, PortableTextMemberSchemaTypes, PortableTextObject, PortableTextSpan, PortableTextTextBlock, RangeDecoration, RangeDecorationOnMovedDetails, ReadyChange, RedoChange, RenderAnnotationFunction, RenderBlockFunction, RenderChildFunction, RenderDecoratorFunction, RenderEditableFunction, RenderListItemFunction, RenderPlaceholderFunction, RenderStyleFunction, SchemaDefinition, ScrollSelectionIntoViewFunction, SelectionChange, StyleDefinition, StyleSchemaType, UndoChange, UnsetChange, ValueChange, defineSchema, defaultKeyGenerator as keyGenerator, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
package/lib/index.js CHANGED
@@ -1118,7 +1118,7 @@ const RelayActorContext = createContext({});
1118
1118
  function RenderDefaultBlockObject(props) {
1119
1119
  const $ = c(4);
1120
1120
  let t0;
1121
- $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {
1121
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
1122
1122
  userSelect: "none"
1123
1123
  }, $[0] = t0) : t0 = $[0];
1124
1124
  let t1;
@@ -1133,7 +1133,7 @@ function RenderDefaultBlockObject(props) {
1133
1133
  function RenderDefaultInlineObject(props) {
1134
1134
  const $ = c(4);
1135
1135
  let t0;
1136
- $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = {
1136
+ $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = {
1137
1137
  userSelect: "none"
1138
1138
  }, $[0] = t0) : t0 = $[0];
1139
1139
  let t1;
@@ -1148,7 +1148,7 @@ function RenderDefaultInlineObject(props) {
1148
1148
  function DropIndicator() {
1149
1149
  const $ = c(1);
1150
1150
  let t0;
1151
- return $[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx("div", { contentEditable: !1, className: "pt-drop-indicator", style: {
1151
+ return $[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = /* @__PURE__ */ jsx("div", { contentEditable: !1, className: "pt-drop-indicator", style: {
1152
1152
  position: "absolute",
1153
1153
  width: "100%",
1154
1154
  height: 1,
@@ -1441,7 +1441,7 @@ function RenderInlineObject(props) {
1441
1441
  }, $[12] = props.element._key, $[13] = props.element._type, $[14] = t3, $[15] = t4) : t4 = $[15];
1442
1442
  const inlineObject_0 = t4, t5 = !props.readOnly;
1443
1443
  let t6;
1444
- $[16] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t6 = {
1444
+ $[16] === Symbol.for("react.memo_cache_sentinel") ? (t6 = {
1445
1445
  display: "inline-block"
1446
1446
  }, $[16] = t6) : t6 = $[16];
1447
1447
  let t7;
@@ -6952,11 +6952,11 @@ function isTextBlockNode(context, node) {
6952
6952
  function isSpanNode(context, node) {
6953
6953
  return typeof node != "object" || node === null || "children" in node ? !1 : "_type" in node ? node._type === context.schema.span.name : "text" in node;
6954
6954
  }
6955
- function isPartialSpanNode(node) {
6956
- return typeof node == "object" && node !== null && "text" in node && typeof node.text == "string";
6955
+ function isPartialSpanNode(context, node) {
6956
+ return !(typeof node != "object" || node === null || !("text" in node) || typeof node.text != "string" || "_type" in node && node._type !== context.schema.span.name);
6957
6957
  }
6958
6958
  function isObjectNode(context, node) {
6959
- return !isEditorNode(node) && !isTextBlockNode(context, node) && !isSpanNode(context, node) && !isPartialSpanNode(node);
6959
+ return !isEditorNode(node) && !isTextBlockNode(context, node) && !isSpanNode(context, node) && !isPartialSpanNode(context, node);
6960
6960
  }
6961
6961
  function getBlock(root, path) {
6962
6962
  const index = path.at(0);
@@ -7042,7 +7042,7 @@ function applyOperationToPortableTextImmutable(context, root, operation) {
7042
7042
  if (!isTextBlockNode(context, parent))
7043
7043
  return root;
7044
7044
  let newChild;
7045
- if (isPartialSpanNode(insertedNode))
7045
+ if (isPartialSpanNode(context, insertedNode))
7046
7046
  newChild = insertedNode;
7047
7047
  else if ("__inline" in insertedNode)
7048
7048
  newChild = {
@@ -7089,7 +7089,7 @@ function applyOperationToPortableTextImmutable(context, root, operation) {
7089
7089
  if (!node || !prev || !parent)
7090
7090
  return root;
7091
7091
  const index = path[path.length - 1];
7092
- if (isPartialSpanNode(node) && isPartialSpanNode(prev)) {
7092
+ if (isPartialSpanNode(context, node) && isPartialSpanNode(context, prev)) {
7093
7093
  const blockIndex = path[0], newPrev = {
7094
7094
  ...prev,
7095
7095
  text: prev.text + node.text
@@ -7244,7 +7244,7 @@ function applyOperationToPortableTextImmutable(context, root, operation) {
7244
7244
  children: replaceChild(root.children, path[0], newNode)
7245
7245
  };
7246
7246
  }
7247
- if (isPartialSpanNode(node)) {
7247
+ if (isPartialSpanNode(context, node)) {
7248
7248
  const newNode = {
7249
7249
  ...node
7250
7250
  };