@portabletext/editor 1.47.8 → 1.47.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/index.cjs +11 -8
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +12 -9
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/editor/range-decorations-machine.ts +19 -11
package/lib/index.cjs
CHANGED
|
@@ -748,15 +748,14 @@ const slateOperationCallback = ({
|
|
|
748
748
|
actions: {
|
|
749
749
|
"update pending range decorations": xstate.assign({
|
|
750
750
|
pendingRangeDecorations: ({
|
|
751
|
+
context,
|
|
751
752
|
event
|
|
752
|
-
}) =>
|
|
753
|
+
}) => event.type !== "range decorations updated" ? context.pendingRangeDecorations : event.rangeDecorations
|
|
753
754
|
}),
|
|
754
755
|
"set up initial range decorations": xstate.assign({
|
|
755
756
|
decoratedRanges: ({
|
|
756
|
-
context
|
|
757
|
-
event
|
|
757
|
+
context
|
|
758
758
|
}) => {
|
|
759
|
-
xstate.assertEvent(event, "ready");
|
|
760
759
|
const rangeDecorationState = [];
|
|
761
760
|
for (const rangeDecoration of context.pendingRangeDecorations) {
|
|
762
761
|
const slateRange = editorProvider.toSlateRange(rangeDecoration.selection, context.slateEditor);
|
|
@@ -781,7 +780,8 @@ const slateOperationCallback = ({
|
|
|
781
780
|
context,
|
|
782
781
|
event
|
|
783
782
|
}) => {
|
|
784
|
-
|
|
783
|
+
if (event.type !== "range decorations updated")
|
|
784
|
+
return context.decoratedRanges;
|
|
785
785
|
const rangeDecorationState = [];
|
|
786
786
|
for (const rangeDecoration of event.rangeDecorations) {
|
|
787
787
|
const slateRange = editorProvider.toSlateRange(rangeDecoration.selection, context.slateEditor);
|
|
@@ -806,7 +806,8 @@ const slateOperationCallback = ({
|
|
|
806
806
|
context,
|
|
807
807
|
event
|
|
808
808
|
}) => {
|
|
809
|
-
|
|
809
|
+
if (event.type !== "slate operation")
|
|
810
|
+
return context.decoratedRanges;
|
|
810
811
|
const rangeDecorationState = [];
|
|
811
812
|
for (const decoratedRange of context.decoratedRanges) {
|
|
812
813
|
const slateRange = editorProvider.toSlateRange(decoratedRange.rangeDecoration.selection, context.slateEditor);
|
|
@@ -848,8 +849,9 @@ const slateOperationCallback = ({
|
|
|
848
849
|
}),
|
|
849
850
|
"assign readOnly": xstate.assign({
|
|
850
851
|
readOnly: ({
|
|
852
|
+
context,
|
|
851
853
|
event
|
|
852
|
-
}) =>
|
|
854
|
+
}) => event.type !== "update read only" ? context.readOnly : event.readOnly
|
|
853
855
|
}),
|
|
854
856
|
"increment update count": xstate.assign({
|
|
855
857
|
updateCount: ({
|
|
@@ -871,7 +873,8 @@ const slateOperationCallback = ({
|
|
|
871
873
|
context,
|
|
872
874
|
event
|
|
873
875
|
}) => {
|
|
874
|
-
|
|
876
|
+
if (event.type !== "range decorations updated")
|
|
877
|
+
return !1;
|
|
875
878
|
const existingRangeDecorations = context.decoratedRanges.map((decoratedRange) => ({
|
|
876
879
|
anchor: decoratedRange.rangeDecoration.selection?.anchor,
|
|
877
880
|
focus: decoratedRange.rangeDecoration.selection?.focus
|