@portabletext/editor 1.48.9 → 1.48.11

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 (80) hide show
  1. package/lib/_chunks-cjs/editor-provider.cjs +879 -169
  2. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  3. package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs +2 -2
  4. package/lib/_chunks-cjs/selector.get-focus-inline-object.cjs.map +1 -1
  5. package/lib/_chunks-cjs/selector.get-text-before.cjs +2 -2
  6. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  7. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +464 -19
  8. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
  9. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +9 -1
  10. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
  11. package/lib/_chunks-cjs/util.slice-blocks.cjs +2 -2
  12. package/lib/_chunks-es/editor-provider.js +773 -65
  13. package/lib/_chunks-es/editor-provider.js.map +1 -1
  14. package/lib/_chunks-es/selector.get-focus-inline-object.js +1 -1
  15. package/lib/_chunks-es/selector.get-text-before.js +1 -1
  16. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +448 -3
  17. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
  18. package/lib/_chunks-es/util.selection-point-to-block-offset.js +9 -1
  19. package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
  20. package/lib/_chunks-es/util.slice-blocks.js +2 -2
  21. package/lib/behaviors/index.cjs +27 -377
  22. package/lib/behaviors/index.cjs.map +1 -1
  23. package/lib/behaviors/index.d.cts +3696 -13915
  24. package/lib/behaviors/index.d.ts +3696 -13915
  25. package/lib/behaviors/index.js +22 -377
  26. package/lib/behaviors/index.js.map +1 -1
  27. package/lib/index.cjs +17 -17
  28. package/lib/index.cjs.map +1 -1
  29. package/lib/index.d.cts +3008 -394
  30. package/lib/index.d.ts +3008 -394
  31. package/lib/index.js +4 -5
  32. package/lib/index.js.map +1 -1
  33. package/lib/plugins/index.cjs +347 -30
  34. package/lib/plugins/index.cjs.map +1 -1
  35. package/lib/plugins/index.d.cts +3008 -395
  36. package/lib/plugins/index.d.ts +3008 -395
  37. package/lib/plugins/index.js +324 -8
  38. package/lib/plugins/index.js.map +1 -1
  39. package/lib/selectors/index.cjs +29 -29
  40. package/lib/selectors/index.cjs.map +1 -1
  41. package/lib/selectors/index.d.cts +3007 -387
  42. package/lib/selectors/index.d.ts +3007 -387
  43. package/lib/selectors/index.js +2 -3
  44. package/lib/selectors/index.js.map +1 -1
  45. package/lib/utils/index.cjs +5 -5
  46. package/lib/utils/index.cjs.map +1 -1
  47. package/lib/utils/index.d.cts +3008 -389
  48. package/lib/utils/index.d.ts +3008 -389
  49. package/lib/utils/index.js +2 -3
  50. package/lib/utils/index.js.map +1 -1
  51. package/package.json +1 -1
  52. package/src/behaviors/behavior.emoji-picker.ts +0 -6
  53. package/src/behaviors/behavior.markdown.ts +0 -48
  54. package/src/behaviors/index.ts +0 -15
  55. package/src/editor/create-editor.ts +0 -3
  56. package/src/editor/editor-machine.ts +105 -52
  57. package/src/editor/sync-machine.ts +10 -4
  58. package/src/internal-utils/__tests__/operationToPatches.test.ts +0 -2
  59. package/src/internal-utils/__tests__/patchToOperations.test.ts +0 -2
  60. package/src/plugins/plugin.core.tsx +1 -1
  61. package/lib/_chunks-cjs/behavior.core.cjs +0 -700
  62. package/lib/_chunks-cjs/behavior.core.cjs.map +0 -1
  63. package/lib/_chunks-cjs/behavior.markdown.cjs +0 -321
  64. package/lib/_chunks-cjs/behavior.markdown.cjs.map +0 -1
  65. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +0 -449
  66. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +0 -1
  67. package/lib/_chunks-cjs/util.get-selection-start-point.cjs +0 -10
  68. package/lib/_chunks-cjs/util.get-selection-start-point.cjs.map +0 -1
  69. package/lib/_chunks-es/behavior.core.js +0 -703
  70. package/lib/_chunks-es/behavior.core.js.map +0 -1
  71. package/lib/_chunks-es/behavior.markdown.js +0 -325
  72. package/lib/_chunks-es/behavior.markdown.js.map +0 -1
  73. package/lib/_chunks-es/selector.is-overlapping-selection.js +0 -451
  74. package/lib/_chunks-es/selector.is-overlapping-selection.js.map +0 -1
  75. package/lib/_chunks-es/util.get-selection-start-point.js +0 -11
  76. package/lib/_chunks-es/util.get-selection-start-point.js.map +0 -1
  77. package/src/behaviors/behavior.code-editor.ts +0 -77
  78. package/src/behaviors/behavior.links.ts +0 -84
  79. package/src/internal-utils/looks-like-url.test.ts +0 -19
  80. package/src/internal-utils/looks-like-url.ts +0 -15
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
- var types = require("@sanity/types"), selector_isOverlappingSelection = require("./selector.is-overlapping-selection.cjs");
2
+ var types = require("@sanity/types"), selector_isSelectingEntireBlocks = require("./selector.is-selecting-entire-blocks.cjs");
3
3
  const getFocusInlineObject = (snapshot) => {
4
- const focusChild = selector_isOverlappingSelection.getFocusChild(snapshot);
4
+ const focusChild = selector_isSelectingEntireBlocks.getFocusChild(snapshot);
5
5
  return focusChild && !types.isPortableTextSpan(focusChild.node) ? {
6
6
  node: focusChild.node,
7
7
  path: focusChild.path
@@ -1 +1 @@
1
- {"version":3,"file":"selector.get-focus-inline-object.cjs","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,8CAAcF,QAAQ;AAEzC,SAAOC,cAAc,CAACE,MAAAA,mBAAmBF,WAAWG,IAAI,IACpD;AAAA,IAACA,MAAMH,WAAWG;AAAAA,IAAMC,MAAMJ,WAAWI;AAAAA,EAAAA,IACzCC;AACN;;"}
1
+ {"version":3,"file":"selector.get-focus-inline-object.cjs","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,MAAAA,mBAAmBF,WAAWG,IAAI,IACpD;AAAA,IAACA,MAAMH,WAAWG;AAAAA,IAAMC,MAAMJ,WAAWI;AAAAA,EAAAA,IACzCC;AACN;;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var util_sliceBlocks = require("./util.slice-blocks.cjs"), selector_isOverlappingSelection = require("./selector.is-overlapping-selection.cjs");
2
+ var util_sliceBlocks = require("./util.slice-blocks.cjs"), selector_isSelectingEntireBlocks = require("./selector.is-selecting-entire-blocks.cjs");
3
3
  const getBlockTextBefore = (snapshot) => {
4
4
  if (!snapshot.context.selection)
5
5
  return "";
@@ -15,7 +15,7 @@ const getBlockTextBefore = (snapshot) => {
15
15
  }]
16
16
  }
17
17
  });
18
- return selector_isOverlappingSelection.getSelectionText({
18
+ return selector_isSelectingEntireBlocks.getSelectionText({
19
19
  context: {
20
20
  ...snapshot.context,
21
21
  selection: {
@@ -1 +1 @@
1
- {"version":3,"file":"selector.get-text-before.cjs","sources":["../../src/selectors/selector.get-text-before.ts"],"sourcesContent":["import type {EditorSelector} from '../editor/editor-selector'\nimport {getBlockStartPoint} from '../utils/util.get-block-start-point'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {reverseSelection} from '../utils/util.reverse-selection'\nimport {getSelectionText} from './selector.get-selection-text'\n\n/**\n * @public\n */\nexport const getBlockTextBefore: EditorSelector<string> = (snapshot) => {\n if (!snapshot.context.selection) {\n return ''\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n const point = selection.anchor\n const key = isKeyedSegment(point.path[0]) ? point.path[0]._key : undefined\n\n const block = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n if (!block) {\n return ''\n }\n\n const startOfBlock = getBlockStartPoint({\n context: snapshot.context,\n block: {\n node: block,\n path: [{_key: block._key}],\n },\n })\n\n return getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: startOfBlock,\n focus: point,\n },\n },\n })\n}\n"],"names":["getBlockTextBefore","snapshot","context","selection","point","backward","reverseSelection","anchor","key","isKeyedSegment","path","_key","undefined","block","value","find","startOfBlock","getBlockStartPoint","node","getSelectionText","focus"],"mappings":";;AASO,MAAMA,qBAA8CC,CAAa,aAAA;AAClE,MAAA,CAACA,SAASC,QAAQC;AACb,WAAA;AAMT,QAAMC,SAHYH,SAASC,QAAQC,UAAUE,WACzCC,kCAAiBL,SAASC,QAAQC,SAAS,IAC3CF,SAASC,QAAQC,WACGI,QAClBC,MAAMC,iBAAAA,eAAeL,MAAMM,KAAK,CAAC,CAAC,IAAIN,MAAMM,KAAK,CAAC,EAAEC,OAAOC,QAE3DC,QAAQL,MACVP,SAASC,QAAQY,MAAMC,KAAMF,CAAAA,WAAUA,OAAMF,SAASH,GAAG,IACzDI;AAEJ,MAAI,CAACC;AACI,WAAA;AAGT,QAAMG,eAAeC,iBAAAA,mBAAmB;AAAA,IACtCf,SAASD,SAASC;AAAAA,IAClBW,OAAO;AAAA,MACLK,MAAML;AAAAA,MACNH,MAAM,CAAC;AAAA,QAACC,MAAME,MAAMF;AAAAA,MAAK,CAAA;AAAA,IAAA;AAAA,EAC3B,CACD;AAED,SAAOQ,iDAAiB;AAAA,IAEtBjB,SAAS;AAAA,MACP,GAAGD,SAASC;AAAAA,MACZC,WAAW;AAAA,QACTI,QAAQS;AAAAA,QACRI,OAAOhB;AAAAA,MAAAA;AAAAA,IACT;AAAA,EACF,CACD;AACH;;"}
1
+ {"version":3,"file":"selector.get-text-before.cjs","sources":["../../src/selectors/selector.get-text-before.ts"],"sourcesContent":["import type {EditorSelector} from '../editor/editor-selector'\nimport {getBlockStartPoint} from '../utils/util.get-block-start-point'\nimport {isKeyedSegment} from '../utils/util.is-keyed-segment'\nimport {reverseSelection} from '../utils/util.reverse-selection'\nimport {getSelectionText} from './selector.get-selection-text'\n\n/**\n * @public\n */\nexport const getBlockTextBefore: EditorSelector<string> = (snapshot) => {\n if (!snapshot.context.selection) {\n return ''\n }\n\n const selection = snapshot.context.selection.backward\n ? reverseSelection(snapshot.context.selection)\n : snapshot.context.selection\n const point = selection.anchor\n const key = isKeyedSegment(point.path[0]) ? point.path[0]._key : undefined\n\n const block = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n if (!block) {\n return ''\n }\n\n const startOfBlock = getBlockStartPoint({\n context: snapshot.context,\n block: {\n node: block,\n path: [{_key: block._key}],\n },\n })\n\n return getSelectionText({\n ...snapshot,\n context: {\n ...snapshot.context,\n selection: {\n anchor: startOfBlock,\n focus: point,\n },\n },\n })\n}\n"],"names":["getBlockTextBefore","snapshot","context","selection","point","backward","reverseSelection","anchor","key","isKeyedSegment","path","_key","undefined","block","value","find","startOfBlock","getBlockStartPoint","node","getSelectionText","focus"],"mappings":";;AASO,MAAMA,qBAA8CC,CAAa,aAAA;AAClE,MAAA,CAACA,SAASC,QAAQC;AACb,WAAA;AAMT,QAAMC,SAHYH,SAASC,QAAQC,UAAUE,WACzCC,kCAAiBL,SAASC,QAAQC,SAAS,IAC3CF,SAASC,QAAQC,WACGI,QAClBC,MAAMC,iBAAAA,eAAeL,MAAMM,KAAK,CAAC,CAAC,IAAIN,MAAMM,KAAK,CAAC,EAAEC,OAAOC,QAE3DC,QAAQL,MACVP,SAASC,QAAQY,MAAMC,KAAMF,CAAAA,WAAUA,OAAMF,SAASH,GAAG,IACzDI;AAEJ,MAAI,CAACC;AACI,WAAA;AAGT,QAAMG,eAAeC,iBAAAA,mBAAmB;AAAA,IACtCf,SAASD,SAASC;AAAAA,IAClBW,OAAO;AAAA,MACLK,MAAML;AAAAA,MACNH,MAAM,CAAC;AAAA,QAACC,MAAME,MAAMF;AAAAA,MAAK,CAAA;AAAA,IAAA;AAAA,EAC3B,CACD;AAED,SAAOQ,kDAAiB;AAAA,IAEtBjB,SAAS;AAAA,MACP,GAAGD,SAASC;AAAAA,MACZC,WAAW;AAAA,QACTI,QAAQS;AAAAA,QACRI,OAAOhB;AAAAA,MAAAA;AAAAA,IACT;AAAA,EACF,CACD;AACH;;"}
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var util_sliceBlocks = require("./util.slice-blocks.cjs"), selector_isOverlappingSelection = require("./selector.is-overlapping-selection.cjs");
2
+ var util_sliceBlocks = require("./util.slice-blocks.cjs"), types = require("@sanity/types");
3
3
  const getSelectedSpans = (snapshot) => {
4
4
  if (!snapshot.context.selection)
5
5
  return [];
@@ -12,7 +12,7 @@ const getSelectedSpans = (snapshot) => {
12
12
  if (block._key === startBlockKey && (startBlockFound = !0), !!util_sliceBlocks.isTextBlock(snapshot.context, block)) {
13
13
  if (block._key === startBlockKey) {
14
14
  for (const child of block.children)
15
- if (util_sliceBlocks.isSpan(snapshot.context, child)) {
15
+ if (util_sliceBlocks.isSpan$1(snapshot.context, child)) {
16
16
  if (startSpanKey && child._key === startSpanKey) {
17
17
  if (startPoint.offset < child.text.length && selectedSpans.push({
18
18
  node: child,
@@ -51,7 +51,7 @@ const getSelectedSpans = (snapshot) => {
51
51
  }
52
52
  if (block._key === endBlockKey) {
53
53
  for (const child of block.children)
54
- if (util_sliceBlocks.isSpan(snapshot.context, child)) {
54
+ if (util_sliceBlocks.isSpan$1(snapshot.context, child)) {
55
55
  if (endSpanKey && child._key === endSpanKey) {
56
56
  endPoint.offset > 0 && selectedSpans.push({
57
57
  node: child,
@@ -76,7 +76,7 @@ const getSelectedSpans = (snapshot) => {
76
76
  }
77
77
  if (startBlockFound)
78
78
  for (const child of block.children)
79
- util_sliceBlocks.isSpan(snapshot.context, child) && selectedSpans.push({
79
+ util_sliceBlocks.isSpan$1(snapshot.context, child) && selectedSpans.push({
80
80
  node: child,
81
81
  path: [{
82
82
  _key: block._key
@@ -86,13 +86,169 @@ const getSelectedSpans = (snapshot) => {
86
86
  });
87
87
  }
88
88
  return selectedSpans;
89
+ }, 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, getFocusBlock = (snapshot) => {
90
+ const key = snapshot.context.selection && util_sliceBlocks.isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
91
+ return node && key ? {
92
+ node,
93
+ path: [{
94
+ _key: key
95
+ }]
96
+ } : void 0;
97
+ }, getFocusListBlock = (snapshot) => {
98
+ const focusTextBlock = getFocusTextBlock(snapshot);
99
+ return focusTextBlock && util_sliceBlocks.isListBlock(snapshot.context, focusTextBlock.node) ? {
100
+ node: focusTextBlock.node,
101
+ path: focusTextBlock.path
102
+ } : void 0;
103
+ }, getFocusTextBlock = (snapshot) => {
104
+ const focusBlock = getFocusBlock(snapshot);
105
+ return focusBlock && util_sliceBlocks.isTextBlock(snapshot.context, focusBlock.node) ? {
106
+ node: focusBlock.node,
107
+ path: focusBlock.path
108
+ } : void 0;
109
+ }, getFocusBlockObject = (snapshot) => {
110
+ const focusBlock = getFocusBlock(snapshot);
111
+ return focusBlock && !util_sliceBlocks.isTextBlock(snapshot.context, focusBlock.node) ? {
112
+ node: focusBlock.node,
113
+ path: focusBlock.path
114
+ } : void 0;
115
+ }, getFocusChild = (snapshot) => {
116
+ const focusBlock = getFocusTextBlock(snapshot);
117
+ if (!focusBlock)
118
+ return;
119
+ const key = snapshot.context.selection && util_sliceBlocks.isKeyedSegment(snapshot.context.selection.focus.path[2]) ? snapshot.context.selection.focus.path[2]._key : void 0, node = key ? focusBlock.node.children.find((span) => span._key === key) : void 0;
120
+ return node && key ? {
121
+ node,
122
+ path: [...focusBlock.path, "children", {
123
+ _key: key
124
+ }]
125
+ } : void 0;
126
+ }, getFocusSpan = (snapshot) => {
127
+ const focusChild = getFocusChild(snapshot);
128
+ return focusChild && util_sliceBlocks.isSpan$1(snapshot.context, focusChild.node) ? {
129
+ node: focusChild.node,
130
+ path: focusChild.path
131
+ } : void 0;
132
+ }, getFirstBlock = (snapshot) => {
133
+ const node = snapshot.context.value[0];
134
+ return node ? {
135
+ node,
136
+ path: [{
137
+ _key: node._key
138
+ }]
139
+ } : void 0;
140
+ }, getLastBlock = (snapshot) => {
141
+ const node = snapshot.context.value[snapshot.context.value.length - 1] ? snapshot.context.value[snapshot.context.value.length - 1] : void 0;
142
+ return node ? {
143
+ node,
144
+ path: [{
145
+ _key: node._key
146
+ }]
147
+ } : void 0;
148
+ }, getSelectedBlocks = (snapshot) => {
149
+ if (!snapshot.context.selection)
150
+ return [];
151
+ const selectedBlocks = [], startKey = snapshot.context.selection.backward ? util_sliceBlocks.isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0 : util_sliceBlocks.isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0, endKey = snapshot.context.selection.backward ? util_sliceBlocks.isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0 : util_sliceBlocks.isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0;
152
+ if (!startKey || !endKey)
153
+ return selectedBlocks;
154
+ for (const block of snapshot.context.value) {
155
+ if (block._key === startKey) {
156
+ if (selectedBlocks.push({
157
+ node: block,
158
+ path: [{
159
+ _key: block._key
160
+ }]
161
+ }), startKey === endKey)
162
+ break;
163
+ continue;
164
+ }
165
+ if (block._key === endKey) {
166
+ selectedBlocks.push({
167
+ node: block,
168
+ path: [{
169
+ _key: block._key
170
+ }]
171
+ });
172
+ break;
173
+ }
174
+ selectedBlocks.length > 0 && selectedBlocks.push({
175
+ node: block,
176
+ path: [{
177
+ _key: block._key
178
+ }]
179
+ });
180
+ }
181
+ return selectedBlocks;
182
+ }, getSelectionStartBlock = (snapshot) => {
183
+ if (!snapshot.context.selection)
184
+ return;
185
+ const key = snapshot.context.selection.backward ? util_sliceBlocks.isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0 : util_sliceBlocks.isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
186
+ return node && key ? {
187
+ node,
188
+ path: [{
189
+ _key: key
190
+ }]
191
+ } : void 0;
192
+ }, getSelectionEndBlock = (snapshot) => {
193
+ if (!snapshot.context.selection)
194
+ return;
195
+ const key = snapshot.context.selection.backward ? util_sliceBlocks.isKeyedSegment(snapshot.context.selection.anchor.path[0]) ? snapshot.context.selection.anchor.path[0]._key : void 0 : util_sliceBlocks.isKeyedSegment(snapshot.context.selection.focus.path[0]) ? snapshot.context.selection.focus.path[0]._key : void 0, node = key ? snapshot.context.value.find((block) => block._key === key) : void 0;
196
+ return node && key ? {
197
+ node,
198
+ path: [{
199
+ _key: key
200
+ }]
201
+ } : void 0;
202
+ }, getPreviousBlock = (snapshot) => {
203
+ let previousBlock;
204
+ const selectionStartBlock = getSelectionStartBlock(snapshot);
205
+ if (!selectionStartBlock)
206
+ return;
207
+ let foundSelectionStartBlock = !1;
208
+ for (const block of snapshot.context.value) {
209
+ if (block._key === selectionStartBlock.node._key) {
210
+ foundSelectionStartBlock = !0;
211
+ break;
212
+ }
213
+ previousBlock = {
214
+ node: block,
215
+ path: [{
216
+ _key: block._key
217
+ }]
218
+ };
219
+ }
220
+ if (foundSelectionStartBlock && previousBlock)
221
+ return previousBlock;
222
+ }, getNextBlock = (snapshot) => {
223
+ let nextBlock;
224
+ const selectionEndBlock = getSelectionEndBlock(snapshot);
225
+ if (!selectionEndBlock)
226
+ return;
227
+ let foundSelectionEndBlock = !1;
228
+ for (const block of snapshot.context.value) {
229
+ if (block._key === selectionEndBlock.node._key) {
230
+ foundSelectionEndBlock = !0;
231
+ continue;
232
+ }
233
+ if (foundSelectionEndBlock) {
234
+ nextBlock = {
235
+ node: block,
236
+ path: [{
237
+ _key: block._key
238
+ }]
239
+ };
240
+ break;
241
+ }
242
+ }
243
+ if (foundSelectionEndBlock && nextBlock)
244
+ return nextBlock;
89
245
  }, getActiveAnnotations = (snapshot) => {
90
246
  if (!snapshot.context.selection)
91
247
  return [];
92
- const selectedBlocks = selector_isOverlappingSelection.getSelectedBlocks(snapshot), selectedSpans = getSelectedSpans(snapshot), focusSpan = selector_isOverlappingSelection.getFocusSpan(snapshot);
248
+ const selectedBlocks = getSelectedBlocks(snapshot), selectedSpans = getSelectedSpans(snapshot), focusSpan = getFocusSpan(snapshot);
93
249
  if (selectedSpans.length === 0 || !focusSpan)
94
250
  return [];
95
- if (selectedSpans.length === 1 && selector_isOverlappingSelection.isSelectionCollapsed(snapshot)) {
251
+ if (selectedSpans.length === 1 && isSelectionCollapsed(snapshot)) {
96
252
  if (snapshot.context.selection.focus.offset === 0)
97
253
  return [];
98
254
  if (snapshot.context.selection.focus.offset === focusSpan.node.text.length)
@@ -102,7 +258,7 @@ const getSelectedSpans = (snapshot) => {
102
258
  }, getActiveListItem = (snapshot) => {
103
259
  if (!snapshot.context.selection)
104
260
  return;
105
- const selectedTextBlocks = selector_isOverlappingSelection.getSelectedBlocks(snapshot).map((block) => block.node).filter((block) => util_sliceBlocks.isTextBlock(snapshot.context, block)), firstTextBlock = selectedTextBlocks.at(0);
261
+ const selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter((block) => util_sliceBlocks.isTextBlock(snapshot.context, block)), firstTextBlock = selectedTextBlocks.at(0);
106
262
  if (!firstTextBlock)
107
263
  return;
108
264
  const firstListItem = firstTextBlock.listItem;
@@ -111,12 +267,125 @@ const getSelectedSpans = (snapshot) => {
111
267
  }, getActiveStyle = (snapshot) => {
112
268
  if (!snapshot.context.selection)
113
269
  return;
114
- const selectedTextBlocks = selector_isOverlappingSelection.getSelectedBlocks(snapshot).map((block) => block.node).filter((block) => util_sliceBlocks.isTextBlock(snapshot.context, block)), firstTextBlock = selectedTextBlocks.at(0);
270
+ const selectedTextBlocks = getSelectedBlocks(snapshot).map((block) => block.node).filter((block) => util_sliceBlocks.isTextBlock(snapshot.context, block)), firstTextBlock = selectedTextBlocks.at(0);
115
271
  if (!firstTextBlock)
116
272
  return;
117
273
  const firstStyle = firstTextBlock.style;
118
274
  if (firstStyle && selectedTextBlocks.every((block) => block.style === firstStyle))
119
275
  return firstStyle;
276
+ }, getSelectionEndPoint = (snapshot) => {
277
+ if (snapshot.context.selection)
278
+ return snapshot.context.selection.backward ? snapshot.context.selection.anchor : snapshot.context.selection.focus;
279
+ }, getSelectionStartPoint = (snapshot) => {
280
+ if (snapshot.context.selection)
281
+ return snapshot.context.selection.backward ? snapshot.context.selection.focus : snapshot.context.selection.anchor;
282
+ }, getNextInlineObject = (snapshot) => {
283
+ const focusTextBlock = getFocusTextBlock(snapshot), selectionEndPoint = getSelectionEndPoint(snapshot), selectionEndPointChildKey = selectionEndPoint && types.isKeySegment(selectionEndPoint.path[2]) ? selectionEndPoint.path[2]._key : void 0;
284
+ if (!focusTextBlock || !selectionEndPointChildKey)
285
+ return;
286
+ let endPointChildFound = !1, inlineObject;
287
+ for (const child of focusTextBlock.node.children) {
288
+ if (child._key === selectionEndPointChildKey) {
289
+ endPointChildFound = !0;
290
+ continue;
291
+ }
292
+ if (!util_sliceBlocks.isSpan(snapshot.context, child) && endPointChildFound) {
293
+ inlineObject = {
294
+ node: child,
295
+ path: [...focusTextBlock.path, "children", {
296
+ _key: child._key
297
+ }]
298
+ };
299
+ break;
300
+ }
301
+ }
302
+ return inlineObject;
303
+ }, getPreviousInlineObject = (snapshot) => {
304
+ const focusTextBlock = getFocusTextBlock(snapshot), selectionStartPoint = getSelectionStartPoint(snapshot), selectionStartPointChildKey = selectionStartPoint && types.isKeySegment(selectionStartPoint.path[2]) ? selectionStartPoint.path[2]._key : void 0;
305
+ if (!focusTextBlock || !selectionStartPointChildKey)
306
+ return;
307
+ let inlineObject;
308
+ for (const child of focusTextBlock.node.children) {
309
+ if (child._key === selectionStartPointChildKey)
310
+ break;
311
+ util_sliceBlocks.isSpan(snapshot.context, child) || (inlineObject = {
312
+ node: child,
313
+ path: [...focusTextBlock.path, "children", {
314
+ _key: child._key
315
+ }]
316
+ });
317
+ }
318
+ return inlineObject;
319
+ }, getSelectedSlice = (snapshot) => util_sliceBlocks.sliceBlocks({
320
+ context: snapshot.context,
321
+ blocks: snapshot.context.value
322
+ }), getSelectionText = (snapshot) => getSelectedSlice(snapshot).reduce((text, block) => util_sliceBlocks.isTextBlock(snapshot.context, block) ? text + block.children.reduce((text2, child) => util_sliceBlocks.isSpan$1(snapshot.context, child) ? text2 + child.text : text2, "") : text, ""), isSelectionExpanded = (snapshot) => !isSelectionCollapsed(snapshot), getCaretWordSelection = (snapshot) => {
323
+ if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
324
+ return null;
325
+ const focusTextBlock = getFocusTextBlock(snapshot), selectionStartPoint = getSelectionStartPoint(snapshot), selectionStartOffset = selectionStartPoint ? util_sliceBlocks.spanSelectionPointToBlockOffset({
326
+ context: snapshot.context,
327
+ selectionPoint: selectionStartPoint
328
+ }) : void 0;
329
+ if (!focusTextBlock || !selectionStartPoint || !selectionStartOffset)
330
+ return null;
331
+ const previousInlineObject = getPreviousInlineObject(snapshot), blockStartPoint = util_sliceBlocks.getBlockStartPoint({
332
+ context: snapshot.context,
333
+ block: focusTextBlock
334
+ }), textDirectlyBefore = getSelectionText({
335
+ context: {
336
+ ...snapshot.context,
337
+ selection: {
338
+ anchor: previousInlineObject ? {
339
+ path: previousInlineObject.path,
340
+ offset: 0
341
+ } : blockStartPoint,
342
+ focus: selectionStartPoint
343
+ }
344
+ }
345
+ }).split(/\s+/).at(-1), nextInlineObject = getNextInlineObject(snapshot), blockEndPoint = util_sliceBlocks.getBlockEndPoint({
346
+ context: snapshot.context,
347
+ block: focusTextBlock
348
+ }), textDirectlyAfter = getSelectionText({
349
+ context: {
350
+ ...snapshot.context,
351
+ selection: {
352
+ anchor: selectionStartPoint,
353
+ focus: nextInlineObject ? {
354
+ path: nextInlineObject.path,
355
+ offset: 0
356
+ } : blockEndPoint
357
+ }
358
+ }
359
+ }).split(/\s+/).at(0);
360
+ if ((textDirectlyBefore === void 0 || textDirectlyBefore === "") && (textDirectlyAfter === void 0 || textDirectlyAfter === ""))
361
+ return null;
362
+ const caretWordStartOffset = textDirectlyBefore ? {
363
+ ...selectionStartOffset,
364
+ offset: selectionStartOffset.offset - textDirectlyBefore.length
365
+ } : selectionStartOffset, caretWordEndOffset = textDirectlyAfter ? {
366
+ ...selectionStartOffset,
367
+ offset: selectionStartOffset.offset + textDirectlyAfter.length
368
+ } : selectionStartOffset, caretWordStartSelectionPoint = util_sliceBlocks.blockOffsetToSpanSelectionPoint({
369
+ context: snapshot.context,
370
+ blockOffset: caretWordStartOffset,
371
+ direction: "backward"
372
+ }), caretWordEndSelectionPoint = util_sliceBlocks.blockOffsetToSpanSelectionPoint({
373
+ context: snapshot.context,
374
+ blockOffset: caretWordEndOffset,
375
+ direction: "forward"
376
+ });
377
+ if (!caretWordStartSelectionPoint || !caretWordEndSelectionPoint)
378
+ return null;
379
+ const caretWordSelection = {
380
+ anchor: caretWordStartSelectionPoint,
381
+ focus: caretWordEndSelectionPoint
382
+ };
383
+ return isSelectionExpanded({
384
+ context: {
385
+ ...snapshot.context,
386
+ selection: caretWordSelection
387
+ }
388
+ }) ? caretWordSelection : null;
120
389
  }, getSelectedTextBlocks = (snapshot) => {
121
390
  if (!snapshot.context.selection)
122
391
  return [];
@@ -154,7 +423,7 @@ const getSelectedSpans = (snapshot) => {
154
423
  }, getTrimmedSelection = (snapshot) => {
155
424
  if (!snapshot.context.selection)
156
425
  return snapshot.context.selection;
157
- const startPoint = selector_isOverlappingSelection.getSelectionStartPoint(snapshot), endPoint = selector_isOverlappingSelection.getSelectionEndPoint(snapshot);
426
+ const startPoint = getSelectionStartPoint(snapshot), endPoint = getSelectionEndPoint(snapshot);
158
427
  if (!startPoint || !endPoint)
159
428
  return snapshot.context.selection;
160
429
  const startBlockKey = util_sliceBlocks.isKeyedSegment(startPoint.path[0]) ? startPoint.path[0]._key : null, startChildKey = util_sliceBlocks.isKeyedSegment(startPoint.path[2]) ? startPoint.path[2]._key : null, endBlockKey = util_sliceBlocks.isKeyedSegment(endPoint.path[0]) ? endPoint.path[0]._key : null, endChildKey = util_sliceBlocks.isKeyedSegment(endPoint.path[2]) ? endPoint.path[2]._key : null;
@@ -166,7 +435,7 @@ const getSelectedSpans = (snapshot) => {
166
435
  if (block._key === endBlockKey && util_sliceBlocks.isEmptyTextBlock(snapshot.context, block))
167
436
  break;
168
437
  for (const child of block.children) {
169
- if (child._key === endChildKey && (!util_sliceBlocks.isSpan(snapshot.context, child) || endPoint.offset === 0)) {
438
+ if (child._key === endChildKey && (!util_sliceBlocks.isSpan$1(snapshot.context, child) || endPoint.offset === 0)) {
170
439
  adjustedEndPoint = previousPotentialEndpoint ? {
171
440
  path: [{
172
441
  _key: previousPotentialEndpoint.blockKey
@@ -178,8 +447,8 @@ const getSelectedSpans = (snapshot) => {
178
447
  break;
179
448
  }
180
449
  if (trimStartPoint) {
181
- const lonelySpan = util_sliceBlocks.isSpan(snapshot.context, child) && block.children.length === 1;
182
- (util_sliceBlocks.isSpan(snapshot.context, child) && child.text.length > 0 || lonelySpan) && (adjustedStartPoint = {
450
+ const lonelySpan = util_sliceBlocks.isSpan$1(snapshot.context, child) && block.children.length === 1;
451
+ (util_sliceBlocks.isSpan$1(snapshot.context, child) && child.text.length > 0 || lonelySpan) && (adjustedStartPoint = {
183
452
  path: [{
184
453
  _key: block._key
185
454
  }, "children", {
@@ -193,7 +462,7 @@ const getSelectedSpans = (snapshot) => {
193
462
  continue;
194
463
  }
195
464
  if (child._key === startChildKey) {
196
- if (!util_sliceBlocks.isSpan(snapshot.context, child)) {
465
+ if (!util_sliceBlocks.isSpan$1(snapshot.context, child)) {
197
466
  trimStartPoint = !0;
198
467
  continue;
199
468
  }
@@ -205,7 +474,7 @@ const getSelectedSpans = (snapshot) => {
205
474
  continue;
206
475
  }
207
476
  }
208
- previousPotentialEndpoint = util_sliceBlocks.isSpan(snapshot.context, child) && child.text.length > 0 ? {
477
+ previousPotentialEndpoint = util_sliceBlocks.isSpan$1(snapshot.context, child) && child.text.length > 0 ? {
209
478
  blockKey: block._key,
210
479
  span: child
211
480
  } : previousPotentialEndpoint;
@@ -221,13 +490,13 @@ const getSelectedSpans = (snapshot) => {
221
490
  anchor: adjustedStartPoint ?? startPoint,
222
491
  focus: trimEndPoint && adjustedEndPoint ? adjustedEndPoint : endPoint
223
492
  };
224
- if (selector_isOverlappingSelection.isSelectionCollapsed({
493
+ if (isSelectionCollapsed({
225
494
  context: {
226
495
  ...snapshot.context,
227
496
  selection: trimmedSelection
228
497
  }
229
498
  })) {
230
- const focusTextBlock = selector_isOverlappingSelection.getFocusTextBlock({
499
+ const focusTextBlock = getFocusTextBlock({
231
500
  context: {
232
501
  ...snapshot.context,
233
502
  selection: trimmedSelection
@@ -242,7 +511,7 @@ function isActiveAnnotation(annotation) {
242
511
  return (snapshot) => {
243
512
  if (!snapshot.context.selection)
244
513
  return !1;
245
- const selectedBlocks = selector_isOverlappingSelection.getSelectedBlocks(snapshot), focusSpan = selector_isOverlappingSelection.getFocusSpan(snapshot), selectedSpans = selector_isOverlappingSelection.isSelectionExpanded(snapshot) ? getSelectedSpans(snapshot) : focusSpan ? [focusSpan] : [];
514
+ const selectedBlocks = getSelectedBlocks(snapshot), focusSpan = getFocusSpan(snapshot), selectedSpans = isSelectionExpanded(snapshot) ? getSelectedSpans(snapshot) : focusSpan ? [focusSpan] : [];
246
515
  if (selectedSpans.length === 0 || selectedSpans.some((span) => !span.node.marks || span.node.marks?.length === 0))
247
516
  return !1;
248
517
  const selectionMarkDefs = selectedBlocks.flatMap((block) => util_sliceBlocks.isTextBlock(snapshot.context, block.node) ? block.node.markDefs ?? [] : []);
@@ -254,7 +523,7 @@ function isActiveAnnotation(annotation) {
254
523
  }
255
524
  function isActiveDecorator(decorator) {
256
525
  return (snapshot) => {
257
- if (selector_isOverlappingSelection.isSelectionExpanded(snapshot)) {
526
+ if (isSelectionExpanded(snapshot)) {
258
527
  const selectedSpans = getSelectedSpans(snapshot);
259
528
  return selectedSpans.length > 0 && selectedSpans.every((span) => span.node.marks?.includes(decorator));
260
529
  }
@@ -267,10 +536,159 @@ function isActiveListItem(listItem) {
267
536
  function isActiveStyle(style) {
268
537
  return (snapshot) => getActiveStyle(snapshot) === style;
269
538
  }
539
+ function isAtTheEndOfBlock(block) {
540
+ return (snapshot) => {
541
+ if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
542
+ return !1;
543
+ const blockEndPoint = util_sliceBlocks.getBlockEndPoint({
544
+ context: snapshot.context,
545
+ block
546
+ });
547
+ return util_sliceBlocks.isEqualSelectionPoints(snapshot.context.selection.focus, blockEndPoint);
548
+ };
549
+ }
550
+ function isAtTheStartOfBlock(block) {
551
+ return (snapshot) => {
552
+ if (!snapshot.context.selection || !isSelectionCollapsed(snapshot))
553
+ return !1;
554
+ const blockStartPoint = util_sliceBlocks.getBlockStartPoint({
555
+ context: snapshot.context,
556
+ block
557
+ });
558
+ return util_sliceBlocks.isEqualSelectionPoints(snapshot.context.selection.focus, blockStartPoint);
559
+ };
560
+ }
561
+ function isPointAfterSelection(point) {
562
+ return (snapshot) => {
563
+ if (!snapshot.context.selection)
564
+ return !1;
565
+ const selection = snapshot.context.selection.backward ? util_sliceBlocks.reverseSelection(snapshot.context.selection) : snapshot.context.selection, pointBlockKey = util_sliceBlocks.isKeyedSegment(point.path[0]) ? point.path[0]._key : void 0, pointChildKey = util_sliceBlocks.isKeyedSegment(point.path[2]) ? point.path[2]._key : void 0, endBlockKey = util_sliceBlocks.isKeyedSegment(selection.focus.path[0]) ? selection.focus.path[0]._key : void 0, endChildKey = util_sliceBlocks.isKeyedSegment(selection.focus.path[2]) ? selection.focus.path[2]._key : void 0;
566
+ if (!pointBlockKey || !endBlockKey)
567
+ return !1;
568
+ let after = !1;
569
+ for (const block of snapshot.context.value) {
570
+ if (block._key === endBlockKey) {
571
+ if (block._key !== pointBlockKey) {
572
+ after = !0;
573
+ break;
574
+ }
575
+ if (!util_sliceBlocks.isTextBlock(snapshot.context, block) || !pointChildKey || !endChildKey)
576
+ break;
577
+ for (const child of block.children) {
578
+ if (child._key === endChildKey) {
579
+ if (child._key !== pointChildKey) {
580
+ after = !0;
581
+ break;
582
+ }
583
+ after = point.offset > selection.focus.offset;
584
+ break;
585
+ }
586
+ if (child._key === pointChildKey)
587
+ break;
588
+ }
589
+ }
590
+ if (block._key === pointBlockKey)
591
+ break;
592
+ }
593
+ return after;
594
+ };
595
+ }
596
+ function isPointBeforeSelection(point) {
597
+ return (snapshot) => {
598
+ if (!snapshot.context.selection)
599
+ return !1;
600
+ const selection = snapshot.context.selection.backward ? util_sliceBlocks.reverseSelection(snapshot.context.selection) : snapshot.context.selection, pointBlockKey = util_sliceBlocks.isKeyedSegment(point.path[0]) ? point.path[0]._key : void 0, pointChildKey = util_sliceBlocks.isKeyedSegment(point.path[2]) ? point.path[2]._key : void 0, startBlockKey = util_sliceBlocks.isKeyedSegment(selection.anchor.path[0]) ? selection.anchor.path[0]._key : void 0, startChildKey = util_sliceBlocks.isKeyedSegment(selection.anchor.path[2]) ? selection.anchor.path[2]._key : void 0;
601
+ if (!pointBlockKey || !startBlockKey)
602
+ return !1;
603
+ let before = !1;
604
+ for (const block of snapshot.context.value) {
605
+ if (block._key === pointBlockKey) {
606
+ if (block._key !== startBlockKey) {
607
+ before = !0;
608
+ break;
609
+ }
610
+ if (!util_sliceBlocks.isTextBlock(snapshot.context, block) || !pointChildKey || !startChildKey)
611
+ break;
612
+ for (const child of block.children) {
613
+ if (child._key === pointChildKey) {
614
+ if (child._key !== startChildKey) {
615
+ before = !0;
616
+ break;
617
+ }
618
+ before = point.offset < selection.anchor.offset;
619
+ break;
620
+ }
621
+ if (child._key === startChildKey)
622
+ break;
623
+ }
624
+ }
625
+ if (block._key === startBlockKey)
626
+ break;
627
+ }
628
+ return before;
629
+ };
630
+ }
631
+ function isOverlappingSelection(selection) {
632
+ return (snapshot) => {
633
+ if (!selection || !snapshot.context.selection)
634
+ return !1;
635
+ const selectionStartPoint = getSelectionStartPoint({
636
+ context: {
637
+ ...snapshot.context,
638
+ selection
639
+ }
640
+ }), selectionEndPoint = getSelectionEndPoint({
641
+ context: {
642
+ ...snapshot.context,
643
+ selection
644
+ }
645
+ }), originalSelectionStartPoint = getSelectionStartPoint(snapshot), originalSelectionEndPoint = getSelectionEndPoint(snapshot);
646
+ if (!selectionStartPoint || !selectionEndPoint || !originalSelectionStartPoint || !originalSelectionEndPoint)
647
+ return !1;
648
+ const startPointBeforeSelection = isPointBeforeSelection(selectionStartPoint)(snapshot), startPointAfterSelection = isPointAfterSelection(selectionStartPoint)(snapshot), endPointBeforeSelection = isPointBeforeSelection(selectionEndPoint)(snapshot), endPointAfterSelection = isPointAfterSelection(selectionEndPoint)(snapshot), originalStartPointBeforeStartPoint = isPointBeforeSelection(originalSelectionStartPoint)({
649
+ ...snapshot,
650
+ context: {
651
+ ...snapshot.context,
652
+ selection: {
653
+ anchor: selectionStartPoint,
654
+ focus: selectionStartPoint
655
+ }
656
+ }
657
+ }), originalStartPointAfterStartPoint = isPointAfterSelection(originalSelectionStartPoint)({
658
+ ...snapshot,
659
+ context: {
660
+ ...snapshot.context,
661
+ selection: {
662
+ anchor: selectionStartPoint,
663
+ focus: selectionStartPoint
664
+ }
665
+ }
666
+ }), originalEndPointBeforeEndPoint = isPointBeforeSelection(originalSelectionEndPoint)({
667
+ ...snapshot,
668
+ context: {
669
+ ...snapshot.context,
670
+ selection: {
671
+ anchor: selectionEndPoint,
672
+ focus: selectionEndPoint
673
+ }
674
+ }
675
+ }), originalEndPointAfterEndPoint = isPointAfterSelection(originalSelectionEndPoint)({
676
+ ...snapshot,
677
+ context: {
678
+ ...snapshot.context,
679
+ selection: {
680
+ anchor: selectionEndPoint,
681
+ focus: selectionEndPoint
682
+ }
683
+ }
684
+ }), endPointEqualToOriginalStartPoint = util_sliceBlocks.isEqualSelectionPoints(selectionEndPoint, originalSelectionStartPoint), startPointEqualToOriginalEndPoint = util_sliceBlocks.isEqualSelectionPoints(selectionStartPoint, originalSelectionEndPoint);
685
+ return endPointBeforeSelection && !endPointEqualToOriginalStartPoint || startPointAfterSelection && !startPointEqualToOriginalEndPoint ? !1 : !originalStartPointBeforeStartPoint && originalStartPointAfterStartPoint && !originalEndPointBeforeEndPoint && originalEndPointAfterEndPoint ? !endPointEqualToOriginalStartPoint : originalStartPointBeforeStartPoint && !originalStartPointAfterStartPoint && originalEndPointBeforeEndPoint && !originalEndPointAfterEndPoint ? !startPointEqualToOriginalEndPoint : !startPointAfterSelection || !startPointBeforeSelection || !endPointAfterSelection || !endPointBeforeSelection;
686
+ };
687
+ }
270
688
  const isSelectingEntireBlocks = (snapshot) => {
271
689
  if (!snapshot.context.selection)
272
690
  return !1;
273
- 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 = selector_isOverlappingSelection.getSelectionStartBlock(snapshot), endBlock = selector_isOverlappingSelection.getSelectionEndBlock(snapshot);
691
+ 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);
274
692
  if (!startBlock || !endBlock)
275
693
  return !1;
276
694
  const startBlockStartPoint = util_sliceBlocks.getBlockStartPoint({
@@ -285,12 +703,39 @@ const isSelectingEntireBlocks = (snapshot) => {
285
703
  exports.getActiveAnnotations = getActiveAnnotations;
286
704
  exports.getActiveListItem = getActiveListItem;
287
705
  exports.getActiveStyle = getActiveStyle;
706
+ exports.getCaretWordSelection = getCaretWordSelection;
707
+ exports.getFirstBlock = getFirstBlock;
708
+ exports.getFocusBlock = getFocusBlock;
709
+ exports.getFocusBlockObject = getFocusBlockObject;
710
+ exports.getFocusChild = getFocusChild;
711
+ exports.getFocusListBlock = getFocusListBlock;
712
+ exports.getFocusSpan = getFocusSpan;
713
+ exports.getFocusTextBlock = getFocusTextBlock;
714
+ exports.getLastBlock = getLastBlock;
715
+ exports.getNextBlock = getNextBlock;
716
+ exports.getNextInlineObject = getNextInlineObject;
717
+ exports.getPreviousBlock = getPreviousBlock;
718
+ exports.getPreviousInlineObject = getPreviousInlineObject;
719
+ exports.getSelectedBlocks = getSelectedBlocks;
720
+ exports.getSelectedSlice = getSelectedSlice;
288
721
  exports.getSelectedSpans = getSelectedSpans;
289
722
  exports.getSelectedTextBlocks = getSelectedTextBlocks;
723
+ exports.getSelectionEndBlock = getSelectionEndBlock;
724
+ exports.getSelectionEndPoint = getSelectionEndPoint;
725
+ exports.getSelectionStartBlock = getSelectionStartBlock;
726
+ exports.getSelectionStartPoint = getSelectionStartPoint;
727
+ exports.getSelectionText = getSelectionText;
290
728
  exports.getTrimmedSelection = getTrimmedSelection;
291
729
  exports.isActiveAnnotation = isActiveAnnotation;
292
730
  exports.isActiveDecorator = isActiveDecorator;
293
731
  exports.isActiveListItem = isActiveListItem;
294
732
  exports.isActiveStyle = isActiveStyle;
733
+ exports.isAtTheEndOfBlock = isAtTheEndOfBlock;
734
+ exports.isAtTheStartOfBlock = isAtTheStartOfBlock;
735
+ exports.isOverlappingSelection = isOverlappingSelection;
736
+ exports.isPointAfterSelection = isPointAfterSelection;
737
+ exports.isPointBeforeSelection = isPointBeforeSelection;
295
738
  exports.isSelectingEntireBlocks = isSelectingEntireBlocks;
739
+ exports.isSelectionCollapsed = isSelectionCollapsed;
740
+ exports.isSelectionExpanded = isSelectionExpanded;
296
741
  //# sourceMappingURL=selector.is-selecting-entire-blocks.cjs.map