@portabletext/editor 8.0.3 → 8.1.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.
@@ -1464,6 +1464,12 @@ interface RangeDecoration {
1464
1464
  * The component that renders the range decoration. It receives the
1465
1465
  * decorated text as its children.
1466
1466
  *
1467
+ * The component can render more than once for one decoration: the range
1468
+ * is split into segments at formatting boundaries and where it overlaps
1469
+ * other decorations, and each segment gets its own wrapper. Where
1470
+ * decorations overlap, their components nest, first in array order
1471
+ * outermost.
1472
+ *
1467
1473
  * @example
1468
1474
  * ```tsx
1469
1475
  * (rangeComponentProps: PropsWithChildren) => (
@@ -1901,6 +1907,7 @@ type OperationEvent = {
1901
1907
  type OperationListener = (event: OperationEvent) => void;
1902
1908
  type DecoratedRange = Range & {
1903
1909
  rangeDecoration: RangeDecoration;
1910
+ merge: (leaf: PortableTextSpan, decoration: object) => void;
1904
1911
  };
1905
1912
  type HistoryItem = {
1906
1913
  operations: EngineOperation[];
@@ -2143,6 +2150,15 @@ type EditorEmittedEvent = {
2143
2150
  */
2144
2151
  type: 'operation';
2145
2152
  operation: Operation;
2153
+ /**
2154
+ * Where the change that produced this operation came from:
2155
+ * `'local'` for changes made in this editor (edits, undo/redo),
2156
+ * `'remote'` for changes applied from the outside (`patches`,
2157
+ * `update value`, and the initial value sync). A normalization fix
2158
+ * (a repaired key, a merged span) reports the origin of the change
2159
+ * that triggered it.
2160
+ */
2161
+ origin: 'local' | 'remote';
2146
2162
  } | PatchEvent | {
2147
2163
  type: 'read only';
2148
2164
  } | {
@@ -2588,6 +2604,7 @@ declare const editorMachine: import("xstate").StateMachine<{
2588
2604
  } | {
2589
2605
  type: 'operation';
2590
2606
  operation: Operation;
2607
+ origin: 'local' | 'remote';
2591
2608
  } | {
2592
2609
  type: 'read only';
2593
2610
  } | {
@@ -3395,4 +3412,4 @@ type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (payload: {
3395
3412
  dom: EditorDom;
3396
3413
  }, guardResponse: TGuardResponse) => Array<BehaviorAction>;
3397
3414
  export { BehaviorGuard as $, defineBlockObject as $t, PortableTextSpan$1 as A, Annotation as At, usePortableTextEditor as B, DecoratorRender as Bt, ListDefinition as C, EditorSchema as Ct, PortableTextBlock$1 as D, RegisteredInlineObject as Dt, Patch$1 as E, RegisteredContainer as Et, defineSchema as F, BlockObjectRenderProps as Ft, Editor as G, RegistrableNode as Gt, useEditorSelector as H, InlineObject as Ht, BlockOffset as I, Container as It, EditorEmittedEvent as J, SpanRenderProps as Jt, EditorConfig as K, Span as Kt, useEditor as L, ContainerRender as Lt, SchemaDefinition$1 as M, AnnotationRenderProps as Mt, StyleDefinition as N, BlockObject as Nt, PortableTextChild$1 as O, RegisteredPositional as Ot, StyleSchemaType as P, BlockObjectRender as Pt, defineBehavior as Q, defineAnnotation as Qt, defaultKeyGenerator as R, ContainerRenderProps as Rt, InlineObjectSchemaType as S, Node$1 as St, OfDefinition$1 as T, RegisteredBlockObject as Tt, EditorProvider as U, InlineObjectRender as Ut, EditorSelector as V, DecoratorRenderProps as Vt, EditorProviderProps as W, InlineObjectRenderProps as Wt, Operation as X, TextBlockRender as Xt, MutationEvent as Y, TextBlock as Yt, Behavior as Z, TextBlockRenderProps as Zt, BlockObjectSchemaType as _, PortableTextEditable as _t, forward as a, AnnotationPath as an, EditorSelectionPoint as at, FieldDefinition$1 as b, PortableTextEditor as bt, CustomBehaviorEvent as c, KeyedSegment as cn, OnPasteFn as ct, SyntheticBehaviorEvent as d, PasteData as dt, defineContainer as en, EditorContext as et, PatchesEvent as f, RangeDecoration as ft, BlockObjectDefinition as g, ScrollSelectionIntoViewFunction as gt, BaseDefinition as h, RenderPlaceholderFunction as ht, execute as i, defineTextBlock as in, EditorSelection as it, PortableTextTextBlock$1 as j, AnnotationRender as jt, PortableTextObject$1 as k, RegisteredSpan as kt, InsertPlacement as l, Path as ln, OnPasteResult as lt, AnnotationSchemaType as m, RenderEditableFunction as mt, BehaviorActionSet as n, defineInlineObject as nn, AddedAnnotationPaths as nt, raise$1 as o, BlockPath as on, InvalidValueResolution as ot, AnnotationDefinition as p, RangeDecorationOnMovedDetails as pt, EditorEvent as q, SpanRender as qt, effect as r, defineSpan as rn, EditableAPIDeleteOptions as rt, BehaviorEvent as s, ChildPath as sn, OnCopyFn as st, BehaviorAction as t, defineDecorator as tn, EditorSnapshot as tt, NativeBehaviorEvent as u, PathSegment as un, OnPasteResultOrPromise as ut, DecoratorDefinition as v, PortableTextEditableProps as vt, ListSchemaType as w, Containers as wt, InlineObjectDefinition as x, TraversalSnapshot as xt, DecoratorSchemaType as y, HotkeyOptions as yt, usePortableTextEditorSelection as z, Decorator as zt };
3398
- //# sourceMappingURL=behavior.types.action-C6D8CCF9.d.ts.map
3415
+ //# sourceMappingURL=behavior.types.action-C0XDEQnB.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"behavior.types.action-C0XDEQnB.d.ts","names":[],"sources":["../src/internal-utils/mime-type.ts","../src/type-utils.ts","../src/converters/converter.types.ts","../src/types/paths.ts","../src/renderers/renderer.types.ts","../src/schema/container-types.ts","../src/editor/editor-schema.ts","../src/engine/interfaces/node.ts","../src/traversal/traversal-snapshot.ts","../src/editor/PortableTextEditor.tsx","../src/types/options.ts","../src/editor/Editable.tsx","../src/types/editor.ts","../src/engine/types/types.ts","../src/engine/interfaces/point.ts","../src/engine/interfaces/range.ts","../src/engine/interfaces/operation.ts","../src/engine/interfaces/range-ref.ts","../src/engine/dom/utils/diff-text.ts","../src/engine/dom/utils/dom.ts","../src/engine/dom/plugin/dom-editor.ts","../src/engine/interfaces/location.ts","../src/engine/interfaces/path-ref.ts","../src/engine/interfaces/point-ref.ts","../src/engine/interfaces/editor.ts","../src/engine/core/operation-channel.ts","../src/editor/range-decorations-machine.ts","../src/types/editor-engine.ts","../src/editor/editor-snapshot.ts","../src/behaviors/behavior.types.guard.ts","../src/behaviors/behavior.types.behavior.ts","../src/types/operation.ts","../src/editor/relay.ts","../src/editor.ts","../src/editor/editor-provider.tsx","../src/editor/editor-selector.ts","../src/editor/usePortableTextEditor.ts","../src/editor/usePortableTextEditorSelection.tsx","../src/utils/key-generator.ts","../src/editor/use-editor.ts","../src/types/block-offset.ts","../src/priority/priority.types.ts","../src/behaviors/behavior.config.ts","../src/editor/editor-machine.ts","../src/internal-utils/event-position.ts","../src/types/block-with-optional-key.ts","../src/behaviors/behavior.types.event.ts","../src/editor/editor-dom.ts","../src/behaviors/behavior.types.action.ts"],"mappings":";;;;KAAY;;;;KCGA,cACV,QACA,sBAAsB,QACtB,oBAAoB,OAAO,YACzB,eAAe,OAAO,SAAS,eAAe;KAWtC,eAAe,QAAQ,6BAA6B;EAC9D,YAAY;OAGP,WAAW,SAAS,sBACd,cAAc,wBACjB,OAAO;KAIL,cAAc,GAAG,UAAU,KAAK;KCvBhC,UAAU,kBAAkB,WAAW;EACjD,UAAU;EACV,WAAW,WAAW;EACtB,aAAa,aAAa;;KASvB,eAAe,kBAAkB,WAAW;EAE3C;EACA;;EAGA;EACA,UAAU;EACV;EACA;;EAGA;EACA;EACA,UAAU;EACV;;EAGA;EACA;;EAGA;EACA,UAAU;EACV;;EAGA;EACA,MAAM,MAAM;EACZ,UAAU;;KAGJ,WAAW,kBAAkB,eACvC,UACA;EAEA,UAAU;EACV,OAAO,cAAc,eAAe;MAChC,cACJ,eAAe;KAKL,aAAa,kBAAkB,eACzC,UACA;EAEA,UAAU;EACV,OAAO,cAAc,eAAe;MAChC,cACJ,eAAe;;;;;UChEA;EACf;;;;;;KAOU;;;;;;;;;KAUA,gCAAgC,eAAe;;;;;KAM/C,OAAO;;;;;;KAOP,YAAY;;;;;;KAOZ,iBAAiB;;;;;;KAOjB,YAAY;;;;;;;;;;;;KC7BZ;EACV,YAAY;EACZ,UAAU;EACV;EACA,MAAM;EACN,MAAM;EACN;EACA;;;;;;;;;;;;;;EAcA,gBAAgB,OAAO,yBAAyB;;;;;KAKtC,mBAAmB,OAAO,yBAAyB;;;;;;;;;;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oB,UAAU,SAC9B,2BAA2B,wBACzB,cAAc,uBAAuB;KAG1C,iBAAiB,wBACpB,uBAAuB,wBAAwB,YAAY;KC5xBjD;EACV,gBAAgB,UAAU,mBAAmB,MAAM;EACnD,gBAAgB,UAAU,mBAAmB,MAAM;EACnD,wBAAwB;;;;;EAKxB,mBAAmB,UAAU,mBAAmB;;;;;;;;EAQhD,wBAAwB;IACtB;IACA;QACI;EACN,uBAAuB,UAAU,mBAAmB;EACpD,qBAAqB,UAAU,mBAAmB;;;;;EAKlD,iBACE,OACA;IAEA,OAAO,cAAc;IACrB;MACE,SAAS;MACT;MACA;;;;;;;KCrCM;EAEN;EACA,OAAO;;EAGP;EACA,OAAO,sBAAsB,yBAAyB;;EAGtD;EACA,OAAO,yBAAyB;;EAGhC;EACA,SAAS;;;;;;;;;;;;;;;;;;;;;;;IAuBP,OAAO,OAAO;;;;;;;;;;;;;;;;;;;;iBAqBN,QACd,OAAO,yBACN,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyCD,QACd,OAAO,sBAAsB,yBAAyB,sBACrD,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAqCD,QACd,OAAO,yBAAyB,sBAC/B,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CD,OACd,QAAQ,cAAc,8CACrB,cAAc;;;;KAOL,kBAAkB,gBAAgB,mBAC5C;EACE,UAAU;EACV,OAAO;EACP,KAAK;GAEP,eAAe,mBACZ,MAAM"}
@@ -1,2 +1,2 @@
1
- import { $ as BehaviorGuard, Q as defineBehavior, Z as Behavior, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../behavior.types.action-C6D8CCF9.js";
1
+ import { $ as BehaviorGuard, Q as defineBehavior, Z as Behavior, a as forward, c as CustomBehaviorEvent, d as SyntheticBehaviorEvent, i as execute, l as InsertPlacement, n as BehaviorActionSet, o as raise, r as effect, s as BehaviorEvent, t as BehaviorAction, u as NativeBehaviorEvent } from "../behavior.types.action-C0XDEQnB.js";
2
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 };
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $t as defineBlockObject, A as PortableTextSpan, At as Annotation, B as usePortableTextEditor, Bt as DecoratorRender, C as ListDefinition, Ct as EditorSchema, D as PortableTextBlock, Dt as RegisteredInlineObject, E as Patch, Et as RegisteredContainer, F as defineSchema, Ft as BlockObjectRenderProps, G as Editor, Gt as RegistrableNode, H as useEditorSelector, Ht as InlineObject, I as BlockOffset, It as Container, J as EditorEmittedEvent, Jt as SpanRenderProps, K as EditorConfig, Kt as Span, L as useEditor, Lt as ContainerRender, M as SchemaDefinition, Mt as AnnotationRenderProps, N as StyleDefinition, Nt as BlockObject, O as PortableTextChild, Ot as RegisteredPositional, P as StyleSchemaType, Pt as BlockObjectRender, Qt as defineAnnotation, R as defaultKeyGenerator, Rt as ContainerRenderProps, S as InlineObjectSchemaType, T as OfDefinition, Tt as RegisteredBlockObject, U as EditorProvider, Ut as InlineObjectRender, V as EditorSelector, Vt as DecoratorRenderProps, W as EditorProviderProps, Wt as InlineObjectRenderProps, X as Operation, Xt as TextBlockRender, Y as MutationEvent, Yt as TextBlock, Zt as TextBlockRenderProps, _ as BlockObjectSchemaType, _t as PortableTextEditable, an as AnnotationPath, at as EditorSelectionPoint, b as FieldDefinition, bt as PortableTextEditor, ct as OnPasteFn, dt as PasteData, en as defineContainer, et as EditorContext, f as PatchesEvent, ft as RangeDecoration, g as BlockObjectDefinition, gt as ScrollSelectionIntoViewFunction, h as BaseDefinition, ht as RenderPlaceholderFunction, in as defineTextBlock, it as EditorSelection, j as PortableTextTextBlock, jt as AnnotationRender, k as PortableTextObject, kt as RegisteredSpan, ln as Path, lt as OnPasteResult, m as AnnotationSchemaType, mt as RenderEditableFunction, nn as defineInlineObject, nt as AddedAnnotationPaths, on as BlockPath, ot as InvalidValueResolution, p as AnnotationDefinition, pt as RangeDecorationOnMovedDetails, q as EditorEvent, qt as SpanRender, rn as defineSpan, rt as EditableAPIDeleteOptions, sn as ChildPath, st as OnCopyFn, tn as defineDecorator, tt as EditorSnapshot, ut as OnPasteResultOrPromise, v as DecoratorDefinition, vt as PortableTextEditableProps, w as ListSchemaType, wt as Containers, x as InlineObjectDefinition, y as DecoratorSchemaType, yt as HotkeyOptions, z as usePortableTextEditorSelection, zt as Decorator } from "./behavior.types.action-C6D8CCF9.js";
1
+ import { $t as defineBlockObject, A as PortableTextSpan, At as Annotation, B as usePortableTextEditor, Bt as DecoratorRender, C as ListDefinition, Ct as EditorSchema, D as PortableTextBlock, Dt as RegisteredInlineObject, E as Patch, Et as RegisteredContainer, F as defineSchema, Ft as BlockObjectRenderProps, G as Editor, Gt as RegistrableNode, H as useEditorSelector, Ht as InlineObject, I as BlockOffset, It as Container, J as EditorEmittedEvent, Jt as SpanRenderProps, K as EditorConfig, Kt as Span, L as useEditor, Lt as ContainerRender, M as SchemaDefinition, Mt as AnnotationRenderProps, N as StyleDefinition, Nt as BlockObject, O as PortableTextChild, Ot as RegisteredPositional, P as StyleSchemaType, Pt as BlockObjectRender, Qt as defineAnnotation, R as defaultKeyGenerator, Rt as ContainerRenderProps, S as InlineObjectSchemaType, T as OfDefinition, Tt as RegisteredBlockObject, U as EditorProvider, Ut as InlineObjectRender, V as EditorSelector, Vt as DecoratorRenderProps, W as EditorProviderProps, Wt as InlineObjectRenderProps, X as Operation, Xt as TextBlockRender, Y as MutationEvent, Yt as TextBlock, Zt as TextBlockRenderProps, _ as BlockObjectSchemaType, _t as PortableTextEditable, an as AnnotationPath, at as EditorSelectionPoint, b as FieldDefinition, bt as PortableTextEditor, ct as OnPasteFn, dt as PasteData, en as defineContainer, et as EditorContext, f as PatchesEvent, ft as RangeDecoration, g as BlockObjectDefinition, gt as ScrollSelectionIntoViewFunction, h as BaseDefinition, ht as RenderPlaceholderFunction, in as defineTextBlock, it as EditorSelection, j as PortableTextTextBlock, jt as AnnotationRender, k as PortableTextObject, kt as RegisteredSpan, ln as Path, lt as OnPasteResult, m as AnnotationSchemaType, mt as RenderEditableFunction, nn as defineInlineObject, nt as AddedAnnotationPaths, on as BlockPath, ot as InvalidValueResolution, p as AnnotationDefinition, pt as RangeDecorationOnMovedDetails, q as EditorEvent, qt as SpanRender, rn as defineSpan, rt as EditableAPIDeleteOptions, sn as ChildPath, st as OnCopyFn, tn as defineDecorator, tt as EditorSnapshot, ut as OnPasteResultOrPromise, v as DecoratorDefinition, vt as PortableTextEditableProps, w as ListSchemaType, wt as Containers, x as InlineObjectDefinition, y as DecoratorSchemaType, yt as HotkeyOptions, z as usePortableTextEditorSelection, zt as Decorator } from "./behavior.types.action-C0XDEQnB.js";
2
2
  export { type AddedAnnotationPaths, type Annotation, type AnnotationDefinition, type AnnotationPath, type AnnotationRender, type AnnotationRenderProps, type AnnotationSchemaType, type BaseDefinition, type BlockObject, type BlockObjectDefinition, type BlockObjectRender, type BlockObjectRenderProps, type BlockObjectSchemaType, type BlockOffset, type BlockPath, type ChildPath, type Container, type ContainerRender, type ContainerRenderProps, type Containers, type Decorator, type DecoratorDefinition, type DecoratorRender, type DecoratorRenderProps, 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 RenderEditableFunction, type RenderPlaceholderFunction, type SchemaDefinition, type ScrollSelectionIntoViewFunction, type Span, type SpanRender, type SpanRenderProps, type StyleDefinition, type StyleSchemaType, type TextBlock, type TextBlockRender, type TextBlockRenderProps, defineAnnotation, defineBlockObject, defineContainer, defineDecorator, defineInlineObject, defineSchema, defineSpan, defineTextBlock, defaultKeyGenerator as keyGenerator, useEditor, useEditorSelector, usePortableTextEditor, usePortableTextEditorSelection };
package/lib/index.js CHANGED
@@ -746,6 +746,40 @@ function move(editor, options = {}) {
746
746
  }
747
747
  editor.setSelection(props);
748
748
  }
749
+ function subscribeToOperations(editor, listener, options) {
750
+ let phase = options?.phase ?? "after";
751
+ return editor.operationListeners[phase] = [...editor.operationListeners[phase], listener], () => {
752
+ let listeners = editor.operationListeners[phase], index = listeners.indexOf(listener);
753
+ index !== -1 && (editor.operationListeners[phase] = [...listeners.slice(0, index), ...listeners.slice(index + 1)]);
754
+ };
755
+ }
756
+ /**
757
+ * Captures the operation together with the engine state that `after`
758
+ * listeners can no longer read once the operation has been applied. All
759
+ * engine flags are stable for the duration of a single apply call, so
760
+ * capturing them at entry is equivalent to reading them at any point during
761
+ * the apply.
762
+ */
763
+ function createOperationEvent(editor, operation) {
764
+ let isNormalizingNode = !!editor.isNormalizingNode, isProcessingRemoteChanges = !!editor.isProcessingRemoteChanges, isUndoing = !!editor.isUndoing, isRedoing = !!editor.isRedoing;
765
+ return {
766
+ operation,
767
+ beforeValue: editor.snapshot.context.value,
768
+ beforeSelection: editor.snapshot.context.selection,
769
+ operationsInProgress: editor.operations.length > 0,
770
+ isNormalizingNode,
771
+ isPatching: !!editor.isPatching,
772
+ isProcessingRemoteChanges,
773
+ isUndoing,
774
+ isRedoing,
775
+ withHistory: !!editor.withHistory,
776
+ undoStepId: editor.undoStepId,
777
+ origin: isProcessingRemoteChanges ? "remote" : isUndoing ? "undo" : isRedoing ? "redo" : isNormalizingNode ? "normalization" : "local"
778
+ };
779
+ }
780
+ function emitOperationEvent(listeners, event) {
781
+ for (let index = 0; index < listeners.length; index++) listeners[index]?.(event);
782
+ }
749
783
  const bold$1 = createKeyboardShortcut({
750
784
  default: [{
751
785
  key: "B",
@@ -2789,9 +2823,12 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({ children }) => /* @__PU
2789
2823
  editor.forceRender = forceRender, editor.readOnly = readOnly;
2790
2824
  let state = useMemo(() => ({
2791
2825
  isUpdatingSelection: !1,
2792
- latestElement: null
2826
+ latestElement: null,
2827
+ localContentChangePending: !1
2793
2828
  }), []);
2794
- useEffect(() => {
2829
+ useEffect(() => subscribeToOperations(editor, (event) => {
2830
+ event.operation.type !== "set.selection" && (event.origin === "local" || event.origin === "undo" || event.origin === "redo") && (state.localContentChangePending = !0);
2831
+ }), [editor, state]), useEffect(() => {
2795
2832
  ref.current && autoFocus && ref.current.focus();
2796
2833
  }, [autoFocus]);
2797
2834
  /**
@@ -2846,6 +2883,8 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({ children }) => /* @__PU
2846
2883
  onDOMSelectionChange,
2847
2884
  scheduleOnDOMSelectionChange
2848
2885
  }), useIsomorphicLayoutEffect(() => {
2886
+ let hadPendingLocalContentChange = state.localContentChangePending;
2887
+ state.localContentChangePending = !1;
2849
2888
  let window = null;
2850
2889
  ref.current && (window = getDefaultView(ref.current)) && (editor.domWindow = window, editor.domElement = ref.current);
2851
2890
  let { selection } = editor.snapshot.context, root = DOMEditor.findDocumentOrShadowRoot(editor), domSelection = getSelection(root);
@@ -2864,7 +2903,13 @@ const RestoreDOM = IS_ANDROID ? RestoreDOMComponent : ({ children }) => /* @__PU
2864
2903
  exactMatch: !0,
2865
2904
  suppressThrow: !0
2866
2905
  });
2867
- if (editorSelection && rangeEquals(editorSelection, selection)) return;
2906
+ if (editorSelection && rangeEquals(editorSelection, selection)) {
2907
+ if (hadPendingLocalContentChange) try {
2908
+ let domRange = DOMEditor.toDOMRange(editor, selection);
2909
+ scrollSelectionIntoView(editor, domRange);
2910
+ } catch {}
2911
+ return;
2912
+ }
2868
2913
  }
2869
2914
  if (selection && !DOMEditor.hasRange(editor, selection)) {
2870
2915
  let fallbackRange = DOMEditor.toEditorSelection(editor, domSelection, {
@@ -4116,40 +4161,6 @@ function performHotkey({ editorActor, editor, portableTextEditor, hotkeys, event
4116
4161
  }
4117
4162
  });
4118
4163
  }
4119
- function subscribeToOperations(editor, listener, options) {
4120
- let phase = options?.phase ?? "after";
4121
- return editor.operationListeners[phase] = [...editor.operationListeners[phase], listener], () => {
4122
- let listeners = editor.operationListeners[phase], index = listeners.indexOf(listener);
4123
- index !== -1 && (editor.operationListeners[phase] = [...listeners.slice(0, index), ...listeners.slice(index + 1)]);
4124
- };
4125
- }
4126
- /**
4127
- * Captures the operation together with the engine state that `after`
4128
- * listeners can no longer read once the operation has been applied. All
4129
- * engine flags are stable for the duration of a single apply call, so
4130
- * capturing them at entry is equivalent to reading them at any point during
4131
- * the apply.
4132
- */
4133
- function createOperationEvent(editor, operation) {
4134
- let isNormalizingNode = !!editor.isNormalizingNode, isProcessingRemoteChanges = !!editor.isProcessingRemoteChanges, isUndoing = !!editor.isUndoing, isRedoing = !!editor.isRedoing;
4135
- return {
4136
- operation,
4137
- beforeValue: editor.snapshot.context.value,
4138
- beforeSelection: editor.snapshot.context.selection,
4139
- operationsInProgress: editor.operations.length > 0,
4140
- isNormalizingNode,
4141
- isPatching: !!editor.isPatching,
4142
- isProcessingRemoteChanges,
4143
- isUndoing,
4144
- isRedoing,
4145
- withHistory: !!editor.withHistory,
4146
- undoStepId: editor.undoStepId,
4147
- origin: isProcessingRemoteChanges ? "remote" : isUndoing ? "undo" : isRedoing ? "redo" : isNormalizingNode ? "normalization" : "local"
4148
- };
4149
- }
4150
- function emitOperationEvent(listeners, event) {
4151
- for (let index = 0; index < listeners.length; index++) listeners[index]?.(event);
4152
- }
4153
4164
  function isForwardRange(range, root) {
4154
4165
  return !isBackwardRange(range, root);
4155
4166
  }
@@ -4192,7 +4203,12 @@ const engineOperationCallback = ({ input, sendBack }) => subscribeToOperations(i
4192
4203
  operation: event.operation,
4193
4204
  origin: event.origin
4194
4205
  });
4195
- }, { phase: "before" }), rangeDecorationsMachine = setup({
4206
+ }, { phase: "before" });
4207
+ function mergeRangeDecoration(leaf, decoration) {
4208
+ let { rangeDecoration } = decoration;
4209
+ leaf.rangeDecorations = [...leaf.rangeDecorations ?? [], rangeDecoration];
4210
+ }
4211
+ const rangeDecorationsMachine = setup({
4196
4212
  types: {
4197
4213
  context: {},
4198
4214
  input: {},
@@ -4213,6 +4229,7 @@ const engineOperationCallback = ({ input, sendBack }) => subscribeToOperations(i
4213
4229
  }
4214
4230
  rangeDecorationState.push({
4215
4231
  rangeDecoration,
4232
+ merge: mergeRangeDecoration,
4216
4233
  ...rangeDecoration.selection
4217
4234
  });
4218
4235
  }
@@ -4232,6 +4249,7 @@ const engineOperationCallback = ({ input, sendBack }) => subscribeToOperations(i
4232
4249
  }
4233
4250
  rangeDecorationState.push({
4234
4251
  rangeDecoration,
4252
+ merge: mergeRangeDecoration,
4235
4253
  ...rangeDecoration.selection
4236
4254
  });
4237
4255
  }
@@ -4260,7 +4278,8 @@ const engineOperationCallback = ({ input, sendBack }) => subscribeToOperations(i
4260
4278
  rangeDecoration: {
4261
4279
  ...decoratedRange.rangeDecoration,
4262
4280
  selection: newRange || currentSelection
4263
- }
4281
+ },
4282
+ merge: mergeRangeDecoration
4264
4283
  });
4265
4284
  }
4266
4285
  context.editorEngine.decoratedRanges = rangeDecorationState;
@@ -5168,29 +5187,33 @@ const PLACEHOLDER_STYLE = {
5168
5187
  right: 0
5169
5188
  };
5170
5189
  function RenderLeaf(props) {
5171
- let $ = c(12), schema = props.schema;
5190
+ let $ = c(16), schema = props.schema;
5172
5191
  if (props.leaf._type !== schema.span.name) return props.children;
5173
5192
  let t0;
5174
5193
  $[0] === props ? t0 = $[1] : (t0 = /* @__PURE__ */ jsx(RenderSpan, { ...props }), $[0] = props, $[1] = t0);
5175
- let renderedSpan = t0;
5176
- if (props.renderPlaceholder && props.leaf.placeholder && props.text.text === "") {
5177
- let t1;
5178
- $[2] === props.renderPlaceholder ? t1 = $[3] : (t1 = props.renderPlaceholder(), $[2] = props.renderPlaceholder, $[3] = t1);
5179
- let t2;
5180
- $[4] === t1 ? t2 = $[5] : (t2 = /* @__PURE__ */ jsx("span", {
5181
- style: PLACEHOLDER_STYLE,
5182
- contentEditable: !1,
5183
- children: t1
5184
- }), $[4] = t1, $[5] = t2);
5185
- let t3;
5186
- return $[6] !== renderedSpan || $[7] !== t2 ? (t3 = /* @__PURE__ */ jsxs(Fragment, { children: [t2, renderedSpan] }), $[6] = renderedSpan, $[7] = t2, $[8] = t3) : t3 = $[8], t3;
5187
- }
5188
- let rangeDecoration = props.leaf.rangeDecoration;
5189
- if (rangeDecoration) {
5190
- let t1;
5191
- $[9] !== rangeDecoration || $[10] !== renderedSpan ? (t1 = rangeDecoration.component({ children: renderedSpan }), $[9] = rangeDecoration, $[10] = renderedSpan, $[11] = t1) : t1 = $[11], renderedSpan = t1;
5192
- }
5193
- return renderedSpan;
5194
+ let renderedSpan, t1;
5195
+ if ($[2] !== props.leaf.placeholder || $[3] !== props.leaf.rangeDecorations || $[4] !== props.renderPlaceholder || $[5] !== props.text || $[6] !== t0) {
5196
+ t1 = Symbol.for("react.early_return_sentinel");
5197
+ bb0: {
5198
+ if (renderedSpan = t0, props.renderPlaceholder && props.leaf.placeholder && props.text.text === "") {
5199
+ let t2;
5200
+ $[9] === props.renderPlaceholder ? t2 = $[10] : (t2 = props.renderPlaceholder(), $[9] = props.renderPlaceholder, $[10] = t2);
5201
+ let t3;
5202
+ $[11] === t2 ? t3 = $[12] : (t3 = /* @__PURE__ */ jsx("span", {
5203
+ style: PLACEHOLDER_STYLE,
5204
+ contentEditable: !1,
5205
+ children: t2
5206
+ }), $[11] = t2, $[12] = t3);
5207
+ let t4;
5208
+ $[13] !== renderedSpan || $[14] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Fragment, { children: [t3, renderedSpan] }), $[13] = renderedSpan, $[14] = t3, $[15] = t4) : t4 = $[15], t1 = t4;
5209
+ break bb0;
5210
+ }
5211
+ let rangeDecorations = props.leaf.rangeDecorations;
5212
+ if (rangeDecorations) for (let rangeDecoration of [...rangeDecorations].reverse()) renderedSpan = rangeDecoration.component({ children: renderedSpan });
5213
+ }
5214
+ $[2] = props.leaf.placeholder, $[3] = props.leaf.rangeDecorations, $[4] = props.renderPlaceholder, $[5] = props.text, $[6] = t0, $[7] = renderedSpan, $[8] = t1;
5215
+ } else renderedSpan = $[7], t1 = $[8];
5216
+ return t1 === Symbol.for("react.early_return_sentinel") ? renderedSpan : t1;
5194
5217
  }
5195
5218
  function RenderText(props) {
5196
5219
  let $ = c(3), t0;
@@ -7543,8 +7566,7 @@ function applyMergeNode(editor, path, position) {
7543
7566
  if (!prevEntry || !isTextBlock({ schema: editor.snapshot.context.schema }, prevEntry.node)) return;
7544
7567
  let prevChildren = prevEntry.node.children, lastInsertedKey = prevChildren.length > 0 ? prevChildren[prevChildren.length - 1]._key : void 0;
7545
7568
  for (let i = 0; i < node.children.length; i++) {
7546
- let child = node.children[i];
7547
- lastInsertedKey === void 0 ? editor.apply({
7569
+ let child = node.children[i], operation = lastInsertedKey === void 0 ? {
7548
7570
  type: "insert",
7549
7571
  path: [
7550
7572
  ...prevPath,
@@ -7553,7 +7575,7 @@ function applyMergeNode(editor, path, position) {
7553
7575
  ],
7554
7576
  node: child,
7555
7577
  position: "before"
7556
- }) : editor.apply({
7578
+ } : {
7557
7579
  type: "insert",
7558
7580
  path: [
7559
7581
  ...prevPath,
@@ -7562,7 +7584,8 @@ function applyMergeNode(editor, path, position) {
7562
7584
  ],
7563
7585
  node: child,
7564
7586
  position: "after"
7565
- }), lastInsertedKey = child._key;
7587
+ };
7588
+ editor.apply(operation), lastInsertedKey = operation.node._key;
7566
7589
  }
7567
7590
  editor.apply({
7568
7591
  type: "unset",
@@ -11610,6 +11633,63 @@ function fieldAcceptsTextBlock(editor, node, _path) {
11610
11633
  return container ? container.field.of.some((member) => member.type === editor.snapshot.context.schema.block.name) : !1;
11611
11634
  }
11612
11635
  /**
11636
+ * A block merge folds `mergingBlock`'s children (and markDefs) into
11637
+ * `destinationBlock` by key. Any child key the merging block shares with
11638
+ * the destination has to be renamed before the merge, or the engine's own
11639
+ * collision handling mints a fresh key for it, which reads on the wire as
11640
+ * that node being destroyed and a new one created instead of moved. There
11641
+ * is no such backstop for markDefs: an unrenamed collision either loses
11642
+ * one of the two defs to last-wins replacement, or, on the `insert.block`
11643
+ * path, gets silently re-minted by `adjustFragmentKeys` (see
11644
+ * `dedupeEqualMarkDefs` below).
11645
+ *
11646
+ * Pure: computes the renames and the block they produce without touching
11647
+ * an editor. Callers raise or apply the renames themselves, ahead of the
11648
+ * merge, against the still-living `mergingBlock`.
11649
+ */
11650
+ function planMergeKeyRenames(args) {
11651
+ let { context, mergingBlock, destinationBlock, dedupeEqualMarkDefs } = args, destinationChildKeys = new Set(destinationBlock.children.map((child) => child._key)), destinationMarkDefsByKey = new Map((destinationBlock.markDefs ?? []).map((markDef) => [markDef._key, markDef])), markDefKeyMap = /* @__PURE__ */ new Map(), renamedMarkDefs = mergingBlock.markDefs?.flatMap((markDef) => {
11652
+ let destinationMarkDef = destinationMarkDefsByKey.get(markDef._key);
11653
+ if (!destinationMarkDef) return [markDef];
11654
+ if (dedupeEqualMarkDefs && isDeepEqual(markDef, destinationMarkDef)) return [];
11655
+ let newKey = context.keyGenerator();
11656
+ return markDefKeyMap.set(markDef._key, newKey), [{
11657
+ ...markDef,
11658
+ _key: newKey
11659
+ }];
11660
+ }), markDefRenames = [];
11661
+ for (let markDef of mergingBlock.markDefs ?? []) {
11662
+ let newKey = markDefKeyMap.get(markDef._key);
11663
+ newKey && markDefRenames.push({
11664
+ markDefKey: markDef._key,
11665
+ newKey
11666
+ });
11667
+ }
11668
+ let childRenames = [], renamedChildren = mergingBlock.children.map((child) => {
11669
+ let currentMarks = isSpan(context, child) ? child.marks : void 0, remappedMarks = currentMarks?.map((mark) => markDefKeyMap.get(mark) ?? mark), marksChanged = !!(remappedMarks && !isEqualMarks(remappedMarks, currentMarks)), newKey = destinationChildKeys.has(child._key) ? context.keyGenerator() : child._key, props = {};
11670
+ return newKey !== child._key && (props._key = newKey), marksChanged && (props.marks = remappedMarks), Object.keys(props).length > 0 && childRenames.push({
11671
+ childKey: child._key,
11672
+ props
11673
+ }), marksChanged ? {
11674
+ ...child,
11675
+ _key: newKey,
11676
+ marks: remappedMarks
11677
+ } : {
11678
+ ...child,
11679
+ _key: newKey
11680
+ };
11681
+ });
11682
+ return {
11683
+ renamedBlock: {
11684
+ ...mergingBlock,
11685
+ children: renamedChildren,
11686
+ ...mergingBlock.markDefs ? { markDefs: renamedMarkDefs } : {}
11687
+ },
11688
+ childRenames,
11689
+ markDefRenames
11690
+ };
11691
+ }
11692
+ /**
11613
11693
  * Indic scripts whose grapheme clusters span multiple code points. Backward
11614
11694
  * character delete on these scripts removes one code point at a time instead
11615
11695
  * of the entire cluster. Besides the script ranges, the class lists the BMP
@@ -11942,12 +12022,29 @@ function mergeBlock(editor, startBlockPath, endBlockPath, removeEmptyStartBlock)
11942
12022
  removeNodeAt(editor, startBlockPath);
11943
12023
  return;
11944
12024
  }
11945
- let endMarkDefs = endBlock.node.markDefs;
11946
- if (Array.isArray(endMarkDefs) && endMarkDefs.length > 0) {
11947
- let oldDefs = startBlock.node.markDefs ?? [];
11948
- setNodeProperties(editor, { markDefs: [...new Map([...oldDefs, ...endMarkDefs].map((def) => [def._key, def])).values()] }, startBlockPath);
11949
- }
11950
- applyMergeNode(editor, endBlockPath, startBlock.node.children.length);
12025
+ let { renamedBlock, childRenames, markDefRenames } = planMergeKeyRenames({
12026
+ context: editor.snapshot.context,
12027
+ mergingBlock: endBlock.node,
12028
+ destinationBlock: startBlock.node,
12029
+ dedupeEqualMarkDefs: !0
12030
+ });
12031
+ for (let { markDefKey, newKey } of markDefRenames) editor.apply({
12032
+ type: "set",
12033
+ path: [
12034
+ ...endBlockPath,
12035
+ "markDefs",
12036
+ { _key: markDefKey },
12037
+ "_key"
12038
+ ],
12039
+ value: newKey
12040
+ });
12041
+ for (let { childKey, props } of childRenames) setNodeProperties(editor, props, [
12042
+ ...endBlockPath,
12043
+ "children",
12044
+ { _key: childKey }
12045
+ ]);
12046
+ let endMarkDefs = renamedBlock.markDefs;
12047
+ Array.isArray(endMarkDefs) && endMarkDefs.length > 0 && setNodeProperties(editor, { markDefs: [...startBlock.node.markDefs ?? [], ...endMarkDefs] }, startBlockPath), applyMergeNode(editor, endBlockPath, startBlock.node.children.length);
11951
12048
  }
11952
12049
  function removeNodeAt(editor, path) {
11953
12050
  getNode(editor.snapshot, path) && editor.apply({
@@ -13138,7 +13235,7 @@ const abstractAnnotationBehaviors = [
13138
13235
  }, previousBlockEndPoint = getBlockEndPoint({
13139
13236
  context: snapshot.context,
13140
13237
  block: previousBlock
13141
- }), { renamedBlock, renameActions } = planMergeKeyRenames({
13238
+ }), { renamedBlock, renameActions } = planMergeKeyRenameActions({
13142
13239
  context: snapshot.context,
13143
13240
  mergingBlockPath: focusTextBlock.path,
13144
13241
  mergingBlock: focusTextBlock.node,
@@ -13236,7 +13333,7 @@ const abstractAnnotationBehaviors = [
13236
13333
  if (!focusTextBlock) return !1;
13237
13334
  let nextSibling = getSibling(adjustedSnapshot, focusTextBlock.path, { direction: "next" });
13238
13335
  if (!nextSibling || !isAtTheEndOfBlock(focusTextBlock)(adjustedSnapshot) || !isTextBlock(snapshot.context, nextSibling.node)) return !1;
13239
- let { renamedBlock, renameActions } = planMergeKeyRenames({
13336
+ let { renamedBlock, renameActions } = planMergeKeyRenameActions({
13240
13337
  context: snapshot.context,
13241
13338
  mergingBlockPath: nextSibling.path,
13242
13339
  mergingBlock: nextSibling.node,
@@ -13332,65 +13429,38 @@ const abstractAnnotationBehaviors = [
13332
13429
  })
13333
13430
  ];
13334
13431
  /**
13335
- * A block merge folds `mergingBlock`'s children (and markDefs) into
13336
- * `destinationBlock` by key. Any key the merging block shares with the
13337
- * destination has to be renamed before the merge, or `insert.block`'s own
13338
- * collision handling mints a fresh key for it, which reads on the wire as
13339
- * that node being destroyed and a new one created instead of moved.
13340
- *
13341
- * Renames are raised as `set`/`child.set` events against the still-living
13342
- * `mergingBlock`, so they land on the wire before the merge's `unset`.
13343
- * `renamedBlock` mirrors the same renames applied to the value the caller
13344
- * already captured, since raising the rename events now doesn't change
13345
- * that captured value.
13432
+ * Raise the child/markDef renames `planMergeKeyRenames` computed as
13433
+ * `set`/`child.set` events against the still-living `mergingBlock`, so
13434
+ * they land on the wire before the merge's `unset`.
13346
13435
  */
13347
- function planMergeKeyRenames(args) {
13348
- let { context, mergingBlockPath, mergingBlock, destinationBlock } = args, destinationChildKeys = new Set(destinationBlock.children.map((child) => child._key)), destinationMarkDefKeys = new Set((destinationBlock.markDefs ?? []).map((markDef) => markDef._key)), markDefKeyMap = /* @__PURE__ */ new Map(), renamedMarkDefs = mergingBlock.markDefs?.map((markDef) => {
13349
- if (!destinationMarkDefKeys.has(markDef._key)) return markDef;
13350
- let newKey = context.keyGenerator();
13351
- return markDefKeyMap.set(markDef._key, newKey), {
13352
- ...markDef,
13353
- _key: newKey
13354
- };
13436
+ function planMergeKeyRenameActions(args) {
13437
+ let { context, mergingBlockPath, mergingBlock, destinationBlock } = args, { renamedBlock, childRenames, markDefRenames } = planMergeKeyRenames({
13438
+ context,
13439
+ mergingBlock,
13440
+ destinationBlock,
13441
+ dedupeEqualMarkDefs: !1
13355
13442
  }), renameActions = [];
13356
- for (let markDef of mergingBlock.markDefs ?? []) {
13357
- let newKey = markDefKeyMap.get(markDef._key);
13358
- newKey && renameActions.push(raise$1({
13359
- type: "set",
13360
- at: [
13361
- ...mergingBlockPath,
13362
- "markDefs",
13363
- { _key: markDef._key },
13364
- "_key"
13365
- ],
13366
- value: newKey
13367
- }));
13368
- }
13369
- let renamedChildren = mergingBlock.children.map((child) => {
13370
- let currentMarks = isSpan(context, child) ? child.marks : void 0, remappedMarks = currentMarks?.map((mark) => markDefKeyMap.get(mark) ?? mark), marksChanged = !!(remappedMarks && !isEqualMarks(remappedMarks, currentMarks)), newKey = destinationChildKeys.has(child._key) ? context.keyGenerator() : child._key, props = {};
13371
- return newKey !== child._key && (props._key = newKey), marksChanged && (props.marks = remappedMarks), Object.keys(props).length > 0 && renameActions.push(raise$1({
13372
- type: "child.set",
13373
- at: [
13374
- ...mergingBlockPath,
13375
- "children",
13376
- { _key: child._key }
13377
- ],
13378
- props
13379
- })), marksChanged ? {
13380
- ...child,
13381
- _key: newKey,
13382
- marks: remappedMarks
13383
- } : {
13384
- ...child,
13385
- _key: newKey
13386
- };
13387
- });
13443
+ for (let { markDefKey, newKey } of markDefRenames) renameActions.push(raise$1({
13444
+ type: "set",
13445
+ at: [
13446
+ ...mergingBlockPath,
13447
+ "markDefs",
13448
+ { _key: markDefKey },
13449
+ "_key"
13450
+ ],
13451
+ value: newKey
13452
+ }));
13453
+ for (let { childKey, props } of childRenames) renameActions.push(raise$1({
13454
+ type: "child.set",
13455
+ at: [
13456
+ ...mergingBlockPath,
13457
+ "children",
13458
+ { _key: childKey }
13459
+ ],
13460
+ props
13461
+ }));
13388
13462
  return {
13389
- renamedBlock: {
13390
- ...mergingBlock,
13391
- children: renamedChildren,
13392
- ...mergingBlock.markDefs ? { markDefs: renamedMarkDefs } : {}
13393
- },
13463
+ renamedBlock,
13394
13464
  renameActions
13395
13465
  };
13396
13466
  }
@@ -16542,7 +16612,8 @@ function createActors(config) {
16542
16612
  return config.subscriptions.push(mutationBatcher.subscribe), config.subscriptions.push(() => subscribeToOperations(config.editorEngine, (event) => {
16543
16613
  isPublicOperation(event.operation) && config.relay.send({
16544
16614
  type: "operation",
16545
- operation: event.operation
16615
+ operation: event.operation,
16616
+ origin: event.origin === "remote" ? "remote" : "local"
16546
16617
  });
16547
16618
  })), config.subscriptions.push(() => {
16548
16619
  let subscription = syncActor.on("*", (event) => {