@portabletext/editor 7.0.0 → 7.0.1

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 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
- return !previousSibling || isListBlock(snapshot.context, focusedTextBlock.node) ? !1 : isEmptyTextBlock(snapshot.context, focusedTextBlock.node) && !isTextBlockNode(snapshot.context, previousSibling.node) ? {
10910
- focusedTextBlock,
10911
- previousSibling
10912
- } : !1;
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
- previousSibling
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
- path: previousSibling.path,
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({