@portabletext/editor 1.10.1 → 1.10.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.esm.js CHANGED
@@ -13,7 +13,7 @@ import { c } from "react-compiler-runtime";
13
13
  import { styled } from "styled-components";
14
14
  import uniq from "lodash/uniq.js";
15
15
  import { Subject } from "rxjs";
16
- import { fromCallback, setup, assign, assertEvent, emit, enqueueActions, createActor } from "xstate";
16
+ import { setup, assign, assertEvent, emit, enqueueActions, createActor } from "xstate";
17
17
  import throttle from "lodash/throttle.js";
18
18
  import { useEffectEvent } from "use-effect-event";
19
19
  import debounce from "lodash/debounce.js";
@@ -2957,7 +2957,7 @@ function _updateBlock(slateEditor, currentBlock, oldBlock, currentBlockIndex) {
2957
2957
  }
2958
2958
  const debug$i = debugWithName("component:PortableTextEditor:Synchronizer"), debugVerbose$3 = debug$i.enabled && !1, FLUSH_PATCHES_THROTTLED_MS = process.env.NODE_ENV === "test" ? 500 : 1e3;
2959
2959
  function Synchronizer(props) {
2960
- const $ = c(35), portableTextEditor = usePortableTextEditor(), readOnly = useSelector(props.editorActor, _temp$1), value = useSelector(props.editorActor, _temp2), {
2960
+ const $ = c(28), portableTextEditor = usePortableTextEditor(), readOnly = useSelector(props.editorActor, _temp$1), value = useSelector(props.editorActor, _temp2), {
2961
2961
  editorActor,
2962
2962
  getValue,
2963
2963
  onChange
@@ -3038,20 +3038,6 @@ ${JSON.stringify(pendingPatches.current, null, 2)}`);
3038
3038
  });
3039
3039
  break bb22;
3040
3040
  }
3041
- case "offline": {
3042
- handleChange({
3043
- type: "connection",
3044
- value: "offline"
3045
- });
3046
- break bb22;
3047
- }
3048
- case "online": {
3049
- handleChange({
3050
- type: "connection",
3051
- value: "online"
3052
- });
3053
- break bb22;
3054
- }
3055
3041
  case "value changed": {
3056
3042
  handleChange({
3057
3043
  type: "value",
@@ -3088,25 +3074,13 @@ ${JSON.stringify(pendingPatches.current, null, 2)}`);
3088
3074
  debug$i("Unsubscribing to changes"), sub.unsubscribe();
3089
3075
  };
3090
3076
  }, t9 = [editorActor, handleChange, onFlushPendingPatches, slateEditor], $[17] = editorActor, $[18] = handleChange, $[19] = onFlushPendingPatches, $[20] = slateEditor, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), useEffect(t8, t9);
3091
- let t10;
3092
- $[23] !== syncValue || $[24] !== value ? (t10 = () => {
3093
- debug$i("Editor is online, syncing from props.value"), syncValue(value);
3094
- }, $[23] = syncValue, $[24] = value, $[25] = t10) : t10 = $[25];
3095
- const handleOnline = t10;
3096
- let t11, t12;
3097
- $[26] !== editorActor || $[27] !== handleOnline ? (t11 = () => {
3098
- const subscription = editorActor.on("online", handleOnline);
3099
- return () => {
3100
- subscription.unsubscribe();
3101
- };
3102
- }, t12 = [handleOnline, editorActor], $[26] = editorActor, $[27] = handleOnline, $[28] = t11, $[29] = t12) : (t11 = $[28], t12 = $[29]), useEffect(t11, t12);
3103
3077
  const isInitialValueFromProps = useRef(!0);
3104
- let t13, t14;
3105
- return $[30] !== editorActor || $[31] !== syncValue || $[32] !== value ? (t13 = () => {
3078
+ let t10, t11;
3079
+ return $[23] !== editorActor || $[24] !== syncValue || $[25] !== value ? (t10 = () => {
3106
3080
  debug$i("Value from props changed, syncing new value"), syncValue(value), isInitialValueFromProps.current && (editorActor.send({
3107
3081
  type: "ready"
3108
3082
  }), isInitialValueFromProps.current = !1);
3109
- }, t14 = [editorActor, syncValue, value], $[30] = editorActor, $[31] = syncValue, $[32] = value, $[33] = t13, $[34] = t14) : (t13 = $[33], t14 = $[34]), useEffect(t13, t14), null;
3083
+ }, t11 = [editorActor, syncValue, value], $[23] = editorActor, $[24] = syncValue, $[25] = value, $[26] = t10, $[27] = t11) : (t10 = $[26], t11 = $[27]), useEffect(t10, t11), null;
3110
3084
  }
3111
3085
  function _temp2(s_0) {
3112
3086
  return s_0.context.value;
@@ -5716,22 +5690,7 @@ function performDefaultAction({
5716
5690
  });
5717
5691
  }
5718
5692
  }
5719
- const networkLogic = fromCallback(({
5720
- sendBack
5721
- }) => {
5722
- const onlineHandler = () => {
5723
- sendBack({
5724
- type: "online"
5725
- });
5726
- }, offlineHandler = () => {
5727
- sendBack({
5728
- type: "offline"
5729
- });
5730
- };
5731
- return window && (window.addEventListener("online", onlineHandler), window.addEventListener("offline", offlineHandler)), () => {
5732
- window && (window.removeEventListener("online", onlineHandler), window.removeEventListener("offline", offlineHandler));
5733
- };
5734
- }), editorMachine = setup({
5693
+ const editorMachine = setup({
5735
5694
  types: {
5736
5695
  context: {},
5737
5696
  events: {},
@@ -5830,9 +5789,6 @@ const networkLogic = fromCallback(({
5830
5789
  actionIntends: [defaultAction]
5831
5790
  });
5832
5791
  })
5833
- },
5834
- actors: {
5835
- networkLogic
5836
5792
  }
5837
5793
  }).createMachine({
5838
5794
  id: "editor",
@@ -5847,10 +5803,6 @@ const networkLogic = fromCallback(({
5847
5803
  maxBlocks: void 0,
5848
5804
  value: input.value
5849
5805
  }),
5850
- invoke: {
5851
- id: "networkLogic",
5852
- src: "networkLogic"
5853
- },
5854
5806
  on: {
5855
5807
  "annotation.add": {
5856
5808
  actions: emit(({
@@ -5924,16 +5876,6 @@ const networkLogic = fromCallback(({
5924
5876
  event
5925
5877
  }) => event)
5926
5878
  },
5927
- online: {
5928
- actions: emit({
5929
- type: "online"
5930
- })
5931
- },
5932
- offline: {
5933
- actions: emit({
5934
- type: "offline"
5935
- })
5936
- },
5937
5879
  loading: {
5938
5880
  actions: emit({
5939
5881
  type: "loading"