@portabletext/editor 2.14.0 → 2.14.1

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.cjs CHANGED
@@ -2890,6 +2890,14 @@ function getNextSpan({
2890
2890
  }
2891
2891
  return nextSpan;
2892
2892
  }
2893
+ const IS_NORMALIZING_NODE = /* @__PURE__ */ new WeakMap();
2894
+ function withNormalizeNode(editor, fn) {
2895
+ const prev = IS_NORMALIZING_NODE.get(editor);
2896
+ IS_NORMALIZING_NODE.set(editor, !0), fn(), IS_NORMALIZING_NODE.set(editor, prev);
2897
+ }
2898
+ function isNormalizingNode(editor) {
2899
+ return IS_NORMALIZING_NODE.get(editor) ?? !1;
2900
+ }
2893
2901
  function withRemoteChanges(editor, fn) {
2894
2902
  const prev = isChangingRemotely(editor) || !1;
2895
2903
  IS_PROCESSING_REMOTE_CHANGES.set(editor, !0), fn(), IS_PROCESSING_REMOTE_CHANGES.set(editor, prev);
@@ -2932,53 +2940,45 @@ function createWithPortableTextMarkModel(editorActor) {
2932
2940
  for (const [child, childPath] of children) {
2933
2941
  const nextNode = node.children[childPath[1] + 1];
2934
2942
  if (editor.isTextSpan(child) && editor.isTextSpan(nextNode) && child.marks?.every((mark) => nextNode.marks?.includes(mark)) && nextNode.marks?.every((mark) => child.marks?.includes(mark))) {
2935
- debug$c("Merging spans", JSON.stringify(child, null, 2), JSON.stringify(nextNode, null, 2)), editorActor.send({
2936
- type: "normalizing"
2937
- }), slate.Transforms.mergeNodes(editor, {
2938
- at: [childPath[0], childPath[1] + 1],
2939
- voids: !0
2940
- }), editorActor.send({
2941
- type: "done normalizing"
2943
+ debug$c("Merging spans", JSON.stringify(child, null, 2), JSON.stringify(nextNode, null, 2)), withNormalizeNode(editor, () => {
2944
+ slate.Transforms.mergeNodes(editor, {
2945
+ at: [childPath[0], childPath[1] + 1],
2946
+ voids: !0
2947
+ });
2942
2948
  });
2943
2949
  return;
2944
2950
  }
2945
2951
  }
2946
2952
  }
2947
2953
  if (editor.isTextBlock(node) && !Array.isArray(node.markDefs)) {
2948
- debug$c("Adding .markDefs to block node"), editorActor.send({
2949
- type: "normalizing"
2950
- }), slate.Transforms.setNodes(editor, {
2951
- markDefs: []
2952
- }, {
2953
- at: path
2954
- }), editorActor.send({
2955
- type: "done normalizing"
2954
+ debug$c("Adding .markDefs to block node"), withNormalizeNode(editor, () => {
2955
+ slate.Transforms.setNodes(editor, {
2956
+ markDefs: []
2957
+ }, {
2958
+ at: path
2959
+ });
2956
2960
  });
2957
2961
  return;
2958
2962
  }
2959
2963
  if (editor.isTextSpan(node) && !Array.isArray(node.marks)) {
2960
- debug$c("Adding .marks to span node"), editorActor.send({
2961
- type: "normalizing"
2962
- }), slate.Transforms.setNodes(editor, {
2963
- marks: []
2964
- }, {
2965
- at: path
2966
- }), editorActor.send({
2967
- type: "done normalizing"
2964
+ debug$c("Adding .marks to span node"), withNormalizeNode(editor, () => {
2965
+ slate.Transforms.setNodes(editor, {
2966
+ marks: []
2967
+ }, {
2968
+ at: path
2969
+ });
2968
2970
  });
2969
2971
  return;
2970
2972
  }
2971
2973
  if (editor.isTextSpan(node)) {
2972
2974
  const blockPath = slate.Path.parent(path), [block] = slate.Editor.node(editor, blockPath), decorators2 = editorActor.getSnapshot().context.schema.decorators.map((decorator) => decorator.name), annotations = node.marks?.filter((mark) => !decorators2.includes(mark));
2973
2975
  if (editor.isTextBlock(block) && node.text === "" && annotations && annotations.length > 0) {
2974
- debug$c("Removing annotations from empty span node"), editorActor.send({
2975
- type: "normalizing"
2976
- }), slate.Transforms.setNodes(editor, {
2977
- marks: node.marks?.filter((mark) => decorators2.includes(mark))
2978
- }, {
2979
- at: path
2980
- }), editorActor.send({
2981
- type: "done normalizing"
2976
+ debug$c("Removing annotations from empty span node"), withNormalizeNode(editor, () => {
2977
+ slate.Transforms.setNodes(editor, {
2978
+ marks: node.marks?.filter((mark) => decorators2.includes(mark))
2979
+ }, {
2980
+ at: path
2981
+ });
2982
2982
  });
2983
2983
  return;
2984
2984
  }
@@ -2989,14 +2989,12 @@ function createWithPortableTextMarkModel(editorActor) {
2989
2989
  if (editor.isTextSpan(child)) {
2990
2990
  const marks = child.marks ?? [], orphanedAnnotations = marks.filter((mark) => !decorators2.includes(mark) && !node.markDefs?.find((def) => def._key === mark));
2991
2991
  if (orphanedAnnotations.length > 0) {
2992
- debug$c("Removing orphaned annotations from span node"), editorActor.send({
2993
- type: "normalizing"
2994
- }), slate.Transforms.setNodes(editor, {
2995
- marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
2996
- }, {
2997
- at: childPath
2998
- }), editorActor.send({
2999
- type: "done normalizing"
2992
+ debug$c("Removing orphaned annotations from span node"), withNormalizeNode(editor, () => {
2993
+ slate.Transforms.setNodes(editor, {
2994
+ marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
2995
+ }, {
2996
+ at: childPath
2997
+ });
3000
2998
  });
3001
2999
  return;
3002
3000
  }
@@ -3007,14 +3005,12 @@ function createWithPortableTextMarkModel(editorActor) {
3007
3005
  if (editor.isTextBlock(block)) {
3008
3006
  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));
3009
3007
  if (orphanedAnnotations.length > 0) {
3010
- debug$c("Removing orphaned annotations from span node"), editorActor.send({
3011
- type: "normalizing"
3012
- }), slate.Transforms.setNodes(editor, {
3013
- marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
3014
- }, {
3015
- at: path
3016
- }), editorActor.send({
3017
- type: "done normalizing"
3008
+ debug$c("Removing orphaned annotations from span node"), withNormalizeNode(editor, () => {
3009
+ slate.Transforms.setNodes(editor, {
3010
+ marks: marks.filter((mark) => !orphanedAnnotations.includes(mark))
3011
+ }, {
3012
+ at: path
3013
+ });
3018
3014
  });
3019
3015
  return;
3020
3016
  }
@@ -3025,14 +3021,12 @@ function createWithPortableTextMarkModel(editorActor) {
3025
3021
  for (const markDef of markDefs)
3026
3022
  markDefKeys.has(markDef._key) || (markDefKeys.add(markDef._key), newMarkDefs.push(markDef));
3027
3023
  if (markDefs.length !== newMarkDefs.length) {
3028
- debug$c("Removing duplicate markDefs"), editorActor.send({
3029
- type: "normalizing"
3030
- }), slate.Transforms.setNodes(editor, {
3031
- markDefs: newMarkDefs
3032
- }, {
3033
- at: path
3034
- }), editorActor.send({
3035
- type: "done normalizing"
3024
+ debug$c("Removing duplicate markDefs"), withNormalizeNode(editor, () => {
3025
+ slate.Transforms.setNodes(editor, {
3026
+ markDefs: newMarkDefs
3027
+ }, {
3028
+ at: path
3029
+ });
3036
3030
  });
3037
3031
  return;
3038
3032
  }
@@ -3040,19 +3034,19 @@ function createWithPortableTextMarkModel(editorActor) {
3040
3034
  if (editor.isTextBlock(node) && !editor.operations.some((op) => op.type === "merge_node" && "markDefs" in op.properties && op.path.length === 1)) {
3041
3035
  const newMarkDefs = (node.markDefs || []).filter((def) => node.children.find((child) => slate.Text.isText(child) && Array.isArray(child.marks) && child.marks.includes(def._key)));
3042
3036
  if (node.markDefs && !isEqual__default.default(newMarkDefs, node.markDefs)) {
3043
- debug$c("Removing markDef not in use"), editorActor.send({
3044
- type: "normalizing"
3045
- }), slate.Transforms.setNodes(editor, {
3046
- markDefs: newMarkDefs
3047
- }, {
3048
- at: path
3049
- }), editorActor.send({
3050
- type: "done normalizing"
3037
+ debug$c("Removing markDef not in use"), withNormalizeNode(editor, () => {
3038
+ slate.Transforms.setNodes(editor, {
3039
+ markDefs: newMarkDefs
3040
+ }, {
3041
+ at: path
3042
+ });
3051
3043
  });
3052
3044
  return;
3053
3045
  }
3054
3046
  }
3055
- normalizeNode(nodeEntry);
3047
+ withNormalizeNode(editor, () => {
3048
+ normalizeNode(nodeEntry);
3049
+ });
3056
3050
  }, editor.apply = (op) => {
3057
3051
  if (isChangingRemotely(editor)) {
3058
3052
  apply2(op);
@@ -3908,7 +3902,7 @@ function createWithUndoRedo(options) {
3908
3902
  } = editor, {
3909
3903
  undos
3910
3904
  } = 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);
3911
- let merge = currentUndoStepId === previousUndoStepId;
3905
+ let merge = currentUndoStepId === previousUndoStepId || isNormalizingNode(editor);
3912
3906
  if (save) {
3913
3907
  if (step ? operations.length === 0 && (merge = currentUndoStepId === void 0 && previousUndoStepId === void 0 ? shouldMerge(op, lastOp) || overwrite : merge) : merge = !1, step && merge)
3914
3908
  step.operations.push(op);
@@ -5522,32 +5516,30 @@ function createWithObjectKeys(editorActor) {
5522
5516
  const [node, path] = entry;
5523
5517
  if (slate.Element.isElement(node) && node._type === editorActor.getSnapshot().context.schema.block.name) {
5524
5518
  if (!node._key) {
5525
- editorActor.send({
5526
- type: "normalizing"
5527
- }), slate.Transforms.setNodes(editor, {
5528
- _key: editorActor.getSnapshot().context.keyGenerator()
5529
- }, {
5530
- at: path
5531
- }), editorActor.send({
5532
- type: "done normalizing"
5519
+ withNormalizeNode(editor, () => {
5520
+ slate.Transforms.setNodes(editor, {
5521
+ _key: editorActor.getSnapshot().context.keyGenerator()
5522
+ }, {
5523
+ at: path
5524
+ });
5533
5525
  });
5534
5526
  return;
5535
5527
  }
5536
5528
  for (const [child, childPath] of slate.Node.children(editor, path))
5537
5529
  if (!child._key) {
5538
- editorActor.send({
5539
- type: "normalizing"
5540
- }), slate.Transforms.setNodes(editor, {
5541
- _key: editorActor.getSnapshot().context.keyGenerator()
5542
- }, {
5543
- at: childPath
5544
- }), editorActor.send({
5545
- type: "done normalizing"
5530
+ withNormalizeNode(editor, () => {
5531
+ slate.Transforms.setNodes(editor, {
5532
+ _key: editorActor.getSnapshot().context.keyGenerator()
5533
+ }, {
5534
+ at: childPath
5535
+ });
5546
5536
  });
5547
5537
  return;
5548
5538
  }
5549
5539
  }
5550
- normalizeNode(entry);
5540
+ withNormalizeNode(editor, () => {
5541
+ normalizeNode(entry);
5542
+ });
5551
5543
  }, editor;
5552
5544
  };
5553
5545
  }
@@ -6267,34 +6259,32 @@ function createWithSchemaTypes({
6267
6259
  if (node._type === void 0 && path.length === 2) {
6268
6260
  debug$8("Setting span type on text node without a type");
6269
6261
  const span = node, key = span._key || editorActor.getSnapshot().context.keyGenerator();
6270
- editorActor.send({
6271
- type: "normalizing"
6272
- }), slate.Transforms.setNodes(editor, {
6273
- ...span,
6274
- _type: editorActor.getSnapshot().context.schema.span.name,
6275
- _key: key
6276
- }, {
6277
- at: path
6278
- }), editorActor.send({
6279
- type: "done normalizing"
6262
+ withNormalizeNode(editor, () => {
6263
+ slate.Transforms.setNodes(editor, {
6264
+ ...span,
6265
+ _type: editorActor.getSnapshot().context.schema.span.name,
6266
+ _key: key
6267
+ }, {
6268
+ at: path
6269
+ });
6280
6270
  });
6281
6271
  return;
6282
6272
  }
6283
6273
  if (node._key === void 0 && (path.length === 1 || path.length === 2)) {
6284
6274
  debug$8("Setting missing key on child node without a key");
6285
6275
  const key = editorActor.getSnapshot().context.keyGenerator();
6286
- editorActor.send({
6287
- type: "normalizing"
6288
- }), slate.Transforms.setNodes(editor, {
6289
- _key: key
6290
- }, {
6291
- at: path
6292
- }), editorActor.send({
6293
- type: "done normalizing"
6276
+ withNormalizeNode(editor, () => {
6277
+ slate.Transforms.setNodes(editor, {
6278
+ _key: key
6279
+ }, {
6280
+ at: path
6281
+ });
6294
6282
  });
6295
6283
  return;
6296
6284
  }
6297
- normalizeNode(entry);
6285
+ withNormalizeNode(editor, () => {
6286
+ normalizeNode(entry);
6287
+ });
6298
6288
  }, editor;
6299
6289
  };
6300
6290
  }
@@ -8889,6 +8879,24 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8889
8879
  marks: [...event.decorators ?? [], ...markDefs.map((markDef) => markDef._key)]
8890
8880
  }
8891
8881
  })]]
8882
+ }), behaviors_index.defineBehavior({
8883
+ on: "insert.text",
8884
+ guard: ({
8885
+ snapshot
8886
+ }) => {
8887
+ const selection = snapshot.context.selection;
8888
+ return !selection || util_isEmptyTextBlock.isSelectionCollapsed(selection) ? !1 : {
8889
+ selection
8890
+ };
8891
+ },
8892
+ actions: [({
8893
+ event
8894
+ }, {
8895
+ selection
8896
+ }) => [behaviors_index.raise({
8897
+ type: "delete",
8898
+ at: selection
8899
+ }), behaviors_index.raise(event)]]
8892
8900
  })], shiftLeft = keyboardShortcuts.createKeyboardShortcut({
8893
8901
  default: [{
8894
8902
  key: "ArrowLeft",
@@ -9930,6 +9938,12 @@ const editorMachine = xstate.setup({
9930
9938
  event
9931
9939
  }) => (xstate.assertEvent(event, "remove behavior"), context.behaviors.delete(event.behaviorConfig), /* @__PURE__ */ new Set([...context.behaviors]))
9932
9940
  }),
9941
+ "add slate editor to context": xstate.assign({
9942
+ slateEditor: ({
9943
+ context,
9944
+ event
9945
+ }) => event.type === "add slate editor" ? event.editor : context.slateEditor
9946
+ }),
9933
9947
  "emit patch event": xstate.emit(({
9934
9948
  event
9935
9949
  }) => (xstate.assertEvent(event, "internal.patch"), event)),
@@ -10052,7 +10066,10 @@ const editorMachine = xstate.setup({
10052
10066
  guards: {
10053
10067
  "slate is busy": ({
10054
10068
  context
10055
- }) => context.slateEditor ? context.slateEditor.operations.length > 0 : !1
10069
+ }) => context.slateEditor ? context.slateEditor.operations.length > 0 : !1,
10070
+ "slate is normalizing node": ({
10071
+ context
10072
+ }) => context.slateEditor ? isNormalizingNode(context.slateEditor) : !1
10056
10073
  }
10057
10074
  }).createMachine({
10058
10075
  id: "editor",
@@ -10086,6 +10103,9 @@ const editorMachine = xstate.setup({
10086
10103
  }) => event.maxBlocks
10087
10104
  })
10088
10105
  },
10106
+ "add slate editor": {
10107
+ actions: "add slate editor to context"
10108
+ },
10089
10109
  "update selection": {
10090
10110
  actions: [xstate.assign({
10091
10111
  selection: ({
@@ -10353,36 +10373,20 @@ const editorMachine = xstate.setup({
10353
10373
  debug$5("exit: setup->set up->writing->pristine->idle");
10354
10374
  }],
10355
10375
  on: {
10356
- normalizing: {
10357
- target: "normalizing"
10358
- },
10359
- "internal.patch": {
10376
+ "internal.patch": [{
10377
+ guard: "slate is normalizing node",
10378
+ actions: "defer event"
10379
+ }, {
10360
10380
  actions: "defer event",
10361
10381
  target: "#editor.setup.set up.writing.dirty"
10362
- },
10363
- mutation: {
10382
+ }],
10383
+ mutation: [{
10384
+ guard: "slate is normalizing node",
10385
+ actions: "defer event"
10386
+ }, {
10364
10387
  actions: "defer event",
10365
10388
  target: "#editor.setup.set up.writing.dirty"
10366
- }
10367
- }
10368
- },
10369
- normalizing: {
10370
- entry: [() => {
10371
- debug$5("entry: setup->set up->writing->pristine->normalizing");
10372
- }],
10373
- exit: [() => {
10374
- debug$5("exit: setup->set up->writing->pristine->normalizing");
10375
- }],
10376
- on: {
10377
- "done normalizing": {
10378
- target: "idle"
10379
- },
10380
- "internal.patch": {
10381
- actions: "defer event"
10382
- },
10383
- mutation: {
10384
- actions: "defer event"
10385
- }
10389
+ }]
10386
10390
  }
10387
10391
  }
10388
10392
  }
@@ -12642,7 +12646,7 @@ function RoutePatchesObservableToEditorActor(props) {
12642
12646
  }, t1 = [props.editorActor, props.patches$], $[0] = props.editorActor, $[1] = props.patches$, $[2] = t0, $[3] = t1) : (t0 = $[2], t1 = $[3]), React.useEffect(t0, t1), null;
12643
12647
  }
12644
12648
  function EditorProvider(props) {
12645
- const $ = reactCompilerRuntime.c(28);
12649
+ const $ = reactCompilerRuntime.c(29);
12646
12650
  let t0;
12647
12651
  $[0] !== props.initialConfig ? (t0 = () => {
12648
12652
  const internalEditor = createInternalEditor(props.initialConfig), portableTextEditor = new PortableTextEditor({
@@ -12658,7 +12662,7 @@ function EditorProvider(props) {
12658
12662
  portableTextEditor: portableTextEditor_0
12659
12663
  } = t1;
12660
12664
  let t2;
12661
- $[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 = () => {
12665
+ $[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 = () => {
12662
12666
  const unsubscribers = [];
12663
12667
  for (const subscription of internalEditor_0.subscriptions)
12664
12668
  unsubscribers.push(subscription());
@@ -12666,24 +12670,27 @@ function EditorProvider(props) {
12666
12670
  const change = eventToChange(event);
12667
12671
  change && portableTextEditor_0.change$.next(change);
12668
12672
  });
12669
- 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(), () => {
12673
+ return unsubscribers.push(relayActorSubscription.unsubscribe), internalEditor_0.actors.editorActor.start(), internalEditor_0.actors.editorActor.send({
12674
+ type: "add slate editor",
12675
+ editor: internalEditor_0.editor._internal.slateEditor.instance
12676
+ }), internalEditor_0.actors.mutationActor.start(), internalEditor_0.actors.relayActor.start(), internalEditor_0.actors.syncActor.start(), () => {
12670
12677
  for (const unsubscribe of unsubscribers)
12671
12678
  unsubscribe();
12672
12679
  stopActor(internalEditor_0.actors.editorActor), stopActor(internalEditor_0.actors.mutationActor), stopActor(internalEditor_0.actors.relayActor), stopActor(internalEditor_0.actors.syncActor);
12673
12680
  };
12674
- }, $[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];
12681
+ }, $[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];
12675
12682
  let t3;
12676
- $[9] !== internalEditor_0 || $[10] !== portableTextEditor_0 ? (t3 = [internalEditor_0, portableTextEditor_0], $[9] = internalEditor_0, $[10] = portableTextEditor_0, $[11] = t3) : t3 = $[11], React.useEffect(t2, t3);
12683
+ $[10] !== internalEditor_0 || $[11] !== portableTextEditor_0 ? (t3 = [internalEditor_0, portableTextEditor_0], $[10] = internalEditor_0, $[11] = portableTextEditor_0, $[12] = t3) : t3 = $[12], React.useEffect(t2, t3);
12677
12684
  let t4;
12678
- $[12] !== portableTextEditor_0 || $[13] !== props.children ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortableTextEditorContext.Provider, { value: portableTextEditor_0, children: props.children }), $[12] = portableTextEditor_0, $[13] = props.children, $[14] = t4) : t4 = $[14];
12685
+ $[13] !== portableTextEditor_0 || $[14] !== props.children ? (t4 = /* @__PURE__ */ jsxRuntime.jsx(PortableTextEditorContext.Provider, { value: portableTextEditor_0, children: props.children }), $[13] = portableTextEditor_0, $[14] = props.children, $[15] = t4) : t4 = $[15];
12679
12686
  let t5;
12680
- $[15] !== internalEditor_0.editor._internal.slateEditor.initialValue || $[16] !== internalEditor_0.editor._internal.slateEditor.instance || $[17] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(slateReact.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];
12687
+ $[16] !== internalEditor_0.editor._internal.slateEditor.initialValue || $[17] !== internalEditor_0.editor._internal.slateEditor.instance || $[18] !== t4 ? (t5 = /* @__PURE__ */ jsxRuntime.jsx(slateReact.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];
12681
12688
  let t6;
12682
- $[19] !== internalEditor_0.actors.relayActor || $[20] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(RelayActorContext.Provider, { value: internalEditor_0.actors.relayActor, children: t5 }), $[19] = internalEditor_0.actors.relayActor, $[20] = t5, $[21] = t6) : t6 = $[21];
12689
+ $[20] !== internalEditor_0.actors.relayActor || $[21] !== t5 ? (t6 = /* @__PURE__ */ jsxRuntime.jsx(RelayActorContext.Provider, { value: internalEditor_0.actors.relayActor, children: t5 }), $[20] = internalEditor_0.actors.relayActor, $[21] = t5, $[22] = t6) : t6 = $[22];
12683
12690
  let t7;
12684
- $[22] !== internalEditor_0.actors.editorActor || $[23] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(EditorActorContext.Provider, { value: internalEditor_0.actors.editorActor, children: t6 }), $[22] = internalEditor_0.actors.editorActor, $[23] = t6, $[24] = t7) : t7 = $[24];
12691
+ $[23] !== internalEditor_0.actors.editorActor || $[24] !== t6 ? (t7 = /* @__PURE__ */ jsxRuntime.jsx(EditorActorContext.Provider, { value: internalEditor_0.actors.editorActor, children: t6 }), $[23] = internalEditor_0.actors.editorActor, $[24] = t6, $[25] = t7) : t7 = $[25];
12685
12692
  let t8;
12686
- return $[25] !== internalEditor_0.editor || $[26] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(useEditor.EditorContext.Provider, { value: internalEditor_0.editor, children: t7 }), $[25] = internalEditor_0.editor, $[26] = t7, $[27] = t8) : t8 = $[27], t8;
12693
+ return $[26] !== internalEditor_0.editor || $[27] !== t7 ? (t8 = /* @__PURE__ */ jsxRuntime.jsx(useEditor.EditorContext.Provider, { value: internalEditor_0.editor, children: t7 }), $[26] = internalEditor_0.editor, $[27] = t7, $[28] = t8) : t8 = $[28], t8;
12687
12694
  }
12688
12695
  const usePortableTextEditorSelection = () => {
12689
12696
  const $ = reactCompilerRuntime.c(3), editorActor = React.useContext(EditorActorContext), [selection, setSelection] = React.useState(null);