@portabletext/editor 1.24.0 → 1.25.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.
Files changed (37) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +186 -62
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/{selector.is-selection-collapsed.cjs → selector.is-active-style.cjs} +158 -3
  4. package/lib/_chunks-cjs/selector.is-active-style.cjs.map +1 -0
  5. package/lib/_chunks-es/behavior.core.js +162 -38
  6. package/lib/_chunks-es/behavior.core.js.map +1 -1
  7. package/lib/_chunks-es/{selector.is-selection-collapsed.js → selector.is-active-style.js} +159 -4
  8. package/lib/_chunks-es/selector.is-active-style.js.map +1 -0
  9. package/lib/behaviors/index.cjs +27 -27
  10. package/lib/behaviors/index.cjs.map +1 -1
  11. package/lib/behaviors/index.d.cts +1718 -94
  12. package/lib/behaviors/index.d.ts +1718 -94
  13. package/lib/behaviors/index.js +1 -1
  14. package/lib/index.cjs +178 -211
  15. package/lib/index.cjs.map +1 -1
  16. package/lib/index.d.cts +8792 -245
  17. package/lib/index.d.ts +8792 -245
  18. package/lib/index.js +174 -207
  19. package/lib/index.js.map +1 -1
  20. package/lib/selectors/index.cjs +24 -171
  21. package/lib/selectors/index.cjs.map +1 -1
  22. package/lib/selectors/index.js +3 -151
  23. package/lib/selectors/index.js.map +1 -1
  24. package/package.json +6 -6
  25. package/src/behavior-actions/behavior.actions.ts +99 -98
  26. package/src/behaviors/behavior.core.annotations.ts +29 -0
  27. package/src/behaviors/behavior.core.block-objects.ts +13 -13
  28. package/src/behaviors/behavior.core.decorators.ts +19 -0
  29. package/src/behaviors/behavior.core.lists.ts +57 -23
  30. package/src/behaviors/behavior.core.style.ts +19 -0
  31. package/src/behaviors/behavior.core.ts +12 -0
  32. package/src/behaviors/behavior.types.ts +87 -87
  33. package/src/editor/create-editor.ts +46 -6
  34. package/src/editor/editor-machine.ts +38 -1
  35. package/src/editor/plugins/create-with-event-listeners.ts +38 -106
  36. package/lib/_chunks-cjs/selector.is-selection-collapsed.cjs.map +0 -1
  37. package/lib/_chunks-es/selector.is-selection-collapsed.js.map +0 -1
@@ -1,159 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var selector_isSelectionCollapsed = require("../_chunks-cjs/selector.is-selection-collapsed.cjs"), util_sliceBlocks = require("../_chunks-cjs/util.slice-blocks.cjs"), types = require("@sanity/types"), selector_getTextBefore = require("../_chunks-cjs/selector.get-text-before.cjs"), util_reverseSelection = require("../_chunks-cjs/util.reverse-selection.cjs");
4
- const getActiveListItem = ({
5
- context
6
- }) => {
7
- if (!context.selection)
8
- return;
9
- const guards = selector_isSelectionCollapsed.createGuards(context), selectedTextBlocks = selector_isSelectionCollapsed.getSelectedBlocks({
10
- context
11
- }).map((block) => block.node).filter(guards.isTextBlock), firstTextBlock = selectedTextBlocks.at(0);
12
- if (!firstTextBlock)
13
- return;
14
- const firstListItem = firstTextBlock.listItem;
15
- if (firstListItem && selectedTextBlocks.every((block) => block.listItem === firstListItem))
16
- return firstListItem;
17
- }, getActiveStyle = ({
18
- context
19
- }) => {
20
- if (!context.selection)
21
- return;
22
- const guards = selector_isSelectionCollapsed.createGuards(context), selectedTextBlocks = selector_isSelectionCollapsed.getSelectedBlocks({
23
- context
24
- }).map((block) => block.node).filter(guards.isTextBlock), firstTextBlock = selectedTextBlocks.at(0);
25
- if (!firstTextBlock)
26
- return;
27
- const firstStyle = firstTextBlock.style;
28
- if (firstStyle && selectedTextBlocks.every((block) => block.style === firstStyle))
29
- return firstStyle;
30
- }, getSelectedSlice = ({
3
+ var selector_isActiveStyle = require("../_chunks-cjs/selector.is-active-style.cjs"), util_sliceBlocks = require("../_chunks-cjs/util.slice-blocks.cjs"), selector_getTextBefore = require("../_chunks-cjs/selector.get-text-before.cjs"), types = require("@sanity/types"), util_reverseSelection = require("../_chunks-cjs/util.reverse-selection.cjs");
4
+ const getSelectedSlice = ({
31
5
  context
32
6
  }) => util_sliceBlocks.sliceBlocks({
33
7
  blocks: context.value,
34
8
  selection: context.selection
35
- }), getSelectedSpans = ({
36
- context
37
- }) => {
38
- if (!context.selection)
39
- return [];
40
- const selectedSpans = [], startPoint = context.selection.backward ? context.selection.focus : context.selection.anchor, endPoint = context.selection.backward ? context.selection.anchor : context.selection.focus, startBlockKey = types.isKeySegment(startPoint.path[0]) ? startPoint.path[0]._key : void 0, endBlockKey = types.isKeySegment(endPoint.path[0]) ? endPoint.path[0]._key : void 0;
41
- if (!startBlockKey || !endBlockKey)
42
- return selectedSpans;
43
- const startSpanKey = types.isKeySegment(startPoint.path[2]) ? startPoint.path[2]._key : void 0, endSpanKey = types.isKeySegment(endPoint.path[2]) ? endPoint.path[2]._key : void 0;
44
- for (const block of context.value)
45
- if (types.isPortableTextTextBlock(block)) {
46
- if (block._key === startBlockKey) {
47
- for (const child of block.children)
48
- if (types.isPortableTextSpan(child)) {
49
- if (startSpanKey && child._key === startSpanKey) {
50
- if (selectedSpans.push({
51
- node: child,
52
- path: [{
53
- _key: block._key
54
- }, "children", {
55
- _key: child._key
56
- }]
57
- }), startSpanKey === endSpanKey)
58
- break;
59
- continue;
60
- }
61
- if (endSpanKey && child._key === endSpanKey) {
62
- selectedSpans.push({
63
- node: child,
64
- path: [{
65
- _key: block._key
66
- }, "children", {
67
- _key: child._key
68
- }]
69
- });
70
- break;
71
- }
72
- selectedSpans.length > 0 && selectedSpans.push({
73
- node: child,
74
- path: [{
75
- _key: block._key
76
- }, "children", {
77
- _key: child._key
78
- }]
79
- });
80
- }
81
- if (startBlockKey === endBlockKey)
82
- break;
83
- continue;
84
- }
85
- if (block._key === endBlockKey) {
86
- for (const child of block.children)
87
- if (types.isPortableTextSpan(child)) {
88
- if (endSpanKey && child._key === endSpanKey) {
89
- selectedSpans.push({
90
- node: child,
91
- path: [{
92
- _key: block._key
93
- }, "children", {
94
- _key: child._key
95
- }]
96
- });
97
- break;
98
- }
99
- selectedSpans.push({
100
- node: child,
101
- path: [{
102
- _key: block._key
103
- }, "children", {
104
- _key: child._key
105
- }]
106
- });
107
- }
108
- break;
109
- }
110
- if (selectedSpans.length > 0)
111
- for (const child of block.children)
112
- types.isPortableTextSpan(child) && selectedSpans.push({
113
- node: child,
114
- path: [{
115
- _key: block._key
116
- }, "children", {
117
- _key: child._key
118
- }]
119
- });
120
- }
121
- return selectedSpans;
122
- };
123
- function isActiveAnnotation(annotation) {
124
- return (snapshot) => {
125
- if (!snapshot.context.selection)
126
- return !1;
127
- const selectedBlocks = selector_isSelectionCollapsed.getSelectedBlocks(snapshot), selectedSpans = getSelectedSpans(snapshot);
128
- if (selectedSpans.length === 0 || selectedSpans.some((span) => !span.node.marks || span.node.marks?.length === 0))
129
- return !1;
130
- const selectionMarkDefs = selectedBlocks.flatMap((block) => types.isPortableTextTextBlock(block.node) ? block.node.markDefs ?? [] : []);
131
- return selectedSpans.every((span) => (span.node.marks?.flatMap((mark) => {
132
- const markDef = selectionMarkDefs.find((markDef2) => markDef2._key === mark);
133
- return markDef ? [markDef._type] : [];
134
- }) ?? []).includes(annotation));
135
- };
136
- }
137
- const isSelectionExpanded = ({
138
- context
139
- }) => !selector_isSelectionCollapsed.isSelectionCollapsed({
140
- context
141
9
  });
142
- function isActiveDecorator(decorator) {
143
- return (snapshot) => {
144
- if (isSelectionExpanded(snapshot)) {
145
- const selectedSpans = getSelectedSpans(snapshot);
146
- return selectedSpans.length > 0 && selectedSpans.every((span) => span.node.marks?.includes(decorator));
147
- }
148
- return snapshot.context.activeDecorators.includes(decorator);
149
- };
150
- }
151
- function isActiveListItem(listItem) {
152
- return (snapshot) => getActiveListItem(snapshot) === listItem;
153
- }
154
- function isActiveStyle(style) {
155
- return (snapshot) => getActiveStyle(snapshot) === style;
156
- }
157
10
  function isPointAfterSelection(point) {
158
11
  return (snapshot) => {
159
12
  if (!snapshot.context.selection)
@@ -224,31 +77,31 @@ function isPointBeforeSelection(point) {
224
77
  return before;
225
78
  };
226
79
  }
227
- exports.getFirstBlock = selector_isSelectionCollapsed.getFirstBlock;
228
- exports.getFocusBlock = selector_isSelectionCollapsed.getFocusBlock;
229
- exports.getFocusBlockObject = selector_isSelectionCollapsed.getFocusBlockObject;
230
- exports.getFocusChild = selector_isSelectionCollapsed.getFocusChild;
231
- exports.getFocusListBlock = selector_isSelectionCollapsed.getFocusListBlock;
232
- exports.getFocusSpan = selector_isSelectionCollapsed.getFocusSpan;
233
- exports.getFocusTextBlock = selector_isSelectionCollapsed.getFocusTextBlock;
234
- exports.getLastBlock = selector_isSelectionCollapsed.getLastBlock;
235
- exports.getNextBlock = selector_isSelectionCollapsed.getNextBlock;
236
- exports.getPreviousBlock = selector_isSelectionCollapsed.getPreviousBlock;
237
- exports.getSelectedBlocks = selector_isSelectionCollapsed.getSelectedBlocks;
238
- exports.getSelectionEndBlock = selector_isSelectionCollapsed.getSelectionEndBlock;
239
- exports.getSelectionStartBlock = selector_isSelectionCollapsed.getSelectionStartBlock;
240
- exports.isSelectionCollapsed = selector_isSelectionCollapsed.isSelectionCollapsed;
80
+ exports.getActiveListItem = selector_isActiveStyle.getActiveListItem;
81
+ exports.getActiveStyle = selector_isActiveStyle.getActiveStyle;
82
+ exports.getFirstBlock = selector_isActiveStyle.getFirstBlock;
83
+ exports.getFocusBlock = selector_isActiveStyle.getFocusBlock;
84
+ exports.getFocusBlockObject = selector_isActiveStyle.getFocusBlockObject;
85
+ exports.getFocusChild = selector_isActiveStyle.getFocusChild;
86
+ exports.getFocusListBlock = selector_isActiveStyle.getFocusListBlock;
87
+ exports.getFocusSpan = selector_isActiveStyle.getFocusSpan;
88
+ exports.getFocusTextBlock = selector_isActiveStyle.getFocusTextBlock;
89
+ exports.getLastBlock = selector_isActiveStyle.getLastBlock;
90
+ exports.getNextBlock = selector_isActiveStyle.getNextBlock;
91
+ exports.getPreviousBlock = selector_isActiveStyle.getPreviousBlock;
92
+ exports.getSelectedBlocks = selector_isActiveStyle.getSelectedBlocks;
93
+ exports.getSelectedSpans = selector_isActiveStyle.getSelectedSpans;
94
+ exports.getSelectionEndBlock = selector_isActiveStyle.getSelectionEndBlock;
95
+ exports.getSelectionStartBlock = selector_isActiveStyle.getSelectionStartBlock;
96
+ exports.isActiveAnnotation = selector_isActiveStyle.isActiveAnnotation;
97
+ exports.isActiveDecorator = selector_isActiveStyle.isActiveDecorator;
98
+ exports.isActiveListItem = selector_isActiveStyle.isActiveListItem;
99
+ exports.isActiveStyle = selector_isActiveStyle.isActiveStyle;
100
+ exports.isSelectionCollapsed = selector_isActiveStyle.isSelectionCollapsed;
101
+ exports.isSelectionExpanded = selector_isActiveStyle.isSelectionExpanded;
241
102
  exports.getBlockTextBefore = selector_getTextBefore.getBlockTextBefore;
242
103
  exports.getSelectionText = selector_getTextBefore.getSelectionText;
243
- exports.getActiveListItem = getActiveListItem;
244
- exports.getActiveStyle = getActiveStyle;
245
104
  exports.getSelectedSlice = getSelectedSlice;
246
- exports.getSelectedSpans = getSelectedSpans;
247
- exports.isActiveAnnotation = isActiveAnnotation;
248
- exports.isActiveDecorator = isActiveDecorator;
249
- exports.isActiveListItem = isActiveListItem;
250
- exports.isActiveStyle = isActiveStyle;
251
105
  exports.isPointAfterSelection = isPointAfterSelection;
252
106
  exports.isPointBeforeSelection = isPointBeforeSelection;
253
- exports.isSelectionExpanded = isSelectionExpanded;
254
107
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/selectors/selector.get-active-list-item.ts","../../src/selectors/selector.get-active-style.ts","../../src/selectors/selector.get-selected-slice.ts","../../src/selectors/selector.get-selected-spans.ts","../../src/selectors/selector.is-active-annotation.ts","../../src/selectors/selector.is-selection-expanded.ts","../../src/selectors/selector.is-active-decorator.ts","../../src/selectors/selector.is-active-list-item.ts","../../src/selectors/selector.is-active-style.ts","../../src/selectors/selector.is-point-after-selection.ts","../../src/selectors/selector.is-point-before-selection.ts"],"sourcesContent":["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> = ({context}) => {\n if (!context.selection) {\n return undefined\n }\n\n const guards = createGuards(context)\n const selectedBlocks = getSelectedBlocks({context}).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 context,\n}) => {\n if (!context.selection) {\n return undefined\n }\n\n const guards = createGuards(context)\n const selectedBlocks = getSelectedBlocks({context}).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 type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {sliceBlocks} from '../utils'\n\n/**\n * @public\n */\nexport const getSelectedSlice: EditorSelector<Array<PortableTextBlock>> = ({\n context,\n}) => {\n return sliceBlocks({blocks: context.value, selection: context.selection})\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> = ({context}) => {\n if (!context.selection) {\n return []\n }\n\n const selectedSpans: Array<{\n node: PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }> = []\n\n const startPoint = context.selection.backward\n ? context.selection.focus\n : context.selection.anchor\n const endPoint = context.selection.backward\n ? context.selection.anchor\n : 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 for (const block of context.value) {\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 selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n\n if (startSpanKey === endSpanKey) {\n break\n }\n\n continue\n }\n\n if (endSpanKey && child._key === endSpanKey) {\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\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 selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\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 (selectedSpans.length > 0) {\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 {isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getSelectedSpans} from './selector.get-selected-spans'\nimport {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 selectedSpans = getSelectedSpans(snapshot)\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 {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport const isSelectionExpanded: EditorSelector<boolean> = ({context}) => {\n return !isSelectionCollapsed({context})\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","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointAfterSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const endBlockKey = isKeySegment(selection.focus.path[0])\n ? selection.focus.path[0]._key\n : undefined\n const endChildKey = isKeySegment(selection.focus.path[2])\n ? selection.focus.path[2]._key\n : undefined\n\n if (!pointBlockKey || !endBlockKey) {\n return false\n }\n\n let after = false\n\n for (const block of snapshot.context.value) {\n if (block._key === endBlockKey) {\n if (block._key !== pointBlockKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !endChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === endChildKey) {\n if (child._key !== pointChildKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this child\n\n after = point.offset > selection.focus.offset\n break\n }\n\n if (child._key === pointChildKey) {\n break\n }\n }\n }\n\n if (block._key === pointBlockKey) {\n break\n }\n }\n\n return after\n }\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointBeforeSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const startBlockKey = isKeySegment(selection.anchor.path[0])\n ? selection.anchor.path[0]._key\n : undefined\n const startChildKey = isKeySegment(selection.anchor.path[2])\n ? selection.anchor.path[2]._key\n : undefined\n\n if (!pointBlockKey || !startBlockKey) {\n return false\n }\n\n let before = false\n\n for (const block of snapshot.context.value) {\n if (block._key === pointBlockKey) {\n if (block._key !== startBlockKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !startChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === pointChildKey) {\n if (child._key !== startChildKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this child\n\n before = point.offset < selection.anchor.offset\n break\n }\n\n if (child._key === startChildKey) {\n break\n }\n }\n }\n\n if (block._key === startBlockKey) {\n break\n }\n }\n\n return before\n }\n}\n"],"names":["getActiveListItem","context","selection","guards","createGuards","selectedTextBlocks","getSelectedBlocks","map","block","node","filter","isTextBlock","firstTextBlock","at","firstListItem","listItem","every","getActiveStyle","firstStyle","style","getSelectedSlice","sliceBlocks","blocks","value","getSelectedSpans","selectedSpans","startPoint","backward","focus","anchor","endPoint","startBlockKey","isKeySegment","path","_key","undefined","endBlockKey","startSpanKey","endSpanKey","isPortableTextTextBlock","child","children","isPortableTextSpan","push","length","isActiveAnnotation","annotation","snapshot","selectedBlocks","some","span","marks","selectionMarkDefs","flatMap","markDefs","mark","markDef","find","_type","includes","isSelectionExpanded","isSelectionCollapsed","isActiveDecorator","decorator","activeDecorators","isActiveListItem","isActiveStyle","isPointAfterSelection","point","reverseSelection","pointBlockKey","pointChildKey","endChildKey","after","offset","isPointBeforeSelection","startChildKey","before"],"mappings":";;;AAQO,MAAMA,oBAETA,CAAC;AAAA,EAACC;AAAO,MAAM;AACjB,MAAI,CAACA,QAAQC;AACX;AAGF,QAAMC,SAASC,8BAAAA,aAAaH,OAAO,GAE7BI,qBADiBC,8BAAAA,kBAAkB;AAAA,IAACL;AAAAA,EAAQ,CAAA,EAAEM,IAAKC,CAAAA,UAAUA,MAAMC,IAAI,EACnCC,OAAOP,OAAOQ,WAAW,GAE7DC,iBAAiBP,mBAAmBQ,GAAG,CAAC;AAE9C,MAAI,CAACD;AACH;AAGF,QAAME,gBAAgBF,eAAeG;AAErC,MAAKD,iBAIDT,mBAAmBW,MAAOR,CAAUA,UAAAA,MAAMO,aAAaD,aAAa;AAC/DA,WAAAA;AAIX,GC5BaG,iBAAiEA,CAAC;AAAA,EAC7EhB;AACF,MAAM;AACJ,MAAI,CAACA,QAAQC;AACX;AAGF,QAAMC,SAASC,8BAAAA,aAAaH,OAAO,GAE7BI,qBADiBC,8BAAAA,kBAAkB;AAAA,IAACL;AAAAA,EAAQ,CAAA,EAAEM,IAAKC,CAAAA,UAAUA,MAAMC,IAAI,EACnCC,OAAOP,OAAOQ,WAAW,GAE7DC,iBAAiBP,mBAAmBQ,GAAG,CAAC;AAE9C,MAAI,CAACD;AACH;AAGF,QAAMM,aAAaN,eAAeO;AAElC,MAAKD,cAIDb,mBAAmBW,MAA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MAAM0B,SAASH,eAAe;AACvB,mBAAA;AACT;AAAA,QAAA;AASF,YAJI,CAACQ,MAAAA,wBAAwB/B,KAAK,KAI9B,CAAC+D,iBAAiB,CAACK;AACrB;AAGSpC,mBAAAA,SAAShC,MAAMiC,UAAU;AAC9BD,cAAAA,MAAMN,SAASqC,eAAe;AAC5B/B,gBAAAA,MAAMN,SAAS0C,eAAe;AACvB,uBAAA;AACT;AAAA,YAAA;AAKOR,qBAAAA,MAAMM,SAASxE,UAAU2B,OAAO6C;AACzC;AAAA,UAAA;AAGF,cAAIlC,MAAMN,SAAS0C;AACjB;AAAA,QAAA;AAAA,MAEJ;AAGF,UAAIpE,MAAM0B,SAASH;AACjB;AAAA,IAAA;AAIG8C,WAAAA;AAAAA,EACT;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/selectors/selector.get-selected-slice.ts","../../src/selectors/selector.is-point-after-selection.ts","../../src/selectors/selector.is-point-before-selection.ts"],"sourcesContent":["import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {sliceBlocks} from '../utils'\n\n/**\n * @public\n */\nexport const getSelectedSlice: EditorSelector<Array<PortableTextBlock>> = ({\n context,\n}) => {\n return sliceBlocks({blocks: context.value, selection: context.selection})\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointAfterSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const endBlockKey = isKeySegment(selection.focus.path[0])\n ? selection.focus.path[0]._key\n : undefined\n const endChildKey = isKeySegment(selection.focus.path[2])\n ? selection.focus.path[2]._key\n : undefined\n\n if (!pointBlockKey || !endBlockKey) {\n return false\n }\n\n let after = false\n\n for (const block of snapshot.context.value) {\n if (block._key === endBlockKey) {\n if (block._key !== pointBlockKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !endChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === endChildKey) {\n if (child._key !== pointChildKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this child\n\n after = point.offset > selection.focus.offset\n break\n }\n\n if (child._key === pointChildKey) {\n break\n }\n }\n }\n\n if (block._key === pointBlockKey) {\n break\n }\n }\n\n return after\n }\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointBeforeSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const startBlockKey = isKeySegment(selection.anchor.path[0])\n ? selection.anchor.path[0]._key\n : undefined\n const startChildKey = isKeySegment(selection.anchor.path[2])\n ? selection.anchor.path[2]._key\n : undefined\n\n if (!pointBlockKey || !startBlockKey) {\n return false\n }\n\n let before = false\n\n for (const block of snapshot.context.value) {\n if (block._key === pointBlockKey) {\n if (block._key !== startBlockKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !startChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === pointChildKey) {\n if (child._key !== startChildKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this child\n\n before = point.offset < selection.anchor.offset\n break\n }\n\n if (child._key === startChildKey) {\n break\n }\n }\n }\n\n if (block._key === startBlockKey) {\n break\n }\n }\n\n return before\n }\n}\n"],"names":["getSelectedSlice","context","sliceBlocks","blocks","value","selection","isPointAfterSelection","point","snapshot","reverseSelection","pointBlockKey","isKeySegment","path","_key","undefined","pointChildKey","endBlockKey","focus","endChildKey","after","block","isPortableTextTextBlock","child","children","offset","isPointBeforeSelection","startBlockKey","anchor","startChildKey","before"],"mappings":";;;AAOO,MAAMA,mBAA6DA,CAAC;AAAA,EACzEC;AACF,MACSC,6BAAY;AAAA,EAACC,QAAQF,QAAQG;AAAAA,EAAOC,WAAWJ,QAAQI;AAAS,CAAC;ACFnE,SAASC,sBACdC,OACyB;AACzB,SAAQC,CAAa,aAAA;AACf,QAAA,CAACA,SAASP,QAAQI;AACb,aAAA;AAGT,UAAMA,YAAYI,sBAAAA,iBAAiBD,SAASP,QAAQI,SAAS,GAEvDK,gBAAgBC,MAAAA,aAAaJ,MAAMK,KAAK,CAAC,CAAC,IAC5CL,MAAMK,KAAK,CAAC,EAAEC,OACdC,QACEC,gBAAgBJ,MAAAA,aAAaJ,MAAMK,KAAK,CAAC,CAAC,IAC5CL,MAAMK,KAAK,CAAC,EAAEC,OACdC,QAEEE,cAAcL,MAAAA,aAAaN,UAAUY,MAAML,KAAK,CAAC,CAAC,IACpDP,UAAUY,MAAML,KAAK,CAAC,EAAEC,OACxBC,QACEI,cAAcP,MAAAA,aAAaN,UAAUY,MAAML,KAAK,CAAC,CAAC,IACpDP,UAAUY,MAAML,KAAK,CAAC,EAAEC,OACxBC;AAEA,QAAA,CAACJ,iBAAiB,CAACM;AACd,aAAA;AAGT,QAAIG,QAAQ;AAEDC,eAAAA,SAASZ,SAASP,QAAQG,OAAO;AACtCgB,UAAAA,MAAMP,SAASG,aAAa;AAC1BI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AACT;AAAA,QAAA;AASF,YAJI,CAACL,MAAAA,wBAAwBD,KAAK,KAI9B,CAACL,iBAAiB,CAACa;AACrB;AAGSN,mBAAAA,SAASF,MAAMG,UAAU;AAC9BD,cAAAA,MAAMT,SAASE,eAAe;AAC5BO,gBAAAA,MAAMT,SAASe,eAAe;AACvB,uBAAA;AACT;AAAA,YAAA;AAKOrB,qBAAAA,MAAMiB,SAASnB,UAAUsB,OAAOH;AACzC;AAAA,UAAA;AAGF,cAAIF,MAAMT,SAASe;AACjB;AAAA,QAAA;AAAA,MAEJ;AAGF,UAAIR,MAAMP,SAASa;AACjB;AAAA,IAAA;AAIGG,WAAAA;AAAAA,EACT;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,162 +1,14 @@
1
- import { getSelectedBlocks, createGuards, isSelectionCollapsed } from "../_chunks-es/selector.is-selection-collapsed.js";
2
- import { getFirstBlock, getFocusBlock, getFocusBlockObject, getFocusChild, getFocusListBlock, getFocusSpan, getFocusTextBlock, getLastBlock, getNextBlock, getPreviousBlock, getSelectionEndBlock, getSelectionStartBlock } from "../_chunks-es/selector.is-selection-collapsed.js";
1
+ import { getActiveListItem, getActiveStyle, getFirstBlock, getFocusBlock, getFocusBlockObject, getFocusChild, getFocusListBlock, getFocusSpan, getFocusTextBlock, getLastBlock, getNextBlock, getPreviousBlock, getSelectedBlocks, getSelectedSpans, getSelectionEndBlock, getSelectionStartBlock, isActiveAnnotation, isActiveDecorator, isActiveListItem, isActiveStyle, isSelectionCollapsed, isSelectionExpanded } from "../_chunks-es/selector.is-active-style.js";
3
2
  import { sliceBlocks } from "../_chunks-es/util.slice-blocks.js";
4
- import { isKeySegment, isPortableTextTextBlock, isPortableTextSpan } from "@sanity/types";
5
3
  import { getBlockTextBefore, getSelectionText } from "../_chunks-es/selector.get-text-before.js";
4
+ import { isKeySegment, isPortableTextTextBlock } from "@sanity/types";
6
5
  import { reverseSelection } from "../_chunks-es/util.reverse-selection.js";
7
- const getActiveListItem = ({
8
- context
9
- }) => {
10
- if (!context.selection)
11
- return;
12
- const guards = createGuards(context), selectedTextBlocks = getSelectedBlocks({
13
- context
14
- }).map((block) => block.node).filter(guards.isTextBlock), firstTextBlock = selectedTextBlocks.at(0);
15
- if (!firstTextBlock)
16
- return;
17
- const firstListItem = firstTextBlock.listItem;
18
- if (firstListItem && selectedTextBlocks.every((block) => block.listItem === firstListItem))
19
- return firstListItem;
20
- }, getActiveStyle = ({
21
- context
22
- }) => {
23
- if (!context.selection)
24
- return;
25
- const guards = createGuards(context), selectedTextBlocks = getSelectedBlocks({
26
- context
27
- }).map((block) => block.node).filter(guards.isTextBlock), firstTextBlock = selectedTextBlocks.at(0);
28
- if (!firstTextBlock)
29
- return;
30
- const firstStyle = firstTextBlock.style;
31
- if (firstStyle && selectedTextBlocks.every((block) => block.style === firstStyle))
32
- return firstStyle;
33
- }, getSelectedSlice = ({
6
+ const getSelectedSlice = ({
34
7
  context
35
8
  }) => sliceBlocks({
36
9
  blocks: context.value,
37
10
  selection: context.selection
38
- }), getSelectedSpans = ({
39
- context
40
- }) => {
41
- if (!context.selection)
42
- return [];
43
- const selectedSpans = [], startPoint = context.selection.backward ? context.selection.focus : context.selection.anchor, endPoint = context.selection.backward ? context.selection.anchor : 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;
44
- if (!startBlockKey || !endBlockKey)
45
- return selectedSpans;
46
- const startSpanKey = isKeySegment(startPoint.path[2]) ? startPoint.path[2]._key : void 0, endSpanKey = isKeySegment(endPoint.path[2]) ? endPoint.path[2]._key : void 0;
47
- for (const block of context.value)
48
- if (isPortableTextTextBlock(block)) {
49
- if (block._key === startBlockKey) {
50
- for (const child of block.children)
51
- if (isPortableTextSpan(child)) {
52
- if (startSpanKey && child._key === startSpanKey) {
53
- if (selectedSpans.push({
54
- node: child,
55
- path: [{
56
- _key: block._key
57
- }, "children", {
58
- _key: child._key
59
- }]
60
- }), startSpanKey === endSpanKey)
61
- break;
62
- continue;
63
- }
64
- if (endSpanKey && child._key === endSpanKey) {
65
- selectedSpans.push({
66
- node: child,
67
- path: [{
68
- _key: block._key
69
- }, "children", {
70
- _key: child._key
71
- }]
72
- });
73
- break;
74
- }
75
- selectedSpans.length > 0 && selectedSpans.push({
76
- node: child,
77
- path: [{
78
- _key: block._key
79
- }, "children", {
80
- _key: child._key
81
- }]
82
- });
83
- }
84
- if (startBlockKey === endBlockKey)
85
- break;
86
- continue;
87
- }
88
- if (block._key === endBlockKey) {
89
- for (const child of block.children)
90
- if (isPortableTextSpan(child)) {
91
- if (endSpanKey && child._key === endSpanKey) {
92
- selectedSpans.push({
93
- node: child,
94
- path: [{
95
- _key: block._key
96
- }, "children", {
97
- _key: child._key
98
- }]
99
- });
100
- break;
101
- }
102
- selectedSpans.push({
103
- node: child,
104
- path: [{
105
- _key: block._key
106
- }, "children", {
107
- _key: child._key
108
- }]
109
- });
110
- }
111
- break;
112
- }
113
- if (selectedSpans.length > 0)
114
- for (const child of block.children)
115
- isPortableTextSpan(child) && selectedSpans.push({
116
- node: child,
117
- path: [{
118
- _key: block._key
119
- }, "children", {
120
- _key: child._key
121
- }]
122
- });
123
- }
124
- return selectedSpans;
125
- };
126
- function isActiveAnnotation(annotation) {
127
- return (snapshot) => {
128
- if (!snapshot.context.selection)
129
- return !1;
130
- const selectedBlocks = getSelectedBlocks(snapshot), selectedSpans = getSelectedSpans(snapshot);
131
- if (selectedSpans.length === 0 || selectedSpans.some((span) => !span.node.marks || span.node.marks?.length === 0))
132
- return !1;
133
- const selectionMarkDefs = selectedBlocks.flatMap((block) => isPortableTextTextBlock(block.node) ? block.node.markDefs ?? [] : []);
134
- return selectedSpans.every((span) => (span.node.marks?.flatMap((mark) => {
135
- const markDef = selectionMarkDefs.find((markDef2) => markDef2._key === mark);
136
- return markDef ? [markDef._type] : [];
137
- }) ?? []).includes(annotation));
138
- };
139
- }
140
- const isSelectionExpanded = ({
141
- context
142
- }) => !isSelectionCollapsed({
143
- context
144
11
  });
145
- function isActiveDecorator(decorator) {
146
- return (snapshot) => {
147
- if (isSelectionExpanded(snapshot)) {
148
- const selectedSpans = getSelectedSpans(snapshot);
149
- return selectedSpans.length > 0 && selectedSpans.every((span) => span.node.marks?.includes(decorator));
150
- }
151
- return snapshot.context.activeDecorators.includes(decorator);
152
- };
153
- }
154
- function isActiveListItem(listItem) {
155
- return (snapshot) => getActiveListItem(snapshot) === listItem;
156
- }
157
- function isActiveStyle(style) {
158
- return (snapshot) => getActiveStyle(snapshot) === style;
159
- }
160
12
  function isPointAfterSelection(point) {
161
13
  return (snapshot) => {
162
14
  if (!snapshot.context.selection)
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/selectors/selector.get-active-list-item.ts","../../src/selectors/selector.get-active-style.ts","../../src/selectors/selector.get-selected-slice.ts","../../src/selectors/selector.get-selected-spans.ts","../../src/selectors/selector.is-active-annotation.ts","../../src/selectors/selector.is-selection-expanded.ts","../../src/selectors/selector.is-active-decorator.ts","../../src/selectors/selector.is-active-list-item.ts","../../src/selectors/selector.is-active-style.ts","../../src/selectors/selector.is-point-after-selection.ts","../../src/selectors/selector.is-point-before-selection.ts"],"sourcesContent":["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> = ({context}) => {\n if (!context.selection) {\n return undefined\n }\n\n const guards = createGuards(context)\n const selectedBlocks = getSelectedBlocks({context}).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 context,\n}) => {\n if (!context.selection) {\n return undefined\n }\n\n const guards = createGuards(context)\n const selectedBlocks = getSelectedBlocks({context}).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 type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {sliceBlocks} from '../utils'\n\n/**\n * @public\n */\nexport const getSelectedSlice: EditorSelector<Array<PortableTextBlock>> = ({\n context,\n}) => {\n return sliceBlocks({blocks: context.value, selection: context.selection})\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> = ({context}) => {\n if (!context.selection) {\n return []\n }\n\n const selectedSpans: Array<{\n node: PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }> = []\n\n const startPoint = context.selection.backward\n ? context.selection.focus\n : context.selection.anchor\n const endPoint = context.selection.backward\n ? context.selection.anchor\n : 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 for (const block of context.value) {\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 selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\n })\n\n if (startSpanKey === endSpanKey) {\n break\n }\n\n continue\n }\n\n if (endSpanKey && child._key === endSpanKey) {\n selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\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 selectedSpans.push({\n node: child,\n path: [{_key: block._key}, 'children', {_key: child._key}],\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 (selectedSpans.length > 0) {\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 {isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getSelectedSpans} from './selector.get-selected-spans'\nimport {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 selectedSpans = getSelectedSpans(snapshot)\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 {isSelectionCollapsed} from './selector.is-selection-collapsed'\n\n/**\n * @public\n */\nexport const isSelectionExpanded: EditorSelector<boolean> = ({context}) => {\n return !isSelectionCollapsed({context})\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","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointAfterSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const endBlockKey = isKeySegment(selection.focus.path[0])\n ? selection.focus.path[0]._key\n : undefined\n const endChildKey = isKeySegment(selection.focus.path[2])\n ? selection.focus.path[2]._key\n : undefined\n\n if (!pointBlockKey || !endBlockKey) {\n return false\n }\n\n let after = false\n\n for (const block of snapshot.context.value) {\n if (block._key === endBlockKey) {\n if (block._key !== pointBlockKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !endChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === endChildKey) {\n if (child._key !== pointChildKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this child\n\n after = point.offset > selection.focus.offset\n break\n }\n\n if (child._key === pointChildKey) {\n break\n }\n }\n }\n\n if (block._key === pointBlockKey) {\n break\n }\n }\n\n return after\n }\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointBeforeSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const startBlockKey = isKeySegment(selection.anchor.path[0])\n ? selection.anchor.path[0]._key\n : undefined\n const startChildKey = isKeySegment(selection.anchor.path[2])\n ? selection.anchor.path[2]._key\n : undefined\n\n if (!pointBlockKey || !startBlockKey) {\n return false\n }\n\n let before = false\n\n for (const block of snapshot.context.value) {\n if (block._key === pointBlockKey) {\n if (block._key !== startBlockKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !startChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === pointChildKey) {\n if (child._key !== startChildKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this child\n\n before = point.offset < selection.anchor.offset\n break\n }\n\n if (child._key === startChildKey) {\n break\n }\n }\n }\n\n if (block._key === startBlockKey) {\n break\n }\n }\n\n return before\n }\n}\n"],"names":["getActiveListItem","context","selection","guards","createGuards","selectedTextBlocks","getSelectedBlocks","map","block","node","filter","isTextBlock","firstTextBlock","at","firstListItem","listItem","every","getActiveStyle","firstStyle","style","getSelectedSlice","sliceBlocks","blocks","value","getSelectedSpans","selectedSpans","startPoint","backward","focus","anchor","endPoint","startBlockKey","isKeySegment","path","_key","undefined","endBlockKey","startSpanKey","endSpanKey","isPortableTextTextBlock","child","children","isPortableTextSpan","push","length","isActiveAnnotation","annotation","snapshot","selectedBlocks","some","span","marks","selectionMarkDefs","flatMap","markDefs","mark","markDef","find","_type","includes","isSelectionExpanded","isSelectionCollapsed","isActiveDecorator","decorator","activeDecorators","isActiveListItem","isActiveStyle","isPointAfterSelection","point","reverseSelection","pointBlockKey","pointChildKey","endChildKey","after","offset","isPointBeforeSelection","startChildKey","before"],"mappings":";;;;;;AAQO,MAAMA,oBAETA,CAAC;AAA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iBtB,SAAS9C,QAAQC,SAAS,GAEvDoE,gBAAgBtC,aAAaoC,MAAMnC,KAAK,CAAC,CAAC,IAC5CmC,MAAMnC,KAAK,CAAC,EAAEC,OACdC,QACEoC,gBAAgBvC,aAAaoC,MAAMnC,KAAK,CAAC,CAAC,IAC5CmC,MAAMnC,KAAK,CAAC,EAAEC,OACdC,QAEEJ,gBAAgBC,aAAa9B,UAAU2B,OAAOI,KAAK,CAAC,CAAC,IACvD/B,UAAU2B,OAAOI,KAAK,CAAC,EAAEC,OACzBC,QACEyC,gBAAgB5C,aAAa9B,UAAU2B,OAAOI,KAAK,CAAC,CAAC,IACvD/B,UAAU2B,OAAOI,KAAK,CAAC,EAAEC,OACzBC;AAEA,QAAA,CAACmC,iBAAiB,CAACvC;AACd,aAAA;AAGT,QAAI8C,SAAS;AAEFrE,eAAAA,SAASuC,SAAS9C,QAAQsB,OAAO;AACtCf,UAAAA,MAAM0B,SAASoC,eAAe;AAC5B9D,YAAAA,MAAM0B,SAASH,eAAe;AACvB,mBAAA;AACT;AAAA,QAAA;AASF,YAJI,CAACQ,wBAAwB/B,KAAK,KAI9B,CAAC+D,iBAAiB,CAACK;AACrB;AAGSpC,mBAAAA,SAAShC,MAAMiC,UAAU;AAC9BD,cAAAA,MAAMN,SAASqC,eAAe;AAC5B/B,gBAAAA,MAAMN,SAAS0C,eAAe;AACvB,uBAAA;AACT;AAAA,YAAA;AAKOR,qBAAAA,MAAMM,SAASxE,UAAU2B,OAAO6C;AACzC;AAAA,UAAA;AAGF,cAAIlC,MAAMN,SAAS0C;AACjB;AAAA,QAAA;AAAA,MAEJ;AAGF,UAAIpE,MAAM0B,SAASH;AACjB;AAAA,IAAA;AAIG8C,WAAAA;AAAAA,EACT;AACF;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/selectors/selector.get-selected-slice.ts","../../src/selectors/selector.is-point-after-selection.ts","../../src/selectors/selector.is-point-before-selection.ts"],"sourcesContent":["import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {sliceBlocks} from '../utils'\n\n/**\n * @public\n */\nexport const getSelectedSlice: EditorSelector<Array<PortableTextBlock>> = ({\n context,\n}) => {\n return sliceBlocks({blocks: context.value, selection: context.selection})\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointAfterSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const endBlockKey = isKeySegment(selection.focus.path[0])\n ? selection.focus.path[0]._key\n : undefined\n const endChildKey = isKeySegment(selection.focus.path[2])\n ? selection.focus.path[2]._key\n : undefined\n\n if (!pointBlockKey || !endBlockKey) {\n return false\n }\n\n let after = false\n\n for (const block of snapshot.context.value) {\n if (block._key === endBlockKey) {\n if (block._key !== pointBlockKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !endChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === endChildKey) {\n if (child._key !== pointChildKey) {\n after = true\n break\n }\n\n // Both the point and the selection end in this child\n\n after = point.offset > selection.focus.offset\n break\n }\n\n if (child._key === pointChildKey) {\n break\n }\n }\n }\n\n if (block._key === pointBlockKey) {\n break\n }\n }\n\n return after\n }\n}\n","import {isKeySegment, isPortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport type {EditorSelectionPoint} from '../types/editor'\nimport {reverseSelection} from '../utils/util.reverse-selection'\n\n/**\n * @public\n */\nexport function isPointBeforeSelection(\n point: EditorSelectionPoint,\n): EditorSelector<boolean> {\n return (snapshot) => {\n if (!snapshot.context.selection) {\n return false\n }\n\n const selection = reverseSelection(snapshot.context.selection)\n\n const pointBlockKey = isKeySegment(point.path[0])\n ? point.path[0]._key\n : undefined\n const pointChildKey = isKeySegment(point.path[2])\n ? point.path[2]._key\n : undefined\n\n const startBlockKey = isKeySegment(selection.anchor.path[0])\n ? selection.anchor.path[0]._key\n : undefined\n const startChildKey = isKeySegment(selection.anchor.path[2])\n ? selection.anchor.path[2]._key\n : undefined\n\n if (!pointBlockKey || !startBlockKey) {\n return false\n }\n\n let before = false\n\n for (const block of snapshot.context.value) {\n if (block._key === pointBlockKey) {\n if (block._key !== startBlockKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this block\n\n if (!isPortableTextTextBlock(block)) {\n break\n }\n\n if (!pointChildKey || !startChildKey) {\n break\n }\n\n for (const child of block.children) {\n if (child._key === pointChildKey) {\n if (child._key !== startChildKey) {\n before = true\n break\n }\n\n // Both the point and the selection start in this child\n\n before = point.offset < selection.anchor.offset\n break\n }\n\n if (child._key === startChildKey) {\n break\n }\n }\n }\n\n if (block._key === startBlockKey) {\n break\n }\n }\n\n return before\n }\n}\n"],"names":["getSelectedSlice","context","sliceBlocks","blocks","value","selection","isPointAfterSelection","point","snapshot","reverseSelection","pointBlockKey","isKeySegment","path","_key","undefined","pointChildKey","endBlockKey","focus","endChildKey","after","block","isPortableTextTextBlock","child","children","offset","isPointBeforeSelection","startBlockKey","anchor","startChildKey","before"],"mappings":";;;;;AAOO,MAAMA,mBAA6DA,CAAC;AAAA,EACzEC;AACF,MACSC,YAAY;AAAA,EAACC,QAAQF,QAAQG;AAAAA,EAAOC,WAAWJ,QAAQI;AAAS,CAAC;ACFnE,SAASC,sBACdC,OACyB;AACzB,SAAQC,CAAa,aAAA;AACf,QAAA,CAACA,SAASP,QAAQI;AACb,aAAA;AAGT,UAAMA,YAAYI,iBAAiBD,SAASP,QAAQI,SAAS,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AAgBJ,aAAaJ,MAAMK,KAAK,CAAC,CAAC,IAC5CL,MAAMK,KAAK,CAAC,EAAEC,OACdC,QAEEY,gBAAgBf,aAAaN,UAAUsB,OAAOf,KAAK,CAAC,CAAC,IACvDP,UAAUsB,OAAOf,KAAK,CAAC,EAAEC,OACzBC,QACEc,gBAAgBjB,aAAaN,UAAUsB,OAAOf,KAAK,CAAC,CAAC,IACvDP,UAAUsB,OAAOf,KAAK,CAAC,EAAEC,OACzBC;AAEA,QAAA,CAACJ,iBAAiB,CAACgB;AACd,aAAA;AAGT,QAAIG,SAAS;AAEFT,eAAAA,SAASZ,SAASP,QAAQG,OAAO;AACtCgB,UAAAA,MAAMP,SAASH,eAAe;AAC5BU,YAAAA,MAAMP,SAASa,eAAe;AACvB,mBAAA;AACT;AAAA,QAAA;AASF,YAJI,CAACL,wBAAwBD,KAAK,KAI9B,CAACL,iBAAiB,CAACa;AACrB;AAGSN,mBAAAA,SAASF,MAAMG,UAAU;AAC9BD,cAAAA,MAAMT,SAASE,eAAe;AAC5BO,gBAAAA,MAAMT,SAASe,eAAe;AACvB,uBAAA;AACT;AAAA,YAAA;AAKOrB,qBAAAA,MAAMiB,SAASnB,UAAUsB,OAAOH;AACzC;AAAA,UAAA;AAGF,cAAIF,MAAMT,SAASe;AACjB;AAAA,QAAA;AAAA,MAEJ;AAGF,UAAIR,MAAMP,SAASa;AACjB;AAAA,IAAA;AAIGG,WAAAA;AAAAA,EACT;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -73,15 +73,15 @@
73
73
  "slate-react": "0.112.1",
74
74
  "use-effect-event": "^1.0.2",
75
75
  "xstate": "^5.19.2",
76
- "@portabletext/block-tools": "1.1.1",
76
+ "@portabletext/block-tools": "1.1.2",
77
77
  "@portabletext/patches": "1.1.2"
78
78
  },
79
79
  "devDependencies": {
80
80
  "@portabletext/toolkit": "^2.0.16",
81
81
  "@sanity/diff-match-patch": "^3.2.0",
82
82
  "@sanity/pkg-utils": "^7.0.2",
83
- "@sanity/schema": "^3.71.0",
84
- "@sanity/types": "^3.71.0",
83
+ "@sanity/schema": "^3.71.1",
84
+ "@sanity/types": "^3.71.1",
85
85
  "@testing-library/jest-dom": "^6.6.3",
86
86
  "@testing-library/react": "^16.2.0",
87
87
  "@types/debug": "^4.1.12",
@@ -109,8 +109,8 @@
109
109
  "racejar": "1.1.1"
110
110
  },
111
111
  "peerDependencies": {
112
- "@sanity/schema": "^3.71.0",
113
- "@sanity/types": "^3.71.0",
112
+ "@sanity/schema": "^3.71.1",
113
+ "@sanity/types": "^3.71.1",
114
114
  "react": "^16.9 || ^17 || ^18 || ^19",
115
115
  "rxjs": "^7.8.1"
116
116
  },