@portabletext/editor 2.14.4 → 2.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/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_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");
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_isAtTheStartOfBlock = require("./_chunks-cjs/selector.is-at-the-start-of-block.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
  }
@@ -687,7 +687,7 @@ function getDragSelection({
687
687
  snapshot
688
688
  }) {
689
689
  let dragSelection = eventSelection;
690
- if (selector_isActiveStyle.getFocusInlineObject({
690
+ if (selector_isAtTheStartOfBlock.getFocusInlineObject({
691
691
  ...snapshot,
692
692
  context: {
693
693
  ...snapshot.context,
@@ -723,9 +723,9 @@ function getDragSelection({
723
723
  block: draggedTextBlock
724
724
  })
725
725
  });
726
- const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot);
726
+ const selectedBlocks = selector_isAtTheStartOfBlock.getSelectedBlocks(snapshot);
727
727
  if (snapshot.context.selection && selector_getSelectionText.isSelectionExpanded(snapshot) && selectedBlocks.length > 1) {
728
- const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
728
+ const selectionStartBlock = selector_isAtTheStartOfBlock.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isAtTheStartOfBlock.getSelectionEndBlock(snapshot);
729
729
  if (!selectionStartBlock || !selectionEndBlock)
730
730
  return dragSelection;
731
731
  const selectionStartPoint = util_getTextBlockText.getBlockStartPoint({
@@ -735,7 +735,7 @@ function getDragSelection({
735
735
  context: snapshot.context,
736
736
  block: selectionEndBlock
737
737
  });
738
- selector_isActiveStyle.isOverlappingSelection(eventSelection)({
738
+ selector_isAtTheStartOfBlock.isOverlappingSelection(eventSelection)({
739
739
  ...snapshot,
740
740
  context: {
741
741
  ...snapshot.context,
@@ -778,13 +778,13 @@ function createCoreBlockElementBehaviorsConfig({
778
778
  eventSelection: dragOrigin.selection,
779
779
  snapshot
780
780
  });
781
- return selector_isActiveStyle.getSelectedBlocks({
781
+ return selector_isAtTheStartOfBlock.getSelectedBlocks({
782
782
  ...snapshot,
783
783
  context: {
784
784
  ...snapshot.context,
785
785
  selection: dragSelection
786
786
  }
787
- }).some((draggedBlock) => draggedBlock.node._key === key) ? !1 : selector_isActiveStyle.isSelectingEntireBlocks({
787
+ }).some((draggedBlock) => draggedBlock.node._key === key) ? !1 : selector_isAtTheStartOfBlock.isSelectingEntireBlocks({
788
788
  ...snapshot,
789
789
  context: {
790
790
  ...snapshot.context,
@@ -1263,7 +1263,7 @@ function RenderSpan(props) {
1263
1263
  offset: props.leaf.text.length
1264
1264
  }
1265
1265
  } : null;
1266
- return selector_isActiveStyle.isOverlappingSelection(spanSelection)(snapshot_0);
1266
+ return selector_isAtTheStartOfBlock.isOverlappingSelection(spanSelection)(snapshot_0);
1267
1267
  }, $[3] = props.children.props.parent, $[4] = props.leaf._key, $[5] = props.leaf.text, $[6] = slateEditor, $[7] = t1) : t1 = $[7];
1268
1268
  const selected = react.useSelector(editorActor, t1), parent_0 = props.children.props.parent, block_0 = parent_0 && slateEditor.isTextBlock(parent_0) ? parent_0 : void 0;
1269
1269
  let t2;
@@ -3120,7 +3120,7 @@ function createWithPortableTextMarkModel(editorActor) {
3120
3120
  });
3121
3121
  slate.Editor.withoutNormalizing(editor, () => {
3122
3122
  apply2(op), slate.Transforms.setNodes(editor, {
3123
- marks: selector_isActiveStyle.getActiveDecorators(snapshot)
3123
+ marks: selector_isAtTheStartOfBlock.getActiveDecorators(snapshot)
3124
3124
  }, {
3125
3125
  at: op.path
3126
3126
  });
@@ -4533,7 +4533,7 @@ const addAnnotationOperationImplementation = ({
4533
4533
  focus: focusOffset
4534
4534
  },
4535
4535
  backward: editorSelection?.backward
4536
- }), trimmedSelection = selector_isActiveStyle.getTrimmedSelection({
4536
+ }), trimmedSelection = selector_isAtTheStartOfBlock.getTrimmedSelection({
4537
4537
  blockIndexMap: editor.blockIndexMap,
4538
4538
  context: {
4539
4539
  converters: [],
@@ -5932,7 +5932,24 @@ function setNodePatch(schema$12, children, operation) {
5932
5932
  }, block)) {
5933
5933
  const child = block.children[operation.path[1]];
5934
5934
  if (child) {
5935
- const blockKey = block._key, childKey = child._key, patches$1 = [], keys = Object.keys(operation.newProperties);
5935
+ const blockKey = block._key, childKey = child._key, patches$1 = [];
5936
+ if (slate.Element.isElement(child)) {
5937
+ const _key = operation.newProperties._key;
5938
+ _key !== void 0 && patches$1.push(patches.set(_key, [{
5939
+ _key: blockKey
5940
+ }, "children", block.children.indexOf(child), "_key"]));
5941
+ const properties = "value" in operation.newProperties && typeof operation.newProperties.value == "object" ? operation.newProperties.value : {}, keys2 = Object.keys(properties);
5942
+ for (const key of keys2) {
5943
+ const value = properties[key];
5944
+ patches$1.push(patches.set(value, [{
5945
+ _key: blockKey
5946
+ }, "children", {
5947
+ _key: childKey
5948
+ }, key]));
5949
+ }
5950
+ return patches$1;
5951
+ }
5952
+ const keys = Object.keys(operation.newProperties);
5936
5953
  return keys.forEach((keyName) => {
5937
5954
  if (keys.length === 1 && keyName === "_key") {
5938
5955
  const val = get__default.default(operation.newProperties, keyName);
@@ -6699,6 +6716,10 @@ function createEditorDom(sendBack, slateEditor) {
6699
6716
  return {
6700
6717
  getBlockNodes: (snapshot) => getBlockNodes(slateEditor, snapshot),
6701
6718
  getChildNodes: (snapshot) => getChildNodes(slateEditor, snapshot),
6719
+ getEditorElement: () => getEditorElement(slateEditor),
6720
+ getSelectionRect: (snapshot) => getSelectionRect(snapshot),
6721
+ getStartBlockElement: (snapshot) => getStartBlockElement(slateEditor, snapshot),
6722
+ getEndBlockElement: (snapshot) => getEndBlockElement(slateEditor, snapshot),
6702
6723
  setDragGhost: ({
6703
6724
  event,
6704
6725
  ghost
@@ -6741,6 +6762,67 @@ function getChildNodes(slateEditor, snapshot) {
6741
6762
  return [];
6742
6763
  }
6743
6764
  }
6765
+ function getEditorElement(slateEditor) {
6766
+ try {
6767
+ return slateDom.DOMEditor.toDOMNode(slateEditor, slateEditor);
6768
+ } catch {
6769
+ return;
6770
+ }
6771
+ }
6772
+ function getSelectionRect(snapshot) {
6773
+ if (!snapshot.context.selection)
6774
+ return null;
6775
+ try {
6776
+ const selection = window.getSelection();
6777
+ return selection ? selection.getRangeAt(0).getBoundingClientRect() : null;
6778
+ } catch {
6779
+ return null;
6780
+ }
6781
+ }
6782
+ function getStartBlockElement(slateEditor, snapshot) {
6783
+ const startBlock = selector_isAtTheStartOfBlock.getSelectionStartBlock(snapshot);
6784
+ if (!startBlock)
6785
+ return null;
6786
+ const startBlockNode = getBlockNodes(slateEditor, {
6787
+ ...snapshot,
6788
+ context: {
6789
+ ...snapshot.context,
6790
+ selection: {
6791
+ anchor: {
6792
+ path: startBlock.path,
6793
+ offset: 0
6794
+ },
6795
+ focus: {
6796
+ path: startBlock.path,
6797
+ offset: 0
6798
+ }
6799
+ }
6800
+ }
6801
+ })?.at(0);
6802
+ return startBlockNode && startBlockNode instanceof Element ? startBlockNode : null;
6803
+ }
6804
+ function getEndBlockElement(slateEditor, snapshot) {
6805
+ const endBlock = selector_isAtTheStartOfBlock.getSelectionEndBlock(snapshot);
6806
+ if (!endBlock)
6807
+ return null;
6808
+ const endBlockNode = getBlockNodes(slateEditor, {
6809
+ ...snapshot,
6810
+ context: {
6811
+ ...snapshot.context,
6812
+ selection: {
6813
+ anchor: {
6814
+ path: endBlock.path,
6815
+ offset: 0
6816
+ },
6817
+ focus: {
6818
+ path: endBlock.path,
6819
+ offset: 0
6820
+ }
6821
+ }
6822
+ }
6823
+ })?.at(0);
6824
+ return endBlockNode && endBlockNode instanceof Element ? endBlockNode : null;
6825
+ }
6744
6826
  function setDragGhost({
6745
6827
  sendBack,
6746
6828
  event,
@@ -6758,7 +6840,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6758
6840
  }) => {
6759
6841
  if (!selector_getSelectionText.isSelectionCollapsed(snapshot))
6760
6842
  return !1;
6761
- const caretWordSelection = selector_isActiveStyle.getCaretWordSelection(snapshot);
6843
+ const caretWordSelection = selector_isAtTheStartOfBlock.getCaretWordSelection(snapshot);
6762
6844
  return !caretWordSelection || !selector_getSelectionText.isSelectionExpanded({
6763
6845
  context: {
6764
6846
  ...snapshot.context,
@@ -6786,7 +6868,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6786
6868
  guard: ({
6787
6869
  snapshot,
6788
6870
  event
6789
- }) => selector_isActiveStyle.isActiveAnnotation(event.annotation.name, {
6871
+ }) => selector_isAtTheStartOfBlock.isActiveAnnotation(event.annotation.name, {
6790
6872
  mode: "partial"
6791
6873
  })(snapshot),
6792
6874
  // Then the existing annotation is removed
@@ -6881,7 +6963,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6881
6963
  }) => {
6882
6964
  if (!defaultKeyboardShortcuts.arrowDown.guard(event.originEvent) || !selector_getSelectionText.isSelectionCollapsed(snapshot))
6883
6965
  return !1;
6884
- const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
6966
+ const focusBlockObject = selector_isAtTheStartOfBlock.getFocusBlockObject(snapshot), nextBlock = selector_isAtTheStartOfBlock.getNextBlock(snapshot);
6885
6967
  return focusBlockObject && !nextBlock;
6886
6968
  },
6887
6969
  actions: [({
@@ -6901,7 +6983,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6901
6983
  }) => {
6902
6984
  if (!defaultKeyboardShortcuts.arrowUp.guard(event.originEvent) || !selector_getSelectionText.isSelectionCollapsed(snapshot))
6903
6985
  return !1;
6904
- const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
6986
+ const focusBlockObject = selector_isAtTheStartOfBlock.getFocusBlockObject(snapshot), previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock(snapshot);
6905
6987
  return focusBlockObject && !previousBlock;
6906
6988
  },
6907
6989
  actions: [({
@@ -6918,7 +7000,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6918
7000
  guard: ({
6919
7001
  snapshot
6920
7002
  }) => {
6921
- const focusBlockObject = selector_isActiveStyle.getFocusBlockObject(snapshot);
7003
+ const focusBlockObject = selector_isAtTheStartOfBlock.getFocusBlockObject(snapshot);
6922
7004
  return selector_getSelectionText.isSelectionCollapsed(snapshot) && focusBlockObject !== void 0;
6923
7005
  },
6924
7006
  actions: [({
@@ -6938,13 +7020,13 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6938
7020
  }) => {
6939
7021
  if (snapshot.context.readOnly || snapshot.context.selection && !selector_getSelectionText.isSelectionCollapsed(snapshot))
6940
7022
  return !1;
6941
- const focusBlockObject = selector_isActiveStyle.getFocusBlockObject({
7023
+ const focusBlockObject = selector_isAtTheStartOfBlock.getFocusBlockObject({
6942
7024
  ...snapshot,
6943
7025
  context: {
6944
7026
  ...snapshot.context,
6945
7027
  selection: event.position.selection
6946
7028
  }
6947
- }), previousBlock = selector_isActiveStyle.getPreviousBlock({
7029
+ }), previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock({
6948
7030
  ...snapshot,
6949
7031
  context: {
6950
7032
  ...snapshot.context,
@@ -6975,13 +7057,13 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
6975
7057
  }) => {
6976
7058
  if (snapshot.context.readOnly || snapshot.context.selection && !selector_getSelectionText.isSelectionCollapsed(snapshot))
6977
7059
  return !1;
6978
- const focusBlockObject = selector_isActiveStyle.getFocusBlockObject({
7060
+ const focusBlockObject = selector_isAtTheStartOfBlock.getFocusBlockObject({
6979
7061
  ...snapshot,
6980
7062
  context: {
6981
7063
  ...snapshot.context,
6982
7064
  selection: event.position.selection
6983
7065
  }
6984
- }), nextBlock = selector_isActiveStyle.getNextBlock({
7066
+ }), nextBlock = selector_isAtTheStartOfBlock.getNextBlock({
6985
7067
  ...snapshot,
6986
7068
  context: {
6987
7069
  ...snapshot.context,
@@ -7009,7 +7091,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
7009
7091
  guard: ({
7010
7092
  snapshot
7011
7093
  }) => {
7012
- const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
7094
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock(snapshot);
7013
7095
  return !focusTextBlock || !selectionCollapsed || !previousBlock ? !1 : util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, previousBlock.node) ? {
7014
7096
  focusTextBlock,
7015
7097
  previousBlock
@@ -7039,7 +7121,7 @@ const addAnnotationOnCollapsedSelection = behaviors_index.defineBehavior({
7039
7121
  guard: ({
7040
7122
  snapshot
7041
7123
  }) => {
7042
- const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
7124
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), nextBlock = selector_isAtTheStartOfBlock.getNextBlock(snapshot);
7043
7125
  return !focusTextBlock || !selectionCollapsed || !nextBlock ? !1 : util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusTextBlock.node) && !schema.isTextBlock(snapshot.context, nextBlock.node) ? {
7044
7126
  focusTextBlock,
7045
7127
  nextBlock
@@ -7148,7 +7230,7 @@ const coreDndBehaviors = [
7148
7230
  const dragSelection = getDragSelection({
7149
7231
  snapshot,
7150
7232
  eventSelection: event.position.selection
7151
- }), selectingEntireBlocks = selector_isActiveStyle.isSelectingEntireBlocks({
7233
+ }), selectingEntireBlocks = selector_isAtTheStartOfBlock.isSelectingEntireBlocks({
7152
7234
  ...snapshot,
7153
7235
  context: {
7154
7236
  ...snapshot.context,
@@ -7254,7 +7336,7 @@ const coreDndBehaviors = [
7254
7336
  event
7255
7337
  }) => {
7256
7338
  const dragOrigin = event.dragOrigin;
7257
- return dragOrigin ? selector_isActiveStyle.isOverlappingSelection(event.position.selection)({
7339
+ return dragOrigin ? selector_isAtTheStartOfBlock.isOverlappingSelection(event.position.selection)({
7258
7340
  ...snapshot,
7259
7341
  context: {
7260
7342
  ...snapshot.context,
@@ -7275,7 +7357,7 @@ const coreDndBehaviors = [
7275
7357
  event
7276
7358
  }) => {
7277
7359
  const dragOrigin = event.dragOrigin, dropPosition = event.position.selection;
7278
- return dragOrigin ? selector_isActiveStyle.isOverlappingSelection(dropPosition)({
7360
+ return dragOrigin ? selector_isAtTheStartOfBlock.isOverlappingSelection(dropPosition)({
7279
7361
  ...snapshot,
7280
7362
  context: {
7281
7363
  ...snapshot.context,
@@ -7331,19 +7413,19 @@ const coreDndBehaviors = [
7331
7413
  const dragOrigin = event.originEvent.dragOrigin, dragSelection = getDragSelection({
7332
7414
  eventSelection: dragOrigin.selection,
7333
7415
  snapshot
7334
- }), dropPosition = event.originEvent.position.selection, droppingOnDragOrigin = dragOrigin ? selector_isActiveStyle.isOverlappingSelection(dropPosition)({
7416
+ }), dropPosition = event.originEvent.position.selection, droppingOnDragOrigin = dragOrigin ? selector_isAtTheStartOfBlock.isOverlappingSelection(dropPosition)({
7335
7417
  ...snapshot,
7336
7418
  context: {
7337
7419
  ...snapshot.context,
7338
7420
  selection: dragSelection
7339
7421
  }
7340
- }) : !1, draggingEntireBlocks = selector_isActiveStyle.isSelectingEntireBlocks({
7422
+ }) : !1, draggingEntireBlocks = selector_isAtTheStartOfBlock.isSelectingEntireBlocks({
7341
7423
  ...snapshot,
7342
7424
  context: {
7343
7425
  ...snapshot.context,
7344
7426
  selection: dragSelection
7345
7427
  }
7346
- }), draggedBlocks = selector_isActiveStyle.getSelectedBlocks({
7428
+ }), draggedBlocks = selector_isAtTheStartOfBlock.getSelectedBlocks({
7347
7429
  ...snapshot,
7348
7430
  context: {
7349
7431
  ...snapshot.context,
@@ -7388,7 +7470,7 @@ const coreDndBehaviors = [
7388
7470
  }) => {
7389
7471
  if (!selector_getSelectionText.getFocusSpan(snapshot))
7390
7472
  return !1;
7391
- const markState = selector_isActiveStyle.getMarkState(snapshot), activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot), activeAnnotations = selector_isActiveStyle.getActiveAnnotationsMarks(snapshot);
7473
+ const markState = selector_isAtTheStartOfBlock.getMarkState(snapshot), activeDecorators = selector_isAtTheStartOfBlock.getActiveDecorators(snapshot), activeAnnotations = selector_isAtTheStartOfBlock.getActiveAnnotationsMarks(snapshot);
7392
7474
  if (markState && markState.state === "unchanged") {
7393
7475
  const markStateDecorators = (markState.marks ?? []).filter((mark) => snapshot.context.schema.decorators.map((decorator) => decorator.name).includes(mark));
7394
7476
  if (markStateDecorators.length === activeDecorators.length && markStateDecorators.every((mark) => activeDecorators.includes(mark)))
@@ -7421,7 +7503,7 @@ const coreDndBehaviors = [
7421
7503
  const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot);
7422
7504
  if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
7423
7505
  return !1;
7424
- const atTheEndOfBlock = selector_isActiveStyle.isAtTheEndOfBlock(focusTextBlock)(snapshot), focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
7506
+ const atTheEndOfBlock = selector_isAtTheStartOfBlock.isAtTheEndOfBlock(focusTextBlock)(snapshot), focusListItem = focusTextBlock.node.listItem, focusLevel = focusTextBlock.node.level;
7425
7507
  return atTheEndOfBlock ? {
7426
7508
  focusListItem,
7427
7509
  focusLevel
@@ -7457,7 +7539,7 @@ const coreDndBehaviors = [
7457
7539
  if (!snapshot.context.selection || !focusTextBlock || !selectionCollapsed)
7458
7540
  return !1;
7459
7541
  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;
7460
- return selector_isActiveStyle.isAtTheStartOfBlock(focusTextBlock)(snapshot) ? {
7542
+ return selector_isAtTheStartOfBlock.isAtTheStartOfBlock(focusTextBlock)(snapshot) ? {
7461
7543
  focusAnnotations,
7462
7544
  focusDecorators,
7463
7545
  focusListItem,
@@ -7494,7 +7576,7 @@ const coreDndBehaviors = [
7494
7576
  }) => {
7495
7577
  if (!snapshot.context.selection || !selector_getSelectionText.isSelectionExpanded(snapshot))
7496
7578
  return !1;
7497
- const firstBlock = selector_isActiveStyle.getFirstBlock(snapshot), lastBlock = selector_isActiveStyle.getLastBlock(snapshot);
7579
+ const firstBlock = selector_isAtTheStartOfBlock.getFirstBlock(snapshot), lastBlock = selector_isAtTheStartOfBlock.getLastBlock(snapshot);
7498
7580
  if (!firstBlock || !lastBlock)
7499
7581
  return !1;
7500
7582
  const firstBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
@@ -7521,7 +7603,7 @@ const coreDndBehaviors = [
7521
7603
  }) => {
7522
7604
  if (!snapshot.context.selection || !selector_getSelectionText.isSelectionExpanded(snapshot))
7523
7605
  return !1;
7524
- const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
7606
+ const selectedBlocks = selector_isAtTheStartOfBlock.getSelectedBlocks(snapshot), selectionStartBlock = selector_isAtTheStartOfBlock.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isAtTheStartOfBlock.getSelectionEndBlock(snapshot);
7525
7607
  if (!selectionStartBlock || !selectionEndBlock)
7526
7608
  return !1;
7527
7609
  const startBlockStartPoint = util_getTextBlockText.getBlockStartPoint({
@@ -7560,7 +7642,7 @@ const coreDndBehaviors = [
7560
7642
  guard: ({
7561
7643
  snapshot
7562
7644
  }) => {
7563
- const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusInlineObject = selector_isActiveStyle.getFocusInlineObject(snapshot);
7645
+ const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusInlineObject = selector_isAtTheStartOfBlock.getFocusInlineObject(snapshot);
7564
7646
  return selectionCollapsed && focusInlineObject;
7565
7647
  },
7566
7648
  actions: [() => [behaviors_index.raise({
@@ -7628,7 +7710,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7628
7710
  guard: ({
7629
7711
  snapshot
7630
7712
  }) => {
7631
- const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot), nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
7713
+ const focusListBlock = selector_isAtTheStartOfBlock.getFocusListBlock(snapshot), nextBlock = selector_isAtTheStartOfBlock.getNextBlock(snapshot);
7632
7714
  return !focusListBlock || !nextBlock || !schema.isTextBlock(snapshot.context, nextBlock.node) || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
7633
7715
  focusListBlock,
7634
7716
  nextBlock
@@ -7650,7 +7732,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7650
7732
  guard: ({
7651
7733
  snapshot
7652
7734
  }) => {
7653
- const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
7735
+ const focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot), previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock(snapshot);
7654
7736
  if (!focusTextBlock || !previousBlock || !isAtTheBeginningOfBlock({
7655
7737
  context: snapshot.context,
7656
7738
  block: focusTextBlock.node
@@ -7689,7 +7771,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7689
7771
  snapshot,
7690
7772
  event
7691
7773
  }) => {
7692
- const blocksToDelete = selector_isActiveStyle.getSelectedBlocks({
7774
+ const blocksToDelete = selector_isAtTheStartOfBlock.getSelectedBlocks({
7693
7775
  ...snapshot,
7694
7776
  context: {
7695
7777
  ...snapshot.context,
@@ -7706,7 +7788,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7706
7788
  ...snapshot.context,
7707
7789
  selection: event.at
7708
7790
  }
7709
- }), deleteEndPoint = selector_isActiveStyle.getSelectionEndPoint({
7791
+ }), deleteEndPoint = selector_isAtTheStartOfBlock.getSelectionEndPoint({
7710
7792
  context: {
7711
7793
  ...snapshot.context,
7712
7794
  selection: event.at
@@ -7808,7 +7890,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7808
7890
  guard: ({
7809
7891
  snapshot
7810
7892
  }) => {
7811
- const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
7893
+ const selectionCollapsed = selector_getSelectionText.isSelectionCollapsed(snapshot), focusListBlock = selector_isAtTheStartOfBlock.getFocusListBlock(snapshot);
7812
7894
  return !selectionCollapsed || !focusListBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
7813
7895
  focusListBlock
7814
7896
  };
@@ -7828,7 +7910,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7828
7910
  }) => {
7829
7911
  if (!defaultKeyboardShortcuts.tab.guard(event.originEvent))
7830
7912
  return !1;
7831
- const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
7913
+ const selectedBlocks = selector_isAtTheStartOfBlock.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
7832
7914
  node: block.node,
7833
7915
  path: block.path
7834
7916
  }] : []);
@@ -7853,7 +7935,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7853
7935
  }) => {
7854
7936
  if (!defaultKeyboardShortcuts.shiftTab.guard(event.originEvent))
7855
7937
  return !1;
7856
- const selectedBlocks = selector_isActiveStyle.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
7938
+ const selectedBlocks = selector_isAtTheStartOfBlock.getSelectedBlocks(snapshot), selectedListBlocks = selectedBlocks.flatMap((block) => util_getTextBlockText.isListBlock(snapshot.context, block.node) ? [{
7857
7939
  node: block.node,
7858
7940
  path: block.path
7859
7941
  }] : []);
@@ -7876,7 +7958,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7876
7958
  snapshot,
7877
7959
  event
7878
7960
  }) => {
7879
- const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
7961
+ const focusListBlock = selector_isAtTheStartOfBlock.getFocusListBlock(snapshot);
7880
7962
  if (!focusListBlock)
7881
7963
  return !1;
7882
7964
  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;
@@ -7910,7 +7992,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7910
7992
  snapshot,
7911
7993
  event
7912
7994
  }) => {
7913
- const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
7995
+ const focusListBlock = selector_isAtTheStartOfBlock.getFocusListBlock(snapshot);
7914
7996
  if (!focusListBlock || util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node))
7915
7997
  return !1;
7916
7998
  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;
@@ -7943,7 +8025,7 @@ const MAX_LIST_LEVEL = 10, clearListOnBackspace = behaviors_index.defineBehavior
7943
8025
  }) => {
7944
8026
  if (event.placement !== "auto" || event.block._type !== snapshot.context.schema.block.name || event.block.listItem !== void 0)
7945
8027
  return !1;
7946
- const focusListBlock = selector_isActiveStyle.getFocusListBlock(snapshot);
8028
+ const focusListBlock = selector_isAtTheStartOfBlock.getFocusListBlock(snapshot);
7947
8029
  return !focusListBlock || !util_isEmptyTextBlock.isEmptyTextBlock(snapshot.context, focusListBlock.node) ? !1 : {
7948
8030
  level: focusListBlock.node.level,
7949
8031
  listItem: focusListBlock.node.listItem
@@ -8035,7 +8117,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8035
8117
  guard: ({
8036
8118
  snapshot,
8037
8119
  event
8038
- }) => selector_isActiveStyle.isActiveAnnotation(event.annotation.name)(snapshot),
8120
+ }) => selector_isAtTheStartOfBlock.isActiveAnnotation(event.annotation.name)(snapshot),
8039
8121
  actions: [({
8040
8122
  event
8041
8123
  }) => [behaviors_index.raise({
@@ -8047,7 +8129,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8047
8129
  guard: ({
8048
8130
  snapshot,
8049
8131
  event
8050
- }) => !selector_isActiveStyle.isActiveAnnotation(event.annotation.name)(snapshot),
8132
+ }) => !selector_isAtTheStartOfBlock.isActiveAnnotation(event.annotation.name)(snapshot),
8051
8133
  actions: [({
8052
8134
  event
8053
8135
  }) => [behaviors_index.raise({
@@ -8059,7 +8141,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8059
8141
  guard: ({
8060
8142
  snapshot,
8061
8143
  event
8062
- }) => selector_isActiveStyle.isActiveDecorator(event.decorator)(snapshot),
8144
+ }) => selector_isAtTheStartOfBlock.isActiveDecorator(event.decorator)(snapshot),
8063
8145
  actions: [({
8064
8146
  event
8065
8147
  }) => [behaviors_index.raise({
@@ -8076,13 +8158,13 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8076
8158
  context: snapshot.context,
8077
8159
  offsets: event.at
8078
8160
  }) : null;
8079
- return manualSelection ? !selector_isActiveStyle.isActiveDecorator(event.decorator)({
8161
+ return manualSelection ? !selector_isAtTheStartOfBlock.isActiveDecorator(event.decorator)({
8080
8162
  ...snapshot,
8081
8163
  context: {
8082
8164
  ...snapshot.context,
8083
8165
  selection: manualSelection
8084
8166
  }
8085
- }) : !selector_isActiveStyle.isActiveDecorator(event.decorator)(snapshot);
8167
+ }) : !selector_isAtTheStartOfBlock.isActiveDecorator(event.decorator)(snapshot);
8086
8168
  },
8087
8169
  actions: [({
8088
8170
  event
@@ -8115,8 +8197,8 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8115
8197
  }) => {
8116
8198
  if (event.direction !== "backward")
8117
8199
  return !1;
8118
- const previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8119
- if (!previousBlock || !focusTextBlock || !selector_isActiveStyle.isAtTheStartOfBlock(focusTextBlock)(snapshot))
8200
+ const previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8201
+ if (!previousBlock || !focusTextBlock || !selector_isAtTheStartOfBlock.isAtTheStartOfBlock(focusTextBlock)(snapshot))
8120
8202
  return !1;
8121
8203
  const previousBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
8122
8204
  context: snapshot.context,
@@ -8170,7 +8252,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8170
8252
  }) => {
8171
8253
  if (event.direction !== "forward")
8172
8254
  return !1;
8173
- const nextBlock = selector_isActiveStyle.getNextBlock({
8255
+ const nextBlock = selector_isAtTheStartOfBlock.getNextBlock({
8174
8256
  ...snapshot,
8175
8257
  context: {
8176
8258
  ...snapshot.context,
@@ -8215,8 +8297,8 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8215
8297
  }) => {
8216
8298
  if (event.direction !== "forward")
8217
8299
  return !1;
8218
- const nextBlock = selector_isActiveStyle.getNextBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8219
- return !nextBlock || !focusTextBlock || !selector_isActiveStyle.isAtTheEndOfBlock(focusTextBlock)(snapshot) || !schema.isTextBlock(snapshot.context, nextBlock.node) ? !1 : {
8300
+ const nextBlock = selector_isAtTheStartOfBlock.getNextBlock(snapshot), focusTextBlock = selector_getSelectionText.getFocusTextBlock(snapshot);
8301
+ return !nextBlock || !focusTextBlock || !selector_isAtTheStartOfBlock.isAtTheEndOfBlock(focusTextBlock)(snapshot) || !schema.isTextBlock(snapshot.context, nextBlock.node) ? !1 : {
8220
8302
  nextBlock
8221
8303
  };
8222
8304
  },
@@ -8313,7 +8395,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8313
8395
  });
8314
8396
  if (!selection)
8315
8397
  return !1;
8316
- const trimmedSelection = selector_isActiveStyle.getTrimmedSelection({
8398
+ const trimmedSelection = selector_isAtTheStartOfBlock.getTrimmedSelection({
8317
8399
  ...snapshot,
8318
8400
  context: {
8319
8401
  ...snapshot.context,
@@ -8416,9 +8498,9 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8416
8498
  event
8417
8499
  }) => {
8418
8500
  if (selector_getSelectionText.getFocusTextBlock(snapshot) && event.mimeType === "text/plain" && event.originEvent.type === "clipboard.paste") {
8419
- const activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot);
8501
+ const activeDecorators = selector_isAtTheStartOfBlock.getActiveDecorators(snapshot);
8420
8502
  return {
8421
- activeAnnotations: selector_isActiveStyle.getActiveAnnotations(snapshot),
8503
+ activeAnnotations: selector_isAtTheStartOfBlock.getActiveAnnotations(snapshot),
8422
8504
  activeDecorators,
8423
8505
  textRuns: event.data.flatMap((block) => schema.isTextBlock(snapshot.context, block) ? [util_getTextBlockText.getTextBlockText(block)] : [])
8424
8506
  };
@@ -8768,7 +8850,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8768
8850
  guard: ({
8769
8851
  snapshot
8770
8852
  }) => {
8771
- const lastBlock = selector_isActiveStyle.getLastBlock(snapshot);
8853
+ const lastBlock = selector_isAtTheStartOfBlock.getLastBlock(snapshot);
8772
8854
  return !lastBlock || snapshot.context.selection ? !1 : {
8773
8855
  lastBlockEndPoint: util_isEmptyTextBlock.getBlockEndPoint({
8774
8856
  context: snapshot.context,
@@ -8923,7 +9005,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8923
9005
  guard: ({
8924
9006
  snapshot,
8925
9007
  event
8926
- }) => defaultKeyboardShortcuts.backspace.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
9008
+ }) => defaultKeyboardShortcuts.backspace.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isAtTheStartOfBlock.getFocusInlineObject(snapshot),
8927
9009
  actions: [() => [behaviors_index.raise({
8928
9010
  type: "delete.backward",
8929
9011
  unit: "character"
@@ -8939,7 +9021,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8939
9021
  guard: ({
8940
9022
  snapshot,
8941
9023
  event
8942
- }) => defaultKeyboardShortcuts.delete.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
9024
+ }) => defaultKeyboardShortcuts.delete.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isAtTheStartOfBlock.getFocusInlineObject(snapshot),
8943
9025
  actions: [() => [behaviors_index.raise({
8944
9026
  type: "delete.forward",
8945
9027
  unit: "character"
@@ -8954,7 +9036,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
8954
9036
  guard: ({
8955
9037
  snapshot,
8956
9038
  event
8957
- }) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isActiveStyle.getFocusInlineObject(snapshot),
9039
+ }) => defaultKeyboardShortcuts.break.guard(event.originEvent) && selector_getSelectionText.isSelectionCollapsed(snapshot) && selector_isAtTheStartOfBlock.getFocusInlineObject(snapshot),
8958
9040
  actions: [() => [behaviors_index.raise({
8959
9041
  type: "insert.break"
8960
9042
  })]]
@@ -9026,7 +9108,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9026
9108
  const focusBlock = selector_getSelectionText.getFocusBlock(snapshot);
9027
9109
  if (!focusBlock)
9028
9110
  return !1;
9029
- const previousBlock = selector_isActiveStyle.getPreviousBlock({
9111
+ const previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock({
9030
9112
  ...snapshot,
9031
9113
  context: {
9032
9114
  ...snapshot.context,
@@ -9069,7 +9151,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9069
9151
  snapshot,
9070
9152
  event
9071
9153
  }) => snapshot.context.schema.lists.some((list) => list.name === event.listItem) ? {
9072
- selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9154
+ selectedTextBlocks: selector_isAtTheStartOfBlock.getSelectedTextBlocks(snapshot)
9073
9155
  } : !1,
9074
9156
  actions: [({
9075
9157
  event
@@ -9088,7 +9170,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9088
9170
  guard: ({
9089
9171
  snapshot
9090
9172
  }) => ({
9091
- selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9173
+ selectedTextBlocks: selector_isAtTheStartOfBlock.getSelectedTextBlocks(snapshot)
9092
9174
  }),
9093
9175
  actions: [(_, {
9094
9176
  selectedTextBlocks
@@ -9102,7 +9184,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9102
9184
  guard: ({
9103
9185
  snapshot,
9104
9186
  event
9105
- }) => selector_isActiveStyle.isActiveListItem(event.listItem)(snapshot),
9187
+ }) => selector_isAtTheStartOfBlock.isActiveListItem(event.listItem)(snapshot),
9106
9188
  actions: [({
9107
9189
  event
9108
9190
  }) => [behaviors_index.raise({
@@ -9114,7 +9196,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9114
9196
  guard: ({
9115
9197
  snapshot,
9116
9198
  event
9117
- }) => !selector_isActiveStyle.isActiveListItem(event.listItem)(snapshot),
9199
+ }) => !selector_isAtTheStartOfBlock.isActiveListItem(event.listItem)(snapshot),
9118
9200
  actions: [({
9119
9201
  event
9120
9202
  }) => [behaviors_index.raise({
@@ -9127,7 +9209,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9127
9209
  snapshot,
9128
9210
  event
9129
9211
  }) => {
9130
- const previousBlock = selector_isActiveStyle.getPreviousBlock({
9212
+ const previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock({
9131
9213
  ...snapshot,
9132
9214
  context: {
9133
9215
  ...snapshot.context,
@@ -9162,7 +9244,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9162
9244
  snapshot,
9163
9245
  event
9164
9246
  }) => {
9165
- const nextBlock = selector_isActiveStyle.getNextBlock({
9247
+ const nextBlock = selector_isAtTheStartOfBlock.getNextBlock({
9166
9248
  ...snapshot,
9167
9249
  context: {
9168
9250
  ...snapshot.context,
@@ -9253,7 +9335,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9253
9335
  guard: ({
9254
9336
  snapshot
9255
9337
  }) => {
9256
- const previousBlock = selector_isActiveStyle.getPreviousBlock(snapshot);
9338
+ const previousBlock = selector_isAtTheStartOfBlock.getPreviousBlock(snapshot);
9257
9339
  return previousBlock ? {
9258
9340
  previousBlock
9259
9341
  } : !1;
@@ -9272,7 +9354,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9272
9354
  guard: ({
9273
9355
  snapshot
9274
9356
  }) => {
9275
- const nextBlock = selector_isActiveStyle.getNextBlock(snapshot);
9357
+ const nextBlock = selector_isAtTheStartOfBlock.getNextBlock(snapshot);
9276
9358
  return nextBlock ? {
9277
9359
  nextBlock
9278
9360
  } : !1;
@@ -9356,7 +9438,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9356
9438
  on: "split",
9357
9439
  guard: ({
9358
9440
  snapshot
9359
- }) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isActiveStyle.getFocusInlineObject(snapshot),
9441
+ }) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isAtTheStartOfBlock.getFocusInlineObject(snapshot),
9360
9442
  actions: []
9361
9443
  }),
9362
9444
  /**
@@ -9366,7 +9448,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9366
9448
  on: "split",
9367
9449
  guard: ({
9368
9450
  snapshot
9369
- }) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isActiveStyle.getFocusBlockObject(snapshot),
9451
+ }) => util_isEmptyTextBlock.isSelectionCollapsed(snapshot.context.selection) && selector_isAtTheStartOfBlock.getFocusBlockObject(snapshot),
9370
9452
  actions: []
9371
9453
  }),
9372
9454
  behaviors_index.defineBehavior({
@@ -9377,7 +9459,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9377
9459
  const selection = snapshot.context.selection;
9378
9460
  if (!selection || util_isEmptyTextBlock.isSelectionCollapsed(selection))
9379
9461
  return !1;
9380
- const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
9462
+ const selectionStartBlock = selector_isAtTheStartOfBlock.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isAtTheStartOfBlock.getSelectionEndBlock(snapshot);
9381
9463
  return !selectionStartBlock || !selectionEndBlock ? !1 : !schema.isTextBlock(snapshot.context, selectionStartBlock.node) && schema.isTextBlock(snapshot.context, selectionEndBlock.node) ? {
9382
9464
  selection
9383
9465
  } : !1;
@@ -9397,7 +9479,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9397
9479
  const selection = snapshot.context.selection;
9398
9480
  if (!selection || util_isEmptyTextBlock.isSelectionCollapsed(selection))
9399
9481
  return !1;
9400
- const selectionStartBlock = selector_isActiveStyle.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isActiveStyle.getSelectionEndBlock(snapshot);
9482
+ const selectionStartBlock = selector_isAtTheStartOfBlock.getSelectionStartBlock(snapshot), selectionEndBlock = selector_isAtTheStartOfBlock.getSelectionEndBlock(snapshot);
9401
9483
  if (!selectionStartBlock || !selectionEndBlock || selectionStartBlock.node._key === selectionEndBlock.node._key)
9402
9484
  return !1;
9403
9485
  const startPoint = util_getTextBlockText.getSelectionStartPoint(selection), startBlockEndPoint = util_isEmptyTextBlock.getBlockEndPoint({
@@ -9518,7 +9600,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9518
9600
  guard: ({
9519
9601
  snapshot
9520
9602
  }) => ({
9521
- selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9603
+ selectedTextBlocks: selector_isAtTheStartOfBlock.getSelectedTextBlocks(snapshot)
9522
9604
  }),
9523
9605
  actions: [({
9524
9606
  event
@@ -9536,7 +9618,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9536
9618
  guard: ({
9537
9619
  snapshot
9538
9620
  }) => ({
9539
- selectedTextBlocks: selector_isActiveStyle.getSelectedTextBlocks(snapshot)
9621
+ selectedTextBlocks: selector_isAtTheStartOfBlock.getSelectedTextBlocks(snapshot)
9540
9622
  }),
9541
9623
  actions: [(_, {
9542
9624
  selectedTextBlocks
@@ -9550,7 +9632,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9550
9632
  guard: ({
9551
9633
  snapshot,
9552
9634
  event
9553
- }) => selector_isActiveStyle.isActiveStyle(event.style)(snapshot),
9635
+ }) => selector_isAtTheStartOfBlock.isActiveStyle(event.style)(snapshot),
9554
9636
  actions: [({
9555
9637
  event
9556
9638
  }) => [behaviors_index.raise({
@@ -9562,7 +9644,7 @@ const abstractAnnotationBehaviors = [behaviors_index.defineBehavior({
9562
9644
  guard: ({
9563
9645
  snapshot,
9564
9646
  event
9565
- }) => !selector_isActiveStyle.isActiveStyle(event.style)(snapshot),
9647
+ }) => !selector_isAtTheStartOfBlock.isActiveStyle(event.style)(snapshot),
9566
9648
  actions: [({
9567
9649
  event
9568
9650
  }) => [behaviors_index.raise({
@@ -10705,13 +10787,13 @@ function createEditableAPI(editor, editorActor) {
10705
10787
  editorActorSnapshot: editorActor.getSnapshot(),
10706
10788
  slateEditorInstance: editor
10707
10789
  });
10708
- return selector_isActiveStyle.getActiveDecorators(snapshot).includes(mark);
10790
+ return selector_isAtTheStartOfBlock.getActiveDecorators(snapshot).includes(mark);
10709
10791
  },
10710
10792
  marks: () => {
10711
10793
  const snapshot = getEditorSnapshot({
10712
10794
  editorActorSnapshot: editorActor.getSnapshot(),
10713
10795
  slateEditorInstance: editor
10714
- }), activeAnnotations = selector_isActiveStyle.getActiveAnnotationsMarks(snapshot), activeDecorators = selector_isActiveStyle.getActiveDecorators(snapshot);
10796
+ }), activeAnnotations = selector_isAtTheStartOfBlock.getActiveAnnotationsMarks(snapshot), activeDecorators = selector_isAtTheStartOfBlock.getActiveDecorators(snapshot);
10715
10797
  return [...activeAnnotations, ...activeDecorators];
10716
10798
  },
10717
10799
  undo: () => {
@@ -10921,7 +11003,7 @@ function createEditableAPI(editor, editorActor) {
10921
11003
  editorActorSnapshot: editorActor.getSnapshot(),
10922
11004
  slateEditorInstance: editor
10923
11005
  });
10924
- return selector_isActiveStyle.isActiveAnnotation(annotationType)(snapshot);
11006
+ return selector_isAtTheStartOfBlock.isActiveAnnotation(annotationType)(snapshot);
10925
11007
  },
10926
11008
  addAnnotation: (type, value) => {
10927
11009
  const snapshotBefore = getEditorSnapshot({