@portabletext/editor 7.0.0 → 7.0.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.js +21 -13
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -10906,28 +10906,36 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
|
|
|
10906
10906
|
if (!focusedTextBlock || !selectionCollapsed)
|
|
10907
10907
|
return !1;
|
|
10908
10908
|
const previousSibling = getSibling(snapshot, focusedTextBlock.path, "previous");
|
|
10909
|
-
|
|
10910
|
-
|
|
10911
|
-
|
|
10912
|
-
|
|
10909
|
+
if (!previousSibling || isListBlock(snapshot.context, focusedTextBlock.node))
|
|
10910
|
+
return !1;
|
|
10911
|
+
if (isEmptyTextBlock(snapshot.context, focusedTextBlock.node) && !isTextBlockNode(snapshot.context, previousSibling.node)) {
|
|
10912
|
+
const leaf = getLeaf(snapshot, previousSibling.path, {
|
|
10913
|
+
edge: "end"
|
|
10914
|
+
}), previousEndPoint = leaf ? {
|
|
10915
|
+
path: leaf.path,
|
|
10916
|
+
offset: isSpan(snapshot.context, leaf.node) ? leaf.node.text.length : 0
|
|
10917
|
+
} : {
|
|
10918
|
+
path: previousSibling.path,
|
|
10919
|
+
offset: 0
|
|
10920
|
+
};
|
|
10921
|
+
return {
|
|
10922
|
+
focusedTextBlock,
|
|
10923
|
+
previousEndPoint
|
|
10924
|
+
};
|
|
10925
|
+
}
|
|
10926
|
+
return !1;
|
|
10913
10927
|
},
|
|
10914
10928
|
actions: [(_, {
|
|
10915
10929
|
focusedTextBlock,
|
|
10916
|
-
|
|
10930
|
+
previousEndPoint
|
|
10917
10931
|
}) => [raise({
|
|
10918
10932
|
type: "delete.block",
|
|
10919
10933
|
at: focusedTextBlock.path
|
|
10920
10934
|
}), raise({
|
|
10921
10935
|
type: "select",
|
|
10922
10936
|
at: {
|
|
10923
|
-
anchor:
|
|
10924
|
-
|
|
10925
|
-
offset: 0
|
|
10926
|
-
},
|
|
10927
|
-
focus: {
|
|
10928
|
-
path: previousSibling.path,
|
|
10929
|
-
offset: 0
|
|
10930
|
-
}
|
|
10937
|
+
anchor: previousEndPoint,
|
|
10938
|
+
focus: previousEndPoint
|
|
10931
10939
|
}
|
|
10932
10940
|
})]]
|
|
10933
10941
|
}), deletingEmptyTextBlockBeforeBlockObject = defineBehavior({
|