@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.
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +4 -1
- package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +4 -1
- package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
- package/lib/_chunks-es/selector.is-selection-expanded.js +1 -1
- package/lib/_chunks-es/util.slice-text-block.js +1 -1
- package/lib/index.cjs +10772 -10731
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +10734 -10693
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
- package/src/editor/components/render-block-object.tsx +11 -10
- package/src/editor/components/render-inline-object.tsx +12 -11
- package/src/editor/components/render-span.tsx +109 -149
- package/src/editor/components/render-text-block.tsx +45 -36
- package/src/editor/editor-provider.tsx +2 -3
- package/src/selectors/selector.is-overlapping-selection.test.ts +116 -0
- package/src/selectors/selector.is-overlapping-selection.ts +20 -4
- package/src/internal-utils/use-constant.ts +0 -15
|
@@ -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
|
-
}
|