@portabletext/editor 2.14.0 → 2.14.2

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.
package/lib/index.js CHANGED
@@ -2919,6 +2919,14 @@ function getNextSpan({
2919
2919
  }
2920
2920
  return nextSpan;
2921
2921
  }
2922
+ const IS_NORMALIZING_NODE = /* @__PURE__ */ new WeakMap();
2923
+ function withNormalizeNode(editor, fn) {
2924
+ const prev = IS_NORMALIZING_NODE.get(editor);
2925
+ IS_NORMALIZING_NODE.set(editor, !0), fn(), IS_NORMALIZING_NODE.set(editor, prev);
2926
+ }
2927
+ function isNormalizingNode(editor) {
2928
+ return IS_NORMALIZING_NODE.get(editor) ?? !1;
2929
+ }
2922
2930
  function withRemoteChanges(editor, fn) {
2923
2931
  const prev = isChangingRemotely(editor) || !1;
2924
2932
  IS_PROCESSING_REMOTE_CHANGES.set(editor, !0), fn(), IS_PROCESSING_REMOTE_CHANGES.set(editor, prev);
@@ -2961,53 +2969,45 @@ function createWithPortableTextMarkModel(editorActor) {
2961
2969
  for (const [child, childPath] of children) {
2962
2970
  const nextNode = node.children[childPath[1] + 1];
2963
2971
  if (editor.isTextSpan(child) && editor.isTextSpan(nextNode) && child.marks?.every((mark) => nextNode.marks?.includes(mark)) && nextNode.marks?.every((mark) => child.marks?.includes(mark))) {
2964
- debug$c("Merging spans", JSON.stringify(child, null, 2), JSON.stringify(nextNode, null, 2)), editorActor.send({
2965
- type: "normalizing"
2966
- }), Transforms.mergeNodes(editor, {
2967
- at: [childPath[0], childPath[1] + 1],
2968
- voids: !0
2969
- }), editorActor.send({
2970
- type: "done normalizing"
2972
+ debug$c("Merging spans", JSON.stringify(child, null, 2), JSON.stringify(nextNode, null, 2)), withNormalizeNode(editor, () => {
2973
+ Transforms.mergeNodes(editor, {
2974
+ at: [childPath[0], childPath[1] + 1],
2975
+ voids: !0
2976
+ });
2971
2977
  });
2972
2978
  return;
2973
2979
  }
2974
2980
  }
2975
2981
  }
2976
2982
  if (editor.isTextBlock(node) && !Array.isArray(node.markDefs)) {
2977
- debug$c("Adding .markDefs to block node"), editorActor.send({
2978
- type: "normalizing"
2979
- }), Transforms.setNodes(editor, {
2980
- markDefs: []
2981
- }, {
2982
- at: path
2983
- }), editorActor.send({
2984
- type: "done normalizing"
2983
+ debug$c("Adding .markDefs to block node"), withNormalizeNode(editor, () => {
2984
+ Transforms.setNodes(editor, {
2985
+ markDefs: []
2986
+ }, {
2987
+ at: path
2988
+ });
2985
2989
  });
2986
2990
  return;
2987
2991
  }
2988
2992
  if (editor.isTextSpan(node) && !Array.isArray(node.marks)) {
2989
- debug$c("Adding .marks to span node"), editorActor.send({
2990
- type: "normalizing"
2991
- }), Transforms.setNodes(editor, {
2992
- marks: []
2993
- }, {
2994
- at: path
2995
- }), editorActor.send({
2996
- type: "done normalizing"
2993
+ debug$c("Adding .marks to span node"), withNormalizeNode(editor, () => {
2994
+ Transforms.setNodes(editor, {
2995
+ marks: []
2996
+ }, {
2997
+ at: path
2998
+ });
2997
2999
  });
2998
3000
  return;
2999
3001
  }
3000
3002
  if (editor.isTextSpan(node)) {
3001
3003
  const blockPath = Path.parent(path), [block] = Editor.node(editor, blockPath), decorators2 = editorActor.getSnapshot().context.schema.decorators.map((decorator) => decorator.name), annotations = node.marks?.filter((mark) => !decorators2.includes(mark));
3002
3004
  if (editor.isTextBlock(block) && node.text === "" && annotations && annotations.length > 0) {
3003
- debug$c("Removing annotations from empty span node"), editorActor.send({
3004
- type: "normalizing"
3005
- }), Transforms.setNodes(editor, {
3006
- marks: node.marks?.filter((mark) => decorators2.includes(mark))
3007
- }, {
3008
- at: path
3009
- }), editorActor.send({
3010
- type: "done normalizing"
3005
+ debug$c("Removing annotations from empty span node"), withNormalizeNode(editor, () => {
3006
+ Transforms.setNodes(editor, {
3007
+ marks: node.marks?.filter((mark) => decorators2.includes(mark))
3008
+ }, {
3009
+ at: path
3010
+ });
3011
3011
  });
3012
3012
  return;
3013
3013
  }
@@ -3018,14 +3018,12 @@ function createWithPortableTextMarkModel(editorActor) {
3018
3018
  if (editor.isTextSpan(child)) {
3019
3019
  const marks = child.marks ?? [], orphanedAnnotations = marks.filter((mark) => !decorators2.includes(mark) && !node.markDefs?.find((def) => def._key === mark));
3020
3020
  if (orphanedAnnotations.length > 0) {
3021
- debug$c("Removing orphaned annotations from span node"), editorActor.send({
3022
- type: "normalizing"
3023
- }), Transforms.setNodes(editor, {
3024
- marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
3025
- }, {
3026
- at: childPath
3027
- }), editorActor.send({
3028
- type: "done normalizing"
3021
+ debug$c("Removing orphaned annotations from span node"), withNormalizeNode(editor, () => {
3022
+ Transforms.setNodes(editor, {
3023
+ marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
3024
+ }, {
3025
+ at: childPath
3026
+ });
3029
3027
  });
3030
3028
  return;
3031
3029
  }
@@ -3036,14 +3034,12 @@ function createWithPortableTextMarkModel(editorActor) {
3036
3034
  if (editor.isTextBlock(block)) {
3037
3035
  const decorators2 = editorActor.getSnapshot().context.schema.decorators.map((decorator) => decorator.name), marks = node.marks ?? [], orphanedAnnotations = marks.filter((mark) => !decorators2.includes(mark) && !block.markDefs?.find((def) => def._key === mark));
3038
3036
  if (orphanedAnnotations.length > 0) {
3039
- debug$c("Removing orphaned annotations from span node"), editorActor.send({
3040
- type: "normalizing"
3041
- }), Transforms.setNodes(editor, {
3042
- marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
3043
- }, {
3044
- at: path
3045
- }), editorActor.send({
3046
- type: "done normalizing"
3037
+ debug$c("Removing orphaned annotations from span node"), withNormalizeNode(editor, () => {
3038
+ Transforms.setNodes(editor, {
3039
+ marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
3040
+ }, {
3041
+ at: path
3042
+ });
3047
3043
  });
3048
3044
  return;
3049
3045
  }
@@ -3054,14 +3050,12 @@ function createWithPortableTextMarkModel(editorActor) {
3054
3050
  for (const markDef of markDefs)
3055
3051
  markDefKeys.has(markDef._key) || (markDefKeys.add(markDef._key), newMarkDefs.push(markDef));
3056
3052
  if (markDefs.length !== newMarkDefs.length) {
3057
- debug$c("Removing duplicate markDefs"), editorActor.send({
3058
- type: "normalizing"
3059
- }), Transforms.setNodes(editor, {
3060
- markDefs: newMarkDefs
3061
- }, {
3062
- at: path
3063
- }), editorActor.send({
3064
- type: "done normalizing"
3053
+ debug$c("Removing duplicate markDefs"), withNormalizeNode(editor, () => {
3054
+ Transforms.setNodes(editor, {
3055
+ markDefs: newMarkDefs
3056
+ }, {
3057
+ at: path
3058
+ });
3065
3059
  });
3066
3060
  return;
3067
3061
  }
@@ -3069,19 +3063,19 @@ function createWithPortableTextMarkModel(editorActor) {
3069
3063
  if (editor.isTextBlock(node) && !editor.operations.some((op) => op.type === "merge_node" && "markDefs" in op.properties && op.path.length === 1)) {
3070
3064
  const newMarkDefs = (node.markDefs || []).filter((def) => node.children.find((child) => Text.isText(child) && Array.isArray(child.marks) && child.marks.includes(def._key)));
3071
3065
  if (node.markDefs && !isEqual(newMarkDefs, node.markDefs)) {
3072
- debug$c("Removing markDef not in use"), editorActor.send({
3073
- type: "normalizing"
3074
- }), Transforms.setNodes(editor, {
3075
- markDefs: newMarkDefs
3076
- }, {
3077
- at: path
3078
- }), editorActor.send({
3079
- type: "done normalizing"
3066
+ debug$c("Removing markDef not in use"), withNormalizeNode(editor, () => {
3067
+ Transforms.setNodes(editor, {
3068
+ markDefs: newMarkDefs
3069
+ }, {
3070
+ at: path
3071
+ });
3080
3072
  });
3081
3073
  return;
3082
3074
  }
3083
3075
  }
3084
- normalizeNode(nodeEntry);
3076
+ withNormalizeNode(editor, () => {
3077
+ normalizeNode(nodeEntry);
3078
+ });
3085
3079
  }, editor.apply = (op) => {
3086
3080
  if (isChangingRemotely(editor)) {
3087
3081
  apply2(op);
@@ -3937,7 +3931,7 @@ function createWithUndoRedo(options) {
3937
3931
  } = editor, {
3938
3932
  undos
3939
3933
  } = history, step = undos[undos.length - 1], lastOp = step && step.operations && step.operations[step.operations.length - 1], overwrite = shouldOverwrite(op, lastOp), save = isSaving(editor), currentUndoStepId = getCurrentUndoStepId(editor);
3940
- let merge = currentUndoStepId === previousUndoStepId;
3934
+ let merge = currentUndoStepId === previousUndoStepId || isNormalizingNode(editor);
3941
3935
  if (save) {
3942
3936
  if (step ? operations.length === 0 && (merge = currentUndoStepId === void 0 && previousUndoStepId === void 0 ? shouldMerge(op, lastOp) || overwrite : merge) : merge = !1, step && merge)
3943
3937
  step.operations.push(op);
@@ -5551,32 +5545,30 @@ function createWithObjectKeys(editorActor) {
5551
5545
  const [node, path] = entry;
5552
5546
  if (Element$1.isElement(node) && node._type === editorActor.getSnapshot().context.schema.block.name) {
5553
5547
  if (!node._key) {
5554
- editorActor.send({
5555
- type: "normalizing"
5556
- }), Transforms.setNodes(editor, {
5557
- _key: editorActor.getSnapshot().context.keyGenerator()
5558
- }, {
5559
- at: path
5560
- }), editorActor.send({
5561
- type: "done normalizing"
5548
+ withNormalizeNode(editor, () => {
5549
+ Transforms.setNodes(editor, {
5550
+ _key: editorActor.getSnapshot().context.keyGenerator()
5551
+ }, {
5552
+ at: path
5553
+ });
5562
5554
  });
5563
5555
  return;
5564
5556
  }
5565
5557
  for (const [child, childPath] of Node.children(editor, path))
5566
5558
  if (!child._key) {
5567
- editorActor.send({
5568
- type: "normalizing"
5569
- }), Transforms.setNodes(editor, {
5570
- _key: editorActor.getSnapshot().context.keyGenerator()
5571
- }, {
5572
- at: childPath
5573
- }), editorActor.send({
5574
- type: "done normalizing"
5559
+ withNormalizeNode(editor, () => {
5560
+ Transforms.setNodes(editor, {
5561
+ _key: editorActor.getSnapshot().context.keyGenerator()
5562
+ }, {
5563
+ at: childPath
5564
+ });
5575
5565
  });
5576
5566
  return;
5577
5567
  }
5578
5568
  }
5579
- normalizeNode(entry);
5569
+ withNormalizeNode(editor, () => {
5570
+ normalizeNode(entry);
5571
+ });
5580
5572
  }, editor;
5581
5573
  };
5582
5574
  }
@@ -6296,34 +6288,32 @@ function createWithSchemaTypes({
6296
6288
  if (node._type === void 0 && path.length === 2) {
6297
6289
  debug$8("Setting span type on text node without a type");
6298
6290
  const span = node, key = span._key || editorActor.getSnapshot().context.keyGenerator();
6299
- editorActor.send({
6300
- type: "normalizing"
6301
- }), Transforms.setNodes(editor, {
6302
- ...span,
6303
- _type: editorActor.getSnapshot().context.schema.span.name,
6304
- _key: key
6305
- }, {
6306
- at: path
6307
- }), editorActor.send({
6308
- type: "done normalizing"
6291
+ withNormalizeNode(editor, () => {
6292
+ Transforms.setNodes(editor, {
6293
+ ...span,
6294
+ _type: editorActor.getSnapshot().context.schema.span.name,
6295
+ _key: key
6296
+ }, {
6297
+ at: path
6298
+ });
6309
6299
  });
6310
6300
  return;
6311
6301
  }
6312
6302
  if (node._key === void 0 && (path.length === 1 || path.length === 2)) {
6313
6303
  debug$8("Setting missing key on child node without a key");
6314
6304
  const key = editorActor.getSnapshot().context.keyGenerator();
6315
- editorActor.send({
6316
- type: "normalizing"
6317
- }), Transforms.setNodes(editor, {
6318
- _key: key
6319
- }, {
6320
- at: path
6321
- }), editorActor.send({
6322
- type: "done normalizing"
6305
+ withNormalizeNode(editor, () => {
6306
+ Transforms.setNodes(editor, {
6307
+ _key: key
6308
+ }, {
6309
+ at: path
6310
+ });
6323
6311
  });
6324
6312
  return;
6325
6313
  }
6326
- normalizeNode(entry);
6314
+ withNormalizeNode(editor, () => {
6315
+ normalizeNode(entry);
6316
+ });
6327
6317
  }, editor;
6328
6318
  };
6329
6319
  }
@@ -8918,6 +8908,24 @@ const abstractAnnotationBehaviors = [defineBehavior({
8918
8908
  marks: [...event.decorators ?? [], ...markDefs.map((markDef) => markDef._key)]
8919
8909
  }
8920
8910
  })]]
8911
+ }), defineBehavior({
8912
+ on: "insert.text",
8913
+ guard: ({
8914
+ snapshot
8915
+ }) => {
8916
+ const selection = snapshot.context.selection;
8917
+ return !selection || isSelectionCollapsed(selection) ? !1 : {
8918
+ selection
8919
+ };
8920
+ },
8921
+ actions: [({
8922
+ event
8923
+ }, {
8924
+ selection
8925
+ }) => [raise({
8926
+ type: "delete",
8927
+ at: selection
8928
+ }), raise(event)]]
8921
8929
  })], shiftLeft = createKeyboardShortcut({
8922
8930
  default: [{
8923
8931
  key: "ArrowLeft",
@@ -9959,6 +9967,12 @@ const editorMachine = setup({
9959
9967
  event
9960
9968
  }) => (assertEvent(event, "remove behavior"), context.behaviors.delete(event.behaviorConfig), /* @__PURE__ */ new Set([...context.behaviors]))
9961
9969
  }),
9970
+ "add slate editor to context": assign({
9971
+ slateEditor: ({
9972
+ context,
9973
+ event
9974
+ }) => event.type === "add slate editor" ? event.editor : context.slateEditor
9975
+ }),
9962
9976
  "emit patch event": emit(({
9963
9977
  event
9964
9978
  }) => (assertEvent(event, "internal.patch"), event)),
@@ -10081,7 +10095,10 @@ const editorMachine = setup({
10081
10095
  guards: {
10082
10096
  "slate is busy": ({
10083
10097
  context
10084
- }) => context.slateEditor ? context.slateEditor.operations.length > 0 : !1
10098
+ }) => context.slateEditor ? context.slateEditor.operations.length > 0 : !1,
10099
+ "slate is normalizing node": ({
10100
+ context
10101
+ }) => context.slateEditor ? isNormalizingNode(context.slateEditor) : !1
10085
10102
  }
10086
10103
  }).createMachine({
10087
10104
  id: "editor",
@@ -10115,6 +10132,9 @@ const editorMachine = setup({
10115
10132
  }) => event.maxBlocks
10116
10133
  })
10117
10134
  },
10135
+ "add slate editor": {
10136
+ actions: "add slate editor to context"
10137
+ },
10118
10138
  "update selection": {
10119
10139
  actions: [assign({
10120
10140
  selection: ({
@@ -10382,36 +10402,20 @@ const editorMachine = setup({
10382
10402
  debug$5("exit: setup->set up->writing->pristine->idle");
10383
10403
  }],
10384
10404
  on: {
10385
- normalizing: {
10386
- target: "normalizing"
10387
- },
10388
- "internal.patch": {
10405
+ "internal.patch": [{
10406
+ guard: "slate is normalizing node",
10407
+ actions: "defer event"
10408
+ }, {
10389
10409
  actions: "defer event",
10390
10410
  target: "#editor.setup.set up.writing.dirty"
10391
- },
10392
- mutation: {
10411
+ }],
10412
+ mutation: [{
10413
+ guard: "slate is normalizing node",
10414
+ actions: "defer event"
10415
+ }, {
10393
10416
  actions: "defer event",
10394
10417
  target: "#editor.setup.set up.writing.dirty"
10395
- }
10396
- }
10397
- },
10398
- normalizing: {
10399
- entry: [() => {
10400
- debug$5("entry: setup->set up->writing->pristine->normalizing");
10401
- }],
10402
- exit: [() => {
10403
- debug$5("exit: setup->set up->writing->pristine->normalizing");
10404
- }],
10405
- on: {
10406
- "done normalizing": {
10407
- target: "idle"
10408
- },
10409
- "internal.patch": {
10410
- actions: "defer event"
10411
- },
10412
- mutation: {
10413
- actions: "defer event"
10414
- }
10418
+ }]
10415
10419
  }
10416
10420
  }
10417
10421
  }
@@ -12671,7 +12675,7 @@ function RoutePatchesObservableToEditorActor(props) {
12671
12675
  }, t1 = [props.editorActor, props.patches$], $[0] = props.editorActor, $[1] = props.patches$, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), useEffect(t0, t1), null;
12672
12676
  }
12673
12677
  function EditorProvider(props) {
12674
- const $ = c(28);
12678
+ const $ = c(29);
12675
12679
  let t0;
12676
12680
  $[0] !== props.initialConfig ? (t0 = () => {
12677
12681
  const internalEditor = createInternalEditor(props.initialConfig), portableTextEditor = new PortableTextEditor({
@@ -12687,7 +12691,7 @@ function EditorProvider(props) {
12687
12691
  portableTextEditor: portableTextEditor_0
12688
12692
  } = t1;
12689
12693
  let t2;
12690
- $[2] !== internalEditor_0.actors.editorActor || $[3] !== internalEditor_0.actors.mutationActor || $[4] !== internalEditor_0.actors.relayActor || $[5] !== internalEditor_0.actors.syncActor || $[6] !== internalEditor_0.subscriptions || $[7] !== portableTextEditor_0 ? (t2 = () => {
12694
+ $[2] !== internalEditor_0.actors.editorActor || $[3] !== internalEditor_0.actors.mutationActor || $[4] !== internalEditor_0.actors.relayActor || $[5] !== internalEditor_0.actors.syncActor || $[6] !== internalEditor_0.editor._internal.slateEditor.instance || $[7] !== internalEditor_0.subscriptions || $[8] !== portableTextEditor_0 ? (t2 = () => {
12691
12695
  const unsubscribers = [];
12692
12696
  for (const subscription of internalEditor_0.subscriptions)
12693
12697
  unsubscribers.push(subscription());
@@ -12695,24 +12699,27 @@ function EditorProvider(props) {
12695
12699
  const change = eventToChange(event);
12696
12700
  change && portableTextEditor_0.change$.next(change);
12697
12701
  });
12698
- return unsubscribers.push(relayActorSubscription.unsubscribe), internalEditor_0.actors.editorActor.start(), internalEditor_0.actors.mutationActor.start(), internalEditor_0.actors.relayActor.start(), internalEditor_0.actors.syncActor.start(), () => {
12702
+ return unsubscribers.push(relayActorSubscription.unsubscribe), internalEditor_0.actors.editorActor.start(), internalEditor_0.actors.editorActor.send({
12703
+ type: "add slate editor",
12704
+ editor: internalEditor_0.editor._internal.slateEditor.instance
12705
+ }), internalEditor_0.actors.mutationActor.start(), internalEditor_0.actors.relayActor.start(), internalEditor_0.actors.syncActor.start(), () => {
12699
12706
  for (const unsubscribe of unsubscribers)
12700
12707
  unsubscribe();
12701
12708
  stopActor(internalEditor_0.actors.editorActor), stopActor(internalEditor_0.actors.mutationActor), stopActor(internalEditor_0.actors.relayActor), stopActor(internalEditor_0.actors.syncActor);
12702
12709
  };
12703
- }, $[2] = internalEditor_0.actors.editorActor, $[3] = internalEditor_0.actors.mutationActor, $[4] = internalEditor_0.actors.relayActor, $[5] = internalEditor_0.actors.syncActor, $[6] = internalEditor_0.subscriptions, $[7] = portableTextEditor_0, $[8] = t2) : t2 = $[8];
12710
+ }, $[2] = internalEditor_0.actors.editorActor, $[3] = internalEditor_0.actors.mutationActor, $[4] = internalEditor_0.actors.relayActor, $[5] = internalEditor_0.actors.syncActor, $[6] = internalEditor_0.editor._internal.slateEditor.instance, $[7] = internalEditor_0.subscriptions, $[8] = portableTextEditor_0, $[9] = t2) : t2 = $[9];
12704
12711
  let t3;
12705
- $[9] !== internalEditor_0 || $[10] !== portableTextEditor_0 ? (t3 = [internalEditor_0, portableTextEditor_0], $[9] = internalEditor_0, $[10] = portableTextEditor_0, $[11] = t3) : t3 = $[11], useEffect(t2, t3);
12712
+ $[10] !== internalEditor_0 || $[11] !== portableTextEditor_0 ? (t3 = [internalEditor_0, portableTextEditor_0], $[10] = internalEditor_0, $[11] = portableTextEditor_0, $[12] = t3) : t3 = $[12], useEffect(t2, t3);
12706
12713
  let t4;
12707
- $[12] !== portableTextEditor_0 || $[13] !== props.children ? (t4 = /* @__PURE__ */ jsx(PortableTextEditorContext.Provider, { value: portableTextEditor_0, children: props.children }), $[12] = portableTextEditor_0, $[13] = props.children, $[14] = t4) : t4 = $[14];
12714
+ $[13] !== portableTextEditor_0 || $[14] !== props.children ? (t4 = /* @__PURE__ */ jsx(PortableTextEditorContext.Provider, { value: portableTextEditor_0, children: props.children }), $[13] = portableTextEditor_0, $[14] = props.children, $[15] = t4) : t4 = $[15];
12708
12715
  let t5;
12709
- $[15] !== internalEditor_0.editor._internal.slateEditor.initialValue || $[16] !== internalEditor_0.editor._internal.slateEditor.instance || $[17] !== t4 ? (t5 = /* @__PURE__ */ jsx(Slate, { editor: internalEditor_0.editor._internal.slateEditor.instance, initialValue: internalEditor_0.editor._internal.slateEditor.initialValue, children: t4 }), $[15] = internalEditor_0.editor._internal.slateEditor.initialValue, $[16] = internalEditor_0.editor._internal.slateEditor.instance, $[17] = t4, $[18] = t5) : t5 = $[18];
12716
+ $[16] !== internalEditor_0.editor._internal.slateEditor.initialValue || $[17] !== internalEditor_0.editor._internal.slateEditor.instance || $[18] !== t4 ? (t5 = /* @__PURE__ */ jsx(Slate, { editor: internalEditor_0.editor._internal.slateEditor.instance, initialValue: internalEditor_0.editor._internal.slateEditor.initialValue, children: t4 }), $[16] = internalEditor_0.editor._internal.slateEditor.initialValue, $[17] = internalEditor_0.editor._internal.slateEditor.instance, $[18] = t4, $[19] = t5) : t5 = $[19];
12710
12717
  let t6;
12711
- $[19] !== internalEditor_0.actors.relayActor || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsx(RelayActorContext.Provider, { value: internalEditor_0.actors.relayActor, children: t5 }), $[19] = internalEditor_0.actors.relayActor, $[20] = t5, $[21] = t6) : t6 = $[21];
12718
+ $[20] !== internalEditor_0.actors.relayActor || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsx(RelayActorContext.Provider, { value: internalEditor_0.actors.relayActor, children: t5 }), $[20] = internalEditor_0.actors.relayActor, $[21] = t5, $[22] = t6) : t6 = $[22];
12712
12719
  let t7;
12713
- $[22] !== internalEditor_0.actors.editorActor || $[23] !== t6 ? (t7 = /* @__PURE__ */ jsx(EditorActorContext.Provider, { value: internalEditor_0.actors.editorActor, children: t6 }), $[22] = internalEditor_0.actors.editorActor, $[23] = t6, $[24] = t7) : t7 = $[24];
12720
+ $[23] !== internalEditor_0.actors.editorActor || $[24] !== t6 ? (t7 = /* @__PURE__ */ jsx(EditorActorContext.Provider, { value: internalEditor_0.actors.editorActor, children: t6 }), $[23] = internalEditor_0.actors.editorActor, $[24] = t6, $[25] = t7) : t7 = $[25];
12714
12721
  let t8;
12715
- return $[25] !== internalEditor_0.editor || $[26] !== t7 ? (t8 = /* @__PURE__ */ jsx(EditorContext.Provider, { value: internalEditor_0.editor, children: t7 }), $[25] = internalEditor_0.editor, $[26] = t7, $[27] = t8) : t8 = $[27], t8;
12722
+ return $[26] !== internalEditor_0.editor || $[27] !== t7 ? (t8 = /* @__PURE__ */ jsx(EditorContext.Provider, { value: internalEditor_0.editor, children: t7 }), $[26] = internalEditor_0.editor, $[27] = t7, $[28] = t8) : t8 = $[28], t8;
12716
12723
  }
12717
12724
  const usePortableTextEditorSelection = () => {
12718
12725
  const $ = c(3), editorActor = useContext(EditorActorContext), [selection, setSelection2] = useState(null);