@portabletext/editor 1.47.7 → 1.47.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 +16 -2
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +17 -3
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- 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 +1 -1
- package/src/behaviors/behavior.abstract.insert.ts +40 -30
- package/src/editor/range-decorations-machine.ts +19 -11
|
@@ -5915,15 +5915,29 @@ const EditorActorContext = React.createContext({}), abstractAnnotationBehaviors
|
|
|
5915
5915
|
guard: ({
|
|
5916
5916
|
snapshot,
|
|
5917
5917
|
event
|
|
5918
|
-
}) =>
|
|
5918
|
+
}) => {
|
|
5919
|
+
if (event.placement !== "auto")
|
|
5920
|
+
return !1;
|
|
5921
|
+
const focusTextBlock = selector_isOverlappingSelection.getFocusTextBlock(snapshot);
|
|
5922
|
+
return focusTextBlock ? {
|
|
5923
|
+
focusTextBlock
|
|
5924
|
+
} : !1;
|
|
5925
|
+
},
|
|
5919
5926
|
actions: [({
|
|
5920
5927
|
event
|
|
5928
|
+
}, {
|
|
5929
|
+
focusTextBlock
|
|
5921
5930
|
}) => event.blocks.length === 1 ? [behavior_core.raise({
|
|
5922
5931
|
type: "insert.block",
|
|
5923
5932
|
block: event.blocks[0],
|
|
5924
5933
|
placement: "auto",
|
|
5925
5934
|
select: "end"
|
|
5926
|
-
})] : event.blocks.
|
|
5935
|
+
})] : util_sliceBlocks.isEmptyTextBlock(focusTextBlock.node) ? event.blocks.map((block, index) => behavior_core.raise({
|
|
5936
|
+
type: "insert.block",
|
|
5937
|
+
block,
|
|
5938
|
+
placement: index === 0 ? "auto" : "after",
|
|
5939
|
+
select: "end"
|
|
5940
|
+
})) : event.blocks.flatMap((block, index) => index === 0 ? [behavior_core.raise({
|
|
5927
5941
|
type: "split.block"
|
|
5928
5942
|
}), behavior_core.raise({
|
|
5929
5943
|
type: "select.previous block",
|