@portabletext/editor 5.0.0 → 5.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 CHANGED
@@ -6584,7 +6584,7 @@ const addAnnotationOnCollapsedSelection = defineBehavior({
6584
6584
  snapshot
6585
6585
  }) => {
6586
6586
  const focusTextBlock = getFocusTextBlock(snapshot), selectionCollapsed = isSelectionCollapsed$1(snapshot), previousBlock = getPreviousBlock(snapshot);
6587
- return !focusTextBlock || !selectionCollapsed || !previousBlock ? !1 : isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !isTextBlock(snapshot.context, previousBlock.node) ? {
6587
+ return !focusTextBlock || !selectionCollapsed || !previousBlock || isListBlock(snapshot.context, focusTextBlock.node) ? !1 : isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !isTextBlock(snapshot.context, previousBlock.node) ? {
6588
6588
  focusTextBlock,
6589
6589
  previousBlock
6590
6590
  } : !1;
@@ -8198,6 +8198,13 @@ const addAnnotationOperationImplementation = ({
8198
8198
  endRef.current && startRef.current && Transforms.removeNodes(operation.editor, {
8199
8199
  at: endRef.current,
8200
8200
  voids: !1
8201
+ }), startRef.current && operation.editor.apply({
8202
+ type: "set_selection",
8203
+ properties: operation.editor.selection,
8204
+ newProperties: {
8205
+ anchor: startRef.current,
8206
+ focus: startRef.current
8207
+ }
8201
8208
  });
8202
8209
  return;
8203
8210
  }