@portabletext/editor 1.41.2 → 1.41.3

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
@@ -9,6 +9,7 @@ import { Editor, Range, Element as Element$2, Text, Transforms, Path } from "sla
9
9
  import { useSlateStatic, useSelected, ReactEditor, useSlate, Editable } from "slate-react";
10
10
  import { getBlockEndPoint, getBlockStartPoint, isKeyedSegment } from "./_chunks-es/util.slice-blocks.js";
11
11
  import { isSelectionCollapsed, getFocusTextBlock, getFocusSpan, getSelectedBlocks, isSelectionExpanded, getSelectionStartBlock, getSelectionEndBlock, getFocusBlock } from "./_chunks-es/selector.is-at-the-start-of-block.js";
12
+ import { getFocusInlineObject } from "./_chunks-es/selector.get-focus-inline-object.js";
12
13
  import { isOverlappingSelection, isSelectingEntireBlocks } from "./_chunks-es/selector.is-overlapping-selection.js";
13
14
  import { DOMEditor, isDOMNode } from "slate-dom";
14
15
  import { isSelectionCollapsed as isSelectionCollapsed$1, getSelectionEndPoint } from "./_chunks-es/util.is-selection-collapsed.js";
@@ -35,25 +36,32 @@ function getDragSelection({
35
36
  snapshot
36
37
  }) {
37
38
  let dragSelection = eventSelection;
38
- const collapsedSelection = isSelectionCollapsed({
39
+ if (getFocusInlineObject({
39
40
  context: {
40
41
  ...snapshot.context,
41
42
  selection: eventSelection
42
43
  }
43
- }), focusTextBlock = getFocusTextBlock({
44
+ }))
45
+ return dragSelection;
46
+ const draggingCollapsedSelection = isSelectionCollapsed({
44
47
  context: {
45
48
  ...snapshot.context,
46
49
  selection: eventSelection
47
50
  }
48
- }), focusSpan = getFocusSpan({
51
+ }), draggedTextBlock = getFocusTextBlock({
52
+ context: {
53
+ ...snapshot.context,
54
+ selection: eventSelection
55
+ }
56
+ }), draggedSpan = getFocusSpan({
49
57
  context: {
50
58
  ...snapshot.context,
51
59
  selection: eventSelection
52
60
  }
53
61
  });
54
- collapsedSelection && focusTextBlock && focusSpan && (dragSelection = {
55
- anchor: getBlockStartPoint(focusTextBlock),
56
- focus: getBlockEndPoint(focusTextBlock)
62
+ draggingCollapsedSelection && draggedTextBlock && draggedSpan && (dragSelection = {
63
+ anchor: getBlockStartPoint(draggedTextBlock),
64
+ focus: getBlockEndPoint(draggedTextBlock)
57
65
  });
58
66
  const selectedBlocks = getSelectedBlocks(snapshot);
59
67
  if (snapshot.context.selection && isSelectionExpanded(snapshot) && selectedBlocks.length > 1) {