@portabletext/editor 2.6.10-canary.0 → 2.7.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.
@@ -44,6 +44,22 @@ export function isOverlappingSelection(
44
44
  return false
45
45
  }
46
46
 
47
+ const startPointEqualToOriginalStartPoint = isEqualSelectionPoints(
48
+ selectionStartPoint,
49
+ originalSelectionStartPoint,
50
+ )
51
+ const endPointEqualToOriginalEndPoint = isEqualSelectionPoints(
52
+ selectionEndPoint,
53
+ originalSelectionEndPoint,
54
+ )
55
+
56
+ if (
57
+ startPointEqualToOriginalStartPoint &&
58
+ endPointEqualToOriginalEndPoint
59
+ ) {
60
+ return true
61
+ }
62
+
47
63
  const startPointBeforeSelection =
48
64
  isPointBeforeSelection(selectionStartPoint)(snapshot)
49
65
  const startPointAfterSelection =
@@ -103,14 +119,14 @@ export function isOverlappingSelection(
103
119
  },
104
120
  })
105
121
 
106
- const endPointEqualToOriginalStartPoint = isEqualSelectionPoints(
107
- selectionEndPoint,
108
- originalSelectionStartPoint,
109
- )
110
122
  const startPointEqualToOriginalEndPoint = isEqualSelectionPoints(
111
123
  selectionStartPoint,
112
124
  originalSelectionEndPoint,
113
125
  )
126
+ const endPointEqualToOriginalStartPoint = isEqualSelectionPoints(
127
+ selectionEndPoint,
128
+ originalSelectionStartPoint,
129
+ )
114
130
 
115
131
  // If all checks fail then we can deduce that the selection does not exist
116
132
  // and there doesn't overlap with the snapshot selection
@@ -1,15 +0,0 @@
1
- import React from 'react'
2
-
3
- type ConstantRef<TConstant> = {constant: TConstant}
4
-
5
- export default function useConstant<TConstant>(
6
- factory: () => TConstant,
7
- ): TConstant {
8
- const ref = React.useRef<ConstantRef<TConstant>>(null)
9
-
10
- if (!ref.current) {
11
- ref.current = {constant: factory()}
12
- }
13
-
14
- return ref.current.constant
15
- }