@portabletext/editor 2.21.2 → 3.0.0
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-dts/index.d.ts +50 -210
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +103 -20
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/_chunks-es/{util.get-text-block-text.js → util.slice-blocks.js} +29 -5
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -0
- package/lib/_chunks-es/util.slice-text-block.js +13 -2
- package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
- package/lib/behaviors/index.d.ts +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +323 -320
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.d.ts +2 -133
- package/lib/plugins/index.js +2 -796
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.d.ts +2 -24
- package/lib/selectors/index.js +28 -130
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.d.ts +3 -3
- package/lib/utils/index.js +97 -9
- package/lib/utils/index.js.map +1 -1
- package/package.json +7 -9
- package/src/behaviors/behavior.perform-event.ts +7 -7
- package/src/editor/PortableTextEditor.tsx +0 -19
- package/src/editor/create-editor.ts +0 -3
- package/src/editor/editor-machine.ts +0 -10
- package/src/editor/event-to-change.tsx +5 -1
- package/src/editor/plugins/create-with-event-listeners.ts +0 -4
- package/src/editor/plugins/createWithObjectKeys.ts +2 -1
- package/src/editor/plugins/createWithPatches.ts +3 -3
- package/src/editor/plugins/createWithPlaceholderBlock.ts +2 -1
- package/src/editor/plugins/createWithPortableTextMarkModel.ts +2 -1
- package/src/editor/plugins/with-plugins.ts +10 -14
- package/src/editor/relay-machine.ts +0 -4
- package/src/editor/sync-machine.ts +2 -2
- package/src/editor.ts +0 -4
- package/src/history/behavior.operation.history.redo.ts +67 -0
- package/src/history/behavior.operation.history.undo.ts +71 -0
- package/src/history/event.history.undo.test.tsx +672 -0
- package/src/history/history.preserving-keys.test.tsx +112 -0
- package/src/history/remote-patches.ts +20 -0
- package/src/history/slate-plugin.history.ts +146 -0
- package/src/history/slate-plugin.redoing.ts +21 -0
- package/src/history/slate-plugin.undoing.ts +21 -0
- package/src/history/slate-plugin.without-history.ts +23 -0
- package/src/history/transform-operation.ts +245 -0
- package/src/history/undo-redo-collaboration.test.tsx +541 -0
- package/src/history/undo-redo.feature +125 -0
- package/src/history/undo-redo.test.tsx +195 -0
- package/src/history/undo-step.ts +148 -0
- package/src/index.ts +0 -1
- package/src/internal-utils/applyPatch.ts +46 -1
- package/src/operations/behavior.operations.ts +2 -4
- package/src/plugins/index.ts +0 -3
- package/src/selectors/index.ts +0 -3
- package/src/test/vitest/step-definitions.tsx +88 -8
- package/src/test/vitest/test-editor.tsx +1 -1
- package/lib/_chunks-es/selector.get-selection-text.js +0 -92
- package/lib/_chunks-es/selector.get-selection-text.js.map +0 -1
- package/lib/_chunks-es/selector.get-text-before.js +0 -36
- package/lib/_chunks-es/selector.get-text-before.js.map +0 -1
- package/lib/_chunks-es/util.get-text-block-text.js.map +0 -1
- package/lib/_chunks-es/util.is-empty-text-block.js +0 -40
- package/lib/_chunks-es/util.is-empty-text-block.js.map +0 -1
- package/lib/_chunks-es/util.merge-text-blocks.js +0 -101
- package/lib/_chunks-es/util.merge-text-blocks.js.map +0 -1
- package/src/editor/plugins/createWithMaxBlocks.ts +0 -53
- package/src/editor/plugins/createWithUndoRedo.ts +0 -628
- package/src/editor/with-undo-step.ts +0 -37
- package/src/editor/withUndoRedo.ts +0 -34
- package/src/editor-event-listener.tsx +0 -28
- package/src/plugins/plugin.decorator-shortcut.ts +0 -238
- package/src/plugins/plugin.markdown.test.tsx +0 -42
- package/src/plugins/plugin.markdown.tsx +0 -131
- package/src/plugins/plugin.one-line.tsx +0 -123
- package/src/selectors/selector.get-list-state.test.ts +0 -189
- package/src/selectors/selector.get-list-state.ts +0 -96
- package/src/selectors/selector.get-selected-slice.ts +0 -13
- package/src/selectors/selector.get-trimmed-selection.test.ts +0 -657
- package/src/selectors/selector.get-trimmed-selection.ts +0 -189
|
@@ -1,18 +1,51 @@
|
|
|
1
1
|
import { isPortableTextSpan, isKeySegment } from "@sanity/types";
|
|
2
|
-
import {
|
|
3
|
-
import { isEqualSelectionPoints, getBlockEndPoint, isSelectionCollapsed } from "./util.is-empty-text-block.js";
|
|
2
|
+
import { getBlockKeyFromSelectionPoint, getChildKeyFromSelectionPoint, getSelectionStartPoint as getSelectionStartPoint$1, getSelectionEndPoint as getSelectionEndPoint$1, isEqualSelectionPoints, getBlockStartPoint, getBlockEndPoint, sliceBlocks, isSelectionCollapsed as isSelectionCollapsed$1, blockOffsetToSpanSelectionPoint, spanSelectionPointToBlockOffset, isListBlock } from "./util.slice-blocks.js";
|
|
4
3
|
import { isTextBlock, isSpan } from "@portabletext/schema";
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
const getFocusBlock = (snapshot) => {
|
|
5
|
+
if (!snapshot.context.selection)
|
|
6
|
+
return;
|
|
7
|
+
const key = getBlockKeyFromSelectionPoint(snapshot.context.selection.focus), index = key ? snapshot.blockIndexMap.get(key) : void 0, node = index !== void 0 ? snapshot.context.value.at(index) : void 0;
|
|
8
|
+
return node && key ? {
|
|
9
|
+
node,
|
|
10
|
+
path: [{
|
|
11
|
+
_key: key
|
|
12
|
+
}]
|
|
13
|
+
} : void 0;
|
|
14
|
+
}, getFocusTextBlock = (snapshot) => {
|
|
15
|
+
const focusBlock = getFocusBlock(snapshot);
|
|
16
|
+
return focusBlock && isTextBlock(snapshot.context, focusBlock.node) ? {
|
|
17
|
+
node: focusBlock.node,
|
|
18
|
+
path: focusBlock.path
|
|
19
|
+
} : void 0;
|
|
20
|
+
}, getFocusChild = (snapshot) => {
|
|
21
|
+
if (!snapshot.context.selection)
|
|
22
|
+
return;
|
|
23
|
+
const focusBlock = getFocusTextBlock(snapshot);
|
|
24
|
+
if (!focusBlock)
|
|
25
|
+
return;
|
|
26
|
+
const key = getChildKeyFromSelectionPoint(snapshot.context.selection.focus), node = key ? focusBlock.node.children.find((span) => span._key === key) : void 0;
|
|
27
|
+
return node && key ? {
|
|
28
|
+
node,
|
|
29
|
+
path: [...focusBlock.path, "children", {
|
|
30
|
+
_key: key
|
|
31
|
+
}]
|
|
32
|
+
} : void 0;
|
|
33
|
+
}, getFocusInlineObject = (snapshot) => {
|
|
7
34
|
const focusChild = getFocusChild(snapshot);
|
|
8
35
|
return focusChild && !isPortableTextSpan(focusChild.node) ? {
|
|
9
36
|
node: focusChild.node,
|
|
10
37
|
path: focusChild.path
|
|
11
38
|
} : void 0;
|
|
39
|
+
}, getFocusSpan = (snapshot) => {
|
|
40
|
+
const focusChild = getFocusChild(snapshot);
|
|
41
|
+
return focusChild && isSpan(snapshot.context, focusChild.node) ? {
|
|
42
|
+
node: focusChild.node,
|
|
43
|
+
path: focusChild.path
|
|
44
|
+
} : void 0;
|
|
12
45
|
}, getSelectedBlocks = (snapshot) => {
|
|
13
46
|
if (!snapshot.context.selection)
|
|
14
47
|
return [];
|
|
15
|
-
const selectedBlocks = [], startPoint = getSelectionStartPoint(snapshot.context.selection), endPoint = getSelectionEndPoint$1(snapshot.context.selection), startKey = getBlockKeyFromSelectionPoint(startPoint), endKey = getBlockKeyFromSelectionPoint(endPoint);
|
|
48
|
+
const selectedBlocks = [], startPoint = getSelectionStartPoint$1(snapshot.context.selection), endPoint = getSelectionEndPoint$1(snapshot.context.selection), startKey = getBlockKeyFromSelectionPoint(startPoint), endKey = getBlockKeyFromSelectionPoint(endPoint);
|
|
16
49
|
if (!startKey || !endKey)
|
|
17
50
|
return selectedBlocks;
|
|
18
51
|
const startBlockIndex = snapshot.blockIndexMap.get(startKey), endBlockIndex = snapshot.blockIndexMap.get(endKey);
|
|
@@ -61,7 +94,7 @@ const getFocusInlineObject = (snapshot) => {
|
|
|
61
94
|
}
|
|
62
95
|
});
|
|
63
96
|
}, getSelectionStartBlock = (snapshot) => {
|
|
64
|
-
const startPoint = getSelectionStartPoint(snapshot.context.selection);
|
|
97
|
+
const startPoint = getSelectionStartPoint$1(snapshot.context.selection);
|
|
65
98
|
if (startPoint)
|
|
66
99
|
return getFocusBlock({
|
|
67
100
|
...snapshot,
|
|
@@ -76,6 +109,9 @@ const getFocusInlineObject = (snapshot) => {
|
|
|
76
109
|
}, getSelectionEndPoint = (snapshot) => {
|
|
77
110
|
if (snapshot.context.selection)
|
|
78
111
|
return snapshot.context.selection.backward ? snapshot.context.selection.anchor : snapshot.context.selection.focus;
|
|
112
|
+
}, getSelectionStartPoint = (snapshot) => {
|
|
113
|
+
if (snapshot.context.selection)
|
|
114
|
+
return snapshot.context.selection.backward ? snapshot.context.selection.focus : snapshot.context.selection.anchor;
|
|
79
115
|
};
|
|
80
116
|
function isPointAfterSelection(point) {
|
|
81
117
|
return (snapshot) => {
|
|
@@ -108,7 +144,7 @@ function isPointBeforeSelection(point) {
|
|
|
108
144
|
return (snapshot) => {
|
|
109
145
|
if (!snapshot.context.selection)
|
|
110
146
|
return !1;
|
|
111
|
-
const startPoint = getSelectionStartPoint(snapshot.context.selection), startBlockKey = getBlockKeyFromSelectionPoint(startPoint), startChildKey = getChildKeyFromSelectionPoint(startPoint), pointBlockKey = getBlockKeyFromSelectionPoint(point), pointChildKey = getChildKeyFromSelectionPoint(point);
|
|
147
|
+
const startPoint = getSelectionStartPoint$1(snapshot.context.selection), startBlockKey = getBlockKeyFromSelectionPoint(startPoint), startChildKey = getChildKeyFromSelectionPoint(startPoint), pointBlockKey = getBlockKeyFromSelectionPoint(point), pointChildKey = getChildKeyFromSelectionPoint(point);
|
|
112
148
|
if (!pointBlockKey || !startBlockKey)
|
|
113
149
|
return !1;
|
|
114
150
|
const startBlockIndex = snapshot.blockIndexMap.get(startBlockKey), pointBlockIndex = snapshot.blockIndexMap.get(pointBlockKey);
|
|
@@ -135,7 +171,7 @@ function isOverlappingSelection(selection) {
|
|
|
135
171
|
return (snapshot) => {
|
|
136
172
|
if (!selection || !snapshot.context.selection)
|
|
137
173
|
return !1;
|
|
138
|
-
const selectionStartPoint = getSelectionStartPoint
|
|
174
|
+
const selectionStartPoint = getSelectionStartPoint({
|
|
139
175
|
context: {
|
|
140
176
|
...snapshot.context,
|
|
141
177
|
selection
|
|
@@ -145,7 +181,7 @@ function isOverlappingSelection(selection) {
|
|
|
145
181
|
...snapshot.context,
|
|
146
182
|
selection
|
|
147
183
|
}
|
|
148
|
-
}), originalSelectionStartPoint = getSelectionStartPoint
|
|
184
|
+
}), originalSelectionStartPoint = getSelectionStartPoint(snapshot), originalSelectionEndPoint = getSelectionEndPoint(snapshot);
|
|
149
185
|
if (!selectionStartPoint || !selectionEndPoint || !originalSelectionStartPoint || !originalSelectionEndPoint)
|
|
150
186
|
return !1;
|
|
151
187
|
const startPointEqualToOriginalStartPoint = isEqualSelectionPoints(selectionStartPoint, originalSelectionStartPoint), endPointEqualToOriginalEndPoint = isEqualSelectionPoints(selectionEndPoint, originalSelectionEndPoint);
|
|
@@ -191,7 +227,7 @@ function isOverlappingSelection(selection) {
|
|
|
191
227
|
return !endPointEqualToOriginalStartPoint && !startPointEqualToOriginalEndPoint && !originalStartPointBeforeStartPoint && !originalStartPointAfterStartPoint && !originalEndPointBeforeEndPoint && !originalEndPointAfterEndPoint || endPointBeforeSelection && !endPointEqualToOriginalStartPoint || startPointAfterSelection && !startPointEqualToOriginalEndPoint ? !1 : !originalStartPointBeforeStartPoint && originalStartPointAfterStartPoint && !originalEndPointBeforeEndPoint && originalEndPointAfterEndPoint ? !endPointEqualToOriginalStartPoint : originalStartPointBeforeStartPoint && !originalStartPointAfterStartPoint && originalEndPointBeforeEndPoint && !originalEndPointAfterEndPoint ? !startPointEqualToOriginalEndPoint : !startPointAfterSelection || !startPointBeforeSelection || !endPointAfterSelection || !endPointBeforeSelection;
|
|
192
228
|
};
|
|
193
229
|
}
|
|
194
|
-
const isSelectingEntireBlocks = (snapshot) => {
|
|
230
|
+
const isSelectionCollapsed = (snapshot) => snapshot.context.selection ? JSON.stringify(snapshot.context.selection.anchor.path) === JSON.stringify(snapshot.context.selection.focus.path) && snapshot.context.selection?.anchor.offset === snapshot.context.selection?.focus.offset : !1, isSelectionExpanded$1 = (snapshot) => snapshot.context.selection !== null && !isSelectionCollapsed(snapshot), isSelectingEntireBlocks = (snapshot) => {
|
|
195
231
|
if (!snapshot.context.selection)
|
|
196
232
|
return !1;
|
|
197
233
|
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);
|
|
@@ -205,6 +241,27 @@ const isSelectingEntireBlocks = (snapshot) => {
|
|
|
205
241
|
block: endBlock
|
|
206
242
|
});
|
|
207
243
|
return isEqualSelectionPoints(startBlockStartPoint, startPoint) && isEqualSelectionPoints(endBlockEndPoint, endPoint);
|
|
244
|
+
}, getSelectedValue = (snapshot) => {
|
|
245
|
+
const selection = snapshot.context.selection;
|
|
246
|
+
if (!selection)
|
|
247
|
+
return [];
|
|
248
|
+
const startPoint = getSelectionStartPoint$1(selection), endPoint = getSelectionEndPoint$1(selection), startBlockKey = getBlockKeyFromSelectionPoint(startPoint), endBlockKey = getBlockKeyFromSelectionPoint(endPoint);
|
|
249
|
+
if (!startBlockKey || !endBlockKey)
|
|
250
|
+
return [];
|
|
251
|
+
const startBlockIndex = snapshot.blockIndexMap.get(startBlockKey), endBlockIndex = snapshot.blockIndexMap.get(endBlockKey);
|
|
252
|
+
if (startBlockIndex === void 0 || endBlockIndex === void 0)
|
|
253
|
+
return [];
|
|
254
|
+
const startBlock = snapshot.context.value.at(startBlockIndex), slicedStartBlock = startBlock ? sliceBlocks({
|
|
255
|
+
context: snapshot.context,
|
|
256
|
+
blocks: [startBlock]
|
|
257
|
+
}).at(0) : void 0;
|
|
258
|
+
if (startBlockIndex === endBlockIndex)
|
|
259
|
+
return slicedStartBlock ? [slicedStartBlock] : [];
|
|
260
|
+
const endBlock = snapshot.context.value.at(endBlockIndex), slicedEndBlock = endBlock ? sliceBlocks({
|
|
261
|
+
context: snapshot.context,
|
|
262
|
+
blocks: [endBlock]
|
|
263
|
+
}).at(0) : void 0, middleBlocks = snapshot.context.value.slice(startBlockIndex + 1, endBlockIndex);
|
|
264
|
+
return [...slicedStartBlock ? [slicedStartBlock] : [], ...middleBlocks, ...slicedEndBlock ? [slicedEndBlock] : []];
|
|
208
265
|
};
|
|
209
266
|
function isBlockPath(path) {
|
|
210
267
|
const firstSegment = path.at(0);
|
|
@@ -214,7 +271,7 @@ function isRecord(value) {
|
|
|
214
271
|
return !!value && (typeof value == "object" || typeof value == "function");
|
|
215
272
|
}
|
|
216
273
|
function isSelectionExpanded(selection) {
|
|
217
|
-
return selection ? !isSelectionCollapsed(selection) : !1;
|
|
274
|
+
return selection ? !isSelectionCollapsed$1(selection) : !1;
|
|
218
275
|
}
|
|
219
276
|
const getNextSpan = (snapshot) => {
|
|
220
277
|
const selectionEndBlock = getSelectionEndBlock(snapshot), selectionEndPoint = getSelectionEndPoint(snapshot);
|
|
@@ -239,7 +296,7 @@ const getNextSpan = (snapshot) => {
|
|
|
239
296
|
}
|
|
240
297
|
return nextSpan;
|
|
241
298
|
}, getPreviousSpan = (snapshot) => {
|
|
242
|
-
const selectionStartBlock = getSelectionStartBlock(snapshot), selectionStartPoint = getSelectionStartPoint
|
|
299
|
+
const selectionStartBlock = getSelectionStartBlock(snapshot), selectionStartPoint = getSelectionStartPoint(snapshot);
|
|
243
300
|
if (!selectionStartBlock || !selectionStartPoint || !isTextBlock(snapshot.context, selectionStartBlock.node))
|
|
244
301
|
return;
|
|
245
302
|
const selectionStartPointChildKey = getChildKeyFromSelectionPoint(selectionStartPoint);
|
|
@@ -258,7 +315,7 @@ const getNextSpan = (snapshot) => {
|
|
|
258
315
|
}, getSelectedSpans = (snapshot) => {
|
|
259
316
|
if (!snapshot.context.selection)
|
|
260
317
|
return [];
|
|
261
|
-
const selectedSpans = [], startPoint = getSelectionStartPoint
|
|
318
|
+
const selectedSpans = [], startPoint = getSelectionStartPoint(snapshot), endPoint = getSelectionEndPoint(snapshot);
|
|
262
319
|
if (!startPoint || !endPoint)
|
|
263
320
|
return selectedSpans;
|
|
264
321
|
const startBlockKey = getBlockKeyFromSelectionPoint(startPoint), endBlockKey = getBlockKeyFromSelectionPoint(endPoint), startSpanKey = getChildKeyFromSelectionPoint(startPoint), endSpanKey = getChildKeyFromSelectionPoint(endPoint);
|
|
@@ -540,10 +597,26 @@ const getActiveAnnotations = (snapshot) => {
|
|
|
540
597
|
}
|
|
541
598
|
}
|
|
542
599
|
return inlineObject;
|
|
543
|
-
},
|
|
544
|
-
|
|
600
|
+
}, getPreviousInlineObject = (snapshot) => {
|
|
601
|
+
const focusTextBlock = getFocusTextBlock(snapshot), selectionStartPoint = getSelectionStartPoint(snapshot), selectionStartPointChildKey = selectionStartPoint && isKeySegment(selectionStartPoint.path[2]) ? selectionStartPoint.path[2]._key : void 0;
|
|
602
|
+
if (!focusTextBlock || !selectionStartPointChildKey)
|
|
603
|
+
return;
|
|
604
|
+
let inlineObject;
|
|
605
|
+
for (const child of focusTextBlock.node.children) {
|
|
606
|
+
if (child._key === selectionStartPointChildKey)
|
|
607
|
+
break;
|
|
608
|
+
isSpan(snapshot.context, child) || (inlineObject = {
|
|
609
|
+
node: child,
|
|
610
|
+
path: [...focusTextBlock.path, "children", {
|
|
611
|
+
_key: child._key
|
|
612
|
+
}]
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
return inlineObject;
|
|
616
|
+
}, getSelectionText = (snapshot) => getSelectedValue(snapshot).reduce((text, block) => isTextBlock(snapshot.context, block) ? text + block.children.reduce((text2, child) => isSpan(snapshot.context, child) ? text2 + child.text : text2, "") : text, ""), getCaretWordSelection = (snapshot) => {
|
|
617
|
+
if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
|
|
545
618
|
return null;
|
|
546
|
-
const focusTextBlock = getFocusTextBlock(snapshot), selectionStartPoint = getSelectionStartPoint
|
|
619
|
+
const focusTextBlock = getFocusTextBlock(snapshot), selectionStartPoint = getSelectionStartPoint(snapshot), selectionStartOffset = selectionStartPoint ? spanSelectionPointToBlockOffset({
|
|
547
620
|
context: snapshot.context,
|
|
548
621
|
selectionPoint: selectionStartPoint
|
|
549
622
|
}) : void 0;
|
|
@@ -668,7 +741,7 @@ const getActiveAnnotations = (snapshot) => {
|
|
|
668
741
|
}, getSelectedTextBlocks = (snapshot) => {
|
|
669
742
|
if (!snapshot.context.selection)
|
|
670
743
|
return [];
|
|
671
|
-
const selectedTextBlocks = [], startPoint = getSelectionStartPoint(snapshot.context.selection), endPoint = getSelectionEndPoint$1(snapshot.context.selection), startBlockKey = getBlockKeyFromSelectionPoint(startPoint), endBlockKey = getBlockKeyFromSelectionPoint(endPoint);
|
|
744
|
+
const selectedTextBlocks = [], startPoint = getSelectionStartPoint$1(snapshot.context.selection), endPoint = getSelectionEndPoint$1(snapshot.context.selection), startBlockKey = getBlockKeyFromSelectionPoint(startPoint), endBlockKey = getBlockKeyFromSelectionPoint(endPoint);
|
|
672
745
|
if (!startBlockKey || !endBlockKey)
|
|
673
746
|
return selectedTextBlocks;
|
|
674
747
|
const startBlockIndex = snapshot.blockIndexMap.get(startBlockKey), endBlockIndex = snapshot.blockIndexMap.get(endBlockKey);
|
|
@@ -733,7 +806,7 @@ function isActiveStyle(style) {
|
|
|
733
806
|
}
|
|
734
807
|
function isAtTheEndOfBlock(block) {
|
|
735
808
|
return (snapshot) => {
|
|
736
|
-
if (!snapshot.context.selection || !isSelectionCollapsed
|
|
809
|
+
if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
|
|
737
810
|
return !1;
|
|
738
811
|
const blockEndPoint = getBlockEndPoint({
|
|
739
812
|
context: snapshot.context,
|
|
@@ -744,7 +817,7 @@ function isAtTheEndOfBlock(block) {
|
|
|
744
817
|
}
|
|
745
818
|
function isAtTheStartOfBlock(block) {
|
|
746
819
|
return (snapshot) => {
|
|
747
|
-
if (!snapshot.context.selection || !isSelectionCollapsed
|
|
820
|
+
if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
|
|
748
821
|
return !1;
|
|
749
822
|
const blockStartPoint = getBlockStartPoint({
|
|
750
823
|
context: snapshot.context,
|
|
@@ -761,22 +834,30 @@ export {
|
|
|
761
834
|
getActiveStyle,
|
|
762
835
|
getCaretWordSelection,
|
|
763
836
|
getFirstBlock,
|
|
837
|
+
getFocusBlock,
|
|
764
838
|
getFocusBlockObject,
|
|
839
|
+
getFocusChild,
|
|
765
840
|
getFocusInlineObject,
|
|
766
841
|
getFocusListBlock,
|
|
842
|
+
getFocusSpan,
|
|
843
|
+
getFocusTextBlock,
|
|
767
844
|
getLastBlock,
|
|
768
845
|
getMarkState,
|
|
769
846
|
getNextBlock,
|
|
770
847
|
getNextInlineObject,
|
|
771
848
|
getNextSpan,
|
|
772
849
|
getPreviousBlock,
|
|
850
|
+
getPreviousInlineObject,
|
|
773
851
|
getPreviousSpan,
|
|
774
852
|
getSelectedBlocks,
|
|
775
853
|
getSelectedSpans,
|
|
776
854
|
getSelectedTextBlocks,
|
|
855
|
+
getSelectedValue,
|
|
777
856
|
getSelectionEndBlock,
|
|
778
857
|
getSelectionEndPoint,
|
|
779
858
|
getSelectionStartBlock,
|
|
859
|
+
getSelectionStartPoint,
|
|
860
|
+
getSelectionText,
|
|
780
861
|
isActiveAnnotation,
|
|
781
862
|
isActiveDecorator,
|
|
782
863
|
isActiveListItem,
|
|
@@ -786,6 +867,8 @@ export {
|
|
|
786
867
|
isOverlappingSelection,
|
|
787
868
|
isPointAfterSelection,
|
|
788
869
|
isPointBeforeSelection,
|
|
789
|
-
isSelectingEntireBlocks
|
|
870
|
+
isSelectingEntireBlocks,
|
|
871
|
+
isSelectionCollapsed,
|
|
872
|
+
isSelectionExpanded$1 as isSelectionExpanded
|
|
790
873
|
};
|
|
791
874
|
//# sourceMappingURL=selector.is-at-the-start-of-block.js.map
|