@portabletext/editor 1.44.7 → 1.44.9
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 +15 -7
- 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 +15 -7
- 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/range-decorations-machine.ts +39 -24
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
|
@@ -859,6 +859,9 @@ const slateOperationCallback = ({
|
|
|
859
859
|
"slate operation listener": fromCallback(slateOperationCallback)
|
|
860
860
|
},
|
|
861
861
|
guards: {
|
|
862
|
+
"has pending range decorations": ({
|
|
863
|
+
context
|
|
864
|
+
}) => context.pendingRangeDecorations.length > 0,
|
|
862
865
|
"has range decorations": ({
|
|
863
866
|
context
|
|
864
867
|
}) => context.decoratedRanges.length > 0,
|
|
@@ -912,10 +915,13 @@ const slateOperationCallback = ({
|
|
|
912
915
|
"range decorations updated": {
|
|
913
916
|
actions: ["update pending range decorations"]
|
|
914
917
|
},
|
|
915
|
-
ready: {
|
|
918
|
+
ready: [{
|
|
916
919
|
target: "ready",
|
|
917
|
-
|
|
918
|
-
|
|
920
|
+
guard: "has pending range decorations",
|
|
921
|
+
actions: ["set up initial range decorations", "increment update count"]
|
|
922
|
+
}, {
|
|
923
|
+
target: "ready"
|
|
924
|
+
}]
|
|
919
925
|
}
|
|
920
926
|
},
|
|
921
927
|
ready: {
|
|
@@ -947,7 +953,7 @@ const slateOperationCallback = ({
|
|
|
947
953
|
}
|
|
948
954
|
});
|
|
949
955
|
function createDecorate(rangeDecorationActor) {
|
|
950
|
-
return function([, path]) {
|
|
956
|
+
return function([node, path]) {
|
|
951
957
|
if (isEqualToEmptyEditor(rangeDecorationActor.getSnapshot().context.slateEditor.children, rangeDecorationActor.getSnapshot().context.schema))
|
|
952
958
|
return [{
|
|
953
959
|
anchor: {
|
|
@@ -962,7 +968,10 @@ function createDecorate(rangeDecorationActor) {
|
|
|
962
968
|
}];
|
|
963
969
|
if (path.length === 0)
|
|
964
970
|
return [];
|
|
965
|
-
|
|
971
|
+
if (!Element$2.isElement(node) || node.children.length === 0)
|
|
972
|
+
return [];
|
|
973
|
+
const blockIndex = path.at(0);
|
|
974
|
+
return blockIndex === void 0 ? [] : rangeDecorationActor.getSnapshot().context.decoratedRanges.filter((decoratedRange) => Range.isCollapsed(decoratedRange) ? node.children.some((_, childIndex) => Path.equals(decoratedRange.anchor.path, [blockIndex, childIndex]) && Path.equals(decoratedRange.focus.path, [blockIndex, childIndex])) : Range.intersection(decoratedRange, {
|
|
966
975
|
anchor: {
|
|
967
976
|
path,
|
|
968
977
|
offset: 0
|
|
@@ -971,8 +980,7 @@ function createDecorate(rangeDecorationActor) {
|
|
|
971
980
|
path,
|
|
972
981
|
offset: 0
|
|
973
982
|
}
|
|
974
|
-
}) || Range.includes(
|
|
975
|
-
return result.length > 0 ? result : [];
|
|
983
|
+
}) || Range.includes(decoratedRange, path));
|
|
976
984
|
};
|
|
977
985
|
}
|
|
978
986
|
const debug = debugWithName("component:Editable"), PLACEHOLDER_STYLE = {
|