@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.d.mts +91 -855
- package/lib/index.d.ts +91 -855
- package/lib/index.esm.js +6 -64
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +5 -63
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +6 -64
- package/lib/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/editor/PortableTextEditor.tsx +2 -2
- package/src/editor/components/Synchronizer.tsx +0 -23
- package/src/editor/editor-machine.ts +0 -33
package/lib/index.js
CHANGED
|
@@ -2936,7 +2936,7 @@ function _updateBlock(slateEditor, currentBlock, oldBlock, currentBlockIndex) {
|
|
|
2936
2936
|
}
|
|
2937
2937
|
const debug$i = debugWithName("component:PortableTextEditor:Synchronizer"), debugVerbose$3 = debug$i.enabled && !1, FLUSH_PATCHES_THROTTLED_MS = process.env.NODE_ENV === "test" ? 500 : 1e3;
|
|
2938
2938
|
function Synchronizer(props) {
|
|
2939
|
-
const $ = reactCompilerRuntime.c(
|
|
2939
|
+
const $ = reactCompilerRuntime.c(28), portableTextEditor = usePortableTextEditor(), readOnly = react$1.useSelector(props.editorActor, _temp$1), value = react$1.useSelector(props.editorActor, _temp2), {
|
|
2940
2940
|
editorActor,
|
|
2941
2941
|
getValue,
|
|
2942
2942
|
onChange
|
|
@@ -3017,20 +3017,6 @@ ${JSON.stringify(pendingPatches.current, null, 2)}`);
|
|
|
3017
3017
|
});
|
|
3018
3018
|
break bb22;
|
|
3019
3019
|
}
|
|
3020
|
-
case "offline": {
|
|
3021
|
-
handleChange({
|
|
3022
|
-
type: "connection",
|
|
3023
|
-
value: "offline"
|
|
3024
|
-
});
|
|
3025
|
-
break bb22;
|
|
3026
|
-
}
|
|
3027
|
-
case "online": {
|
|
3028
|
-
handleChange({
|
|
3029
|
-
type: "connection",
|
|
3030
|
-
value: "online"
|
|
3031
|
-
});
|
|
3032
|
-
break bb22;
|
|
3033
|
-
}
|
|
3034
3020
|
case "value changed": {
|
|
3035
3021
|
handleChange({
|
|
3036
3022
|
type: "value",
|
|
@@ -3067,25 +3053,13 @@ ${JSON.stringify(pendingPatches.current, null, 2)}`);
|
|
|
3067
3053
|
debug$i("Unsubscribing to changes"), sub.unsubscribe();
|
|
3068
3054
|
};
|
|
3069
3055
|
}, t9 = [editorActor, handleChange, onFlushPendingPatches, slateEditor], $[17] = editorActor, $[18] = handleChange, $[19] = onFlushPendingPatches, $[20] = slateEditor, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), react.useEffect(t8, t9);
|
|
3070
|
-
let t10;
|
|
3071
|
-
$[23] !== syncValue || $[24] !== value ? (t10 = () => {
|
|
3072
|
-
debug$i("Editor is online, syncing from props.value"), syncValue(value);
|
|
3073
|
-
}, $[23] = syncValue, $[24] = value, $[25] = t10) : t10 = $[25];
|
|
3074
|
-
const handleOnline = t10;
|
|
3075
|
-
let t11, t12;
|
|
3076
|
-
$[26] !== editorActor || $[27] !== handleOnline ? (t11 = () => {
|
|
3077
|
-
const subscription = editorActor.on("online", handleOnline);
|
|
3078
|
-
return () => {
|
|
3079
|
-
subscription.unsubscribe();
|
|
3080
|
-
};
|
|
3081
|
-
}, t12 = [handleOnline, editorActor], $[26] = editorActor, $[27] = handleOnline, $[28] = t11, $[29] = t12) : (t11 = $[28], t12 = $[29]), react.useEffect(t11, t12);
|
|
3082
3056
|
const isInitialValueFromProps = react.useRef(!0);
|
|
3083
|
-
let
|
|
3084
|
-
return $[
|
|
3057
|
+
let t10, t11;
|
|
3058
|
+
return $[23] !== editorActor || $[24] !== syncValue || $[25] !== value ? (t10 = () => {
|
|
3085
3059
|
debug$i("Value from props changed, syncing new value"), syncValue(value), isInitialValueFromProps.current && (editorActor.send({
|
|
3086
3060
|
type: "ready"
|
|
3087
3061
|
}), isInitialValueFromProps.current = !1);
|
|
3088
|
-
},
|
|
3062
|
+
}, t11 = [editorActor, syncValue, value], $[23] = editorActor, $[24] = syncValue, $[25] = value, $[26] = t10, $[27] = t11) : (t10 = $[26], t11 = $[27]), react.useEffect(t10, t11), null;
|
|
3089
3063
|
}
|
|
3090
3064
|
function _temp2(s_0) {
|
|
3091
3065
|
return s_0.context.value;
|
|
@@ -5695,22 +5669,7 @@ function performDefaultAction({
|
|
|
5695
5669
|
});
|
|
5696
5670
|
}
|
|
5697
5671
|
}
|
|
5698
|
-
const
|
|
5699
|
-
sendBack
|
|
5700
|
-
}) => {
|
|
5701
|
-
const onlineHandler = () => {
|
|
5702
|
-
sendBack({
|
|
5703
|
-
type: "online"
|
|
5704
|
-
});
|
|
5705
|
-
}, offlineHandler = () => {
|
|
5706
|
-
sendBack({
|
|
5707
|
-
type: "offline"
|
|
5708
|
-
});
|
|
5709
|
-
};
|
|
5710
|
-
return window && (window.addEventListener("online", onlineHandler), window.addEventListener("offline", offlineHandler)), () => {
|
|
5711
|
-
window && (window.removeEventListener("online", onlineHandler), window.removeEventListener("offline", offlineHandler));
|
|
5712
|
-
};
|
|
5713
|
-
}), editorMachine = xstate.setup({
|
|
5672
|
+
const editorMachine = xstate.setup({
|
|
5714
5673
|
types: {
|
|
5715
5674
|
context: {},
|
|
5716
5675
|
events: {},
|
|
@@ -5809,9 +5768,6 @@ const networkLogic = xstate.fromCallback(({
|
|
|
5809
5768
|
actionIntends: [defaultAction]
|
|
5810
5769
|
});
|
|
5811
5770
|
})
|
|
5812
|
-
},
|
|
5813
|
-
actors: {
|
|
5814
|
-
networkLogic
|
|
5815
5771
|
}
|
|
5816
5772
|
}).createMachine({
|
|
5817
5773
|
id: "editor",
|
|
@@ -5826,10 +5782,6 @@ const networkLogic = xstate.fromCallback(({
|
|
|
5826
5782
|
maxBlocks: void 0,
|
|
5827
5783
|
value: input.value
|
|
5828
5784
|
}),
|
|
5829
|
-
invoke: {
|
|
5830
|
-
id: "networkLogic",
|
|
5831
|
-
src: "networkLogic"
|
|
5832
|
-
},
|
|
5833
5785
|
on: {
|
|
5834
5786
|
"annotation.add": {
|
|
5835
5787
|
actions: xstate.emit(({
|
|
@@ -5903,16 +5855,6 @@ const networkLogic = xstate.fromCallback(({
|
|
|
5903
5855
|
event
|
|
5904
5856
|
}) => event)
|
|
5905
5857
|
},
|
|
5906
|
-
online: {
|
|
5907
|
-
actions: xstate.emit({
|
|
5908
|
-
type: "online"
|
|
5909
|
-
})
|
|
5910
|
-
},
|
|
5911
|
-
offline: {
|
|
5912
|
-
actions: xstate.emit({
|
|
5913
|
-
type: "offline"
|
|
5914
|
-
})
|
|
5915
|
-
},
|
|
5916
5858
|
loading: {
|
|
5917
5859
|
actions: xstate.emit({
|
|
5918
5860
|
type: "loading"
|