@portabletext/editor 1.41.2 → 1.41.4
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/behavior.core.cjs +52 -28
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/behavior.markdown.cjs +11 -11
- package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +24 -21
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs +11 -0
- package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.get-text-before.cjs +2 -2
- package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-active-style.cjs +240 -0
- package/lib/_chunks-cjs/selector.is-active-style.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +300 -218
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +27 -3
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/behavior.markdown.js +1 -1
- package/lib/_chunks-es/editor-provider.js +5 -2
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/selector.get-focus-inline-object.js +13 -0
- package/lib/_chunks-es/selector.get-focus-inline-object.js.map +1 -0
- package/lib/_chunks-es/selector.get-text-before.js +1 -1
- package/lib/_chunks-es/selector.is-active-style.js +243 -0
- package/lib/_chunks-es/selector.is-active-style.js.map +1 -0
- package/lib/_chunks-es/selector.is-overlapping-selection.js +298 -217
- package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
- package/lib/behaviors/index.cjs +9 -9
- package/lib/behaviors/index.cjs.map +1 -1
- package/lib/behaviors/index.js +1 -1
- package/lib/index.cjs +85 -105
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +80 -99
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +6 -6
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.js +1 -1
- package/lib/selectors/index.cjs +37 -43
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.js +5 -10
- package/lib/selectors/index.js.map +1 -1
- package/package.json +1 -1
- package/src/behaviors/behavior.core.dnd.ts +27 -0
- package/src/behaviors/behavior.core.ts +2 -0
- package/src/behaviors/behavior.default.ts +4 -0
- package/src/editor/Editable.tsx +22 -40
- package/src/internal-utils/drag-selection.test.ts +1 -1
- package/src/internal-utils/drag-selection.ts +23 -6
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs +0 -322
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs.map +0 -1
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +0 -324
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +0 -1
- package/src/internal-utils/dragging-on-drag-origin.ts +0 -22
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isPortableTextSpan } from "@sanity/types";
|
|
2
|
+
import { getFocusChild } from "./selector.is-overlapping-selection.js";
|
|
3
|
+
const getFocusInlineObject = (snapshot) => {
|
|
4
|
+
const focusChild = getFocusChild(snapshot);
|
|
5
|
+
return focusChild && !isPortableTextSpan(focusChild.node) ? {
|
|
6
|
+
node: focusChild.node,
|
|
7
|
+
path: focusChild.path
|
|
8
|
+
} : void 0;
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
getFocusInlineObject
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=selector.get-focus-inline-object.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.get-focus-inline-object.js","sources":["../../src/selectors/selector.get-focus-inline-object.ts"],"sourcesContent":["import {\n isPortableTextSpan,\n type KeyedSegment,\n type PortableTextObject,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getFocusChild} from './selectors'\n\n/**\n * @public\n */\nexport const getFocusInlineObject: EditorSelector<\n | {node: PortableTextObject; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const focusChild = getFocusChild(snapshot)\n\n return focusChild && !isPortableTextSpan(focusChild.node)\n ? {node: focusChild.node, path: focusChild.path}\n : undefined\n}\n"],"names":["getFocusInlineObject","snapshot","focusChild","getFocusChild","isPortableTextSpan","node","path","undefined"],"mappings":";;AAWO,MAAMA,uBAGRC,CAAa,aAAA;AACVC,QAAAA,aAAaC,cAAcF,QAAQ;AAEzC,SAAOC,cAAc,CAACE,mBAAmBF,WAAWG,IAAI,IACpD;AAAA,IAACA,MAAMH,WAAWG;AAAAA,IAAMC,MAAMJ,WAAWI;AAAAA,EAAAA,IACzCC;AACN;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getBlockStartPoint, isKeyedSegment, reverseSelection } from "./util.slice-blocks.js";
|
|
2
|
-
import { getSelectionText } from "./selector.is-
|
|
2
|
+
import { getSelectionText } from "./selector.is-overlapping-selection.js";
|
|
3
3
|
const getBlockTextBefore = (snapshot) => {
|
|
4
4
|
if (!snapshot.context.selection)
|
|
5
5
|
return "";
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { getBlockStartPoint, getBlockEndPoint, isEqualSelectionPoints, isEmptyTextBlock, isKeyedSegment } from "./util.slice-blocks.js";
|
|
2
|
+
import { getSelectionStartBlock, getSelectionEndBlock, getSelectedBlocks, createGuards, isSelectionCollapsed, getSelectionStartPoint, getSelectionEndPoint, getFocusTextBlock, getFocusSpan, isSelectionExpanded } from "./selector.is-overlapping-selection.js";
|
|
3
|
+
import { isKeySegment, isPortableTextTextBlock, isPortableTextSpan } from "@sanity/types";
|
|
4
|
+
const isSelectingEntireBlocks = (snapshot) => {
|
|
5
|
+
if (!snapshot.context.selection)
|
|
6
|
+
return !1;
|
|
7
|
+
const startPoint = snapshot.context.selection.backward ? snapshot.context.selection.focus : snapshot.context.selection.anchor, endPoint = snapshot.context.selection.backward ? snapshot.context.selection.anchor : snapshot.context.selection.focus, startBlock = getSelectionStartBlock(snapshot), endBlock = getSelectionEndBlock(snapshot);
|
|
8
|
+
if (!startBlock || !endBlock)
|
|
9
|
+
return !1;
|
|
10
|
+
const startBlockStartPoint = getBlockStartPoint(startBlock), endBlockEndPoint = getBlockEndPoint(endBlock);
|
|
11
|
+
return isEqualSelectionPoints(startBlockStartPoint, startPoint) && isEqualSelectionPoints(endBlockEndPoint, endPoint);
|
|
12
|
+
}, getSelectedSpans = (snapshot) => {
|
|
13
|
+
if (!snapshot.context.selection)
|
|
14
|
+
return [];
|
|
15
|
+
const selectedSpans = [], startPoint = snapshot.context.selection.backward ? snapshot.context.selection.focus : snapshot.context.selection.anchor, endPoint = snapshot.context.selection.backward ? snapshot.context.selection.anchor : snapshot.context.selection.focus, startBlockKey = isKeySegment(startPoint.path[0]) ? startPoint.path[0]._key : void 0, endBlockKey = isKeySegment(endPoint.path[0]) ? endPoint.path[0]._key : void 0;
|
|
16
|
+
if (!startBlockKey || !endBlockKey)
|
|
17
|
+
return selectedSpans;
|
|
18
|
+
const startSpanKey = isKeySegment(startPoint.path[2]) ? startPoint.path[2]._key : void 0, endSpanKey = isKeySegment(endPoint.path[2]) ? endPoint.path[2]._key : void 0;
|
|
19
|
+
let startBlockFound = !1;
|
|
20
|
+
for (const block of snapshot.context.value)
|
|
21
|
+
if (block._key === startBlockKey && (startBlockFound = !0), !!isPortableTextTextBlock(block)) {
|
|
22
|
+
if (block._key === startBlockKey) {
|
|
23
|
+
for (const child of block.children)
|
|
24
|
+
if (isPortableTextSpan(child)) {
|
|
25
|
+
if (startSpanKey && child._key === startSpanKey) {
|
|
26
|
+
if (startPoint.offset < child.text.length && selectedSpans.push({
|
|
27
|
+
node: child,
|
|
28
|
+
path: [{
|
|
29
|
+
_key: block._key
|
|
30
|
+
}, "children", {
|
|
31
|
+
_key: child._key
|
|
32
|
+
}]
|
|
33
|
+
}), startSpanKey === endSpanKey)
|
|
34
|
+
break;
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if (endSpanKey && child._key === endSpanKey) {
|
|
38
|
+
endPoint.offset > 0 && selectedSpans.push({
|
|
39
|
+
node: child,
|
|
40
|
+
path: [{
|
|
41
|
+
_key: block._key
|
|
42
|
+
}, "children", {
|
|
43
|
+
_key: child._key
|
|
44
|
+
}]
|
|
45
|
+
});
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
selectedSpans.length > 0 && selectedSpans.push({
|
|
49
|
+
node: child,
|
|
50
|
+
path: [{
|
|
51
|
+
_key: block._key
|
|
52
|
+
}, "children", {
|
|
53
|
+
_key: child._key
|
|
54
|
+
}]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (startBlockKey === endBlockKey)
|
|
58
|
+
break;
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (block._key === endBlockKey) {
|
|
62
|
+
for (const child of block.children)
|
|
63
|
+
if (isPortableTextSpan(child)) {
|
|
64
|
+
if (endSpanKey && child._key === endSpanKey) {
|
|
65
|
+
endPoint.offset > 0 && selectedSpans.push({
|
|
66
|
+
node: child,
|
|
67
|
+
path: [{
|
|
68
|
+
_key: block._key
|
|
69
|
+
}, "children", {
|
|
70
|
+
_key: child._key
|
|
71
|
+
}]
|
|
72
|
+
});
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
75
|
+
selectedSpans.push({
|
|
76
|
+
node: child,
|
|
77
|
+
path: [{
|
|
78
|
+
_key: block._key
|
|
79
|
+
}, "children", {
|
|
80
|
+
_key: child._key
|
|
81
|
+
}]
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
if (startBlockFound)
|
|
87
|
+
for (const child of block.children)
|
|
88
|
+
isPortableTextSpan(child) && selectedSpans.push({
|
|
89
|
+
node: child,
|
|
90
|
+
path: [{
|
|
91
|
+
_key: block._key
|
|
92
|
+
}, "children", {
|
|
93
|
+
_key: child._key
|
|
94
|
+
}]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
return selectedSpans;
|
|
98
|
+
}, getActiveListItem = (snapshot) => {
|
|
99
|
+
if (!snapshot.context.selection)
|
|
100
|
+
return;
|
|
101
|
+
const guards = createGuards(snapshot.context), selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter(guards.isTextBlock), firstTextBlock = selectedTextBlocks.at(0);
|
|
102
|
+
if (!firstTextBlock)
|
|
103
|
+
return;
|
|
104
|
+
const firstListItem = firstTextBlock.listItem;
|
|
105
|
+
if (firstListItem && selectedTextBlocks.every((block) => block.listItem === firstListItem))
|
|
106
|
+
return firstListItem;
|
|
107
|
+
}, getActiveStyle = (snapshot) => {
|
|
108
|
+
if (!snapshot.context.selection)
|
|
109
|
+
return;
|
|
110
|
+
const guards = createGuards(snapshot.context), selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter(guards.isTextBlock), firstTextBlock = selectedTextBlocks.at(0);
|
|
111
|
+
if (!firstTextBlock)
|
|
112
|
+
return;
|
|
113
|
+
const firstStyle = firstTextBlock.style;
|
|
114
|
+
if (firstStyle && selectedTextBlocks.every((block) => block.style === firstStyle))
|
|
115
|
+
return firstStyle;
|
|
116
|
+
}, getTrimmedSelection = (snapshot) => {
|
|
117
|
+
if (!snapshot.context.selection)
|
|
118
|
+
return snapshot.context.selection;
|
|
119
|
+
const startPoint = getSelectionStartPoint(snapshot), endPoint = getSelectionEndPoint(snapshot);
|
|
120
|
+
if (!startPoint || !endPoint)
|
|
121
|
+
return snapshot.context.selection;
|
|
122
|
+
const startBlockKey = isKeyedSegment(startPoint.path[0]) ? startPoint.path[0]._key : null, startChildKey = isKeyedSegment(startPoint.path[2]) ? startPoint.path[2]._key : null, endBlockKey = isKeyedSegment(endPoint.path[0]) ? endPoint.path[0]._key : null, endChildKey = isKeyedSegment(endPoint.path[2]) ? endPoint.path[2]._key : null;
|
|
123
|
+
if (!startBlockKey || !endBlockKey)
|
|
124
|
+
return snapshot.context.selection;
|
|
125
|
+
let startBlockFound = !1, adjustedStartPoint, trimStartPoint = !1, adjustedEndPoint, trimEndPoint = !1, previousPotentialEndpoint;
|
|
126
|
+
for (const block of snapshot.context.value)
|
|
127
|
+
if (!(block._key === startBlockKey && (startBlockFound = !0, isPortableTextTextBlock(block) && isEmptyTextBlock(block))) && startBlockFound && isPortableTextTextBlock(block)) {
|
|
128
|
+
if (block._key === endBlockKey && isEmptyTextBlock(block))
|
|
129
|
+
break;
|
|
130
|
+
for (const child of block.children) {
|
|
131
|
+
if (child._key === endChildKey && (!isPortableTextSpan(child) || endPoint.offset === 0)) {
|
|
132
|
+
adjustedEndPoint = previousPotentialEndpoint ? {
|
|
133
|
+
path: [{
|
|
134
|
+
_key: previousPotentialEndpoint.blockKey
|
|
135
|
+
}, "children", {
|
|
136
|
+
_key: previousPotentialEndpoint.span._key
|
|
137
|
+
}],
|
|
138
|
+
offset: previousPotentialEndpoint.span.text.length
|
|
139
|
+
} : void 0, trimEndPoint = !0;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
if (trimStartPoint) {
|
|
143
|
+
const lonelySpan = isPortableTextSpan(child) && block.children.length === 1;
|
|
144
|
+
(isPortableTextSpan(child) && child.text.length > 0 || lonelySpan) && (adjustedStartPoint = {
|
|
145
|
+
path: [{
|
|
146
|
+
_key: block._key
|
|
147
|
+
}, "children", {
|
|
148
|
+
_key: child._key
|
|
149
|
+
}],
|
|
150
|
+
offset: 0
|
|
151
|
+
}, previousPotentialEndpoint = {
|
|
152
|
+
blockKey: block._key,
|
|
153
|
+
span: child
|
|
154
|
+
}, trimStartPoint = !1);
|
|
155
|
+
continue;
|
|
156
|
+
}
|
|
157
|
+
if (child._key === startChildKey) {
|
|
158
|
+
if (!isPortableTextSpan(child)) {
|
|
159
|
+
trimStartPoint = !0;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (startPoint.offset === child.text.length) {
|
|
163
|
+
trimStartPoint = !0, previousPotentialEndpoint = child.text.length > 0 ? {
|
|
164
|
+
blockKey: block._key,
|
|
165
|
+
span: child
|
|
166
|
+
} : previousPotentialEndpoint;
|
|
167
|
+
continue;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
previousPotentialEndpoint = isPortableTextSpan(child) && child.text.length > 0 ? {
|
|
171
|
+
blockKey: block._key,
|
|
172
|
+
span: child
|
|
173
|
+
} : previousPotentialEndpoint;
|
|
174
|
+
}
|
|
175
|
+
if (block._key === endBlockKey)
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
const trimmedSelection = snapshot.context.selection.backward ? {
|
|
179
|
+
anchor: trimEndPoint && adjustedEndPoint ? adjustedEndPoint : endPoint,
|
|
180
|
+
focus: adjustedStartPoint ?? startPoint,
|
|
181
|
+
backward: !0
|
|
182
|
+
} : {
|
|
183
|
+
anchor: adjustedStartPoint ?? startPoint,
|
|
184
|
+
focus: trimEndPoint && adjustedEndPoint ? adjustedEndPoint : endPoint
|
|
185
|
+
};
|
|
186
|
+
if (isSelectionCollapsed({
|
|
187
|
+
context: {
|
|
188
|
+
...snapshot.context,
|
|
189
|
+
selection: trimmedSelection
|
|
190
|
+
}
|
|
191
|
+
})) {
|
|
192
|
+
const focusTextBlock = getFocusTextBlock({
|
|
193
|
+
context: {
|
|
194
|
+
...snapshot.context,
|
|
195
|
+
selection: trimmedSelection
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
if (focusTextBlock && !isEmptyTextBlock(focusTextBlock.node))
|
|
199
|
+
return null;
|
|
200
|
+
}
|
|
201
|
+
return trimmedSelection;
|
|
202
|
+
};
|
|
203
|
+
function isActiveAnnotation(annotation) {
|
|
204
|
+
return (snapshot) => {
|
|
205
|
+
if (!snapshot.context.selection)
|
|
206
|
+
return !1;
|
|
207
|
+
const selectedBlocks = getSelectedBlocks(snapshot), focusSpan = getFocusSpan(snapshot), selectedSpans = isSelectionExpanded(snapshot) ? getSelectedSpans(snapshot) : focusSpan ? [focusSpan] : [];
|
|
208
|
+
if (selectedSpans.length === 0 || selectedSpans.some((span) => !span.node.marks || span.node.marks?.length === 0))
|
|
209
|
+
return !1;
|
|
210
|
+
const selectionMarkDefs = selectedBlocks.flatMap((block) => isPortableTextTextBlock(block.node) ? block.node.markDefs ?? [] : []);
|
|
211
|
+
return selectedSpans.every((span) => (span.node.marks?.flatMap((mark) => {
|
|
212
|
+
const markDef = selectionMarkDefs.find((markDef2) => markDef2._key === mark);
|
|
213
|
+
return markDef ? [markDef._type] : [];
|
|
214
|
+
}) ?? []).includes(annotation));
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function isActiveDecorator(decorator) {
|
|
218
|
+
return (snapshot) => {
|
|
219
|
+
if (isSelectionExpanded(snapshot)) {
|
|
220
|
+
const selectedSpans = getSelectedSpans(snapshot);
|
|
221
|
+
return selectedSpans.length > 0 && selectedSpans.every((span) => span.node.marks?.includes(decorator));
|
|
222
|
+
}
|
|
223
|
+
return snapshot.context.activeDecorators.includes(decorator);
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
function isActiveListItem(listItem) {
|
|
227
|
+
return (snapshot) => getActiveListItem(snapshot) === listItem;
|
|
228
|
+
}
|
|
229
|
+
function isActiveStyle(style) {
|
|
230
|
+
return (snapshot) => getActiveStyle(snapshot) === style;
|
|
231
|
+
}
|
|
232
|
+
export {
|
|
233
|
+
getActiveListItem,
|
|
234
|
+
getActiveStyle,
|
|
235
|
+
getSelectedSpans,
|
|
236
|
+
getTrimmedSelection,
|
|
237
|
+
isActiveAnnotation,
|
|
238
|
+
isActiveDecorator,
|
|
239
|
+
isActiveListItem,
|
|
240
|
+
isActiveStyle,
|
|
241
|
+
isSelectingEntireBlocks
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=selector.is-active-style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector.is-active-style.js","sources":["../../src/selectors/selector.is-selecting-entire-blocks.ts","../../src/selectors/selector.get-selected-spans.ts","../../src/selectors/selector.get-active-list-item.ts","../../src/selectors/selector.get-active-style.ts","../../src/selectors/selector.get-trimmed-selection.ts","../../src/selectors/selector.is-active-annotation.ts","../../src/selectors/selector.is-active-decorator.ts","../../src/selectors/selector.is-active-list-item.ts","../../src/selectors/selector.is-active-style.ts"],"sourcesContent":["import type {EditorSelector} from '../editor/editor-selector'\nimport * as utils from '../utils'\nimport {getSelectionEndBlock, getSelectionStartBlock} from './selectors'\n\n/**\n * @public\n */\nexport const isSelectingEntireBlocks: EditorSelector<boolean> = (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const startPoint = snapshot.context.selection.backward\n ? snapshot.context.selection.focus\n : snapshot.context.selection.anchor\n const endPoint = snapshot.context.selection.backward\n ? snapshot.context.selection.anchor\n : snapshot.context.selection.focus\n\n const startBlock = getSelectionStartBlock(snapshot)\n const endBlock = getSelectionEndBlock(snapshot)\n\n if (!startBlock || !endBlock) {\n return false\n }\n\n const startBlockStartPoint = utils.getBlockStartPoint(startBlock)\n const endBlockEndPoint = utils.getBlockEndPoint(endBlock)\n\n return (\n utils.isEqualSelectionPoints(startBlockStartPoint, startPoint) &&\n utils.isEqualSelectionPoints(endBlockEndPoint, endPoint)\n )\n}\n","import {\n isKeySegment,\n isPortableTextSpan,\n isPortableTextTextBlock,\n type KeyedSegment,\n type PortableTextSpan,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelectedSpans: EditorSelector<\n Array<{\n node: PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }>\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return []\n }\n\n const selectedSpans: Array<{\n node: PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }> = []\n\n const startPoint = snapshot.context.selection.backward\n ? snapshot.context.selection.focus\n : snapshot.context.selection.anchor\n const endPoint = snapshot.context.selection.backward\n ? snapshot.context.selection.anchor\n : snapshot.context.selection.focus\n\n const startBlockKey = isKeySegment(startPoint.path[0])\n ? startPoint.path[0]._key\n : undefined\n const endBlockKey = isKeySegment(endPoint.path[0])\n ? endPoint.path[0]._key\n : undefined\n\n if (!startBlockKey || !endBlockKey) {\n return selectedSpans\n }\n\n const startSpanKey = isKeySegment(startPoint.path[2])\n ? startPoint.path[2]._key\n : undefined\n const endSpanKey = isKeySegment(endPoint.path[2])\n ? endPoint.path[2]._key\n : undefined\n\n let startBlockFound = false\n\n for (const block of snapshot.context.value) {\n if (block._key === startBlockKey) {\n startBlockFound = true\n }\n\n if (!isPortableTextTextBlock(block)) {\n continue\n }\n\n if (block._key === startBlockKey) {\n for (const child of block.children) {\n if (!isPortableTextSpan(child)) {\n continue\n }\n\n if (startSpanKey && child._key === startSpanKey) {\n if (startPoint.offset < child.text.length) {\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n }\n\n if (startSpanKey === endSpanKey) {\n break\n }\n\n continue\n }\n\n if (endSpanKey && child._key === endSpanKey) {\n if (endPoint.offset > 0) {\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n }\n break\n }\n\n if (selectedSpans.length > 0) {\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n }\n }\n\n if (startBlockKey === endBlockKey) {\n break\n }\n\n continue\n }\n\n if (block._key === endBlockKey) {\n for (const child of block.children) {\n if (!isPortableTextSpan(child)) {\n continue\n }\n\n if (endSpanKey && child._key === endSpanKey) {\n if (endPoint.offset > 0) {\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n }\n break\n }\n\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n }\n\n break\n }\n\n if (startBlockFound) {\n for (const child of block.children) {\n if (!isPortableTextSpan(child)) {\n continue\n }\n\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n }\n }\n }\n\n return selectedSpans\n}\n","import type {PortableTextListBlock} from '@sanity/types'\nimport {createGuards} from '../behavior-actions/behavior.guards'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getSelectedBlocks} from './selectors'\n\n/**\n * @public\n */\nexport const getActiveListItem: EditorSelector<\n PortableTextListBlock['listItem'] | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const guards = createGuards(snapshot.context)\n const selectedBlocks = getSelectedBlocks(snapshot).map((block) => block.node)\n const selectedTextBlocks = selectedBlocks.filter(guards.isTextBlock)\n\n const firstTextBlock = selectedTextBlocks.at(0)\n\n if (!firstTextBlock) {\n return undefined\n }\n\n const firstListItem = firstTextBlock.listItem\n\n if (!firstListItem) {\n return undefined\n }\n\n if (selectedTextBlocks.every((block) => block.listItem === firstListItem)) {\n return firstListItem\n }\n\n return undefined\n}\n","import type {PortableTextTextBlock} from '@sanity/types'\nimport {createGuards} from '../behavior-actions/behavior.guards'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getSelectedBlocks} from './selectors'\n\n/**\n * @public\n */\nexport const getActiveStyle: EditorSelector<PortableTextTextBlock['style']> = (\n snapshot,\n) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const guards = createGuards(snapshot.context)\n const selectedBlocks = getSelectedBlocks(snapshot).map((block) => block.node)\n const selectedTextBlocks = selectedBlocks.filter(guards.isTextBlock)\n\n const firstTextBlock = selectedTextBlocks.at(0)\n\n if (!firstTextBlock) {\n return undefined\n }\n\n const firstStyle = firstTextBlock.style\n\n if (!firstStyle) {\n return undefined\n }\n\n if (selectedTextBlocks.every((block) => block.style === firstStyle)) {\n return firstStyle\n }\n\n return undefined\n}\n","import {\n isPortableTextSpan,\n isPortableTextTextBlock,\n type PortableTextSpan,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelection, EditorSelectionPoint} from '../types/editor'\nimport {isEmptyTextBlock, isKeyedSegment} from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\nimport {isSelectionCollapsed} from './selector.is-selection-collapsed'\nimport {getFocusTextBlock} from './selectors'\n\n/**\n * @public\n */\nexport const getTrimmedSelection: EditorSelector<EditorSelection> = (\n snapshot,\n) => {\n if (!snapshot.context.selection) {\n return snapshot.context.selection\n }\n\n const startPoint = getSelectionStartPoint(snapshot)\n const endPoint = getSelectionEndPoint(snapshot)\n\n if (!startPoint || !endPoint) {\n return snapshot.context.selection\n }\n\n const startBlockKey = isKeyedSegment(startPoint.path[0])\n ? startPoint.path[0]._key\n : null\n const startChildKey = isKeyedSegment(startPoint.path[2])\n ? startPoint.path[2]._key\n : null\n const endBlockKey = isKeyedSegment(endPoint.path[0])\n ? endPoint.path[0]._key\n : null\n const endChildKey = isKeyedSegment(endPoint.path[2])\n ? endPoint.path[2]._key\n : null\n\n if (!startBlockKey || !endBlockKey) {\n return snapshot.context.selection\n }\n\n let startBlockFound = false\n let adjustedStartPoint: EditorSelectionPoint | undefined\n let trimStartPoint = false\n let adjustedEndPoint: EditorSelectionPoint | undefined\n let trimEndPoint = false\n let previousPotentialEndpoint:\n | {blockKey: string; span: PortableTextSpan}\n | undefined\n\n for (const block of snapshot.context.value) {\n if (block._key === startBlockKey) {\n startBlockFound = true\n\n if (isPortableTextTextBlock(block) && isEmptyTextBlock(block)) {\n continue\n }\n }\n\n if (!startBlockFound) {\n continue\n }\n\n if (!isPortableTextTextBlock(block)) {\n continue\n }\n\n if (block._key === endBlockKey && isEmptyTextBlock(block)) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === endChildKey) {\n if (!isPortableTextSpan(child) || endPoint.offset === 0) {\n adjustedEndPoint = previousPotentialEndpoint\n ? {\n path: [\n {_key: previousPotentialEndpoint.blockKey},\n 'children',\n {_key: previousPotentialEndpoint.span._key},\n ],\n offset: previousPotentialEndpoint.span.text.length,\n }\n : undefined\n\n trimEndPoint = true\n break\n }\n }\n\n if (trimStartPoint) {\n const lonelySpan =\n isPortableTextSpan(child) && block.children.length === 1\n\n if (\n (isPortableTextSpan(child) && child.text.length > 0) ||\n lonelySpan\n ) {\n adjustedStartPoint = {\n path: [{_key: block._key}, 'children', {_key: child._key}],\n offset: 0,\n }\n previousPotentialEndpoint = {blockKey: block._key, span: child}\n trimStartPoint = false\n }\n\n continue\n }\n\n if (child._key === startChildKey) {\n if (!isPortableTextSpan(child)) {\n trimStartPoint = true\n continue\n }\n\n if (startPoint.offset === child.text.length) {\n trimStartPoint = true\n previousPotentialEndpoint =\n child.text.length > 0\n ? {blockKey: block._key, span: child}\n : previousPotentialEndpoint\n continue\n }\n }\n\n previousPotentialEndpoint =\n isPortableTextSpan(child) && child.text.length > 0\n ? {blockKey: block._key, span: child}\n : previousPotentialEndpoint\n }\n\n if (block._key === endBlockKey) {\n break\n }\n }\n\n const trimmedSelection = snapshot.context.selection.backward\n ? {\n anchor: trimEndPoint && adjustedEndPoint ? adjustedEndPoint : endPoint,\n focus: adjustedStartPoint ?? startPoint,\n backward: true,\n }\n : {\n anchor: adjustedStartPoint ?? startPoint,\n focus: trimEndPoint && adjustedEndPoint ? adjustedEndPoint : endPoint,\n }\n\n if (\n isSelectionCollapsed({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: trimmedSelection,\n },\n })\n ) {\n const focusTextBlock = getFocusTextBlock({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: trimmedSelection,\n },\n })\n\n if (focusTextBlock && !isEmptyTextBlock(focusTextBlock.node)) {\n return null\n }\n }\n\n return trimmedSelection\n}\n","import {isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getSelectedSpans} from './selector.get-selected-spans'\nimport {isSelectionExpanded} from './selector.is-selection-expanded'\nimport {getFocusSpan, getSelectedBlocks} from './selectors'\n\n/**\n * @public\n */\nexport function isActiveAnnotation(\n annotation: string,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selectedBlocks = getSelectedBlocks(snapshot)\n const focusSpan = getFocusSpan(snapshot)\n\n const selectedSpans = isSelectionExpanded(snapshot)\n ? getSelectedSpans(snapshot)\n : focusSpan\n ? [focusSpan]\n : []\n\n if (selectedSpans.length === 0) {\n return false\n }\n\n if (\n selectedSpans.some(\n (span) => !span.node.marks || span.node.marks?.length === 0,\n )\n ) {\n return false\n }\n\n const selectionMarkDefs = selectedBlocks.flatMap((block) =>\n isPortableTextTextBlock(block.node) ? (block.node.markDefs ?? []) : [],\n )\n\n return selectedSpans.every((span) => {\n const spanMarkDefs =\n span.node.marks?.flatMap((mark) => {\n const markDef = selectionMarkDefs.find(\n (markDef) => markDef._key === mark,\n )\n\n return markDef ? [markDef._type] : []\n }) ?? []\n\n return spanMarkDefs.includes(annotation)\n })\n }\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {getSelectedSpans} from './selector.get-selected-spans'\nimport {isSelectionExpanded} from './selector.is-selection-expanded'\n\n/**\n * @public\n */\nexport function isActiveDecorator(decorator: string): EditorSelector<boolean> {\n return (snapshot) => {\n if (isSelectionExpanded(snapshot)) {\n const selectedSpans = getSelectedSpans(snapshot)\n\n return (\n selectedSpans.length > 0 &&\n selectedSpans.every((span) => span.node.marks?.includes(decorator))\n )\n }\n\n return snapshot.context.activeDecorators.includes(decorator)\n }\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {getActiveListItem} from './selector.get-active-list-item'\n\n/**\n * @public\n */\nexport function isActiveListItem(listItem: string): EditorSelector<boolean> {\n return (snapshot) => {\n const activeListItem = getActiveListItem(snapshot)\n\n return activeListItem === listItem\n }\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport {getActiveStyle} from './selector.get-active-style'\n\n/**\n * @public\n */\nexport function isActiveStyle(style: string): EditorSelector<boolean> {\n return (snapshot) => {\n const activeStyle = getActiveStyle(snapshot)\n\n return activeStyle === style\n }\n}\n"],"names":["isSelectingEntireBlocks","snapshot","context","selection","startPoint","backward","focus","anchor","endPoint","startBlock","getSelectionStartBlock","endBlock","getSelectionEndBlock","startBlockStartPoint","utils","endBlockEndPoint","getSelectedSpans","selectedSpans","startBlockKey","isKeySegment","path","_key","undefined","endBlockKey","startSpanKey","endSpanKey","startBlockFound","block","value","isPortableTextTextBlock","child","children","isPortableTextSpan","offset","text","length","push","node","getActiveListItem","guards","createGuards","selectedTextBlocks","getSelectedBlocks","map","filter","isTextBlock","firstTextBlock","at","firstListItem","listItem","every","getActiveStyle","firstStyle","style","getTrimmedSelection","getSelectionStartPoint","getSelectionEndPoint","isKeyedSegment","startChildKey","endChildKey","adjustedStartPoint","trimStartPoint","adjustedEndPoint","trimEndPoint","previousPotentialEndpoint","isEmptyTextBlock","blockKey","span","lonelySpan","trimmedSelection","isSelectionCollapsed","focusTextBlock","getFocusTextBlock","isActiveAnnotation","annotation","selectedBlocks","focusSpan","getFocusSpan","isSelectionExpanded","some","marks","selectionMarkDefs","flatMap","markDefs","mark","markDef","find","_type","includes","isActiveDecorator","decorator","activeDecorators","isActiveListItem","isActiveStyle"],"mappings":";;;AAOO,MAAMA,0BAAoDC,CAAa,aAAA;AACxE,MAAA,CAACA,SAASC,QAAQC;AACb,WAAA;AAGT,QAAMC,aAAaH,SAASC,QAAQC,UAAUE,WAC1CJ,SAASC,QAAQC,UAAUG,QAC3BL,SAASC,QAAQC,UAAUI,QACzBC,WAAWP,SAASC,QAAQC,UAAUE,WACxCJ,SAASC,QAAQC,UAAUI,SAC3BN,SAASC,QAAQC,UAAUG,OAEzBG,aAAaC,uBAAuBT,QAAQ,GAC5CU,WAAWC,qBAAqBX,QAAQ;AAE1C,MAAA,CAACQ,cAAc,CAACE;AACX,WAAA;AAGHE,QAAAA,uBAAuBC,mBAAyBL,UAAU,GAC1DM,mBAAmBD,iBAAuBH,QAAQ;AAGtDG,SAAAA,uBAA6BD,sBAAsB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