@portabletext/editor 7.10.8 → 7.10.10

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.
@@ -3158,5 +3158,5 @@ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
3158
3158
  event: TBehaviorEvent;
3159
3159
  dom: EditorDom;
3160
3160
  }, guardResponse: TGuardResponse) => Array<BehaviorAction>;
3161
- export { HotkeyOptions as $, BlockStyleRenderProps as A, defineSpan as At, RangeDecoration as B, EditorSnapshot as C, SpanRenderProps as Ct, BlockDecoratorRenderProps as D, defineBlockObject as Dt, BlockChildRenderProps as E, TextBlockRenderProps as Et, OnCopyFn as F, KeyedSegment as Ft, RenderDecoratorFunction as G, RenderAnnotationFunction as H, OnPasteFn as I, Path as It, RenderPlaceholderFunction as J, RenderEditableFunction as K, OnPasteResult as L, EditorSelection as M, AnnotationPath as Mt, EditorSelectionPoint as N, BlockPath as Nt, BlockListItemRenderProps as O, defineContainer as Ot, InvalidValueResolution as P, ChildPath as Pt, PortableTextEditableProps as Q, OnPasteResultOrPromise as R, EditorContext as S, SpanRender as St, BlockAnnotationRenderProps as T, TextBlockRender as Tt, RenderBlockFunction as U, RangeDecorationOnMovedDetails as V, RenderChildFunction as W, ScrollSelectionIntoViewFunction as X, RenderStyleFunction as Y, PortableTextEditable as Z, MutationEvent as _, InlineObject as _t, forward as a, Containers as at, defineBehavior as b, RegistrableNode as bt, BehaviorEvent as c, RegisteredInlineObject as ct, InsertPlacement as d, BlockObject as dt, PortableTextEditor as et, NativeBehaviorEvent as f, BlockObjectRender as ft, EditorEmittedEvent as g, ContainerRenderProps as gt, PatchesEvent as h, ContainerRender as ht, execute as i, EditorSchema as it, EditableAPIDeleteOptions as j, defineTextBlock as jt, BlockRenderProps as k, defineInlineObject as kt, CustomBehaviorEvent as l, RegisteredPositional as lt, ExternalEditorEvent as m, Container as mt, BehaviorActionSet as n, TraversalSnapshot as nt, raise as o, RegisteredBlockObject as ot, SyntheticBehaviorEvent as p, BlockObjectRenderProps as pt, RenderListItemFunction as q, effect as r, Node$1 as rt, EditorDom as s, RegisteredContainer as st, BehaviorAction as t, resolveContainerAt as tt, ExternalBehaviorEvent as u, RegisteredSpan as ut, Operation as v, InlineObjectRender as vt, AddedAnnotationPaths as w, TextBlock as wt, BehaviorGuard as x, Span as xt, Behavior as y, InlineObjectRenderProps as yt, PasteData as z };
3161
+ export { HotkeyOptions as $, BlockStyleRenderProps as A, defineSpan as At, RangeDecoration as B, EditorSnapshot as C, SpanRenderProps as Ct, BlockDecoratorRenderProps as D, defineBlockObject as Dt, BlockChildRenderProps as E, TextBlockRenderProps as Et, OnCopyFn as F, KeyedSegment as Ft, RenderDecoratorFunction as G, RenderAnnotationFunction as H, OnPasteFn as I, Path as It, RenderPlaceholderFunction as J, RenderEditableFunction as K, OnPasteResult as L, PathSegment as Lt, EditorSelection as M, AnnotationPath as Mt, EditorSelectionPoint as N, BlockPath as Nt, BlockListItemRenderProps as O, defineContainer as Ot, InvalidValueResolution as P, ChildPath as Pt, PortableTextEditableProps as Q, OnPasteResultOrPromise as R, EditorContext as S, SpanRender as St, BlockAnnotationRenderProps as T, TextBlockRender as Tt, RenderBlockFunction as U, RangeDecorationOnMovedDetails as V, RenderChildFunction as W, ScrollSelectionIntoViewFunction as X, RenderStyleFunction as Y, PortableTextEditable as Z, MutationEvent as _, InlineObject as _t, forward as a, Containers as at, defineBehavior as b, RegistrableNode as bt, BehaviorEvent as c, RegisteredInlineObject as ct, InsertPlacement as d, BlockObject as dt, PortableTextEditor as et, NativeBehaviorEvent as f, BlockObjectRender as ft, EditorEmittedEvent as g, ContainerRenderProps as gt, PatchesEvent as h, ContainerRender as ht, execute as i, EditorSchema as it, EditableAPIDeleteOptions as j, defineTextBlock as jt, BlockRenderProps as k, defineInlineObject as kt, CustomBehaviorEvent as l, RegisteredPositional as lt, ExternalEditorEvent as m, Container as mt, BehaviorActionSet as n, TraversalSnapshot as nt, raise as o, RegisteredBlockObject as ot, SyntheticBehaviorEvent as p, BlockObjectRenderProps as pt, RenderListItemFunction as q, effect as r, Node$1 as rt, EditorDom as s, RegisteredContainer as st, BehaviorAction as t, resolveContainerAt as tt, ExternalBehaviorEvent as u, RegisteredSpan as ut, Operation as v, InlineObjectRender as vt, AddedAnnotationPaths as w, TextBlock as wt, BehaviorGuard as x, Span as xt, Behavior as y, InlineObjectRenderProps as yt, PasteData as z };
3162
3162
  //# sourceMappingURL=behavior.types.action.d.ts.map
@@ -568,8 +568,18 @@ function getActiveDecorators(snapshot) {
568
568
  }
569
569
  function isActiveAnnotation(annotation, options) {
570
570
  return (snapshot) => {
571
- if ((options?.mode ?? "full") === "partial")
572
- return getSelectedValue(snapshot).flatMap((block) => isTextBlock(snapshot.context, block) ? block.markDefs ?? [] : []).some((markDef) => markDef._type === annotation);
571
+ if ((options?.mode ?? "full") === "partial" && isSelectionExpanded$1(snapshot))
572
+ return getSelectedValue(snapshot).some((block) => {
573
+ if (!isTextBlock(snapshot.context, block))
574
+ return !1;
575
+ const annotationKeys = new Set((block.markDefs ?? []).filter((markDef) => markDef._type === annotation).map((markDef) => markDef._key));
576
+ return annotationKeys.size === 0 ? !1 : block.children.some((child) => isSpan(snapshot.context, child) && // Spans the selection only touches at a zero-width boundary
577
+ // survive the slice with empty text and intact `marks`,
578
+ // keeping their definitions alive through the slice's
579
+ // unused-definition pruning. A boundary touch selects nothing
580
+ // of the annotation, so those spans don't count.
581
+ child.text.length > 0 && child.marks?.some((mark) => annotationKeys.has(mark)));
582
+ });
573
583
  const selectionMarkDefs = getSelectedTextBlocks(snapshot).flatMap((block) => block.node.markDefs ?? []), activeAnnotations = getActiveAnnotationsMarks(snapshot);
574
584
  return selectionMarkDefs.filter((markDef) => markDef._type === annotation && activeAnnotations.includes(markDef._key)).length > 0;
575
585
  };