@portabletext/editor 2.13.3 → 2.13.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/lib/_chunks-cjs/{selector.is-selection-expanded.cjs → selector.get-selection-text.cjs} +25 -25
  2. package/lib/_chunks-cjs/selector.get-selection-text.cjs.map +1 -0
  3. package/lib/_chunks-cjs/selector.get-text-before.cjs +4 -4
  4. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  5. package/lib/_chunks-cjs/{selector.is-selecting-entire-blocks.cjs → selector.is-active-style.cjs} +408 -399
  6. package/lib/_chunks-cjs/selector.is-active-style.cjs.map +1 -0
  7. package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs +3 -3
  8. package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
  9. package/lib/_chunks-cjs/{util.slice-blocks.cjs → util.get-text-block-text.cjs} +25 -26
  10. package/lib/_chunks-cjs/util.get-text-block-text.cjs.map +1 -0
  11. package/lib/_chunks-cjs/{util.is-selection-collapsed.cjs → util.is-empty-text-block.cjs} +9 -9
  12. package/lib/_chunks-cjs/util.is-empty-text-block.cjs.map +1 -0
  13. package/lib/_chunks-cjs/util.merge-text-blocks.cjs +2 -2
  14. package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
  15. package/lib/_chunks-cjs/util.slice-text-block.cjs +5 -5
  16. package/lib/_chunks-cjs/util.slice-text-block.cjs.map +1 -1
  17. package/lib/_chunks-dts/behavior.types.action.d.cts +270 -270
  18. package/lib/_chunks-dts/behavior.types.action.d.ts +315 -315
  19. package/lib/_chunks-es/{selector.is-selection-expanded.js → selector.get-selection-text.js} +20 -20
  20. package/lib/_chunks-es/selector.get-selection-text.js.map +1 -0
  21. package/lib/_chunks-es/selector.get-text-before.js +2 -2
  22. package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
  23. package/lib/_chunks-es/{selector.is-selecting-entire-blocks.js → selector.is-active-style.js} +385 -376
  24. package/lib/_chunks-es/selector.is-active-style.js.map +1 -0
  25. package/lib/_chunks-es/util.child-selection-point-to-block-offset.js +1 -1
  26. package/lib/_chunks-es/util.child-selection-point-to-block-offset.js.map +1 -1
  27. package/lib/_chunks-es/{util.slice-blocks.js → util.get-text-block-text.js} +25 -26
  28. package/lib/_chunks-es/util.get-text-block-text.js.map +1 -0
  29. package/lib/_chunks-es/{util.is-selection-collapsed.js → util.is-empty-text-block.js} +8 -8
  30. package/lib/_chunks-es/util.is-empty-text-block.js.map +1 -0
  31. package/lib/_chunks-es/util.merge-text-blocks.js +1 -1
  32. package/lib/_chunks-es/util.merge-text-blocks.js.map +1 -1
  33. package/lib/_chunks-es/util.slice-text-block.js +1 -1
  34. package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
  35. package/lib/index.cjs +225 -225
  36. package/lib/index.cjs.map +1 -1
  37. package/lib/index.js +18 -18
  38. package/lib/index.js.map +1 -1
  39. package/lib/plugins/index.cjs +21 -21
  40. package/lib/plugins/index.cjs.map +1 -1
  41. package/lib/plugins/index.d.cts +4 -4
  42. package/lib/plugins/index.d.ts +4 -4
  43. package/lib/plugins/index.js +3 -3
  44. package/lib/plugins/index.js.map +1 -1
  45. package/lib/selectors/index.cjs +52 -52
  46. package/lib/selectors/index.cjs.map +1 -1
  47. package/lib/selectors/index.js +5 -5
  48. package/lib/selectors/index.js.map +1 -1
  49. package/lib/utils/index.cjs +14 -14
  50. package/lib/utils/index.cjs.map +1 -1
  51. package/lib/utils/index.d.cts +2 -2
  52. package/lib/utils/index.d.ts +2 -2
  53. package/lib/utils/index.js +3 -3
  54. package/lib/utils/index.js.map +1 -1
  55. package/package.json +12 -12
  56. package/src/behaviors/behavior.abstract.annotation.ts +3 -3
  57. package/src/behaviors/behavior.abstract.decorator.ts +2 -2
  58. package/src/behaviors/behavior.abstract.delete.ts +25 -16
  59. package/src/behaviors/behavior.abstract.deserialize.ts +4 -3
  60. package/src/behaviors/behavior.abstract.insert.ts +6 -7
  61. package/src/behaviors/behavior.abstract.keyboard.ts +7 -8
  62. package/src/behaviors/behavior.abstract.list-item.ts +2 -1
  63. package/src/behaviors/behavior.abstract.move.ts +2 -1
  64. package/src/behaviors/behavior.abstract.select.ts +4 -2
  65. package/src/behaviors/behavior.abstract.split.ts +33 -24
  66. package/src/behaviors/behavior.abstract.style.ts +2 -1
  67. package/src/behaviors/behavior.abstract.ts +8 -7
  68. package/src/behaviors/behavior.core.annotations.ts +8 -7
  69. package/src/behaviors/behavior.core.block-element.ts +7 -5
  70. package/src/behaviors/behavior.core.block-objects.ts +25 -27
  71. package/src/behaviors/behavior.core.dnd.ts +10 -8
  72. package/src/behaviors/behavior.core.insert-break.ts +45 -36
  73. package/src/behaviors/behavior.core.lists.ts +31 -25
  74. package/src/behaviors/behavior.decorator-pair.ts +26 -23
  75. package/src/behaviors/behavior.markdown.ts +26 -21
  76. package/src/converters/converter.portable-text.ts +3 -3
  77. package/src/converters/converter.text-html.serialize.test.ts +1 -1
  78. package/src/converters/converter.text-html.ts +3 -3
  79. package/src/converters/converter.text-plain.test.ts +1 -1
  80. package/src/converters/converter.text-plain.ts +3 -3
  81. package/src/editor/Editable.tsx +2 -2
  82. package/src/editor/components/render-span.tsx +3 -5
  83. package/src/editor/create-editor.ts +2 -2
  84. package/src/editor/create-slate-editor.tsx +1 -4
  85. package/src/editor/editor-dom.ts +2 -2
  86. package/src/editor/plugins/createWithEditableAPI.ts +5 -10
  87. package/src/editor/plugins/createWithMaxBlocks.ts +2 -2
  88. package/src/editor/plugins/createWithObjectKeys.ts +2 -2
  89. package/src/editor/plugins/createWithPatches.ts +3 -10
  90. package/src/editor/plugins/createWithPlaceholderBlock.ts +2 -2
  91. package/src/editor/plugins/createWithPortableTextMarkModel.ts +2 -2
  92. package/src/editor/plugins/createWithSchemaTypes.ts +1 -1
  93. package/src/editor/plugins/createWithUndoRedo.ts +6 -6
  94. package/src/editor/plugins/slate-plugin.update-selection.ts +1 -1
  95. package/src/editor/sync-machine.ts +2 -5
  96. package/src/{internal-utils → editor}/weakMaps.ts +1 -1
  97. package/src/editor/with-undo-step.ts +1 -1
  98. package/src/index.ts +1 -1
  99. package/src/internal-utils/applyPatch.ts +2 -2
  100. package/src/internal-utils/build-index-maps.test.ts +1 -1
  101. package/src/internal-utils/create-test-snapshot.ts +1 -1
  102. package/src/internal-utils/event-position.ts +11 -9
  103. package/src/internal-utils/operation-to-patches.test.ts +1 -1
  104. package/src/internal-utils/portable-text-node.ts +1 -1
  105. package/src/internal-utils/selection-block-keys.ts +1 -1
  106. package/src/internal-utils/selection-focus-text.ts +1 -1
  107. package/src/internal-utils/to-slate-range.ts +4 -4
  108. package/src/operations/behavior.operation.annotation.add.ts +1 -1
  109. package/src/operations/behavior.operation.block.set.ts +1 -1
  110. package/src/operations/behavior.operation.block.unset.ts +2 -2
  111. package/src/operations/behavior.operation.decorator.add.ts +11 -9
  112. package/src/operations/behavior.operation.delete.ts +1 -1
  113. package/src/operations/behavior.operation.insert.block.ts +2 -2
  114. package/src/operations/behavior.operation.insert.child.ts +1 -1
  115. package/src/operations/behavior.operation.move.block.ts +1 -1
  116. package/src/plugins/plugin.behavior.tsx +1 -1
  117. package/src/plugins/plugin.decorator-shortcut.ts +3 -3
  118. package/src/plugins/plugin.internal.auto-close-brackets.ts +2 -1
  119. package/src/plugins/plugin.one-line.tsx +11 -11
  120. package/src/priority/priority.types.ts +1 -1
  121. package/src/{internal-utils → selectors}/drag-selection.test.ts +1 -1
  122. package/src/{internal-utils → selectors}/drag-selection.ts +26 -19
  123. package/src/selectors/selector.get-anchor-block.ts +1 -1
  124. package/src/selectors/selector.get-anchor-child.ts +1 -1
  125. package/src/selectors/selector.get-block-offsets.ts +3 -3
  126. package/src/selectors/selector.get-caret-word-selection.test.ts +1 -1
  127. package/src/selectors/selector.get-focus-block.ts +1 -1
  128. package/src/selectors/selector.get-focus-child.ts +1 -1
  129. package/src/selectors/selector.get-focus-list-block.ts +1 -1
  130. package/src/selectors/selector.get-list-state.test.ts +1 -1
  131. package/src/selectors/selector.get-mark-state.ts +1 -1
  132. package/src/selectors/selector.get-next-inline-object.ts +1 -1
  133. package/src/selectors/selector.get-next-span.ts +1 -1
  134. package/src/selectors/selector.get-previous-inline-object.ts +1 -1
  135. package/src/selectors/selector.get-previous-span.ts +1 -1
  136. package/src/selectors/selector.get-selected-blocks.ts +1 -1
  137. package/src/selectors/selector.get-selected-spans.test.ts +1 -1
  138. package/src/selectors/selector.get-selected-spans.ts +2 -2
  139. package/src/selectors/selector.get-selected-text-blocks.ts +3 -2
  140. package/src/selectors/selector.get-selected-value.test.ts +87 -1
  141. package/src/selectors/selector.get-selected-value.ts +4 -6
  142. package/src/selectors/selector.get-selection-end-point.ts +1 -1
  143. package/src/selectors/selector.get-selection-start-point.ts +1 -1
  144. package/src/selectors/selector.get-selection-text.test.ts +1 -1
  145. package/src/selectors/selector.get-selection.ts +1 -1
  146. package/src/selectors/selector.get-text-before.ts +1 -1
  147. package/src/selectors/selector.get-trimmed-selection.test.ts +1 -1
  148. package/src/selectors/selector.get-trimmed-selection.ts +5 -7
  149. package/src/selectors/selector.is-active-decorator.test.ts +2 -1
  150. package/src/selectors/selector.is-at-the-end-of-block.ts +4 -3
  151. package/src/selectors/selector.is-at-the-start-of-block.ts +4 -3
  152. package/src/selectors/selector.is-overlapping-selection.test.ts +1 -1
  153. package/src/selectors/selector.is-overlapping-selection.ts +1 -1
  154. package/src/selectors/selector.is-point-after-selection.ts +3 -3
  155. package/src/selectors/selector.is-point-before-selection.ts +3 -3
  156. package/src/selectors/selector.is-selecting-entire-blocks.ts +7 -5
  157. package/src/test/gherkin-parameter-types.ts +1 -1
  158. package/src/test/vitest/step-definitions.tsx +19 -9
  159. package/src/types/paths.ts +4 -1
  160. package/src/utils/util.at-the-beginning-of-block.ts +1 -1
  161. package/src/utils/util.block-offset.ts +4 -4
  162. package/src/utils/util.block-offsets-to-selection.ts +1 -1
  163. package/src/utils/util.child-selection-point-to-block-offset.ts +3 -3
  164. package/src/utils/util.get-selection-end-point.ts +1 -1
  165. package/src/utils/util.get-selection-start-point.ts +1 -1
  166. package/src/utils/util.merge-text-blocks.ts +2 -2
  167. package/src/utils/util.selection-point-to-block-offset.ts +1 -1
  168. package/src/{selection/selection-point.ts → utils/util.selection-point.ts} +1 -1
  169. package/src/utils/util.slice-blocks.ts +6 -6
  170. package/src/utils/util.slice-text-block.test.ts +3 -1
  171. package/src/utils/util.slice-text-block.ts +3 -3
  172. package/src/utils/util.split-text-block.ts +1 -1
  173. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +0 -1
  174. package/lib/_chunks-cjs/selector.is-selection-expanded.cjs.map +0 -1
  175. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +0 -1
  176. package/lib/_chunks-cjs/util.slice-blocks.cjs.map +0 -1
  177. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +0 -1
  178. package/lib/_chunks-es/selector.is-selection-expanded.js.map +0 -1
  179. package/lib/_chunks-es/util.is-selection-collapsed.js.map +0 -1
  180. package/lib/_chunks-es/util.slice-blocks.js.map +0 -1
  181. /package/src/{internal-utils → editor}/withChanges.ts +0 -0
  182. /package/src/{internal-utils → editor}/withUndoRedo.ts +0 -0
  183. /package/src/{internal-utils → editor}/withoutPatching.ts +0 -0
  184. /package/src/{internal-utils → utils}/asserters.ts +0 -0
  185. /package/src/{editor → utils}/key-generator.ts +0 -0
  186. /package/src/{internal-utils → utils}/parse-blocks.test.ts +0 -0
  187. /package/src/{internal-utils → utils}/parse-blocks.ts +0 -0
package/lib/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: !0 });
3
- var reactCompilerRuntime = require("react-compiler-runtime"), React = require("react"), useEditor = require("./_chunks-cjs/use-editor.cjs"), jsxRuntime = require("react/jsx-runtime"), react = require("@xstate/react"), noop = require("lodash/noop.js"), slate = require("slate"), slateReact = require("slate-react"), debug$g = require("debug"), slateDom = require("slate-dom"), util_sliceBlocks = require("./_chunks-cjs/util.slice-blocks.cjs"), util_isSelectionCollapsed = require("./_chunks-cjs/util.is-selection-collapsed.cjs"), isEqual = require("lodash/isEqual.js"), schema = require("@portabletext/schema"), selector_isSelectionExpanded = require("./_chunks-cjs/selector.is-selection-expanded.cjs"), selector_isSelectingEntireBlocks = require("./_chunks-cjs/selector.is-selecting-entire-blocks.cjs"), behaviors_index = require("./behaviors/index.cjs"), uniq = require("lodash/uniq.js"), xstate = require("xstate"), sanityBridge = require("@portabletext/sanity-bridge"), blockTools = require("@portabletext/block-tools"), toHtml = require("@portabletext/to-html"), schema$1 = require("@sanity/schema"), flatten = require("lodash/flatten.js"), omit = require("lodash/omit.js"), patches = require("@portabletext/patches"), util_childSelectionPointToBlockOffset = require("./_chunks-cjs/util.child-selection-point-to-block-offset.cjs"), util_sliceTextBlock = require("./_chunks-cjs/util.slice-text-block.cjs"), get = require("lodash/get.js"), isUndefined = require("lodash/isUndefined.js"), omitBy = require("lodash/omitBy.js"), immer = require("immer"), keyboardShortcuts = require("@portabletext/keyboard-shortcuts"), isPlainObject = require("lodash/isPlainObject.js"), rxjs = require("rxjs");
3
+ var reactCompilerRuntime = require("react-compiler-runtime"), React = require("react"), useEditor = require("./_chunks-cjs/use-editor.cjs"), jsxRuntime = require("react/jsx-runtime"), react = require("@xstate/react"), noop = require("lodash/noop.js"), slate = require("slate"), slateReact = require("slate-react"), debug$g = require("debug"), slateDom = require("slate-dom"), util_isEmptyTextBlock = require("./_chunks-cjs/util.is-empty-text-block.cjs"), util_getTextBlockText = require("./_chunks-cjs/util.get-text-block-text.cjs"), isEqual = require("lodash/isEqual.js"), schema = require("@portabletext/schema"), selector_isActiveStyle = require("./_chunks-cjs/selector.is-active-style.cjs"), selector_getSelectionText = require("./_chunks-cjs/selector.get-selection-text.cjs"), behaviors_index = require("./behaviors/index.cjs"), uniq = require("lodash/uniq.js"), xstate = require("xstate"), sanityBridge = require("@portabletext/sanity-bridge"), blockTools = require("@portabletext/block-tools"), toHtml = require("@portabletext/to-html"), schema$1 = require("@sanity/schema"), flatten = require("lodash/flatten.js"), omit = require("lodash/omit.js"), patches = require("@portabletext/patches"), util_childSelectionPointToBlockOffset = require("./_chunks-cjs/util.child-selection-point-to-block-offset.cjs"), util_sliceTextBlock = require("./_chunks-cjs/util.slice-text-block.cjs"), get = require("lodash/get.js"), isUndefined = require("lodash/isUndefined.js"), omitBy = require("lodash/omitBy.js"), immer = require("immer"), keyboardShortcuts = require("@portabletext/keyboard-shortcuts"), isPlainObject = require("lodash/isPlainObject.js"), rxjs = require("rxjs");
4
4
  function _interopDefaultCompat(e) {
5
5
  return e && typeof e == "object" && "default" in e ? e : { default: e };
6
6
  }
@@ -387,7 +387,7 @@ function getEventPosition({
387
387
  block: eventPositionBlock,
388
388
  isEditor: !1,
389
389
  selection: {
390
- anchor: util_sliceBlocks.getBlockStartPoint({
390
+ anchor: util_getTextBlockText.getBlockStartPoint({
391
391
  context: editorActor.getSnapshot().context,
392
392
  block: {
393
393
  node: eventBlock,
@@ -396,7 +396,7 @@ function getEventPosition({
396
396
  }]
397
397
  }
398
398
  }),
399
- focus: util_isSelectionCollapsed.getBlockEndPoint({
399
+ focus: util_isEmptyTextBlock.getBlockEndPoint({
400
400
  context: editorActor.getSnapshot().context,
401
401
  block: {
402
402
  node: eventBlock,
@@ -409,13 +409,13 @@ function getEventPosition({
409
409
  };
410
410
  if (!eventPositionBlock || !eventSelection)
411
411
  return;
412
- const eventSelectionFocusBlockKey = util_sliceBlocks.getBlockKeyFromSelectionPoint(eventSelection.focus);
412
+ const eventSelectionFocusBlockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(eventSelection.focus);
413
413
  if (eventSelectionFocusBlockKey !== void 0)
414
- return util_isSelectionCollapsed.isSelectionCollapsed(eventSelection) && eventBlock && eventSelectionFocusBlockKey !== eventBlock._key ? {
414
+ return util_isEmptyTextBlock.isSelectionCollapsed(eventSelection) && eventBlock && eventSelectionFocusBlockKey !== eventBlock._key ? {
415
415
  block: eventPositionBlock,
416
416
  isEditor: !1,
417
417
  selection: {
418
- anchor: util_sliceBlocks.getBlockStartPoint({
418
+ anchor: util_getTextBlockText.getBlockStartPoint({
419
419
  context: editorActor.getSnapshot().context,
420
420
  block: {
421
421
  node: eventBlock,
@@ -424,7 +424,7 @@ function getEventPosition({
424
424
  }]
425
425
  }
426
426
  }),
427
- focus: util_isSelectionCollapsed.getBlockEndPoint({
427
+ focus: util_isEmptyTextBlock.getBlockEndPoint({
428
428
  context: editorActor.getSnapshot().context,
429
429
  block: {
430
430
  node: eventBlock,
@@ -562,7 +562,7 @@ function normalizeSelection(selection, value) {
562
562
  function toSlateRange(snapshot) {
563
563
  if (!snapshot.context.selection)
564
564
  return null;
565
- if (util_isSelectionCollapsed.isEqualSelectionPoints(snapshot.context.selection.anchor, snapshot.context.selection.focus)) {
565
+ if (util_isEmptyTextBlock.isEqualSelectionPoints(snapshot.context.selection.anchor, snapshot.context.selection.focus)) {
566
566
  const anchorPoint2 = toSlateSelectionPoint(snapshot, snapshot.context.selection.anchor, snapshot.context.selection.backward ? "forward" : "backward");
567
567
  return anchorPoint2 ? {
568
568
  anchor: anchorPoint2,
@@ -576,7 +576,7 @@ function toSlateRange(snapshot) {
576
576
  };
577
577
  }
578
578
  function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
579
- const blockKey = util_sliceBlocks.getBlockKeyFromSelectionPoint(selectionPoint);
579
+ const blockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(selectionPoint);
580
580
  if (!blockKey)
581
581
  return;
582
582
  const blockIndex = snapshot.blockIndexMap.get(blockKey);
@@ -590,10 +590,10 @@ function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
590
590
  path: [blockIndex, 0],
591
591
  offset: 0
592
592
  };
593
- let childKey = util_sliceBlocks.getChildKeyFromSelectionPoint({
593
+ let childKey = util_getTextBlockText.getChildKeyFromSelectionPoint({
594
594
  path: selectionPoint.path
595
595
  });
596
- const spanSelectionPoint = childKey ? void 0 : util_sliceBlocks.blockOffsetToSpanSelectionPoint({
596
+ const spanSelectionPoint = childKey ? void 0 : util_getTextBlockText.blockOffsetToSpanSelectionPoint({
597
597
  context: {
598
598
  schema: snapshot.context.schema,
599
599
  value: [block]
@@ -606,7 +606,7 @@ function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
606
606
  },
607
607
  direction
608
608
  });
609
- if (childKey = spanSelectionPoint ? util_sliceBlocks.getChildKeyFromSelectionPoint(spanSelectionPoint) : childKey, !childKey)
609
+ if (childKey = spanSelectionPoint ? util_getTextBlockText.getChildKeyFromSelectionPoint(spanSelectionPoint) : childKey, !childKey)
610
610
  return {
611
611
  path: [blockIndex, 0],
612
612
  offset: 0
@@ -625,7 +625,7 @@ function toSlateSelectionPoint(snapshot, selectionPoint, direction) {
625
625
  offset: schema.isSpan(snapshot.context, pathChild) ? Math.min(pathChild.text.length, offset) : offset
626
626
  };
627
627
  }
628
- const IS_PROCESSING_REMOTE_CHANGES = /* @__PURE__ */ new WeakMap(), KEY_TO_SLATE_ELEMENT = /* @__PURE__ */ new WeakMap(), KEY_TO_VALUE_ELEMENT = /* @__PURE__ */ new WeakMap(), SLATE_TO_PORTABLE_TEXT_RANGE = /* @__PURE__ */ new WeakMap(), EditorActorContext = React.createContext({});
628
+ const EditorActorContext = React.createContext({});
629
629
  function DropIndicator() {
630
630
  const $ = reactCompilerRuntime.c(1);
631
631
  let t0;
@@ -667,12 +667,22 @@ function RenderDefaultInlineObject(props) {
667
667
  "]"
668
668
  ] }), $[1] = props.inlineObject._key, $[2] = props.inlineObject._type, $[3] = t1) : t1 = $[3], t1;
669
669
  }
670
+ function createEditorPriority(config) {
671
+ return {
672
+ id: util_getTextBlockText.defaultKeyGenerator(),
673
+ name: config?.name,
674
+ reference: config?.reference
675
+ };
676
+ }
677
+ const corePriority = createEditorPriority({
678
+ name: "core"
679
+ });
670
680
  function getDragSelection({
671
681
  eventSelection,
672
682
  snapshot
673
683
  }) {
674
684
  let dragSelection = eventSelection;
675
- if (selector_isSelectingEntireBlocks.getFocusInlineObject({
685
+ if (selector_isActiveStyle.getFocusInlineObject({
676
686
  ...snapshot,
677
687
  context: {
678
688
  ...snapshot.context,
@@ -680,18 +690,18 @@ function getDragSelection({
680
690
  }
681
691
  }))
682
692
  return dragSelection;
683
- const draggingCollapsedSelection = selector_isSelectionExpanded.isSelectionCollapsed({
693
+ const draggingCollapsedSelection = selector_getSelectionText.isSelectionCollapsed({
684
694
  context: {
685
695
  ...snapshot.context,
686
696
  selection: eventSelection
687
697
  }
688
- }), draggedTextBlock = selector_isSelectionExpanded.getFocusTextBlock({
698
+ }), draggedTextBlock = selector_getSelectionText.getFocusTextBlock({
689
699
  ...snapshot,
690
700
  context: {
691
701
  ...snapshot.context,
692
702
  selection: eventSelection
693
703
  }
694
- }), draggedSpan = selector_isSelectionExpanded.getFocusSpan({
704
+ }), draggedSpan = selector_getSelectionText.getFocusSpan({
695
705
  ...snapshot,
696
706
  context: {
697
707
  ...snapshot.context,
@@ -699,28 +709,28 @@ function getDragSelection({
699
709
  }
700
710
  });
701
711
  draggingCollapsedSelection && draggedTextBlock && draggedSpan && (dragSelection = {
702
- anchor: util_sliceBlocks.getBlockStartPoint({
712
+ anchor: util_getTextBlockText.getBlockStartPoint({
703
713
  context: snapshot.context,
704
714
  block: draggedTextBlock
705
715
  }),
706
- focus: util_isSelectionCollapsed.getBlockEndPoint({
716
+ focus: util_isEmptyTextBlock.getBlockEndPoint({
707
717
  context: snapshot.context,
708
718
  block: draggedTextBlock
709
719
  })
710
720
  });
711
- const selectedBlocks = selector_isSelectingEntireBlocks.getSelectedBlocks(snapshot);
712
- if (snapshot.context.selection && selector_isSelectionExpanded.isSelectionExpanded(snapshot) && selectedBlocks.length > 1) {
713
- const selectionStartBlock = selector_isSelectingEntireBlocks.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isSelectingEntireBlocks.getSelectionEndBlock(snapshot);
721
+ const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot);
722
+ if (snapshot.context.selection && selector_getSelectionText.isSelectionExpanded(snapshot) && selectedBlocks.length > 1) {
723
+ const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
714
724
  if (!selectionStartBlock || !selectionEndBlock)
715
725
  return dragSelection;
716
- const selectionStartPoint = util_sliceBlocks.getBlockStartPoint({
726
+ const selectionStartPoint = util_getTextBlockText.getBlockStartPoint({
717
727
  context: snapshot.context,
718
728
  block: selectionStartBlock
719
- }), selectionEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
729
+ }), selectionEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
720
730
  context: snapshot.context,
721
731
  block: selectionEndBlock
722
732
  });
723
- selector_isSelectingEntireBlocks.isOverlappingSelection(eventSelection)({
733
+ selector_isActiveStyle.isOverlappingSelection(eventSelection)({
724
734
  ...snapshot,
725
735
  context: {
726
736
  ...snapshot.context,
@@ -736,16 +746,6 @@ function getDragSelection({
736
746
  }
737
747
  return dragSelection;
738
748
  }
739
- function createEditorPriority(config) {
740
- return {
741
- id: util_sliceBlocks.defaultKeyGenerator(),
742
- name: config?.name,
743
- reference: config?.reference
744
- };
745
- }
746
- const corePriority = createEditorPriority({
747
- name: "core"
748
- });
749
749
  function createCoreBlockElementBehaviorsConfig({
750
750
  key,
751
751
  onSetDragPositionBlock
@@ -757,7 +757,7 @@ function createCoreBlockElementBehaviorsConfig({
757
757
  snapshot,
758
758
  event
759
759
  }) => {
760
- const dropFocusBlock = selector_isSelectionExpanded.getFocusBlock({
760
+ const dropFocusBlock = selector_getSelectionText.getFocusBlock({
761
761
  ...snapshot,
762
762
  context: {
763
763
  ...snapshot.context,
@@ -773,13 +773,13 @@ function createCoreBlockElementBehaviorsConfig({
773
773
  eventSelection: dragOrigin.selection,
774
774
  snapshot
775
775
  });
776
- return selector_isSelectingEntireBlocks.getSelectedBlocks({
776
+ return selector_isActiveStyle.getSelectedBlocks({
777
777
  ...snapshot,
778
778
  context: {
779
779
  ...snapshot.context,
780
780
  selection: dragSelection
781
781
  }
782
- }).some((draggedBlock) => draggedBlock.node._key === key) ? !1 : selector_isSelectingEntireBlocks.isSelectingEntireBlocks({
782
+ }).some((draggedBlock) => draggedBlock.node._key === key) ? !1 : selector_isActiveStyle.isSelectingEntireBlocks({
783
783
  ...snapshot,
784
784
  context: {
785
785
  ...snapshot.context,
@@ -1226,9 +1226,9 @@ function RenderSpan(props) {
1226
1226
  editorActorSnapshot,
1227
1227
  slateEditorInstance: slateEditor
1228
1228
  });
1229
- if (!snapshot.context.selection || !selector_isSelectionExpanded.isSelectionCollapsed(snapshot))
1229
+ if (!snapshot.context.selection || !selector_getSelectionText.isSelectionCollapsed(snapshot))
1230
1230
  return !1;
1231
- const focusedSpan = selector_isSelectionExpanded.getFocusSpan(snapshot);
1231
+ const focusedSpan = selector_getSelectionText.getFocusSpan(snapshot);
1232
1232
  return focusedSpan ? focusedSpan.node._key === props.leaf._key : !1;
1233
1233
  }, $[0] = props.leaf._key, $[1] = slateEditor, $[2] = t0) : t0 = $[2];
1234
1234
  const focused = react.useSelector(editorActor, t0);
@@ -1258,7 +1258,7 @@ function RenderSpan(props) {
1258
1258
  offset: props.leaf.text.length
1259
1259
  }
1260
1260
  } : null;
1261
- return selector_isSelectingEntireBlocks.isOverlappingSelection(spanSelection)(snapshot_0);
1261
+ return selector_isActiveStyle.isOverlappingSelection(spanSelection)(snapshot_0);
1262
1262
  }, $[3] = props.children.props.parent, $[4] = props.leaf._key, $[5] = props.leaf.text, $[6] = slateEditor, $[7] = t1) : t1 = $[7];
1263
1263
  const selected = react.useSelector(editorActor, t1), parent_0 = props.children.props.parent, block_0 = parent_0 && slateEditor.isTextBlock(parent_0) ? parent_0 : void 0;
1264
1264
  let t2;
@@ -1960,7 +1960,7 @@ function validateSelection(slateEditor, editorElement) {
1960
1960
  debug$e("Could not resolve selection, selecting top document"), slate.Transforms.deselect(slateEditor), slateEditor.children.length > 0 && slate.Transforms.select(slateEditor, slate.Editor.start(slateEditor, [])), slateEditor.onChange();
1961
1961
  }
1962
1962
  }
1963
- const debug$d = debugWithName("component:Editable"), PortableTextEditable = React.forwardRef(function(props, forwardedRef) {
1963
+ const IS_PROCESSING_REMOTE_CHANGES = /* @__PURE__ */ new WeakMap(), KEY_TO_SLATE_ELEMENT = /* @__PURE__ */ new WeakMap(), KEY_TO_VALUE_ELEMENT = /* @__PURE__ */ new WeakMap(), SLATE_TO_PORTABLE_TEXT_RANGE = /* @__PURE__ */ new WeakMap(), debug$d = debugWithName("component:Editable"), PortableTextEditable = React.forwardRef(function(props, forwardedRef) {
1964
1964
  const $ = reactCompilerRuntime.c(174);
1965
1965
  let hotkeys, onBeforeInput, onBlur, onClick, onCopy, onCut, onDrag, onDragEnd, onDragEnter, onDragLeave, onDragOver, onDragStart, onDrop, onFocus, onPaste, propsSelection, rangeDecorations, renderAnnotation, renderBlock, renderChild, renderDecorator, renderListItem, renderPlaceholder, renderStyle, restProps, scrollSelectionIntoView, spellCheck;
1966
1966
  $[0] !== props ? ({
@@ -2187,7 +2187,7 @@ const debug$d = debugWithName("component:Editable"), PortableTextEditable = Reac
2187
2187
  type: "behavior event",
2188
2188
  behaviorEvent: {
2189
2189
  type: "insert.blocks",
2190
- blocks: util_sliceBlocks.parseBlocks({
2190
+ blocks: util_getTextBlockText.parseBlocks({
2191
2191
  context: {
2192
2192
  keyGenerator: editorActor.getSnapshot().context.keyGenerator,
2193
2193
  schema: editorActor.getSnapshot().context.schema
@@ -2616,7 +2616,7 @@ const converterJson = {
2616
2616
  originEvent: event.originEvent,
2617
2617
  reason: "No selection"
2618
2618
  };
2619
- const blocks = selector_isSelectionExpanded.getSelectedValue(snapshot);
2619
+ const blocks = selector_getSelectionText.getSelectedValue(snapshot);
2620
2620
  return blocks.length === 0 ? {
2621
2621
  type: "serialization.failure",
2622
2622
  mimeType: "application/x-portable-text",
@@ -2641,7 +2641,7 @@ const converterJson = {
2641
2641
  reason: "Data is not an array"
2642
2642
  };
2643
2643
  const parsedBlocks = blocks.flatMap((block) => {
2644
- const parsedBlock = util_sliceBlocks.parseBlock({
2644
+ const parsedBlock = util_getTextBlockText.parseBlock({
2645
2645
  context: snapshot.context,
2646
2646
  block,
2647
2647
  options: {
@@ -2676,7 +2676,7 @@ function createConverterTextHtml(legacySchema) {
2676
2676
  originEvent: event.originEvent,
2677
2677
  reason: "No selection"
2678
2678
  };
2679
- const blocks = selector_isSelectionExpanded.getSelectedValue(snapshot), html = toHtml.toHTML(blocks, {
2679
+ const blocks = selector_getSelectionText.getSelectedValue(snapshot), html = toHtml.toHTML(blocks, {
2680
2680
  onMissingComponent: !1,
2681
2681
  components: {
2682
2682
  unknownType: ({
@@ -2704,7 +2704,7 @@ function createConverterTextHtml(legacySchema) {
2704
2704
  keyGenerator: snapshot.context.keyGenerator,
2705
2705
  unstable_whitespaceOnPasteMode: legacySchema.block.options.unstable_whitespaceOnPasteMode
2706
2706
  }).flatMap((block) => {
2707
- const parsedBlock = util_sliceBlocks.parseBlock({
2707
+ const parsedBlock = util_getTextBlockText.parseBlock({
2708
2708
  context: snapshot.context,
2709
2709
  block,
2710
2710
  options: {
@@ -2734,7 +2734,7 @@ function createConverterTextPlain(legacySchema) {
2734
2734
  event
2735
2735
  }) => snapshot.context.selection ? {
2736
2736
  type: "serialization.success",
2737
- data: selector_isSelectionExpanded.getSelectedValue(snapshot).map((block) => schema.isTextBlock(snapshot.context, block) ? block.children.map((child) => child._type === snapshot.context.schema.span.name ? child.text : event.originEvent === "drag.dragstart" ? `[${snapshot.context.schema.inlineObjects.find((inlineObjectType) => inlineObjectType.name === child._type)?.title ?? "Object"}]` : "").join("") : event.originEvent === "drag.dragstart" ? `[${snapshot.context.schema.blockObjects.find((blockObjectType) => blockObjectType.name === block._type)?.title ?? "Object"}]` : "").filter((block) => block !== "").join(`
2737
+ data: selector_getSelectionText.getSelectedValue(snapshot).map((block) => schema.isTextBlock(snapshot.context, block) ? block.children.map((child) => child._type === snapshot.context.schema.span.name ? child.text : event.originEvent === "drag.dragstart" ? `[${snapshot.context.schema.inlineObjects.find((inlineObjectType) => inlineObjectType.name === child._type)?.title ?? "Object"}]` : "").join("") : event.originEvent === "drag.dragstart" ? `[${snapshot.context.schema.blockObjects.find((blockObjectType) => blockObjectType.name === block._type)?.title ?? "Object"}]` : "").filter((block) => block !== "").join(`
2738
2738
 
2739
2739
  `),
2740
2740
  mimeType: "text/plain",
@@ -2752,7 +2752,7 @@ function createConverterTextPlain(legacySchema) {
2752
2752
  const textToHtml = `<html><body>${escapeHtml(event.data).split(/\n{2,}/).map((line) => line ? `<p>${line.replace(/(?:\r\n|\r|\n)/g, "<br/>")}</p>` : "<p></p>").join("")}</body></html>`, parsedBlocks = blockTools.htmlToBlocks(textToHtml, legacySchema.portableText, {
2753
2753
  keyGenerator: snapshot.context.keyGenerator
2754
2754
  }).flatMap((block) => {
2755
- const parsedBlock = util_sliceBlocks.parseBlock({
2755
+ const parsedBlock = util_getTextBlockText.parseBlock({
2756
2756
  context: snapshot.context,
2757
2757
  block,
2758
2758
  options: {
@@ -3133,7 +3133,7 @@ function createWithPortableTextMarkModel(editorActor) {
3133
3133
  const snapshot = getEditorSnapshot({
3134
3134
  editorActorSnapshot: editorActor.getSnapshot(),
3135
3135
  slateEditorInstance: editor
3136
- }), markState = selector_isSelectingEntireBlocks.getMarkState(snapshot);
3136
+ }), markState = selector_isActiveStyle.getMarkState(snapshot);
3137
3137
  if (!markState) {
3138
3138
  apply2(op);
3139
3139
  return;
@@ -3183,7 +3183,7 @@ function createWithPortableTextMarkModel(editorActor) {
3183
3183
  });
3184
3184
  slate.Editor.withoutNormalizing(editor, () => {
3185
3185
  apply2(op), slate.Transforms.setNodes(editor, {
3186
- marks: selector_isSelectingEntireBlocks.getActiveDecorators(snapshot)
3186
+ marks: selector_isActiveStyle.getActiveDecorators(snapshot)
3187
3187
  }, {
3188
3188
  at: op.path
3189
3189
  });
@@ -3899,7 +3899,7 @@ function getCurrentUndoStepId(editor) {
3899
3899
  }
3900
3900
  function createUndoStep(editor) {
3901
3901
  CURRENT_UNDO_STEP.set(editor, {
3902
- undoStepId: util_sliceBlocks.defaultKeyGenerator()
3902
+ undoStepId: util_getTextBlockText.defaultKeyGenerator()
3903
3903
  });
3904
3904
  }
3905
3905
  function clearUndoStep(editor) {
@@ -4170,7 +4170,7 @@ const addAnnotationOperationImplementation = ({
4170
4170
  context,
4171
4171
  operation
4172
4172
  }) => {
4173
- const parsedAnnotation = util_sliceBlocks.parseAnnotation({
4173
+ const parsedAnnotation = util_getTextBlockText.parseAnnotation({
4174
4174
  annotation: {
4175
4175
  _type: operation.annotation.name,
4176
4176
  ...operation.annotation.value
@@ -4300,7 +4300,7 @@ const addAnnotationOperationImplementation = ({
4300
4300
  } = operation.props, updatedBlock = {
4301
4301
  ...block,
4302
4302
  ...filteredProps
4303
- }, parsedBlock = util_sliceBlocks.parseBlock({
4303
+ }, parsedBlock = util_getTextBlockText.parseBlock({
4304
4304
  context,
4305
4305
  block: updatedBlock,
4306
4306
  options: {
@@ -4350,7 +4350,7 @@ const addAnnotationOperationImplementation = ({
4350
4350
  if (!parsedBlock)
4351
4351
  throw new Error(`Unable to parse block at ${JSON.stringify(operation.at)}`);
4352
4352
  if (schema.isTextBlock(context, parsedBlock)) {
4353
- const propsToRemove = operation.props.filter((prop) => prop !== "_type"), updatedTextBlock = util_sliceBlocks.parseBlock({
4353
+ const propsToRemove = operation.props.filter((prop) => prop !== "_type"), updatedTextBlock = util_getTextBlockText.parseBlock({
4354
4354
  context,
4355
4355
  block: omit__default.default(parsedBlock, propsToRemove),
4356
4356
  options: {
@@ -4368,7 +4368,7 @@ const addAnnotationOperationImplementation = ({
4368
4368
  });
4369
4369
  return;
4370
4370
  }
4371
- const updatedBlockObject = util_sliceBlocks.parseBlock({
4371
+ const updatedBlockObject = util_getTextBlockText.parseBlock({
4372
4372
  context,
4373
4373
  block: omit__default.default(parsedBlock, operation.props.filter((prop) => prop !== "_type")),
4374
4374
  options: {
@@ -4534,14 +4534,14 @@ const addAnnotationOperationImplementation = ({
4534
4534
  context,
4535
4535
  operation
4536
4536
  }) => {
4537
- const editor = operation.editor, mark = operation.decorator, value = fromSlateValue(editor.children, context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(editor)), manualAnchor = operation.at?.anchor ? util_sliceBlocks.blockOffsetToSpanSelectionPoint({
4537
+ const editor = operation.editor, mark = operation.decorator, value = fromSlateValue(editor.children, context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(editor)), manualAnchor = operation.at?.anchor ? util_getTextBlockText.blockOffsetToSpanSelectionPoint({
4538
4538
  context: {
4539
4539
  ...context,
4540
4540
  value
4541
4541
  },
4542
4542
  blockOffset: operation.at.anchor,
4543
4543
  direction: "backward"
4544
- }) : void 0, manualFocus = operation.at?.focus ? util_sliceBlocks.blockOffsetToSpanSelectionPoint({
4544
+ }) : void 0, manualFocus = operation.at?.focus ? util_getTextBlockText.blockOffsetToSpanSelectionPoint({
4545
4545
  context: {
4546
4546
  ...context,
4547
4547
  value
@@ -4597,7 +4597,7 @@ const addAnnotationOperationImplementation = ({
4597
4597
  focus: focusOffset
4598
4598
  },
4599
4599
  backward: editorSelection?.backward
4600
- }), trimmedSelection = selector_isSelectingEntireBlocks.getTrimmedSelection({
4600
+ }), trimmedSelection = selector_isActiveStyle.getTrimmedSelection({
4601
4601
  blockIndexMap: editor.blockIndexMap,
4602
4602
  context: {
4603
4603
  converters: [],
@@ -4666,7 +4666,7 @@ const addAnnotationOperationImplementation = ({
4666
4666
  context,
4667
4667
  operation
4668
4668
  }) => {
4669
- const anchorBlockKey = util_sliceBlocks.getBlockKeyFromSelectionPoint(operation.at.anchor), focusBlockKey = util_sliceBlocks.getBlockKeyFromSelectionPoint(operation.at.focus), startBlockKey = operation.at.backward ? focusBlockKey : anchorBlockKey, endBlockKey = operation.at.backward ? anchorBlockKey : focusBlockKey, endOffset = operation.at.backward ? operation.at.focus.offset : operation.at.anchor.offset;
4669
+ const anchorBlockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(operation.at.anchor), focusBlockKey = util_getTextBlockText.getBlockKeyFromSelectionPoint(operation.at.focus), startBlockKey = operation.at.backward ? focusBlockKey : anchorBlockKey, endBlockKey = operation.at.backward ? anchorBlockKey : focusBlockKey, endOffset = operation.at.backward ? operation.at.focus.offset : operation.at.anchor.offset;
4670
4670
  if (!startBlockKey)
4671
4671
  throw new Error("Failed to get start block key");
4672
4672
  if (!endBlockKey)
@@ -4760,7 +4760,7 @@ const insertBlockOperationImplementation = ({
4760
4760
  context,
4761
4761
  operation
4762
4762
  }) => {
4763
- const parsedBlock = util_sliceBlocks.parseBlock({
4763
+ const parsedBlock = util_getTextBlockText.parseBlock({
4764
4764
  block: operation.block,
4765
4765
  context,
4766
4766
  options: {
@@ -4927,7 +4927,7 @@ function insertBlock({
4927
4927
  slate.Transforms.insertNodes(editor, [block], {
4928
4928
  at: endBlockPath,
4929
4929
  select: !1
4930
- }), (select === "start" || select === "end") && slate.Transforms.select(editor, slate.Editor.start(editor, endBlockPath)), util_isSelectionCollapsed.isEmptyTextBlock(context, endBlock) && slate.Transforms.removeNodes(editor, {
4930
+ }), (select === "start" || select === "end") && slate.Transforms.select(editor, slate.Editor.start(editor, endBlockPath)), util_isEmptyTextBlock.isEmptyTextBlock(context, endBlock) && slate.Transforms.removeNodes(editor, {
4931
4931
  at: slate.Path.next(endBlockPath)
4932
4932
  });
4933
4933
  else if (slate.Range.isCollapsed(currentSelection) && slate.Point.equals(selectionEndPoint, endBlockEndPoint2)) {
@@ -4992,7 +4992,7 @@ const insertChildOperationImplementation = ({
4992
4992
  const markDefs = focusBlock.markDefs ?? [], markDefKeyMap = /* @__PURE__ */ new Map();
4993
4993
  for (const markDef of markDefs)
4994
4994
  markDefKeyMap.set(markDef._key, markDef._key);
4995
- const span = util_sliceBlocks.parseSpan({
4995
+ const span = util_getTextBlockText.parseSpan({
4996
4996
  span: operation.child,
4997
4997
  context,
4998
4998
  markDefKeyMap,
@@ -5013,7 +5013,7 @@ const insertChildOperationImplementation = ({
5013
5013
  }), slateDom.EDITOR_TO_PENDING_SELECTION.set(operation.editor, operation.editor.selection);
5014
5014
  return;
5015
5015
  }
5016
- const inlineObject = util_sliceBlocks.parseInlineObject({
5016
+ const inlineObject = util_getTextBlockText.parseInlineObject({
5017
5017
  inlineObject: operation.child,
5018
5018
  context,
5019
5019
  options: {
@@ -5059,7 +5059,7 @@ const insertChildOperationImplementation = ({
5059
5059
  }, moveBlockOperationImplementation = ({
5060
5060
  operation
5061
5061
  }) => {
5062
- const originKey = util_sliceBlocks.getBlockKeyFromSelectionPoint({
5062
+ const originKey = util_getTextBlockText.getBlockKeyFromSelectionPoint({
5063
5063
  path: operation.at
5064
5064
  });
5065
5065
  if (!originKey)
@@ -5067,7 +5067,7 @@ const insertChildOperationImplementation = ({
5067
5067
  const originBlockIndex = operation.editor.blockIndexMap.get(originKey);
5068
5068
  if (originBlockIndex === void 0)
5069
5069
  throw new Error("Failed to get block index from block key");
5070
- const destinationKey = util_sliceBlocks.getBlockKeyFromSelectionPoint({
5070
+ const destinationKey = util_getTextBlockText.getBlockKeyFromSelectionPoint({
5071
5071
  path: operation.to
5072
5072
  });
5073
5073
  if (!destinationKey)
@@ -5907,7 +5907,7 @@ function unsetPatch(editor, patch) {
5907
5907
  function findBlock(children, path) {
5908
5908
  let blockIndex = -1;
5909
5909
  const block = children.find((node, index) => {
5910
- const isMatch = util_sliceBlocks.isKeyedSegment(path[0]) ? node._key === path[0]._key : index === path[0];
5910
+ const isMatch = util_getTextBlockText.isKeyedSegment(path[0]) ? node._key === path[0]._key : index === path[0];
5911
5911
  return isMatch && (blockIndex = index), isMatch;
5912
5912
  });
5913
5913
  if (block)
@@ -5922,7 +5922,7 @@ function findBlockChild(block, path) {
5922
5922
  return;
5923
5923
  let childIndex = -1;
5924
5924
  const child = blockNode.children.find((node, index) => {
5925
- const isMatch = util_sliceBlocks.isKeyedSegment(path[2]) ? node._key === path[2]._key : index === path[2];
5925
+ const isMatch = util_getTextBlockText.isKeyedSegment(path[2]) ? node._key === path[2]._key : index === path[2];
5926
5926
  return isMatch && (childIndex = index), isMatch;
5927
5927
  });
5928
5928
  if (child)
@@ -6323,7 +6323,7 @@ function createWithSchemaTypes({
6323
6323
  editorActor
6324
6324
  }) {
6325
6325
  return function(editor) {
6326
- editor.isTextBlock = (value) => slate.Editor.isEditor(value) ? !1 : schema.isTextBlock(editorActor.getSnapshot().context, value), editor.isTextSpan = (value) => slate.Editor.isEditor(value) ? !1 : schema.isSpan(editorActor.getSnapshot().context, value), editor.isListBlock = (value) => slate.Editor.isEditor(value) ? !1 : util_sliceBlocks.isListBlock(editorActor.getSnapshot().context, value), editor.isVoid = (element) => slate.Editor.isEditor(element) ? !1 : editorActor.getSnapshot().context.schema.block.name !== element._type && (editorActor.getSnapshot().context.schema.blockObjects.map((obj) => obj.name).includes(element._type) || editorActor.getSnapshot().context.schema.inlineObjects.map((obj) => obj.name).includes(element._type)), editor.isInline = (element) => slate.Editor.isEditor(element) ? !1 : editorActor.getSnapshot().context.schema.inlineObjects.map((obj) => obj.name).includes(element._type) && "__inline" in element && element.__inline === !0;
6326
+ editor.isTextBlock = (value) => slate.Editor.isEditor(value) ? !1 : schema.isTextBlock(editorActor.getSnapshot().context, value), editor.isTextSpan = (value) => slate.Editor.isEditor(value) ? !1 : schema.isSpan(editorActor.getSnapshot().context, value), editor.isListBlock = (value) => slate.Editor.isEditor(value) ? !1 : util_getTextBlockText.isListBlock(editorActor.getSnapshot().context, value), editor.isVoid = (element) => slate.Editor.isEditor(element) ? !1 : editorActor.getSnapshot().context.schema.block.name !== element._type && (editorActor.getSnapshot().context.schema.blockObjects.map((obj) => obj.name).includes(element._type) || editorActor.getSnapshot().context.schema.inlineObjects.map((obj) => obj.name).includes(element._type)), editor.isInline = (element) => slate.Editor.isEditor(element) ? !1 : editorActor.getSnapshot().context.schema.inlineObjects.map((obj) => obj.name).includes(element._type) && "__inline" in element && element.__inline === !0;
6327
6327
  const {
6328
6328
  normalizeNode
6329
6329
  } = editor;
@@ -6432,7 +6432,7 @@ function isEditorNode(node) {
6432
6432
  return typeof node == "object" && node !== null ? !("_type" in node) && "children" in node && Array.isArray(node.children) : !1;
6433
6433
  }
6434
6434
  function isTextBlockNode(context, node) {
6435
- return util_sliceBlocks.isTypedObject(node) && node._type === context.schema.block.name;
6435
+ return util_getTextBlockText.isTypedObject(node) && node._type === context.schema.block.name;
6436
6436
  }
6437
6437
  function isSpanNode(context, node) {
6438
6438
  return typeof node != "object" || node === null || "children" in node ? !1 : "_type" in node ? node._type === context.schema.span.name : "text" in node;
@@ -6824,10 +6824,10 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6824
6824
  guard: ({
6825
6825
  snapshot
6826
6826
  }) => {
6827
- if (!selector_isSelectionExpanded.isSelectionCollapsed(snapshot))
6827
+ if (!selector_getSelectionText.isSelectionCollapsed(snapshot))
6828
6828
  return !1;
6829
- const caretWordSelection = selector_isSelectingEntireBlocks.getCaretWordSelection(snapshot);
6830
- return !caretWordSelection || !selector_isSelectionExpanded.isSelectionExpanded({
6829
+ const caretWordSelection = selector_isActiveStyle.getCaretWordSelection(snapshot);
6830
+ return !caretWordSelection || !selector_getSelectionText.isSelectionExpanded({
6831
6831
  context: {
6832
6832
  ...snapshot.context,
6833
6833
  selection: caretWordSelection
@@ -6854,7 +6854,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6854
6854
  guard: ({
6855
6855
  snapshot,
6856
6856
  event
6857
- }) => selector_isSelectingEntireBlocks.isActiveAnnotation(event.annotation.name, {
6857
+ }) => selector_isActiveStyle.isActiveAnnotation(event.annotation.name, {
6858
6858
  mode: "partial"
6859
6859
  })(snapshot),
6860
6860
  // Then the existing annotation is removed
@@ -6947,9 +6947,9 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6947
6947
  snapshot,
6948
6948
  event
6949
6949
  }) => {
6950
- if (!defaultKeyboardShortcuts.arrowDown.guard(event.originEvent) || !selector_isSelectionExpanded.isSelectionCollapsed(snapshot))
6950
+ if (!defaultKeyboardShortcuts.arrowDown.guard(event.originEvent) || !selector_getSelectionText.isSelectionCollapsed(snapshot))
6951
6951
  return !1;
6952
- const focusBlockObject = selector_isSelectingEntireBlocks.getFocusBlockObject(snapshot), nextBlock = selector_isSelectingEntireBlocks.getNextBlock(snapshot);
6952
+ const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
6953
6953
  return focusBlockObject && !nextBlock;
6954
6954
  },
6955
6955
  actions: [({
@@ -6967,9 +6967,9 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6967
6967
  snapshot,
6968
6968
  event
6969
6969
  }) => {
6970
- if (!defaultKeyboardShortcuts.arrowUp.guard(event.originEvent) || !selector_isSelectionExpanded.isSelectionCollapsed(snapshot))
6970
+ if (!defaultKeyboardShortcuts.arrowUp.guard(event.originEvent) || !selector_getSelectionText.isSelectionCollapsed(snapshot))
6971
6971
  return !1;
6972
- const focusBlockObject = selector_isSelectingEntireBlocks.getFocusBlockObject(snapshot), previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock(snapshot);
6972
+ const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
6973
6973
  return focusBlockObject && !previousBlock;
6974
6974
  },
6975
6975
  actions: [({
@@ -6986,8 +6986,8 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6986
6986
  guard: ({
6987
6987
  snapshot
6988
6988
  }) => {
6989
- const focusBlockObject = selector_isSelectingEntireBlocks.getFocusBlockObject(snapshot);
6990
- return selector_isSelectionExpanded.isSelectionCollapsed(snapshot) && focusBlockObject !== void 0;
6989
+ const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot);
6990
+ return selector_getSelectionText.isSelectionCollapsed(snapshot) && focusBlockObject !== void 0;
6991
6991
  },
6992
6992
  actions: [({
6993
6993
  snapshot
@@ -7004,15 +7004,15 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
7004
7004
  snapshot,
7005
7005
  event
7006
7006
  }) => {
7007
- if (snapshot.context.readOnly || snapshot.context.selection && !selector_isSelectionExpanded.isSelectionCollapsed(snapshot))
7007
+ if (snapshot.context.readOnly || snapshot.context.selection && !selector_getSelectionText.isSelectionCollapsed(snapshot))
7008
7008
  return !1;
7009
- const focusBlockObject = selector_isSelectingEntireBlocks.getFocusBlockObject({
7009
+ const focusBlockObject = selector_isActiveStyle.getFocusBlockObject({
7010
7010
  ...snapshot,
7011
7011
  context: {
7012
7012
  ...snapshot.context,
7013
7013
  selection: event.position.selection
7014
7014
  }
7015
- }), previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock({
7015
+ }), previousBlock = selector_isActiveStyle.getPreviousBlock({
7016
7016
  ...snapshot,
7017
7017
  context: {
7018
7018
  ...snapshot.context,
@@ -7041,15 +7041,15 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
7041
7041
  snapshot,
7042
7042
  event
7043
7043
  }) => {
7044
- if (snapshot.context.readOnly || snapshot.context.selection && !selector_isSelectionExpanded.isSelectionCollapsed(snapshot))
7044
+ if (snapshot.context.readOnly || snapshot.context.selection && !selector_getSelectionText.isSelectionCollapsed(snapshot))
7045
7045
  return !1;
7046
- const focusBlockObject = selector_isSelectingEntireBlocks.getFocusBlockObject({
7046
+ const focusBlockObject = selector_isActiveStyle.getFocusBlockObject({
7047
7047
  ...snapshot,
7048
7048
  context: {
7049
7049
  ...snapshot.context,
7050
7050
  selection: event.position.selection
7051
7051
  }
7052
- }), nextBlock = selector_isSelectingEntireBlocks.getNextBlock({
7052
+ }), nextBlock = selector_isActiveStyle.getNextBlock({
7053
7053
  ...snapshot,
7054
7054
  context: {
7055
7055
  ...snapshot.context,
@@ -7077,8 +7077,8 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
7077
7077
  guard: ({
7078
7078
  snapshot
7079
7079
  }) => {
7080
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot), selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot), previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock(snapshot);
7081
- return !focusTextBlock || !selectionCollapsed || !previousBlock ? !1 : util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, previousBlock.node) ? {
7080
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
7081
+ return !focusTextBlock || !selectionCollapsed || !previousBlock ? !1 : util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, previousBlock.node) ? {
7082
7082
  focusTextBlock,
7083
7083
  previousBlock
7084
7084
  } : !1;
@@ -7107,8 +7107,8 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
7107
7107
  guard: ({
7108
7108
  snapshot
7109
7109
  }) => {
7110
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot), selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot), nextBlock = selector_isSelectingEntireBlocks.getNextBlock(snapshot);
7111
- return !focusTextBlock || !selectionCollapsed || !nextBlock ? !1 : util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, nextBlock.node) ? {
7110
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
7111
+ return !focusTextBlock || !selectionCollapsed || !nextBlock ? !1 : util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, nextBlock.node) ? {
7112
7112
  focusTextBlock,
7113
7113
  nextBlock
7114
7114
  } : !1;
@@ -7216,7 +7216,7 @@ const coreDndBehaviors = [
7216
7216
  const dragSelection = getDragSelection({
7217
7217
  snapshot,
7218
7218
  eventSelection: event.position.selection
7219
- }), selectingEntireBlocks = selector_isSelectingEntireBlocks.isSelectingEntireBlocks({
7219
+ }), selectingEntireBlocks = selector_isActiveStyle.isSelectingEntireBlocks({
7220
7220
  ...snapshot,
7221
7221
  context: {
7222
7222
  ...snapshot.context,
@@ -7322,7 +7322,7 @@ const coreDndBehaviors = [
7322
7322
  event
7323
7323
  }) => {
7324
7324
  const dragOrigin = event.dragOrigin;
7325
- return dragOrigin ? selector_isSelectingEntireBlocks.isOverlappingSelection(event.position.selection)({
7325
+ return dragOrigin ? selector_isActiveStyle.isOverlappingSelection(event.position.selection)({
7326
7326
  ...snapshot,
7327
7327
  context: {
7328
7328
  ...snapshot.context,
@@ -7343,7 +7343,7 @@ const coreDndBehaviors = [
7343
7343
  event
7344
7344
  }) => {
7345
7345
  const dragOrigin = event.dragOrigin, dropPosition = event.position.selection;
7346
- return dragOrigin ? selector_isSelectingEntireBlocks.isOverlappingSelection(dropPosition)({
7346
+ return dragOrigin ? selector_isActiveStyle.isOverlappingSelection(dropPosition)({
7347
7347
  ...snapshot,
7348
7348
  context: {
7349
7349
  ...snapshot.context,
@@ -7399,19 +7399,19 @@ const coreDndBehaviors = [
7399
7399
  const dragOrigin = event.originEvent.dragOrigin, dragSelection = getDragSelection({
7400
7400
  eventSelection: dragOrigin.selection,
7401
7401
  snapshot
7402
- }), dropPosition = event.originEvent.position.selection, droppingOnDragOrigin = dragOrigin ? selector_isSelectingEntireBlocks.isOverlappingSelection(dropPosition)({
7402
+ }), dropPosition = event.originEvent.position.selection, droppingOnDragOrigin = dragOrigin ? selector_isActiveStyle.isOverlappingSelection(dropPosition)({
7403
7403
  ...snapshot,
7404
7404
  context: {
7405
7405
  ...snapshot.context,
7406
7406
  selection: dragSelection
7407
7407
  }
7408
- }) : !1, draggingEntireBlocks = selector_isSelectingEntireBlocks.isSelectingEntireBlocks({
7408
+ }) : !1, draggingEntireBlocks = selector_isActiveStyle.isSelectingEntireBlocks({
7409
7409
  ...snapshot,
7410
7410
  context: {
7411
7411
  ...snapshot.context,
7412
7412
  selection: dragSelection
7413
7413
  }
7414
- }), draggedBlocks = selector_isSelectingEntireBlocks.getSelectedBlocks({
7414
+ }), draggedBlocks = selector_isActiveStyle.getSelectedBlocks({
7415
7415
  ...snapshot,
7416
7416
  context: {
7417
7417
  ...snapshot.context,
@@ -7454,9 +7454,9 @@ const coreDndBehaviors = [
7454
7454
  guard: ({
7455
7455
  snapshot
7456
7456
  }) => {
7457
- if (!selector_isSelectionExpanded.getFocusSpan(snapshot))
7457
+ if (!selector_getSelectionText.getFocusSpan(snapshot))
7458
7458
  return !1;
7459
- const markState = selector_isSelectingEntireBlocks.getMarkState(snapshot), activeDecorators = selector_isSelectingEntireBlocks.getActiveDecorators(snapshot), activeAnnotations = selector_isSelectingEntireBlocks.getActiveAnnotationsMarks(snapshot);
7459
+ const markState = selector_isActiveStyle.getMarkState(snapshot), activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot), activeAnnotations = selector_isActiveStyle.getActiveAnnotationsMarks(snapshot);
7460
7460
  if (markState && markState.state === "unchanged") {
7461
7461
  const markStateDecorators = (markState.marks ?? []).filter((mark) => snapshot.context.schema.decorators.map((decorator) => decorator.name).includes(mark));
7462
7462
  if (markStateDecorators.length === activeDecorators.length && markStateDecorators.every((mark) => activeDecorators.includes(mark)))
@@ -7486,10 +7486,10 @@ const coreDndBehaviors = [
7486
7486
  guard: ({
7487
7487
  snapshot
7488
7488
  }) => {
7489
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot), selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot);
7489
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
7490
7490
  if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
7491
7491
  return !1;
7492
- const atTheEndOfBlock = selector_isSelectingEntireBlocks.isAtTheEndOfBlock(focusTextBlock)(snapshot), focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
7492
+ const atTheEndOfBlock = selector_isActiveStyle.isAtTheEndOfBlock(focusTextBlock)(snapshot), focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
7493
7493
  return atTheEndOfBlock ? {
7494
7494
  focusListItem,
7495
7495
  focusLevel
@@ -7521,11 +7521,11 @@ const coreDndBehaviors = [
7521
7521
  guard: ({
7522
7522
  snapshot
7523
7523
  }) => {
7524
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot), selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot);
7524
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
7525
7525
  if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
7526
7526
  return !1;
7527
- const focusSpan = selector_isSelectionExpanded.getFocusSpan(snapshot), focusDecorators = focusSpan?.node.marks?.filter((mark) => snapshot.context.schema.decorators.some((decorator) => decorator.name === mark) ?? []), focusAnnotations = focusSpan?.node.marks?.filter((mark) => !snapshot.context.schema.decorators.some((decorator) => decorator.name === mark)) ?? [], focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
7528
- return selector_isSelectingEntireBlocks.isAtTheStartOfBlock(focusTextBlock)(snapshot) ? {
7527
+ const focusSpan = selector_getSelectionText.getFocusSpan(snapshot), focusDecorators = focusSpan?.node.marks?.filter((mark) => snapshot.context.schema.decorators.some((decorator) => decorator.name === mark) ?? []), focusAnnotations = focusSpan?.node.marks?.filter((mark) => !snapshot.context.schema.decorators.some((decorator) => decorator.name === mark)) ?? [], focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
7528
+ return selector_isActiveStyle.isAtTheStartOfBlock(focusTextBlock)(snapshot) ? {
7529
7529
  focusAnnotations,
7530
7530
  focusDecorators,
7531
7531
  focusListItem,
@@ -7560,19 +7560,19 @@ const coreDndBehaviors = [
7560
7560
  guard: ({
7561
7561
  snapshot
7562
7562
  }) => {
7563
- if (!snapshot.context.selection || !selector_isSelectionExpanded.isSelectionExpanded(snapshot))
7563
+ if (!snapshot.context.selection || !selector_getSelectionText.isSelectionExpanded(snapshot))
7564
7564
  return !1;
7565
- const firstBlock = selector_isSelectingEntireBlocks.getFirstBlock(snapshot), lastBlock = selector_isSelectingEntireBlocks.getLastBlock(snapshot);
7565
+ const firstBlock = selector_isActiveStyle.getFirstBlock(snapshot), lastBlock = selector_isActiveStyle.getLastBlock(snapshot);
7566
7566
  if (!firstBlock || !lastBlock)
7567
7567
  return !1;
7568
- const firstBlockStartPoint = util_sliceBlocks.getBlockStartPoint({
7568
+ const firstBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
7569
7569
  context: snapshot.context,
7570
7570
  block: firstBlock
7571
- }), selectionStartPoint = util_sliceBlocks.getSelectionStartPoint(snapshot.context.selection), lastBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
7571
+ }), selectionStartPoint = util_getTextBlockText.getSelectionStartPoint(snapshot.context.selection), lastBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
7572
7572
  context: snapshot.context,
7573
7573
  block: lastBlock
7574
- }), selectionEndPoint = util_sliceBlocks.getSelectionEndPoint(snapshot.context.selection);
7575
- return util_isSelectionCollapsed.isEqualSelectionPoints(firstBlockStartPoint, selectionStartPoint) && util_isSelectionCollapsed.isEqualSelectionPoints(lastBlockEndPoint, selectionEndPoint) ? {
7574
+ }), selectionEndPoint = util_getTextBlockText.getSelectionEndPoint(snapshot.context.selection);
7575
+ return util_isEmptyTextBlock.isEqualSelectionPoints(firstBlockStartPoint, selectionStartPoint) && util_isEmptyTextBlock.isEqualSelectionPoints(lastBlockEndPoint, selectionEndPoint) ? {
7576
7576
  selection: snapshot.context.selection
7577
7577
  } : !1;
7578
7578
  },
@@ -7587,19 +7587,19 @@ const coreDndBehaviors = [
7587
7587
  guard: ({
7588
7588
  snapshot
7589
7589
  }) => {
7590
- if (!snapshot.context.selection || !selector_isSelectionExpanded.isSelectionExpanded(snapshot))
7590
+ if (!snapshot.context.selection || !selector_getSelectionText.isSelectionExpanded(snapshot))
7591
7591
  return !1;
7592
- const selectedBlocks = selector_isSelectingEntireBlocks.getSelectedBlocks(snapshot), selectionStartBlock = selector_isSelectingEntireBlocks.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isSelectingEntireBlocks.getSelectionEndBlock(snapshot);
7592
+ const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
7593
7593
  if (!selectionStartBlock || !selectionEndBlock)
7594
7594
  return !1;
7595
- const startBlockStartPoint = util_sliceBlocks.getBlockStartPoint({
7595
+ const startBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
7596
7596
  context: snapshot.context,
7597
7597
  block: selectionStartBlock
7598
- }), selectionStartPoint = util_sliceBlocks.getSelectionStartPoint(snapshot.context.selection), endBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
7598
+ }), selectionStartPoint = util_getTextBlockText.getSelectionStartPoint(snapshot.context.selection), endBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
7599
7599
  context: snapshot.context,
7600
7600
  block: selectionEndBlock
7601
- }), selectionEndPoint = util_sliceBlocks.getSelectionEndPoint(snapshot.context.selection);
7602
- return util_isSelectionCollapsed.isEqualSelectionPoints(selectionStartPoint, startBlockStartPoint) && util_isSelectionCollapsed.isEqualSelectionPoints(selectionEndPoint, endBlockEndPoint) ? {
7601
+ }), selectionEndPoint = util_getTextBlockText.getSelectionEndPoint(snapshot.context.selection);
7602
+ return util_isEmptyTextBlock.isEqualSelectionPoints(selectionStartPoint, startBlockStartPoint) && util_isEmptyTextBlock.isEqualSelectionPoints(selectionEndPoint, endBlockEndPoint) ? {
7603
7603
  selectedBlocks
7604
7604
  } : !1;
7605
7605
  },
@@ -7628,7 +7628,7 @@ const coreDndBehaviors = [
7628
7628
  guard: ({
7629
7629
  snapshot
7630
7630
  }) => {
7631
- const selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot), focusInlineObject = selector_isSelectingEntireBlocks.getFocusInlineObject(snapshot);
7631
+ const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusInlineObject = selector_isActiveStyle.getFocusInlineObject(snapshot);
7632
7632
  return selectionCollapsed && focusInlineObject;
7633
7633
  },
7634
7634
  actions: [() => [behaviors_index.raise({
@@ -7648,14 +7648,14 @@ function isAtTheBeginningOfBlock({
7648
7648
  context,
7649
7649
  block
7650
7650
  }) {
7651
- return !schema.isTextBlock(context, block) || !context.selection || !util_isSelectionCollapsed.isSelectionCollapsed(context.selection) ? !1 : util_sliceBlocks.getChildKeyFromSelectionPoint(context.selection.focus) === block.children[0]._key && context.selection.focus.offset === 0;
7651
+ return !schema.isTextBlock(context, block) || !context.selection || !util_isEmptyTextBlock.isSelectionCollapsed(context.selection) ? !1 : util_getTextBlockText.getChildKeyFromSelectionPoint(context.selection.focus) === block.children[0]._key && context.selection.focus.offset === 0;
7652
7652
  }
7653
7653
  const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior({
7654
7654
  on: "delete.backward",
7655
7655
  guard: ({
7656
7656
  snapshot
7657
7657
  }) => {
7658
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
7658
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
7659
7659
  return !focusTextBlock || focusTextBlock.node.level !== 1 || !isAtTheBeginningOfBlock({
7660
7660
  context: snapshot.context,
7661
7661
  block: focusTextBlock.node
@@ -7675,7 +7675,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7675
7675
  guard: ({
7676
7676
  snapshot
7677
7677
  }) => {
7678
- const selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot), focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot), focusSpan = selector_isSelectionExpanded.getFocusSpan(snapshot);
7678
+ const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), focusSpan = selector_getSelectionText.getFocusSpan(snapshot);
7679
7679
  return !selectionCollapsed || !focusTextBlock || !focusSpan ? !1 : focusTextBlock.node.children[0]._key === focusSpan.node._key && snapshot.context.selection?.focus.offset === 0 && focusTextBlock.node.level !== void 0 && focusTextBlock.node.level > 1 ? {
7680
7680
  focusTextBlock,
7681
7681
  level: focusTextBlock.node.level - 1
@@ -7696,8 +7696,8 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7696
7696
  guard: ({
7697
7697
  snapshot
7698
7698
  }) => {
7699
- const focusListBlock = selector_isSelectingEntireBlocks.getFocusListBlock(snapshot), nextBlock = selector_isSelectingEntireBlocks.getNextBlock(snapshot);
7700
- return !focusListBlock || !nextBlock || !schema.isTextBlock(snapshot.context, nextBlock.node) || !util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
7699
+ const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
7700
+ return !focusListBlock || !nextBlock || !schema.isTextBlock(snapshot.context, nextBlock.node) || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
7701
7701
  focusListBlock,
7702
7702
  nextBlock
7703
7703
  };
@@ -7718,13 +7718,13 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7718
7718
  guard: ({
7719
7719
  snapshot
7720
7720
  }) => {
7721
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot), previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock(snapshot);
7721
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
7722
7722
  if (!focusTextBlock || !previousBlock || !isAtTheBeginningOfBlock({
7723
7723
  context: snapshot.context,
7724
7724
  block: focusTextBlock.node
7725
- }) || !util_sliceBlocks.isListBlock(snapshot.context, previousBlock.node) || !util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, previousBlock.node))
7725
+ }) || !util_getTextBlockText.isListBlock(snapshot.context, previousBlock.node) || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, previousBlock.node))
7726
7726
  return !1;
7727
- const previousBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
7727
+ const previousBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
7728
7728
  context: snapshot.context,
7729
7729
  block: previousBlock
7730
7730
  });
@@ -7757,7 +7757,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7757
7757
  snapshot,
7758
7758
  event
7759
7759
  }) => {
7760
- const blocksToDelete = selector_isSelectingEntireBlocks.getSelectedBlocks({
7760
+ const blocksToDelete = selector_isActiveStyle.getSelectedBlocks({
7761
7761
  ...snapshot,
7762
7762
  context: {
7763
7763
  ...snapshot.context,
@@ -7767,14 +7767,14 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7767
7767
  if (blocksToDelete.length < 2)
7768
7768
  return !1;
7769
7769
  const startBlock = blocksToDelete.at(0)?.node, middleBlocks = blocksToDelete.slice(1, -1), endBlock = blocksToDelete.at(-1)?.node;
7770
- if (!util_sliceBlocks.isListBlock(snapshot.context, startBlock) || !util_sliceBlocks.isListBlock(snapshot.context, endBlock))
7770
+ if (!util_getTextBlockText.isListBlock(snapshot.context, startBlock) || !util_getTextBlockText.isListBlock(snapshot.context, endBlock))
7771
7771
  return !1;
7772
- const deleteStartPoint = selector_isSelectionExpanded.getSelectionStartPoint({
7772
+ const deleteStartPoint = selector_getSelectionText.getSelectionStartPoint({
7773
7773
  context: {
7774
7774
  ...snapshot.context,
7775
7775
  selection: event.at
7776
7776
  }
7777
- }), deleteEndPoint = selector_isSelectingEntireBlocks.getSelectionEndPoint({
7777
+ }), deleteEndPoint = selector_isActiveStyle.getSelectionEndPoint({
7778
7778
  context: {
7779
7779
  ...snapshot.context,
7780
7780
  selection: event.at
@@ -7782,7 +7782,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7782
7782
  });
7783
7783
  if (!deleteStartPoint || !deleteEndPoint)
7784
7784
  return !1;
7785
- const startBlockStartPoint = util_sliceBlocks.getBlockStartPoint({
7785
+ const startBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
7786
7786
  context: snapshot.context,
7787
7787
  block: {
7788
7788
  node: startBlock,
@@ -7791,9 +7791,9 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7791
7791
  }]
7792
7792
  }
7793
7793
  });
7794
- if (!util_isSelectionCollapsed.isEqualSelectionPoints(deleteStartPoint, startBlockStartPoint))
7794
+ if (!util_isEmptyTextBlock.isEqualSelectionPoints(deleteStartPoint, startBlockStartPoint))
7795
7795
  return !1;
7796
- const startBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
7796
+ const startBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
7797
7797
  context: snapshot.context,
7798
7798
  block: {
7799
7799
  node: startBlock,
@@ -7801,7 +7801,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7801
7801
  _key: startBlock._key
7802
7802
  }]
7803
7803
  }
7804
- }), endBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
7804
+ }), endBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
7805
7805
  context: snapshot.context,
7806
7806
  block: {
7807
7807
  node: endBlock,
@@ -7876,8 +7876,8 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7876
7876
  guard: ({
7877
7877
  snapshot
7878
7878
  }) => {
7879
- const selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot), focusListBlock = selector_isSelectingEntireBlocks.getFocusListBlock(snapshot);
7880
- return !selectionCollapsed || !focusListBlock || !util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
7879
+ const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
7880
+ return !selectionCollapsed || !focusListBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
7881
7881
  focusListBlock
7882
7882
  };
7883
7883
  },
@@ -7896,7 +7896,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7896
7896
  }) => {
7897
7897
  if (!defaultKeyboardShortcuts.tab.guard(event.originEvent))
7898
7898
  return !1;
7899
- const selectedBlocks = selector_isSelectingEntireBlocks.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_sliceBlocks.isListBlock(snapshot.context, block.node) ? [{
7899
+ const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
7900
7900
  node: block.node,
7901
7901
  path: block.path
7902
7902
  }] : []);
@@ -7921,7 +7921,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7921
7921
  }) => {
7922
7922
  if (!defaultKeyboardShortcuts.shiftTab.guard(event.originEvent))
7923
7923
  return !1;
7924
- const selectedBlocks = selector_isSelectingEntireBlocks.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_sliceBlocks.isListBlock(snapshot.context, block.node) ? [{
7924
+ const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
7925
7925
  node: block.node,
7926
7926
  path: block.path
7927
7927
  }] : []);
@@ -7944,10 +7944,10 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7944
7944
  snapshot,
7945
7945
  event
7946
7946
  }) => {
7947
- const focusListBlock = selector_isSelectingEntireBlocks.getFocusListBlock(snapshot);
7947
+ const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
7948
7948
  if (!focusListBlock)
7949
7949
  return !1;
7950
- const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock = util_sliceBlocks.isListBlock(snapshot.context, firstInsertedBlock) ? firstInsertedBlock : util_sliceBlocks.isListBlock(snapshot.context, secondInsertedBlock) ? secondInsertedBlock : void 0;
7950
+ const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock = util_getTextBlockText.isListBlock(snapshot.context, firstInsertedBlock) ? firstInsertedBlock : util_getTextBlockText.isListBlock(snapshot.context, secondInsertedBlock) ? secondInsertedBlock : void 0;
7951
7951
  if (!insertedListBlock)
7952
7952
  return !1;
7953
7953
  const levelDifference = focusListBlock.node.level - insertedListBlock.level;
@@ -7966,7 +7966,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7966
7966
  let adjustLevel = !0, listStartBlockFound = !1;
7967
7967
  return [behaviors_index.raise({
7968
7968
  ...event,
7969
- blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustLevel ? listStartBlockFound && adjustLevel && util_sliceBlocks.isListBlock(snapshot.context, block) ? {
7969
+ blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustLevel ? listStartBlockFound && adjustLevel && util_getTextBlockText.isListBlock(snapshot.context, block) ? {
7970
7970
  ...block,
7971
7971
  level: Math.min(MAX_LIST_LEVEL, Math.max(1, block.level + levelDifference))
7972
7972
  } : (listStartBlockFound && (adjustLevel = !1), block) : block))
@@ -7978,10 +7978,10 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7978
7978
  snapshot,
7979
7979
  event
7980
7980
  }) => {
7981
- const focusListBlock = selector_isSelectingEntireBlocks.getFocusListBlock(snapshot);
7982
- if (!focusListBlock || util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusListBlock.node))
7981
+ const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
7982
+ if (!focusListBlock || util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node))
7983
7983
  return !1;
7984
- const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock = util_sliceBlocks.isListBlock(snapshot.context, firstInsertedBlock) ? firstInsertedBlock : util_sliceBlocks.isListBlock(snapshot.context, secondInsertedBlock) ? secondInsertedBlock : void 0;
7984
+ const firstInsertedBlock = event.blocks.at(0), secondInsertedBlock = event.blocks.at(1), insertedListBlock = util_getTextBlockText.isListBlock(snapshot.context, firstInsertedBlock) ? firstInsertedBlock : util_getTextBlockText.isListBlock(snapshot.context, secondInsertedBlock) ? secondInsertedBlock : void 0;
7985
7985
  return !insertedListBlock || focusListBlock.node.level !== insertedListBlock.level || focusListBlock.node.listItem === insertedListBlock.listItem ? !1 : {
7986
7986
  listItem: focusListBlock.node.listItem,
7987
7987
  insertedListBlock
@@ -7997,7 +7997,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7997
7997
  let adjustListItem = !0, listStartBlockFound = !1;
7998
7998
  return [behaviors_index.raise({
7999
7999
  ...event,
8000
- blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustListItem ? listStartBlockFound && adjustListItem && util_sliceBlocks.isListBlock(snapshot.context, block) ? {
8000
+ blocks: event.blocks.map((block) => (block._key === insertedListBlock._key && (listStartBlockFound = !0), adjustListItem ? listStartBlockFound && adjustListItem && util_getTextBlockText.isListBlock(snapshot.context, block) ? {
8001
8001
  ...block,
8002
8002
  listItem: block.level === insertedListBlock.level ? listItem : block.listItem
8003
8003
  } : (listStartBlockFound && (adjustListItem = !1), block) : block))
@@ -8011,8 +8011,8 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
8011
8011
  }) => {
8012
8012
  if (event.placement !== "auto" || event.block._type !== snapshot.context.schema.block.name || event.block.listItem !== void 0)
8013
8013
  return !1;
8014
- const focusListBlock = selector_isSelectingEntireBlocks.getFocusListBlock(snapshot);
8015
- return !focusListBlock || !util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
8014
+ const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
8015
+ return !focusListBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
8016
8016
  level: focusListBlock.node.level,
8017
8017
  listItem: focusListBlock.node.listItem
8018
8018
  };
@@ -8055,7 +8055,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8055
8055
  snapshot,
8056
8056
  event
8057
8057
  }) => {
8058
- const blockKey = event.at[0]._key, markDefKey = event.at[2]._key, block = selector_isSelectionExpanded.getFocusTextBlock({
8058
+ const blockKey = event.at[0]._key, markDefKey = event.at[2]._key, block = selector_getSelectionText.getFocusTextBlock({
8059
8059
  ...snapshot,
8060
8060
  context: {
8061
8061
  ...snapshot.context,
@@ -8103,7 +8103,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8103
8103
  guard: ({
8104
8104
  snapshot,
8105
8105
  event
8106
- }) => selector_isSelectingEntireBlocks.isActiveAnnotation(event.annotation.name)(snapshot),
8106
+ }) => selector_isActiveStyle.isActiveAnnotation(event.annotation.name)(snapshot),
8107
8107
  actions: [({
8108
8108
  event
8109
8109
  }) => [behaviors_index.raise({
@@ -8115,7 +8115,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8115
8115
  guard: ({
8116
8116
  snapshot,
8117
8117
  event
8118
- }) => !selector_isSelectingEntireBlocks.isActiveAnnotation(event.annotation.name)(snapshot),
8118
+ }) => !selector_isActiveStyle.isActiveAnnotation(event.annotation.name)(snapshot),
8119
8119
  actions: [({
8120
8120
  event
8121
8121
  }) => [behaviors_index.raise({
@@ -8127,7 +8127,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8127
8127
  guard: ({
8128
8128
  snapshot,
8129
8129
  event
8130
- }) => selector_isSelectingEntireBlocks.isActiveDecorator(event.decorator)(snapshot),
8130
+ }) => selector_isActiveStyle.isActiveDecorator(event.decorator)(snapshot),
8131
8131
  actions: [({
8132
8132
  event
8133
8133
  }) => [behaviors_index.raise({
@@ -8144,13 +8144,13 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8144
8144
  context: snapshot.context,
8145
8145
  offsets: event.at
8146
8146
  }) : null;
8147
- return manualSelection ? !selector_isSelectingEntireBlocks.isActiveDecorator(event.decorator)({
8147
+ return manualSelection ? !selector_isActiveStyle.isActiveDecorator(event.decorator)({
8148
8148
  ...snapshot,
8149
8149
  context: {
8150
8150
  ...snapshot.context,
8151
8151
  selection: manualSelection
8152
8152
  }
8153
- }) : !selector_isSelectingEntireBlocks.isActiveDecorator(event.decorator)(snapshot);
8153
+ }) : !selector_isActiveStyle.isActiveDecorator(event.decorator)(snapshot);
8154
8154
  },
8155
8155
  actions: [({
8156
8156
  event
@@ -8183,10 +8183,10 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8183
8183
  }) => {
8184
8184
  if (event.direction !== "backward")
8185
8185
  return !1;
8186
- const previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock(snapshot), focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
8187
- if (!previousBlock || !focusTextBlock || !selector_isSelectingEntireBlocks.isAtTheStartOfBlock(focusTextBlock)(snapshot))
8186
+ const previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8187
+ if (!previousBlock || !focusTextBlock || !selector_isActiveStyle.isAtTheStartOfBlock(focusTextBlock)(snapshot))
8188
8188
  return !1;
8189
- const previousBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
8189
+ const previousBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
8190
8190
  context: snapshot.context,
8191
8191
  block: previousBlock
8192
8192
  });
@@ -8238,22 +8238,22 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8238
8238
  }) => {
8239
8239
  if (event.direction !== "forward")
8240
8240
  return !1;
8241
- const nextBlock = selector_isSelectingEntireBlocks.getNextBlock({
8241
+ const nextBlock = selector_isActiveStyle.getNextBlock({
8242
8242
  ...snapshot,
8243
8243
  context: {
8244
8244
  ...snapshot.context,
8245
8245
  selection: event.at
8246
8246
  }
8247
- }), focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock({
8247
+ }), focusTextBlock = selector_getSelectionText.getFocusTextBlock({
8248
8248
  ...snapshot,
8249
8249
  context: {
8250
8250
  ...snapshot.context,
8251
8251
  selection: event.at
8252
8252
  }
8253
8253
  });
8254
- if (!nextBlock || !focusTextBlock || !util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusTextBlock.node))
8254
+ if (!nextBlock || !focusTextBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node))
8255
8255
  return !1;
8256
- const nextBlockStartPoint = util_sliceBlocks.getBlockStartPoint({
8256
+ const nextBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
8257
8257
  context: snapshot.context,
8258
8258
  block: nextBlock
8259
8259
  });
@@ -8283,8 +8283,8 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8283
8283
  }) => {
8284
8284
  if (event.direction !== "forward")
8285
8285
  return !1;
8286
- const nextBlock = selector_isSelectingEntireBlocks.getNextBlock(snapshot), focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
8287
- return !nextBlock || !focusTextBlock || !selector_isSelectingEntireBlocks.isAtTheEndOfBlock(focusTextBlock)(snapshot) || !schema.isTextBlock(snapshot.context, nextBlock.node) ? !1 : {
8286
+ const nextBlock = selector_isActiveStyle.getNextBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8287
+ return !nextBlock || !focusTextBlock || !selector_isActiveStyle.isAtTheEndOfBlock(focusTextBlock)(snapshot) || !schema.isTextBlock(snapshot.context, nextBlock.node) ? !1 : {
8288
8288
  nextBlock
8289
8289
  };
8290
8290
  },
@@ -8323,7 +8323,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8323
8323
  snapshot,
8324
8324
  event
8325
8325
  }) => {
8326
- const focusChild = selector_isSelectionExpanded.getFocusChild({
8326
+ const focusChild = selector_getSelectionText.getFocusChild({
8327
8327
  ...snapshot,
8328
8328
  context: {
8329
8329
  ...snapshot.context,
@@ -8381,7 +8381,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8381
8381
  });
8382
8382
  if (!selection)
8383
8383
  return !1;
8384
- const trimmedSelection = selector_isSelectingEntireBlocks.getTrimmedSelection({
8384
+ const trimmedSelection = selector_isActiveStyle.getTrimmedSelection({
8385
8385
  ...snapshot,
8386
8386
  context: {
8387
8387
  ...snapshot.context,
@@ -8483,12 +8483,12 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8483
8483
  snapshot,
8484
8484
  event
8485
8485
  }) => {
8486
- if (selector_isSelectionExpanded.getFocusTextBlock(snapshot) && event.mimeType === "text/plain" && event.originEvent.type === "clipboard.paste") {
8487
- const activeDecorators = selector_isSelectingEntireBlocks.getActiveDecorators(snapshot);
8486
+ if (selector_getSelectionText.getFocusTextBlock(snapshot) && event.mimeType === "text/plain" && event.originEvent.type === "clipboard.paste") {
8487
+ const activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot);
8488
8488
  return {
8489
- activeAnnotations: selector_isSelectingEntireBlocks.getActiveAnnotations(snapshot),
8489
+ activeAnnotations: selector_isActiveStyle.getActiveAnnotations(snapshot),
8490
8490
  activeDecorators,
8491
- textRuns: event.data.flatMap((block) => schema.isTextBlock(snapshot.context, block) ? [util_sliceBlocks.getTextBlockText(block)] : [])
8491
+ textRuns: event.data.flatMap((block) => schema.isTextBlock(snapshot.context, block) ? [util_getTextBlockText.getTextBlockText(block)] : [])
8492
8492
  };
8493
8493
  }
8494
8494
  return !1;
@@ -8695,8 +8695,8 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8695
8695
  }) => {
8696
8696
  if (event.placement !== "auto")
8697
8697
  return !1;
8698
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
8699
- if (!focusTextBlock || !util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusTextBlock.node))
8698
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8699
+ if (!focusTextBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node))
8700
8700
  return !1;
8701
8701
  const firstBlockKey = event.blocks.at(0)?._key ?? snapshot.context.keyGenerator(), lastBlockKey = event.blocks.at(-1)?._key ?? snapshot.context.keyGenerator();
8702
8702
  return {
@@ -8736,13 +8736,13 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8736
8736
  }) => {
8737
8737
  if (event.placement !== "auto")
8738
8738
  return !1;
8739
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
8739
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8740
8740
  if (!focusTextBlock || !snapshot.context.selection)
8741
8741
  return !1;
8742
- const focusBlockStartPoint = util_sliceBlocks.getBlockStartPoint({
8742
+ const focusBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
8743
8743
  context: snapshot.context,
8744
8744
  block: focusTextBlock
8745
- }), focusBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
8745
+ }), focusBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
8746
8746
  context: snapshot.context,
8747
8747
  block: focusTextBlock
8748
8748
  }), focusTextBlockAfter = util_sliceTextBlock.sliceTextBlock({
@@ -8771,7 +8771,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8771
8771
  selection,
8772
8772
  firstBlockKey,
8773
8773
  focusBlockStartPoint
8774
- }) => [...event.blocks.flatMap((block, index) => index === 0 ? [...util_isSelectionCollapsed.isEqualSelectionPoints(selection.focus, focusBlockEndPoint) ? [] : [behaviors_index.raise({
8774
+ }) => [...event.blocks.flatMap((block, index) => index === 0 ? [...util_isEmptyTextBlock.isEqualSelectionPoints(selection.focus, focusBlockEndPoint) ? [] : [behaviors_index.raise({
8775
8775
  type: "delete",
8776
8776
  at: {
8777
8777
  anchor: selection.focus,
@@ -8800,7 +8800,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8800
8800
  })]), ...event.select === "none" ? [behaviors_index.raise({
8801
8801
  type: "select",
8802
8802
  at: selection
8803
- })] : event.select === "start" ? [util_isSelectionCollapsed.isEqualSelectionPoints(selection.focus, focusBlockStartPoint) ? behaviors_index.raise({
8803
+ })] : event.select === "start" ? [util_isEmptyTextBlock.isEqualSelectionPoints(selection.focus, focusBlockStartPoint) ? behaviors_index.raise({
8804
8804
  type: "select.block",
8805
8805
  at: [{
8806
8806
  _key: firstBlockKey
@@ -8836,9 +8836,9 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8836
8836
  guard: ({
8837
8837
  snapshot
8838
8838
  }) => {
8839
- const lastBlock = selector_isSelectingEntireBlocks.getLastBlock(snapshot);
8839
+ const lastBlock = selector_isActiveStyle.getLastBlock(snapshot);
8840
8840
  return !lastBlock || snapshot.context.selection ? !1 : {
8841
- lastBlockEndPoint: util_isSelectionCollapsed.getBlockEndPoint({
8841
+ lastBlockEndPoint: util_isEmptyTextBlock.getBlockEndPoint({
8842
8842
  context: snapshot.context,
8843
8843
  block: lastBlock
8844
8844
  })
@@ -8860,7 +8860,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8860
8860
  guard: ({
8861
8861
  snapshot
8862
8862
  }) => {
8863
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
8863
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8864
8864
  return snapshot.context.selection && !focusTextBlock;
8865
8865
  },
8866
8866
  actions: [({
@@ -8901,7 +8901,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8901
8901
  on: "insert.span",
8902
8902
  guard: ({
8903
8903
  snapshot
8904
- }) => !selector_isSelectionExpanded.getFocusTextBlock(snapshot),
8904
+ }) => !selector_getSelectionText.getFocusTextBlock(snapshot),
8905
8905
  actions: [({
8906
8906
  snapshot,
8907
8907
  event
@@ -8924,7 +8924,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8924
8924
  snapshot,
8925
8925
  event
8926
8926
  }) => {
8927
- const focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
8927
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8928
8928
  return {
8929
8929
  markDefs: event.annotations?.map((annotation) => ({
8930
8930
  _type: annotation.name,
@@ -8973,7 +8973,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8973
8973
  guard: ({
8974
8974
  snapshot,
8975
8975
  event
8976
- }) => defaultKeyboardShortcuts.backspace.guard(event.originEvent) && selector_isSelectionExpanded.isSelectionCollapsed(snapshot) && selector_isSelectingEntireBlocks.getFocusInlineObject(snapshot),
8976
+ }) => defaultKeyboardShortcuts.backspace.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
8977
8977
  actions: [() => [behaviors_index.raise({
8978
8978
  type: "delete.backward",
8979
8979
  unit: "character"
@@ -8989,7 +8989,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8989
8989
  guard: ({
8990
8990
  snapshot,
8991
8991
  event
8992
- }) => defaultKeyboardShortcuts.delete.guard(event.originEvent) && selector_isSelectionExpanded.isSelectionCollapsed(snapshot) && selector_isSelectingEntireBlocks.getFocusInlineObject(snapshot),
8992
+ }) => defaultKeyboardShortcuts.delete.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
8993
8993
  actions: [() => [behaviors_index.raise({
8994
8994
  type: "delete.forward",
8995
8995
  unit: "character"
@@ -9004,7 +9004,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9004
9004
  guard: ({
9005
9005
  snapshot,
9006
9006
  event
9007
- }) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_isSelectionExpanded.isSelectionCollapsed(snapshot) && selector_isSelectingEntireBlocks.getFocusInlineObject(snapshot),
9007
+ }) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
9008
9008
  actions: [() => [behaviors_index.raise({
9009
9009
  type: "insert.break"
9010
9010
  })]]
@@ -9018,7 +9018,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9018
9018
  guard: ({
9019
9019
  snapshot,
9020
9020
  event
9021
- }) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_isSelectionExpanded.isSelectionExpanded(snapshot),
9021
+ }) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_getSelectionText.isSelectionExpanded(snapshot),
9022
9022
  actions: [() => [behaviors_index.raise({
9023
9023
  type: "insert.break"
9024
9024
  })]]
@@ -9073,10 +9073,10 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9073
9073
  }) => {
9074
9074
  if (!snapshot.context.selection || !shiftLeft.guard(event.originEvent))
9075
9075
  return !1;
9076
- const focusBlock = selector_isSelectionExpanded.getFocusBlock(snapshot);
9076
+ const focusBlock = selector_getSelectionText.getFocusBlock(snapshot);
9077
9077
  if (!focusBlock)
9078
9078
  return !1;
9079
- const previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock({
9079
+ const previousBlock = selector_isActiveStyle.getPreviousBlock({
9080
9080
  ...snapshot,
9081
9081
  context: {
9082
9082
  ...snapshot.context,
@@ -9092,7 +9092,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9092
9092
  }
9093
9093
  }
9094
9094
  });
9095
- return previousBlock && schema.isTextBlock(snapshot.context, focusBlock.node) && snapshot.context.selection.focus.offset === 0 && util_isSelectionCollapsed.isEmptyTextBlock(snapshot.context, focusBlock.node) ? {
9095
+ return previousBlock && schema.isTextBlock(snapshot.context, focusBlock.node) && snapshot.context.selection.focus.offset === 0 && util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusBlock.node) ? {
9096
9096
  previousBlock,
9097
9097
  selection: snapshot.context.selection
9098
9098
  } : !1;
@@ -9106,7 +9106,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9106
9106
  type: "select",
9107
9107
  at: {
9108
9108
  anchor: selection.anchor,
9109
- focus: util_isSelectionCollapsed.getBlockEndPoint({
9109
+ focus: util_isEmptyTextBlock.getBlockEndPoint({
9110
9110
  context: snapshot.context,
9111
9111
  block: previousBlock
9112
9112
  })
@@ -9119,7 +9119,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9119
9119
  snapshot,
9120
9120
  event
9121
9121
  }) => snapshot.context.schema.lists.some((list) => list.name === event.listItem) ? {
9122
- selectedTextBlocks: selector_isSelectingEntireBlocks.getSelectedTextBlocks(snapshot)
9122
+ selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9123
9123
  } : !1,
9124
9124
  actions: [({
9125
9125
  event
@@ -9138,7 +9138,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9138
9138
  guard: ({
9139
9139
  snapshot
9140
9140
  }) => ({
9141
- selectedTextBlocks: selector_isSelectingEntireBlocks.getSelectedTextBlocks(snapshot)
9141
+ selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9142
9142
  }),
9143
9143
  actions: [(_, {
9144
9144
  selectedTextBlocks
@@ -9152,7 +9152,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9152
9152
  guard: ({
9153
9153
  snapshot,
9154
9154
  event
9155
- }) => selector_isSelectingEntireBlocks.isActiveListItem(event.listItem)(snapshot),
9155
+ }) => selector_isActiveStyle.isActiveListItem(event.listItem)(snapshot),
9156
9156
  actions: [({
9157
9157
  event
9158
9158
  }) => [behaviors_index.raise({
@@ -9164,7 +9164,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9164
9164
  guard: ({
9165
9165
  snapshot,
9166
9166
  event
9167
- }) => !selector_isSelectingEntireBlocks.isActiveListItem(event.listItem)(snapshot),
9167
+ }) => !selector_isActiveStyle.isActiveListItem(event.listItem)(snapshot),
9168
9168
  actions: [({
9169
9169
  event
9170
9170
  }) => [behaviors_index.raise({
@@ -9177,7 +9177,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9177
9177
  snapshot,
9178
9178
  event
9179
9179
  }) => {
9180
- const previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock({
9180
+ const previousBlock = selector_isActiveStyle.getPreviousBlock({
9181
9181
  ...snapshot,
9182
9182
  context: {
9183
9183
  ...snapshot.context,
@@ -9212,7 +9212,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9212
9212
  snapshot,
9213
9213
  event
9214
9214
  }) => {
9215
- const nextBlock = selector_isSelectingEntireBlocks.getNextBlock({
9215
+ const nextBlock = selector_isActiveStyle.getNextBlock({
9216
9216
  ...snapshot,
9217
9217
  context: {
9218
9218
  ...snapshot.context,
@@ -9249,7 +9249,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9249
9249
  }) => {
9250
9250
  if (event.select !== "end")
9251
9251
  return !1;
9252
- const block = selector_isSelectionExpanded.getFocusBlock({
9252
+ const block = selector_getSelectionText.getFocusBlock({
9253
9253
  ...snapshot,
9254
9254
  context: {
9255
9255
  ...snapshot.context,
@@ -9266,7 +9266,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9266
9266
  }
9267
9267
  });
9268
9268
  return block ? {
9269
- blockEndPoint: util_isSelectionCollapsed.getBlockEndPoint({
9269
+ blockEndPoint: util_isEmptyTextBlock.getBlockEndPoint({
9270
9270
  context: snapshot.context,
9271
9271
  block
9272
9272
  })
@@ -9303,7 +9303,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9303
9303
  guard: ({
9304
9304
  snapshot
9305
9305
  }) => {
9306
- const previousBlock = selector_isSelectingEntireBlocks.getPreviousBlock(snapshot);
9306
+ const previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
9307
9307
  return previousBlock ? {
9308
9308
  previousBlock
9309
9309
  } : !1;
@@ -9322,7 +9322,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9322
9322
  guard: ({
9323
9323
  snapshot
9324
9324
  }) => {
9325
- const nextBlock = selector_isSelectingEntireBlocks.getNextBlock(snapshot);
9325
+ const nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
9326
9326
  return nextBlock ? {
9327
9327
  nextBlock
9328
9328
  } : !1;
@@ -9406,7 +9406,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9406
9406
  on: "split",
9407
9407
  guard: ({
9408
9408
  snapshot
9409
- }) => selector_isSelectionExpanded.isSelectionCollapsed(snapshot) && selector_isSelectingEntireBlocks.getFocusInlineObject(snapshot),
9409
+ }) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isActiveStyle.getFocusInlineObject(snapshot),
9410
9410
  actions: []
9411
9411
  }),
9412
9412
  /**
@@ -9416,7 +9416,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9416
9416
  on: "split",
9417
9417
  guard: ({
9418
9418
  snapshot
9419
- }) => selector_isSelectionExpanded.isSelectionCollapsed(snapshot) && selector_isSelectingEntireBlocks.getFocusBlockObject(snapshot),
9419
+ }) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isActiveStyle.getFocusBlockObject(snapshot),
9420
9420
  actions: []
9421
9421
  }),
9422
9422
  behaviors_index.defineBehavior({
@@ -9425,9 +9425,9 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9425
9425
  snapshot
9426
9426
  }) => {
9427
9427
  const selection = snapshot.context.selection;
9428
- if (!selection || util_isSelectionCollapsed.isSelectionCollapsed(selection))
9428
+ if (!selection || util_isEmptyTextBlock.isSelectionCollapsed(selection))
9429
9429
  return !1;
9430
- const selectionStartBlock = selector_isSelectingEntireBlocks.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isSelectingEntireBlocks.getSelectionEndBlock(snapshot);
9430
+ const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
9431
9431
  return !selectionStartBlock || !selectionEndBlock ? !1 : !schema.isTextBlock(snapshot.context, selectionStartBlock.node) && schema.isTextBlock(snapshot.context, selectionEndBlock.node) ? {
9432
9432
  selection
9433
9433
  } : !1;
@@ -9445,18 +9445,18 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9445
9445
  snapshot
9446
9446
  }) => {
9447
9447
  const selection = snapshot.context.selection;
9448
- if (!selection || util_isSelectionCollapsed.isSelectionCollapsed(selection))
9448
+ if (!selection || util_isEmptyTextBlock.isSelectionCollapsed(selection))
9449
9449
  return !1;
9450
- const selectionStartBlock = selector_isSelectingEntireBlocks.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isSelectingEntireBlocks.getSelectionEndBlock(snapshot);
9450
+ const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
9451
9451
  if (!selectionStartBlock || !selectionEndBlock || selectionStartBlock.node._key === selectionEndBlock.node._key)
9452
9452
  return !1;
9453
- const startPoint = util_sliceBlocks.getSelectionStartPoint(selection), startBlockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
9453
+ const startPoint = util_getTextBlockText.getSelectionStartPoint(selection), startBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
9454
9454
  context: snapshot.context,
9455
9455
  block: selectionStartBlock
9456
- }), endPoint = util_sliceBlocks.getSelectionEndPoint(selection), endBlockStartPoint = util_sliceBlocks.getBlockStartPoint({
9456
+ }), endPoint = util_getTextBlockText.getSelectionEndPoint(selection), endBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
9457
9457
  context: snapshot.context,
9458
9458
  block: selectionEndBlock
9459
- }), blocksInBetween = selector_isSelectionExpanded.getSelectedValue(snapshot).filter((block) => block._key !== selectionStartBlock.node._key && block._key !== selectionEndBlock.node._key);
9459
+ }), blocksInBetween = selector_getSelectionText.getSelectedValue(snapshot).filter((block) => block._key !== selectionStartBlock.node._key && block._key !== selectionEndBlock.node._key);
9460
9460
  return {
9461
9461
  startPoint,
9462
9462
  startBlockEndPoint,
@@ -9496,7 +9496,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9496
9496
  snapshot
9497
9497
  }) => {
9498
9498
  const selection = snapshot.context.selection;
9499
- return !selection || util_isSelectionCollapsed.isSelectionCollapsed(selection) ? !1 : {
9499
+ return !selection || util_isEmptyTextBlock.isSelectionCollapsed(selection) ? !1 : {
9500
9500
  selection
9501
9501
  };
9502
9502
  },
@@ -9515,18 +9515,18 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9515
9515
  snapshot
9516
9516
  }) => {
9517
9517
  const selection = snapshot.context.selection;
9518
- if (!selection || !util_isSelectionCollapsed.isSelectionCollapsed(selection))
9518
+ if (!selection || !util_isEmptyTextBlock.isSelectionCollapsed(selection))
9519
9519
  return !1;
9520
- const selectionStartPoint = util_sliceBlocks.getSelectionStartPoint(selection), focusTextBlock = selector_isSelectionExpanded.getFocusTextBlock(snapshot);
9520
+ const selectionStartPoint = util_getTextBlockText.getSelectionStartPoint(selection), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
9521
9521
  if (!focusTextBlock)
9522
9522
  return !1;
9523
- const blockEndPoint = util_isSelectionCollapsed.getBlockEndPoint({
9523
+ const blockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
9524
9524
  context: snapshot.context,
9525
9525
  block: focusTextBlock
9526
9526
  }), newTextBlockSelection = {
9527
9527
  anchor: selectionStartPoint,
9528
9528
  focus: blockEndPoint
9529
- }, newTextBlock = util_sliceBlocks.parseBlock({
9529
+ }, newTextBlock = util_getTextBlockText.parseBlock({
9530
9530
  block: util_sliceTextBlock.sliceTextBlock({
9531
9531
  context: {
9532
9532
  ...snapshot.context,
@@ -9548,7 +9548,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9548
9548
  actions: [(_, {
9549
9549
  newTextBlock,
9550
9550
  newTextBlockSelection
9551
- }) => util_isSelectionCollapsed.isSelectionCollapsed(newTextBlockSelection) ? [behaviors_index.raise({
9551
+ }) => util_isEmptyTextBlock.isSelectionCollapsed(newTextBlockSelection) ? [behaviors_index.raise({
9552
9552
  type: "insert.block",
9553
9553
  block: newTextBlock,
9554
9554
  placement: "after",
@@ -9568,7 +9568,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9568
9568
  guard: ({
9569
9569
  snapshot
9570
9570
  }) => ({
9571
- selectedTextBlocks: selector_isSelectingEntireBlocks.getSelectedTextBlocks(snapshot)
9571
+ selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9572
9572
  }),
9573
9573
  actions: [({
9574
9574
  event
@@ -9586,7 +9586,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9586
9586
  guard: ({
9587
9587
  snapshot
9588
9588
  }) => ({
9589
- selectedTextBlocks: selector_isSelectingEntireBlocks.getSelectedTextBlocks(snapshot)
9589
+ selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9590
9590
  }),
9591
9591
  actions: [(_, {
9592
9592
  selectedTextBlocks
@@ -9600,7 +9600,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9600
9600
  guard: ({
9601
9601
  snapshot,
9602
9602
  event
9603
- }) => selector_isSelectingEntireBlocks.isActiveStyle(event.style)(snapshot),
9603
+ }) => selector_isActiveStyle.isActiveStyle(event.style)(snapshot),
9604
9604
  actions: [({
9605
9605
  event
9606
9606
  }) => [behaviors_index.raise({
@@ -9612,7 +9612,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9612
9612
  guard: ({
9613
9613
  snapshot,
9614
9614
  event
9615
- }) => !selector_isSelectingEntireBlocks.isActiveStyle(event.style)(snapshot),
9615
+ }) => !selector_isActiveStyle.isActiveStyle(event.style)(snapshot),
9616
9616
  actions: [({
9617
9617
  event
9618
9618
  }) => [behaviors_index.raise({
@@ -9624,7 +9624,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9624
9624
  guard: ({
9625
9625
  snapshot
9626
9626
  }) => {
9627
- const focusSpan = selector_isSelectionExpanded.getFocusSpan(snapshot), selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot);
9627
+ const focusSpan = selector_getSelectionText.getFocusSpan(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
9628
9628
  return focusSpan && selectionCollapsed;
9629
9629
  },
9630
9630
  actions: []
@@ -9641,7 +9641,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9641
9641
  guard: ({
9642
9642
  snapshot
9643
9643
  }) => {
9644
- const focusSpan = selector_isSelectionExpanded.getFocusSpan(snapshot), selectionCollapsed = selector_isSelectionExpanded.isSelectionCollapsed(snapshot);
9644
+ const focusSpan = selector_getSelectionText.getFocusSpan(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
9645
9645
  return focusSpan && selectionCollapsed;
9646
9646
  },
9647
9647
  actions: []
@@ -9675,7 +9675,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9675
9675
  on: "clipboard.paste",
9676
9676
  guard: ({
9677
9677
  snapshot
9678
- }) => snapshot.context.selection && selector_isSelectionExpanded.isSelectionExpanded(snapshot) ? {
9678
+ }) => snapshot.context.selection && selector_getSelectionText.isSelectionExpanded(snapshot) ? {
9679
9679
  selection: snapshot.context.selection
9680
9680
  } : !1,
9681
9681
  actions: [({
@@ -10759,13 +10759,13 @@ function createEditableAPI(editor, editorActor) {
10759
10759
  editorActorSnapshot: editorActor.getSnapshot(),
10760
10760
  slateEditorInstance: editor
10761
10761
  });
10762
- return selector_isSelectingEntireBlocks.getActiveDecorators(snapshot).includes(mark);
10762
+ return selector_isActiveStyle.getActiveDecorators(snapshot).includes(mark);
10763
10763
  },
10764
10764
  marks: () => {
10765
10765
  const snapshot = getEditorSnapshot({
10766
10766
  editorActorSnapshot: editorActor.getSnapshot(),
10767
10767
  slateEditorInstance: editor
10768
- }), activeAnnotations = selector_isSelectingEntireBlocks.getActiveAnnotationsMarks(snapshot), activeDecorators = selector_isSelectingEntireBlocks.getActiveDecorators(snapshot);
10768
+ }), activeAnnotations = selector_isActiveStyle.getActiveAnnotationsMarks(snapshot), activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot);
10769
10769
  return [...activeAnnotations, ...activeDecorators];
10770
10770
  },
10771
10771
  undo: () => {
@@ -10975,13 +10975,13 @@ function createEditableAPI(editor, editorActor) {
10975
10975
  editorActorSnapshot: editorActor.getSnapshot(),
10976
10976
  slateEditorInstance: editor
10977
10977
  });
10978
- return selector_isSelectingEntireBlocks.isActiveAnnotation(annotationType)(snapshot);
10978
+ return selector_isActiveStyle.isActiveAnnotation(annotationType)(snapshot);
10979
10979
  },
10980
10980
  addAnnotation: (type, value) => {
10981
10981
  const snapshotBefore = getEditorSnapshot({
10982
10982
  editorActorSnapshot: editorActor.getSnapshot(),
10983
10983
  slateEditorInstance: editor
10984
- }), selectedValueBefore = selector_isSelectionExpanded.getSelectedValue(snapshotBefore), focusSpanBefore = selector_isSelectionExpanded.getFocusSpan(snapshotBefore), markDefsBefore = selectedValueBefore.flatMap((block) => schema.isTextBlock(snapshotBefore.context, block) ? block.markDefs ?? [] : []);
10984
+ }), selectedValueBefore = selector_getSelectionText.getSelectedValue(snapshotBefore), focusSpanBefore = selector_getSelectionText.getFocusSpan(snapshotBefore), markDefsBefore = selectedValueBefore.flatMap((block) => schema.isTextBlock(snapshotBefore.context, block) ? block.markDefs ?? [] : []);
10985
10985
  editorActor.send({
10986
10986
  type: "behavior event",
10987
10987
  behaviorEvent: {
@@ -10996,7 +10996,7 @@ function createEditableAPI(editor, editorActor) {
10996
10996
  const snapshotAfter = getEditorSnapshot({
10997
10997
  editorActorSnapshot: editorActor.getSnapshot(),
10998
10998
  slateEditorInstance: editor
10999
- }), selectedValueAfter = selector_isSelectionExpanded.getSelectedValue(snapshotAfter), focusBlockAfter = selector_isSelectionExpanded.getFocusBlock(snapshotAfter), focusSpanAfter = selector_isSelectionExpanded.getFocusSpan(snapshotAfter), newMarkDefKeysOnFocusSpan = focusSpanAfter?.node.marks?.filter((mark) => !focusSpanBefore?.node.marks?.includes(mark) && !snapshotAfter.context.schema.decorators.map((decorator) => decorator.name).includes(mark)), markDefs = selectedValueAfter.flatMap((block) => schema.isTextBlock(snapshotAfter.context, block) ? block.markDefs?.map((markDef2) => ({
10999
+ }), selectedValueAfter = selector_getSelectionText.getSelectedValue(snapshotAfter), focusBlockAfter = selector_getSelectionText.getFocusBlock(snapshotAfter), focusSpanAfter = selector_getSelectionText.getFocusSpan(snapshotAfter), newMarkDefKeysOnFocusSpan = focusSpanAfter?.node.marks?.filter((mark) => !focusSpanBefore?.node.marks?.includes(mark) && !snapshotAfter.context.schema.decorators.map((decorator) => decorator.name).includes(mark)), markDefs = selectedValueAfter.flatMap((block) => schema.isTextBlock(snapshotAfter.context, block) ? block.markDefs?.map((markDef2) => ({
11000
11000
  markDef: markDef2,
11001
11001
  path: [{
11002
11002
  _key: block._key
@@ -12099,7 +12099,7 @@ function editorConfigToMachineInput(config) {
12099
12099
  return {
12100
12100
  converters: createCoreConverters(legacySchema),
12101
12101
  getLegacySchema: () => legacySchema,
12102
- keyGenerator: config.keyGenerator ?? util_sliceBlocks.defaultKeyGenerator,
12102
+ keyGenerator: config.keyGenerator ?? util_getTextBlockText.defaultKeyGenerator,
12103
12103
  maxBlocks: config.maxBlocks,
12104
12104
  readOnly: config.readOnly,
12105
12105
  schema: schema2,
@@ -12765,7 +12765,7 @@ const usePortableTextEditorSelection = () => {
12765
12765
  }, t1 = [editorActor], $[0] = editorActor, $[1] = t0, $[2] = t1) : (t0 = $[1], t1 = $[2]), React.useEffect(t0, t1), selection;
12766
12766
  };
12767
12767
  exports.useEditor = useEditor.useEditor;
12768
- exports.keyGenerator = util_sliceBlocks.defaultKeyGenerator;
12768
+ exports.keyGenerator = util_getTextBlockText.defaultKeyGenerator;
12769
12769
  Object.defineProperty(exports, "defineSchema", {
12770
12770
  enumerable: !0,
12771
12771
  get: function() {