@portabletext/editor 1.44.8 → 1.44.10
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/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/index.cjs +20 -5
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +1 -13
- package/lib/index.d.ts +1 -13
- package/lib/index.js +20 -5
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.cts +1 -13
- package/lib/plugins/index.d.ts +1 -13
- package/package.json +1 -1
- package/src/behaviors/behavior.types.event.ts +1 -13
- package/src/editor/Editable.tsx +3 -2
- package/src/editor/range-decorations-machine.ts +21 -3
package/lib/index.d.cts
CHANGED
|
@@ -5025,19 +5025,7 @@ declare type ExternalBehaviorEvent =
|
|
|
5025
5025
|
}
|
|
5026
5026
|
}
|
|
5027
5027
|
}
|
|
5028
|
-
|
|
|
5029
|
-
AbstractBehaviorEvent,
|
|
5030
|
-
'type',
|
|
5031
|
-
| 'annotation.toggle'
|
|
5032
|
-
| 'decorator.toggle'
|
|
5033
|
-
| 'insert.blocks'
|
|
5034
|
-
| 'list item.add'
|
|
5035
|
-
| 'list item.remove'
|
|
5036
|
-
| 'list item.toggle'
|
|
5037
|
-
| 'style.add'
|
|
5038
|
-
| 'style.remove'
|
|
5039
|
-
| 'style.toggle'
|
|
5040
|
-
>
|
|
5028
|
+
| AbstractBehaviorEvent
|
|
5041
5029
|
| SyntheticBehaviorEvent
|
|
5042
5030
|
| CustomBehaviorEvent
|
|
5043
5031
|
|
package/lib/index.d.ts
CHANGED
|
@@ -5025,19 +5025,7 @@ declare type ExternalBehaviorEvent =
|
|
|
5025
5025
|
}
|
|
5026
5026
|
}
|
|
5027
5027
|
}
|
|
5028
|
-
|
|
|
5029
|
-
AbstractBehaviorEvent,
|
|
5030
|
-
'type',
|
|
5031
|
-
| 'annotation.toggle'
|
|
5032
|
-
| 'decorator.toggle'
|
|
5033
|
-
| 'insert.blocks'
|
|
5034
|
-
| 'list item.add'
|
|
5035
|
-
| 'list item.remove'
|
|
5036
|
-
| 'list item.toggle'
|
|
5037
|
-
| 'style.add'
|
|
5038
|
-
| 'style.remove'
|
|
5039
|
-
| 'style.toggle'
|
|
5040
|
-
>
|
|
5028
|
+
| AbstractBehaviorEvent
|
|
5041
5029
|
| SyntheticBehaviorEvent
|
|
5042
5030
|
| CustomBehaviorEvent
|
|
5043
5031
|
|
package/lib/index.js
CHANGED
|
@@ -881,7 +881,10 @@ const slateOperationCallback = ({
|
|
|
881
881
|
},
|
|
882
882
|
"not read only": ({
|
|
883
883
|
context
|
|
884
|
-
}) => !context.readOnly
|
|
884
|
+
}) => !context.readOnly,
|
|
885
|
+
"should skip setup": ({
|
|
886
|
+
context
|
|
887
|
+
}) => context.skipSetup
|
|
885
888
|
}
|
|
886
889
|
}).createMachine({
|
|
887
890
|
id: "range decorations",
|
|
@@ -891,6 +894,7 @@ const slateOperationCallback = ({
|
|
|
891
894
|
readOnly: input.readOnly,
|
|
892
895
|
pendingRangeDecorations: input.rangeDecorations,
|
|
893
896
|
decoratedRanges: [],
|
|
897
|
+
skipSetup: input.skipSetup,
|
|
894
898
|
schema: input.schema,
|
|
895
899
|
slateEditor: input.slateEditor,
|
|
896
900
|
updateCount: 0
|
|
@@ -908,9 +912,17 @@ const slateOperationCallback = ({
|
|
|
908
912
|
actions: ["assign readOnly"]
|
|
909
913
|
}
|
|
910
914
|
},
|
|
911
|
-
initial: "
|
|
915
|
+
initial: "setting up",
|
|
912
916
|
states: {
|
|
913
|
-
|
|
917
|
+
"setting up": {
|
|
918
|
+
always: [{
|
|
919
|
+
guard: and(["should skip setup", "has pending range decorations"]),
|
|
920
|
+
target: "ready",
|
|
921
|
+
actions: ["set up initial range decorations", "increment update count"]
|
|
922
|
+
}, {
|
|
923
|
+
guard: "should skip setup",
|
|
924
|
+
target: "ready"
|
|
925
|
+
}],
|
|
914
926
|
on: {
|
|
915
927
|
"range decorations updated": {
|
|
916
928
|
actions: ["update pending range decorations"]
|
|
@@ -1024,10 +1036,13 @@ const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|
|
|
1024
1036
|
"edit mode": "read only"
|
|
1025
1037
|
})), schemaTypes = useSelector(editorActor, (s_0) => s_0.context.schema), slateEditor = useSlate(), rangeDecorationsActor = useActorRef(rangeDecorationsMachine, {
|
|
1026
1038
|
input: {
|
|
1039
|
+
rangeDecorations: rangeDecorations ?? [],
|
|
1027
1040
|
readOnly,
|
|
1028
|
-
slateEditor,
|
|
1029
1041
|
schema: schemaTypes,
|
|
1030
|
-
|
|
1042
|
+
slateEditor,
|
|
1043
|
+
skipSetup: !editorActor.getSnapshot().matches({
|
|
1044
|
+
setup: "setting up"
|
|
1045
|
+
})
|
|
1031
1046
|
}
|
|
1032
1047
|
});
|
|
1033
1048
|
useSelector(rangeDecorationsActor, (s_1) => s_1.context.updateCount);
|