@portabletext/editor 1.48.7 → 1.48.9

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 (120) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +20 -8
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/behavior.markdown.cjs +5 -5
  4. package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
  5. package/lib/_chunks-cjs/editor-provider.cjs +99 -68
  6. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  7. package/lib/_chunks-cjs/selector.get-text-before.cjs +7 -4
  8. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  9. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +41 -45
  10. package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs.map +1 -1
  11. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +29 -23
  12. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
  13. package/lib/_chunks-cjs/util.merge-text-blocks.cjs +3 -3
  14. package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
  15. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +15 -15
  16. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
  17. package/lib/_chunks-cjs/util.slice-blocks.cjs +258 -38
  18. package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
  19. package/lib/_chunks-es/behavior.core.js +21 -10
  20. package/lib/_chunks-es/behavior.core.js.map +1 -1
  21. package/lib/_chunks-es/behavior.markdown.js +5 -6
  22. package/lib/_chunks-es/behavior.markdown.js.map +1 -1
  23. package/lib/_chunks-es/editor-provider.js +75 -45
  24. package/lib/_chunks-es/editor-provider.js.map +1 -1
  25. package/lib/_chunks-es/selector.get-text-before.js +7 -4
  26. package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
  27. package/lib/_chunks-es/selector.is-overlapping-selection.js +43 -47
  28. package/lib/_chunks-es/selector.is-overlapping-selection.js.map +1 -1
  29. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +30 -26
  30. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
  31. package/lib/_chunks-es/util.merge-text-blocks.js +1 -1
  32. package/lib/_chunks-es/util.selection-point-to-block-offset.js +15 -16
  33. package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
  34. package/lib/_chunks-es/util.slice-blocks.js +258 -38
  35. package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
  36. package/lib/behaviors/index.d.cts +5 -5
  37. package/lib/behaviors/index.d.ts +5 -5
  38. package/lib/index.cjs +45 -21
  39. package/lib/index.cjs.map +1 -1
  40. package/lib/index.js +44 -21
  41. package/lib/index.js.map +1 -1
  42. package/lib/plugins/index.cjs +16 -7
  43. package/lib/plugins/index.cjs.map +1 -1
  44. package/lib/plugins/index.js +16 -7
  45. package/lib/plugins/index.js.map +1 -1
  46. package/lib/selectors/index.cjs +3 -3
  47. package/lib/selectors/index.cjs.map +1 -1
  48. package/lib/selectors/index.d.cts +2 -6
  49. package/lib/selectors/index.d.ts +2 -6
  50. package/lib/selectors/index.js +5 -5
  51. package/lib/selectors/index.js.map +1 -1
  52. package/lib/utils/index.cjs +30 -24
  53. package/lib/utils/index.cjs.map +1 -1
  54. package/lib/utils/index.d.cts +37 -31
  55. package/lib/utils/index.d.ts +37 -31
  56. package/lib/utils/index.js +30 -24
  57. package/lib/utils/index.js.map +1 -1
  58. package/package.json +1 -1
  59. package/src/behavior-actions/behavior.action.block.unset.ts +1 -1
  60. package/src/behavior-actions/behavior.action.decorator.add.ts +20 -5
  61. package/src/behaviors/behavior.abstract.decorator.ts +1 -1
  62. package/src/behaviors/behavior.abstract.delete.ts +1 -1
  63. package/src/behaviors/behavior.abstract.insert.ts +2 -2
  64. package/src/behaviors/behavior.abstract.select.ts +16 -4
  65. package/src/behaviors/behavior.abstract.split.ts +9 -6
  66. package/src/behaviors/behavior.core.block-objects.ts +5 -5
  67. package/src/behaviors/behavior.core.insert-break.ts +16 -4
  68. package/src/behaviors/behavior.core.lists.ts +4 -6
  69. package/src/behaviors/behavior.decorator-pair.ts +13 -4
  70. package/src/behaviors/behavior.default.ts +1 -1
  71. package/src/behaviors/behavior.markdown.ts +5 -5
  72. package/src/converters/converter.portable-text.ts +1 -1
  73. package/src/converters/converter.text-html.ts +1 -1
  74. package/src/converters/converter.text-plain.ts +4 -4
  75. package/src/editor/plugins/__tests__/withEditableAPIGetFragment.test.tsx +10 -2
  76. package/src/editor/plugins/createWithSchemaTypes.ts +12 -19
  77. package/src/internal-utils/__tests__/dmpToOperations.test.ts +13 -12
  78. package/src/internal-utils/drag-selection.ts +16 -4
  79. package/src/internal-utils/event-position.ts +20 -8
  80. package/src/internal-utils/parse-blocks.ts +17 -5
  81. package/src/internal-utils/validateValue.ts +6 -6
  82. package/src/plugins/plugin.decorator-shortcut.ts +2 -2
  83. package/src/selectors/selector.get-active-annotations.ts +5 -2
  84. package/src/selectors/selector.get-active-list-item.ts +4 -3
  85. package/src/selectors/selector.get-active-style.ts +4 -3
  86. package/src/selectors/selector.get-anchor-text-block.ts +3 -6
  87. package/src/selectors/selector.get-block-offsets.ts +2 -2
  88. package/src/selectors/selector.get-caret-word-selection.ts +11 -5
  89. package/src/selectors/selector.get-selected-slice.ts +1 -1
  90. package/src/selectors/selector.get-selected-spans.ts +11 -15
  91. package/src/selectors/selector.get-selected-text-blocks.ts +3 -3
  92. package/src/selectors/selector.get-selection-text.ts +3 -3
  93. package/src/selectors/selector.get-text-before.ts +5 -2
  94. package/src/selectors/selector.get-trimmed-selection.ts +20 -14
  95. package/src/selectors/selector.is-active-annotation.ts +4 -2
  96. package/src/selectors/selector.is-active-decorator.test.ts +3 -3
  97. package/src/selectors/selector.is-at-the-end-of-block.ts +4 -1
  98. package/src/selectors/selector.is-at-the-start-of-block.ts +4 -1
  99. package/src/selectors/selector.is-point-after-selection.ts +7 -6
  100. package/src/selectors/selector.is-point-before-selection.ts +7 -6
  101. package/src/selectors/selector.is-selecting-entire-blocks.ts +8 -2
  102. package/src/selectors/selectors.ts +25 -28
  103. package/src/utils/util.block-offset-to-block-selection-point.ts +4 -4
  104. package/src/utils/util.block-offset-to-selection-point.ts +5 -5
  105. package/src/utils/util.block-offset.test.ts +219 -156
  106. package/src/utils/util.block-offset.ts +14 -17
  107. package/src/utils/util.block-offsets-to-selection.ts +5 -5
  108. package/src/utils/util.child-selection-point-to-block-offset.ts +7 -10
  109. package/src/utils/util.get-block-end-point.ts +15 -15
  110. package/src/utils/util.get-block-start-point.ts +13 -12
  111. package/src/utils/util.is-empty-text-block.ts +9 -8
  112. package/src/utils/util.selection-point-to-block-offset.ts +4 -4
  113. package/src/utils/util.slice-blocks.test.ts +178 -121
  114. package/src/utils/util.slice-blocks.ts +25 -24
  115. package/src/utils/util.split-text-block.ts +18 -12
  116. package/lib/_chunks-cjs/parse-blocks.cjs +0 -205
  117. package/lib/_chunks-cjs/parse-blocks.cjs.map +0 -1
  118. package/lib/_chunks-es/parse-blocks.js +0 -206
  119. package/lib/_chunks-es/parse-blocks.js.map +0 -1
  120. package/src/behavior-actions/behavior.guards.ts +0 -24
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/selectors/selector.get-anchor-block.ts","../../src/selectors/selector.get-anchor-text-block.ts","../../src/selectors/selector.get-anchor-child.ts","../../src/selectors/selector.get-anchor-span.ts","../../src/selectors/selector.get-block-offsets.ts","../../src/selectors/selector.get-selection.ts","../../src/selectors/selector.get-value.ts"],"sourcesContent":["import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\n\n/**\n * @public\n */\nexport const getAnchorBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n","import {\n isPortableTextTextBlock,\n type KeyedSegment,\n type PortableTextTextBlock,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorBlock} from './selector.get-anchor-block'\n\n/**\n * @public\n */\nexport const getAnchorTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorBlock(snapshot)\n\n return anchorBlock && isPortableTextTextBlock(anchorBlock.node)\n ? {node: anchorBlock.node, path: anchorBlock.path}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport type {PortableTextObject, PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\nimport {getAnchorTextBlock} from './selector.get-anchor-text-block'\n\n/**\n * @public\n */\nexport const getAnchorChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorTextBlock(snapshot)\n\n if (!anchorBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[2])\n ? snapshot.context.selection.anchor.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? anchorBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...anchorBlock.path, 'children', {_key: key}]}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport {isPortableTextSpan, type PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorChild} from './selector.get-anchor-child'\n\n/**\n * @public\n */\nexport const getAnchorSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const anchorChild = getAnchorChild(snapshot)\n\n return anchorChild && isPortableTextSpan(anchorChild.node)\n ? {node: anchorChild.node, path: anchorChild.path}\n : undefined\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport * as utils from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\n\n/**\n * @public\n */\nexport const getBlockOffsets: EditorSelector<\n {start: BlockOffset; end: BlockOffset} | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (!selectionStartPoint || !selectionEndPoint) {\n return undefined\n }\n\n const start = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionStartPoint,\n })\n const end = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionEndPoint,\n })\n\n return start && end ? {start, end} : undefined\n}\n","import type {EditorSelection} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelection: EditorSelector<EditorSelection> = (snapshot) => {\n return snapshot.context.selection\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getValue: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return snapshot.context.value\n}\n"],"names":["getAnchorBlock","snapshot","key","context","selection","isKeyedSegment","anchor","path","_key","undefined","node","value","find","block","getAnchorTextBlock","anchorBlock","isPortableTextTextBlock","getAnchorChild","children","span","getAnchorSpan","anchorChild","isPortableTextSpan","getBlockOffsets","selectionStartPoint","getSelectionStartPoint","selectionEndPoint","getSelectionEndPoint","start","utils","selectionPoint","end","getSelection","getValue"],"mappings":";;;AAOO,MAAMA,iBAERC,C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;AAAA,IAACA,MAAMW,YAAYX;AAAAA,IAAMH,MAAMc,YAAYd;AAAAA,EAAAA,IAC3CE;AACN,GCRac,kBAERtB,CAAa,aAAA;AACZ,MAAA,CAACA,SAASE,QAAQC;AACpB;AAGF,QAAMoB,sBAAsBC,gCAAAA,uBAAuBxB,QAAQ,GACrDyB,oBAAoBC,qDAAqB1B,QAAQ;AAEnD,MAAA,CAACuB,uBAAuB,CAACE;AAC3B;AAGIE,QAAAA,QAAQC,iBAAAA,gCAAsC;AAAA,IAClDlB,OAAOV,SAASE,QAAQQ;AAAAA,IACxBmB,gBAAgBN;AAAAA,EAAAA,CACjB,GACKO,MAAMF,iDAAsC;AAAA,IAChDlB,OAAOV,SAASE,QAAQQ;AAAAA,IACxBmB,gBAAgBJ;AAAAA,EAAAA,CACjB;AAED,SAAOE,SAASG,MAAM;AAAA,IAACH;AAAAA,IAAOG;AAAAA,EAAAA,IAAOtB;AACvC,GC3BauB,eAAiD/B,CACrDA,aAAAA,SAASE,QAAQC,WCDb6B,WACXhC,CAEOA,aAAAA,SAASE,QAAQQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/selectors/selector.get-anchor-block.ts","../../src/selectors/selector.get-anchor-text-block.ts","../../src/selectors/selector.get-anchor-child.ts","../../src/selectors/selector.get-anchor-span.ts","../../src/selectors/selector.get-block-offsets.ts","../../src/selectors/selector.get-selection.ts","../../src/selectors/selector.get-value.ts"],"sourcesContent":["import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\n\n/**\n * @public\n */\nexport const getAnchorBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n","import type {KeyedSegment, PortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isTextBlock} from '../internal-utils/parse-blocks'\nimport {getAnchorBlock} from './selector.get-anchor-block'\n\n/**\n * @public\n */\nexport const getAnchorTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorBlock(snapshot)\n\n return anchorBlock && isTextBlock(snapshot.context, anchorBlock.node)\n ? {node: anchorBlock.node, path: anchorBlock.path}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport type {PortableTextObject, PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\nimport {getAnchorTextBlock} from './selector.get-anchor-text-block'\n\n/**\n * @public\n */\nexport const getAnchorChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorTextBlock(snapshot)\n\n if (!anchorBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[2])\n ? snapshot.context.selection.anchor.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? anchorBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...anchorBlock.path, 'children', {_key: key}]}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport {isPortableTextSpan, type PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorChild} from './selector.get-anchor-child'\n\n/**\n * @public\n */\nexport const getAnchorSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const anchorChild = getAnchorChild(snapshot)\n\n return anchorChild && isPortableTextSpan(anchorChild.node)\n ? {node: anchorChild.node, path: anchorChild.path}\n : undefined\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport * as utils from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\n\n/**\n * @public\n */\nexport const getBlockOffsets: EditorSelector<\n {start: BlockOffset; end: BlockOffset} | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (!selectionStartPoint || !selectionEndPoint) {\n return undefined\n }\n\n const start = utils.spanSelectionPointToBlockOffset({\n context: snapshot.context,\n selectionPoint: selectionStartPoint,\n })\n const end = utils.spanSelectionPointToBlockOffset({\n context: snapshot.context,\n selectionPoint: selectionEndPoint,\n })\n\n return start && end ? {start, end} : undefined\n}\n","import type {EditorSelection} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelection: EditorSelector<EditorSelection> = (snapshot) => {\n return snapshot.context.selection\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getValue: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return snapshot.context.value\n}\n"],"names":["getAnchorBlock","snapshot","key","context","selection","isKeyedSegment","anchor","path","_key","undefined","node","value","find","block","getAnchorTextBlock","anchorBlock","isTextBlock","getAnchorChild","children","span","getAnchorSpan","anchorChild","isPortableTextSpan","getBlockOffsets","selectionStartPoint","getSelectionStartPoint","selectionEndPoint","getSelectionEndPoint","start","utils","selectionPoint","end","getSelection","getValue"],"mappings":";;;AAOO,MAAMA,iBAERC,CAAa,aAAA;AAChB,QAAMC,MAAMD,SAASE,QAAQC,aACzBC,iBAAAA,e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AYd;AAAAA,EAAAA,IAC3CE;AACN,GCRac,kBAERtB,CAAa,aAAA;AACZ,MAAA,CAACA,SAASE,QAAQC;AACpB;AAGF,QAAMoB,sBAAsBC,gCAAAA,uBAAuBxB,QAAQ,GACrDyB,oBAAoBC,qDAAqB1B,QAAQ;AAEnD,MAAA,CAACuB,uBAAuB,CAACE;AAC3B;AAGIE,QAAAA,QAAQC,iBAAAA,gCAAsC;AAAA,IAClD1B,SAASF,SAASE;AAAAA,IAClB2B,gBAAgBN;AAAAA,EAAAA,CACjB,GACKO,MAAMF,iDAAsC;AAAA,IAChD1B,SAASF,SAASE;AAAAA,IAClB2B,gBAAgBJ;AAAAA,EAAAA,CACjB;AAED,SAAOE,SAASG,MAAM;AAAA,IAACH;AAAAA,IAAOG;AAAAA,EAAAA,IAAOtB;AACvC,GC3BauB,eAAiD/B,CACrDA,aAAAA,SAASE,QAAQC,WCDb6B,WACXhC,CAEOA,aAAAA,SAASE,QAAQQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -6,16 +6,12 @@ import type {
6
6
  BlockStyleDefinition,
7
7
  ObjectSchemaType,
8
8
  Path,
9
- PortableTextChild,
10
- } from '@sanity/types'
11
- import {
12
- KeyedSegment,
13
9
  PortableTextBlock,
10
+ PortableTextChild,
14
11
  PortableTextListBlock,
15
- PortableTextObject,
16
- PortableTextSpan,
17
12
  PortableTextTextBlock,
18
13
  } from '@sanity/types'
14
+ import {KeyedSegment, PortableTextObject, PortableTextSpan} from '@sanity/types'
19
15
  import type {
20
16
  FocusEvent as FocusEvent_2,
21
17
  KeyboardEvent as KeyboardEvent_2,
@@ -6,16 +6,12 @@ import type {
6
6
  BlockStyleDefinition,
7
7
  ObjectSchemaType,
8
8
  Path,
9
- PortableTextChild,
10
- } from '@sanity/types'
11
- import {
12
- KeyedSegment,
13
9
  PortableTextBlock,
10
+ PortableTextChild,
14
11
  PortableTextListBlock,
15
- PortableTextObject,
16
- PortableTextSpan,
17
12
  PortableTextTextBlock,
18
13
  } from '@sanity/types'
14
+ import {KeyedSegment, PortableTextObject, PortableTextSpan} from '@sanity/types'
19
15
  import type {
20
16
  FocusEvent as FocusEvent_2,
21
17
  KeyboardEvent as KeyboardEvent_2,
@@ -1,6 +1,6 @@
1
1
  import { getActiveAnnotations, getActiveListItem, getActiveStyle, getSelectedSpans, getSelectedTextBlocks, getTrimmedSelection, isActiveAnnotation, isActiveDecorator, isActiveListItem, isActiveStyle, isSelectingEntireBlocks } from "../_chunks-es/selector.is-selecting-entire-blocks.js";
2
- import { isKeyedSegment, spanSelectionPointToBlockOffset } from "../_chunks-es/util.slice-blocks.js";
3
- import { isPortableTextTextBlock, isPortableTextSpan } from "@sanity/types";
2
+ import { isKeyedSegment, isTextBlock, spanSelectionPointToBlockOffset } from "../_chunks-es/util.slice-blocks.js";
3
+ import { isPortableTextSpan } from "@sanity/types";
4
4
  import { getSelectionStartPoint, getSelectionEndPoint } from "../_chunks-es/selector.is-overlapping-selection.js";
5
5
  import { getCaretWordSelection, getFirstBlock, getFocusBlock, getFocusBlockObject, getFocusChild, getFocusListBlock, getFocusSpan, getFocusTextBlock, getLastBlock, getNextBlock, getNextInlineObject, getPreviousBlock, getPreviousInlineObject, getSelectedBlocks, getSelectedSlice, getSelectionEndBlock, getSelectionStartBlock, getSelectionText, isAtTheEndOfBlock, isAtTheStartOfBlock, isOverlappingSelection, isPointAfterSelection, isPointBeforeSelection, isSelectionCollapsed, isSelectionExpanded } from "../_chunks-es/selector.is-overlapping-selection.js";
6
6
  import { getFocusInlineObject } from "../_chunks-es/selector.get-focus-inline-object.js";
@@ -15,7 +15,7 @@ const getAnchorBlock = (snapshot) => {
15
15
  } : void 0;
16
16
  }, getAnchorTextBlock = (snapshot) => {
17
17
  const anchorBlock = getAnchorBlock(snapshot);
18
- return anchorBlock && isPortableTextTextBlock(anchorBlock.node) ? {
18
+ return anchorBlock && isTextBlock(snapshot.context, anchorBlock.node) ? {
19
19
  node: anchorBlock.node,
20
20
  path: anchorBlock.path
21
21
  } : void 0;
@@ -43,10 +43,10 @@ const getAnchorBlock = (snapshot) => {
43
43
  if (!selectionStartPoint || !selectionEndPoint)
44
44
  return;
45
45
  const start = spanSelectionPointToBlockOffset({
46
- value: snapshot.context.value,
46
+ context: snapshot.context,
47
47
  selectionPoint: selectionStartPoint
48
48
  }), end = spanSelectionPointToBlockOffset({
49
- value: snapshot.context.value,
49
+ context: snapshot.context,
50
50
  selectionPoint: selectionEndPoint
51
51
  });
52
52
  return start && end ? {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/selectors/selector.get-anchor-block.ts","../../src/selectors/selector.get-anchor-text-block.ts","../../src/selectors/selector.get-anchor-child.ts","../../src/selectors/selector.get-anchor-span.ts","../../src/selectors/selector.get-block-offsets.ts","../../src/selectors/selector.get-selection.ts","../../src/selectors/selector.get-value.ts"],"sourcesContent":["import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\n\n/**\n * @public\n */\nexport const getAnchorBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n","import {\n isPortableTextTextBlock,\n type KeyedSegment,\n type PortableTextTextBlock,\n} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorBlock} from './selector.get-anchor-block'\n\n/**\n * @public\n */\nexport const getAnchorTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorBlock(snapshot)\n\n return anchorBlock && isPortableTextTextBlock(anchorBlock.node)\n ? {node: anchorBlock.node, path: anchorBlock.path}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport type {PortableTextObject, PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\nimport {getAnchorTextBlock} from './selector.get-anchor-text-block'\n\n/**\n * @public\n */\nexport const getAnchorChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorTextBlock(snapshot)\n\n if (!anchorBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[2])\n ? snapshot.context.selection.anchor.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? anchorBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...anchorBlock.path, 'children', {_key: key}]}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport {isPortableTextSpan, type PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorChild} from './selector.get-anchor-child'\n\n/**\n * @public\n */\nexport const getAnchorSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const anchorChild = getAnchorChild(snapshot)\n\n return anchorChild && isPortableTextSpan(anchorChild.node)\n ? {node: anchorChild.node, path: anchorChild.path}\n : undefined\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport * as utils from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\n\n/**\n * @public\n */\nexport const getBlockOffsets: EditorSelector<\n {start: BlockOffset; end: BlockOffset} | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (!selectionStartPoint || !selectionEndPoint) {\n return undefined\n }\n\n const start = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionStartPoint,\n })\n const end = utils.spanSelectionPointToBlockOffset({\n value: snapshot.context.value,\n selectionPoint: selectionEndPoint,\n })\n\n return start && end ? {start, end} : undefined\n}\n","import type {EditorSelection} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelection: EditorSelector<EditorSelection> = (snapshot) => {\n return snapshot.context.selection\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getValue: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return snapshot.context.value\n}\n"],"names":["getAnchorBlock","snapshot","key","context","selection","isKeyedSegment","anchor","path","_key","undefined","node","value","find","block","getAnchorTextBlock","anchorBlock","isPortableTextTextBlock","getAnchorChild","children","span","getAnchorSpan","anchorChild","isPortableTextSpan","getBlockOffsets","selectionStartPoint","getSelectionStartPoint","selectionEndPoint","getSelectionEndPoint","start","utils","selectionPoint","end","getSelection","getValue"],"mappings":";;;;;;;AAOO,MAAMA,iBAERC,CAAa,aAAA;AAChB,QAAMC,MAAMD,SAASE,QAAQC,aACzBC,eAAeJ,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,CAAC,IACtDN,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,EAAEC,OAE5CC,QAEEC,OAAOR,MACTD,SAASE,QAAQQ,MAAMC,KAAMC,CAAAA,UAAUA,MAAML,SAASN,GAAG,IACzDO;AAEJ,SAAOC,QAAQR,MAAM;AAAA,IAACQ;AAAAA,IAAMH,MAAM,CAAC;AAAA,MAACC,MAAMN;AAAAA,IAAI,CAAA;AAAA,EAAA,IAAKO;AACrD,GCVaK,qBAERb,CAAa,aAAA;AACVc,QAAAA,cAAcf,eAAe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EAAAA,CACjB;AAED,SAAOE,SAASG,MAAM;AAAA,IAACH;AAAAA,IAAOG;AAAAA,EAAAA,IAAOtB;AACvC,GC3BauB,eAAiD/B,CACrDA,aAAAA,SAASE,QAAQC,WCDb6B,WACXhC,CAEOA,aAAAA,SAASE,QAAQQ;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/selectors/selector.get-anchor-block.ts","../../src/selectors/selector.get-anchor-text-block.ts","../../src/selectors/selector.get-anchor-child.ts","../../src/selectors/selector.get-anchor-span.ts","../../src/selectors/selector.get-block-offsets.ts","../../src/selectors/selector.get-selection.ts","../../src/selectors/selector.get-value.ts"],"sourcesContent":["import type {KeyedSegment, PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\n\n/**\n * @public\n */\nexport const getAnchorBlock: EditorSelector<\n {node: PortableTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[0])\n ? snapshot.context.selection.anchor.path[0]._key\n : undefined\n : undefined\n\n const node = key\n ? snapshot.context.value.find((block) => block._key === key)\n : undefined\n\n return node && key ? {node, path: [{_key: key}]} : undefined\n}\n","import type {KeyedSegment, PortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isTextBlock} from '../internal-utils/parse-blocks'\nimport {getAnchorBlock} from './selector.get-anchor-block'\n\n/**\n * @public\n */\nexport const getAnchorTextBlock: EditorSelector<\n {node: PortableTextTextBlock; path: [KeyedSegment]} | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorBlock(snapshot)\n\n return anchorBlock && isTextBlock(snapshot.context, anchorBlock.node)\n ? {node: anchorBlock.node, path: anchorBlock.path}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport type {PortableTextObject, PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {isKeyedSegment} from '../utils'\nimport {getAnchorTextBlock} from './selector.get-anchor-text-block'\n\n/**\n * @public\n */\nexport const getAnchorChild: EditorSelector<\n | {\n node: PortableTextObject | PortableTextSpan\n path: [KeyedSegment, 'children', KeyedSegment]\n }\n | undefined\n> = (snapshot) => {\n const anchorBlock = getAnchorTextBlock(snapshot)\n\n if (!anchorBlock) {\n return undefined\n }\n\n const key = snapshot.context.selection\n ? isKeyedSegment(snapshot.context.selection.anchor.path[2])\n ? snapshot.context.selection.anchor.path[2]._key\n : undefined\n : undefined\n\n const node = key\n ? anchorBlock.node.children.find((span) => span._key === key)\n : undefined\n\n return node && key\n ? {node, path: [...anchorBlock.path, 'children', {_key: key}]}\n : undefined\n}\n","import type {KeyedSegment} from '@portabletext/patches'\nimport {isPortableTextSpan, type PortableTextSpan} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\nimport {getAnchorChild} from './selector.get-anchor-child'\n\n/**\n * @public\n */\nexport const getAnchorSpan: EditorSelector<\n | {node: PortableTextSpan; path: [KeyedSegment, 'children', KeyedSegment]}\n | undefined\n> = (snapshot) => {\n const anchorChild = getAnchorChild(snapshot)\n\n return anchorChild && isPortableTextSpan(anchorChild.node)\n ? {node: anchorChild.node, path: anchorChild.path}\n : undefined\n}\n","import type {EditorSelector} from '../editor/editor-selector'\nimport type {BlockOffset} from '../types/block-offset'\nimport * as utils from '../utils'\nimport {getSelectionEndPoint} from './selector.get-selection-end-point'\nimport {getSelectionStartPoint} from './selector.get-selection-start-point'\n\n/**\n * @public\n */\nexport const getBlockOffsets: EditorSelector<\n {start: BlockOffset; end: BlockOffset} | undefined\n> = (snapshot) => {\n if (!snapshot.context.selection) {\n return undefined\n }\n\n const selectionStartPoint = getSelectionStartPoint(snapshot)\n const selectionEndPoint = getSelectionEndPoint(snapshot)\n\n if (!selectionStartPoint || !selectionEndPoint) {\n return undefined\n }\n\n const start = utils.spanSelectionPointToBlockOffset({\n context: snapshot.context,\n selectionPoint: selectionStartPoint,\n })\n const end = utils.spanSelectionPointToBlockOffset({\n context: snapshot.context,\n selectionPoint: selectionEndPoint,\n })\n\n return start && end ? {start, end} : undefined\n}\n","import type {EditorSelection} from '..'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getSelection: EditorSelector<EditorSelection> = (snapshot) => {\n return snapshot.context.selection\n}\n","import type {PortableTextBlock} from '@sanity/types'\nimport type {EditorSelector} from '../editor/editor-selector'\n\n/**\n * @public\n */\nexport const getValue: EditorSelector<Array<PortableTextBlock>> = (\n snapshot,\n) => {\n return snapshot.context.value\n}\n"],"names":["getAnchorBlock","snapshot","key","context","selection","isKeyedSegment","anchor","path","_key","undefined","node","value","find","block","getAnchorTextBlock","anchorBlock","isTextBlock","getAnchorChild","children","span","getAnchorSpan","anchorChild","isPortableTextSpan","getBlockOffsets","selectionStartPoint","getSelectionStartPoint","selectionEndPoint","getSelectionEndPoint","start","utils","selectionPoint","end","getSelection","getValue"],"mappings":";;;;;;;AAOO,MAAMA,iBAERC,CAAa,aAAA;AAChB,QAAMC,MAAMD,SAASE,QAAQC,aACzBC,eAAeJ,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,CAAC,IACtDN,SAASE,QAAQC,UAAUE,OAAOC,KAAK,CAAC,EAAEC,OAE5CC,QAEEC,OAAOR,MACTD,SAASE,QAAQQ,MAAMC,KAAMC,CAAAA,UAAUA,MAAML,SAASN,GAAG,IACzDO;AAEJ,SAAOC,QAAQR,MAAM;AAAA,IAACQ;AAAAA,IAAMH,MAAM,CAAC;AAAA,MAACC,MAAMN;AAAAA,IAAI,CAAA;AAAA,EAAA,IAAKO;AACrD,GCbaK,qBAERb,CAAa,aAAA;AACVc,QAAAA,cAAcf,eAAeC,QAAQ;AAE3C,SAAOc,eAAeC,YAAYf,SAASE,SAASY,YAAYL,IAAI,IAChE;AAAA,IAACA,MAAMK,YAAYL;AAAAA,IAAMH,MAAMQ,YAAYR;AAAAA,EAAAA,IAC3CE;AACN,GCPaQ,i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QAAQQ;"}
@@ -13,31 +13,37 @@ function splitTextBlock({
13
13
  if (!firstChild || !lastChild)
14
14
  return;
15
15
  const before = util_sliceBlocks.sliceBlocks({
16
- blocks: [block],
17
- selection: {
18
- anchor: {
19
- path: [{
20
- _key: block._key
21
- }, "children", {
22
- _key: firstChild._key
23
- }],
24
- offset: 0
25
- },
26
- focus: point
27
- }
16
+ context: {
17
+ schema: context.schema,
18
+ selection: {
19
+ anchor: {
20
+ path: [{
21
+ _key: block._key
22
+ }, "children", {
23
+ _key: firstChild._key
24
+ }],
25
+ offset: 0
26
+ },
27
+ focus: point
28
+ }
29
+ },
30
+ blocks: [block]
28
31
  }).at(0), after = util_sliceBlocks.sliceBlocks({
29
- blocks: [block],
30
- selection: {
31
- anchor: point,
32
- focus: {
33
- path: [{
34
- _key: block._key
35
- }, "children", {
36
- _key: lastChild._key
37
- }],
38
- offset: util_sliceBlocks.isSpan(context, lastChild) ? lastChild.text.length : 0
32
+ context: {
33
+ schema: context.schema,
34
+ selection: {
35
+ anchor: point,
36
+ focus: {
37
+ path: [{
38
+ _key: block._key
39
+ }, "children", {
40
+ _key: lastChild._key
41
+ }],
42
+ offset: util_sliceBlocks.isSpan$1(context, lastChild) ? lastChild.text.length : 0
43
+ }
39
44
  }
40
- }
45
+ },
46
+ blocks: [block]
41
47
  }).at(0);
42
48
  if (!(!before || !after) && !(!util_mergeTextBlocks.isTextBlock(context, before) || !util_mergeTextBlocks.isTextBlock(context, after)))
43
49
  return {
@@ -52,7 +58,7 @@ exports.getTextBlockText = util_sliceBlocks.getTextBlockText;
52
58
  exports.isEmptyTextBlock = util_sliceBlocks.isEmptyTextBlock;
53
59
  exports.isEqualSelectionPoints = util_sliceBlocks.isEqualSelectionPoints;
54
60
  exports.isKeyedSegment = util_sliceBlocks.isKeyedSegment;
55
- exports.isSpan = util_sliceBlocks.isSpan;
61
+ exports.isSpan = util_sliceBlocks.isSpan$1;
56
62
  exports.reverseSelection = util_sliceBlocks.reverseSelection;
57
63
  exports.sliceBlocks = util_sliceBlocks.sliceBlocks;
58
64
  exports.spanSelectionPointToBlockOffset = util_sliceBlocks.spanSelectionPointToBlockOffset;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../src/utils/util.is-equal-selections.ts","../../src/utils/util.split-text-block.ts"],"sourcesContent":["import type {EditorSelection} from '../types/editor'\nimport {isEqualSelectionPoints} from './util.is-equal-selection-points'\n\n/**\n * @public\n */\nexport function isEqualSelections(a: EditorSelection, b: EditorSelection) {\n if (!a && !b) {\n return true\n }\n\n if (!a || !b) {\n return false\n }\n\n return (\n isEqualSelectionPoints(a.anchor, b.anchor) &&\n isEqualSelectionPoints(a.focus, b.focus)\n )\n}\n","import type {PortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelectionPoint} from '..'\nimport type {EditorContext} from '../editor/editor-snapshot'\nimport {isSpan} from './util.is-span'\nimport {isTextBlock} from './util.is-text-block'\nimport {sliceBlocks} from './util.slice-blocks'\n\n/**\n * @beta\n */\nexport function splitTextBlock({\n context,\n block,\n point,\n}: {\n context: Pick<EditorContext, 'schema'>\n block: PortableTextTextBlock\n point: EditorSelectionPoint\n}): {before: PortableTextTextBlock; after: PortableTextTextBlock} | undefined {\n const firstChild = block.children.at(0)\n const lastChild = block.children.at(block.children.length - 1)\n\n if (!firstChild || !lastChild) {\n return undefined\n }\n\n const before = sliceBlocks({\n blocks: [block],\n selection: {\n anchor: {\n path: [{_key: block._key}, 'children', {_key: firstChild._key}],\n offset: 0,\n },\n focus: point,\n },\n }).at(0)\n const after = sliceBlocks({\n blocks: [block],\n selection: {\n anchor: point,\n focus: {\n path: [{_key: block._key}, 'children', {_key: lastChild._key}],\n offset: isSpan(context, lastChild) ? lastChild.text.length : 0,\n },\n },\n }).at(0)\n\n if (!before || !after) {\n return undefined\n }\n\n if (!isTextBlock(context, before) || !isTextBlock(context, after)) {\n return undefined\n }\n\n return {before, after}\n}\n"],"names":["isEqualSelections","a","b","isEqualSelectionPoints","anchor","focus","splitTextBlock","context","block","point","firstChild","children","at","lastChild","length","before","sliceBlocks","blocks","selection","path","_key","offset","after","isSpan","text","isTextBlock"],"mappings":";;;AAMgBA,SAAAA,kBAAkBC,GAAoBC,GAAoB;AACpE,SAAA,CAACD,KAAK,CAACC,IACF,KAGL,CAACD,KAAK,CAACC,IACF,KAIPC,iBAAAA,uBAAuBF,EAAEG,QAAQF,EAAEE,MAAM,KACzCD,wCAAuBF,EAAEI,OAAOH,EAAEG,KAAK;AAE3C;ACTO,SAASC,eAAe;AAAA,EAC7BC;AAAAA,EACAC;AAAAA,EACAC;AAKF,GAA8E;AAC5E,QAAMC,aAAaF,MAAMG,SAASC,GAAG,CAAC,GAChCC,YAAYL,MAAMG,SAASC,GAAGJ,MAAMG,SAASG,SAAS,CAAC;AAEzD,MAAA,CAACJ,cAAc,CAACG;AAClB;AAGF,QAAME,SAASC,iBAAAA,YAAY;AAAA,IACzBC,QAAQ,CAACT,KAAK;AAAA,IACdU,WAAW;AAAA,MACTd,QAAQ;AAAA,QACNe,MAAM,CAAC;AAAA,UAACC,MAAMZ,MAAMY;AAAAA,WAAO,YAAY;AAAA,UAACA,MAAMV,WAAWU;AAAAA,QAAAA,CAAK;AAAA,QAC9DC,QAAQ;AAAA,MACV;AAAA,MACAhB,OAAOI;AAAAA,IAAAA;AAAAA,EAEV,CAAA,EAAEG,GAAG,CAAC,GACDU,QAAQN,iBAAAA,YAAY;AAAA,IACxBC,QAAQ,CAACT,KAAK;AAAA,IACdU,WAAW;AAAA,MACTd,QAAQK;AAAAA,MACRJ,OAAO;AAAA,QACLc,MAAM,CAAC;AAAA,UAACC,MAAMZ,MAAMY;AAAAA,WAAO,YAAY;AAAA,UAACA,MAAMP,UAAUO;AAAAA,QAAAA,CAAK;AAAA,QAC7DC,QAAQE,iBAAOhB,OAAAA,SAASM,SAAS,IAAIA,UAAUW,KAAKV,SAAS;AAAA,MAAA;AAAA,IAC/D;AAAA,EACF,CACD,EAAEF,GAAG,CAAC;AAEP,MAAI,EAACG,CAAAA,UAAU,CAACO,UAIZ,EAACG,CAAAA,qBAAAA,YAAYlB,SAASQ,MAAM,KAAK,CAACU,qBAAYlB,YAAAA,SAASe,KAAK;AAIzD,WAAA;AAAA,MAACP;AAAAA,MAAQO;AAAAA,IAAK;AACvB;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../src/utils/util.is-equal-selections.ts","../../src/utils/util.split-text-block.ts"],"sourcesContent":["import type {EditorSelection} from '../types/editor'\nimport {isEqualSelectionPoints} from './util.is-equal-selection-points'\n\n/**\n * @public\n */\nexport function isEqualSelections(a: EditorSelection, b: EditorSelection) {\n if (!a && !b) {\n return true\n }\n\n if (!a || !b) {\n return false\n }\n\n return (\n isEqualSelectionPoints(a.anchor, b.anchor) &&\n isEqualSelectionPoints(a.focus, b.focus)\n )\n}\n","import type {PortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelectionPoint} from '..'\nimport type {EditorContext} from '../editor/editor-snapshot'\nimport {isSpan} from './util.is-span'\nimport {isTextBlock} from './util.is-text-block'\nimport {sliceBlocks} from './util.slice-blocks'\n\n/**\n * @beta\n */\nexport function splitTextBlock({\n context,\n block,\n point,\n}: {\n context: Pick<EditorContext, 'schema'>\n block: PortableTextTextBlock\n point: EditorSelectionPoint\n}): {before: PortableTextTextBlock; after: PortableTextTextBlock} | undefined {\n const firstChild = block.children.at(0)\n const lastChild = block.children.at(block.children.length - 1)\n\n if (!firstChild || !lastChild) {\n return undefined\n }\n\n const before = sliceBlocks({\n context: {\n schema: context.schema,\n selection: {\n anchor: {\n path: [{_key: block._key}, 'children', {_key: firstChild._key}],\n offset: 0,\n },\n focus: point,\n },\n },\n blocks: [block],\n }).at(0)\n const after = sliceBlocks({\n context: {\n schema: context.schema,\n selection: {\n anchor: point,\n focus: {\n path: [{_key: block._key}, 'children', {_key: lastChild._key}],\n offset: isSpan(context, lastChild) ? lastChild.text.length : 0,\n },\n },\n },\n blocks: [block],\n }).at(0)\n\n if (!before || !after) {\n return undefined\n }\n\n if (!isTextBlock(context, before) || !isTextBlock(context, after)) {\n return undefined\n }\n\n return {before, after}\n}\n"],"names":["isEqualSelections","a","b","isEqualSelectionPoints","anchor","focus","splitTextBlock","context","block","point","firstChild","children","at","lastChild","length","before","sliceBlocks","schema","selection","path","_key","offset","blocks","after","isSpan","text","isTextBlock"],"mappings":";;;AAMgBA,SAAAA,kBAAkBC,GAAoBC,GAAoB;AACpE,SAAA,CAACD,KAAK,CAACC,IACF,KAGL,CAACD,KAAK,CAACC,IACF,KAIPC,iBAAAA,uBAAuBF,EAAEG,QAAQF,EAAEE,MAAM,KACzCD,wCAAuBF,EAAEI,OAAOH,EAAEG,KAAK;AAE3C;ACTO,SAASC,eAAe;AAAA,EAC7BC;AAAAA,EACAC;AAAAA,EACAC;AAKF,GAA8E;AAC5E,QAAMC,aAAaF,MAAMG,SAASC,GAAG,CAAC,GAChCC,YAAYL,MAAMG,SAASC,GAAGJ,MAAMG,SAASG,SAAS,CAAC;AAEzD,MAAA,CAACJ,cAAc,CAACG;AAClB;AAGF,QAAME,SAASC,iBAAAA,YAAY;AAAA,IACzBT,SAAS;AAAA,MACPU,QAAQV,QAAQU;AAAAA,MAChBC,WAAW;AAAA,QACTd,QAAQ;AAAA,UACNe,MAAM,CAAC;AAAA,YAACC,MAAMZ,MAAMY;AAAAA,aAAO,YAAY;AAAA,YAACA,MAAMV,WAAWU;AAAAA,UAAAA,CAAK;AAAA,UAC9DC,QAAQ;AAAA,QACV;AAAA,QACAhB,OAAOI;AAAAA,MAAAA;AAAAA,IAEX;AAAA,IACAa,QAAQ,CAACd,KAAK;AAAA,EACf,CAAA,EAAEI,GAAG,CAAC,GACDW,QAAQP,iBAAAA,YAAY;AAAA,IACxBT,SAAS;AAAA,MACPU,QAAQV,QAAQU;AAAAA,MAChBC,WAAW;AAAA,QACTd,QAAQK;AAAAA,QACRJ,OAAO;AAAA,UACLc,MAAM,CAAC;AAAA,YAACC,MAAMZ,MAAMY;AAAAA,aAAO,YAAY;AAAA,YAACA,MAAMP,UAAUO;AAAAA,UAAAA,CAAK;AAAA,UAC7DC,QAAQG,iBAAOjB,SAAAA,SAASM,SAAS,IAAIA,UAAUY,KAAKX,SAAS;AAAA,QAAA;AAAA,MAC/D;AAAA,IAEJ;AAAA,IACAQ,QAAQ,CAACd,KAAK;AAAA,EAAA,CACf,EAAEI,GAAG,CAAC;AAEP,MAAI,EAACG,CAAAA,UAAU,CAACQ,UAIZ,EAACG,CAAAA,qBAAAA,YAAYnB,SAASQ,MAAM,KAAK,CAACW,qBAAYnB,YAAAA,SAASgB,KAAK;AAIzD,WAAA;AAAA,MAACR;AAAAA,MAAQQ;AAAAA,IAAK;AACvB;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,18 +4,15 @@ import type {
4
4
  BlockDecoratorDefinition,
5
5
  BlockListDefinition,
6
6
  BlockStyleDefinition,
7
+ KeyedSegment,
7
8
  ObjectSchemaType,
8
9
  Path,
10
+ PortableTextBlock,
9
11
  PortableTextChild,
10
12
  PortableTextListBlock,
11
13
  PortableTextTextBlock,
12
14
  } from '@sanity/types'
13
- import {
14
- KeyedSegment,
15
- PortableTextBlock,
16
- PortableTextObject,
17
- PortableTextSpan,
18
- } from '@sanity/types'
15
+ import {PortableTextObject, PortableTextSpan} from '@sanity/types'
19
16
  import type {
20
17
  FocusEvent as FocusEvent_2,
21
18
  KeyboardEvent as KeyboardEvent_2,
@@ -321,11 +318,11 @@ declare type BlockOffset = {
321
318
  * @public
322
319
  */
323
320
  export declare function blockOffsetsToSelection({
324
- value,
321
+ context,
325
322
  offsets,
326
323
  backward,
327
324
  }: {
328
- value: Array<PortableTextBlock>
325
+ context: Pick<EditorContext, 'schema' | 'value'>
329
326
  offsets: {
330
327
  anchor: BlockOffset
331
328
  focus: BlockOffset
@@ -337,10 +334,10 @@ export declare function blockOffsetsToSelection({
337
334
  * @public
338
335
  */
339
336
  export declare function blockOffsetToBlockSelectionPoint({
340
- value,
337
+ context,
341
338
  blockOffset,
342
339
  }: {
343
- value: Array<PortableTextBlock>
340
+ context: Pick<EditorContext, 'value'>
344
341
  blockOffset: BlockOffset
345
342
  }): EditorSelectionPoint | undefined
346
343
 
@@ -348,11 +345,11 @@ export declare function blockOffsetToBlockSelectionPoint({
348
345
  * @public
349
346
  */
350
347
  export declare function blockOffsetToSelectionPoint({
351
- value,
348
+ context,
352
349
  blockOffset,
353
350
  direction,
354
351
  }: {
355
- value: Array<PortableTextBlock>
352
+ context: Pick<EditorContext, 'schema' | 'value'>
356
353
  blockOffset: BlockOffset
357
354
  direction: 'forward' | 'backward'
358
355
  }): EditorSelectionPoint | undefined
@@ -361,11 +358,11 @@ export declare function blockOffsetToSelectionPoint({
361
358
  * @public
362
359
  */
363
360
  export declare function blockOffsetToSpanSelectionPoint({
364
- value,
361
+ context,
365
362
  blockOffset,
366
363
  direction,
367
364
  }: {
368
- value: Array<PortableTextBlock>
365
+ context: Pick<EditorContext, 'schema' | 'value'>
369
366
  blockOffset: BlockOffset
370
367
  direction: 'forward' | 'backward'
371
368
  }):
@@ -383,10 +380,10 @@ declare type BlockWithOptionalKey =
383
380
  * @public
384
381
  */
385
382
  export declare function childSelectionPointToBlockOffset({
386
- value,
383
+ context,
387
384
  selectionPoint,
388
385
  }: {
389
- value: Array<PortableTextBlock>
386
+ context: Pick<EditorContext, 'schema' | 'value'>
390
387
  selectionPoint: EditorSelectionPoint
391
388
  }): BlockOffset | undefined
392
389
 
@@ -5214,22 +5211,28 @@ declare type ExtractNamespace<TType extends string> =
5214
5211
  * @public
5215
5212
  */
5216
5213
  export declare function getBlockEndPoint({
5217
- node,
5218
- path,
5214
+ context,
5215
+ block,
5219
5216
  }: {
5220
- node: PortableTextBlock
5221
- path: [KeyedSegment]
5217
+ context: Pick<EditorContext, 'schema'>
5218
+ block: {
5219
+ node: PortableTextBlock
5220
+ path: [KeyedSegment]
5221
+ }
5222
5222
  }): EditorSelectionPoint
5223
5223
 
5224
5224
  /**
5225
5225
  * @public
5226
5226
  */
5227
5227
  export declare function getBlockStartPoint({
5228
- node,
5229
- path,
5228
+ context,
5229
+ block,
5230
5230
  }: {
5231
- node: PortableTextBlock
5232
- path: [KeyedSegment]
5231
+ context: Pick<EditorContext, 'schema'>
5232
+ block: {
5233
+ node: PortableTextBlock
5234
+ path: [KeyedSegment]
5235
+ }
5233
5236
  }): EditorSelectionPoint
5234
5237
 
5235
5238
  /**
@@ -5322,7 +5325,10 @@ declare type InvalidValueResolution = {
5322
5325
  /**
5323
5326
  * @public
5324
5327
  */
5325
- export declare function isEmptyTextBlock(block: PortableTextBlock): boolean
5328
+ export declare function isEmptyTextBlock(
5329
+ context: Pick<EditorContext, 'schema'>,
5330
+ block: PortableTextBlock,
5331
+ ): boolean
5326
5332
 
5327
5333
  /**
5328
5334
  * @public
@@ -5584,10 +5590,10 @@ export declare function reverseSelection<
5584
5590
  * @public
5585
5591
  */
5586
5592
  export declare function selectionPointToBlockOffset({
5587
- value,
5593
+ context,
5588
5594
  selectionPoint,
5589
5595
  }: {
5590
- value: Array<PortableTextBlock>
5596
+ context: Pick<EditorContext, 'schema' | 'value'>
5591
5597
  selectionPoint: EditorSelectionPoint
5592
5598
  }): BlockOffset | undefined
5593
5599
 
@@ -5607,21 +5613,21 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
5607
5613
  * @public
5608
5614
  */
5609
5615
  export declare function sliceBlocks({
5616
+ context,
5610
5617
  blocks,
5611
- selection,
5612
5618
  }: {
5619
+ context: Pick<EditorContext, 'schema' | 'selection'>
5613
5620
  blocks: Array<PortableTextBlock>
5614
- selection: EditorSelection
5615
5621
  }): Array<PortableTextBlock>
5616
5622
 
5617
5623
  /**
5618
5624
  * @public
5619
5625
  */
5620
5626
  export declare function spanSelectionPointToBlockOffset({
5621
- value,
5627
+ context,
5622
5628
  selectionPoint,
5623
5629
  }: {
5624
- value: Array<PortableTextBlock>
5630
+ context: Pick<EditorContext, 'schema' | 'value'>
5625
5631
  selectionPoint: EditorSelectionPoint
5626
5632
  }): BlockOffset | undefined
5627
5633
 
@@ -4,18 +4,15 @@ import type {
4
4
  BlockDecoratorDefinition,
5
5
  BlockListDefinition,
6
6
  BlockStyleDefinition,
7
+ KeyedSegment,
7
8
  ObjectSchemaType,
8
9
  Path,
10
+ PortableTextBlock,
9
11
  PortableTextChild,
10
12
  PortableTextListBlock,
11
13
  PortableTextTextBlock,
12
14
  } from '@sanity/types'
13
- import {
14
- KeyedSegment,
15
- PortableTextBlock,
16
- PortableTextObject,
17
- PortableTextSpan,
18
- } from '@sanity/types'
15
+ import {PortableTextObject, PortableTextSpan} from '@sanity/types'
19
16
  import type {
20
17
  FocusEvent as FocusEvent_2,
21
18
  KeyboardEvent as KeyboardEvent_2,
@@ -321,11 +318,11 @@ declare type BlockOffset = {
321
318
  * @public
322
319
  */
323
320
  export declare function blockOffsetsToSelection({
324
- value,
321
+ context,
325
322
  offsets,
326
323
  backward,
327
324
  }: {
328
- value: Array<PortableTextBlock>
325
+ context: Pick<EditorContext, 'schema' | 'value'>
329
326
  offsets: {
330
327
  anchor: BlockOffset
331
328
  focus: BlockOffset
@@ -337,10 +334,10 @@ export declare function blockOffsetsToSelection({
337
334
  * @public
338
335
  */
339
336
  export declare function blockOffsetToBlockSelectionPoint({
340
- value,
337
+ context,
341
338
  blockOffset,
342
339
  }: {
343
- value: Array<PortableTextBlock>
340
+ context: Pick<EditorContext, 'value'>
344
341
  blockOffset: BlockOffset
345
342
  }): EditorSelectionPoint | undefined
346
343
 
@@ -348,11 +345,11 @@ export declare function blockOffsetToBlockSelectionPoint({
348
345
  * @public
349
346
  */
350
347
  export declare function blockOffsetToSelectionPoint({
351
- value,
348
+ context,
352
349
  blockOffset,
353
350
  direction,
354
351
  }: {
355
- value: Array<PortableTextBlock>
352
+ context: Pick<EditorContext, 'schema' | 'value'>
356
353
  blockOffset: BlockOffset
357
354
  direction: 'forward' | 'backward'
358
355
  }): EditorSelectionPoint | undefined
@@ -361,11 +358,11 @@ export declare function blockOffsetToSelectionPoint({
361
358
  * @public
362
359
  */
363
360
  export declare function blockOffsetToSpanSelectionPoint({
364
- value,
361
+ context,
365
362
  blockOffset,
366
363
  direction,
367
364
  }: {
368
- value: Array<PortableTextBlock>
365
+ context: Pick<EditorContext, 'schema' | 'value'>
369
366
  blockOffset: BlockOffset
370
367
  direction: 'forward' | 'backward'
371
368
  }):
@@ -383,10 +380,10 @@ declare type BlockWithOptionalKey =
383
380
  * @public
384
381
  */
385
382
  export declare function childSelectionPointToBlockOffset({
386
- value,
383
+ context,
387
384
  selectionPoint,
388
385
  }: {
389
- value: Array<PortableTextBlock>
386
+ context: Pick<EditorContext, 'schema' | 'value'>
390
387
  selectionPoint: EditorSelectionPoint
391
388
  }): BlockOffset | undefined
392
389
 
@@ -5214,22 +5211,28 @@ declare type ExtractNamespace<TType extends string> =
5214
5211
  * @public
5215
5212
  */
5216
5213
  export declare function getBlockEndPoint({
5217
- node,
5218
- path,
5214
+ context,
5215
+ block,
5219
5216
  }: {
5220
- node: PortableTextBlock
5221
- path: [KeyedSegment]
5217
+ context: Pick<EditorContext, 'schema'>
5218
+ block: {
5219
+ node: PortableTextBlock
5220
+ path: [KeyedSegment]
5221
+ }
5222
5222
  }): EditorSelectionPoint
5223
5223
 
5224
5224
  /**
5225
5225
  * @public
5226
5226
  */
5227
5227
  export declare function getBlockStartPoint({
5228
- node,
5229
- path,
5228
+ context,
5229
+ block,
5230
5230
  }: {
5231
- node: PortableTextBlock
5232
- path: [KeyedSegment]
5231
+ context: Pick<EditorContext, 'schema'>
5232
+ block: {
5233
+ node: PortableTextBlock
5234
+ path: [KeyedSegment]
5235
+ }
5233
5236
  }): EditorSelectionPoint
5234
5237
 
5235
5238
  /**
@@ -5322,7 +5325,10 @@ declare type InvalidValueResolution = {
5322
5325
  /**
5323
5326
  * @public
5324
5327
  */
5325
- export declare function isEmptyTextBlock(block: PortableTextBlock): boolean
5328
+ export declare function isEmptyTextBlock(
5329
+ context: Pick<EditorContext, 'schema'>,
5330
+ block: PortableTextBlock,
5331
+ ): boolean
5326
5332
 
5327
5333
  /**
5328
5334
  * @public
@@ -5584,10 +5590,10 @@ export declare function reverseSelection<
5584
5590
  * @public
5585
5591
  */
5586
5592
  export declare function selectionPointToBlockOffset({
5587
- value,
5593
+ context,
5588
5594
  selectionPoint,
5589
5595
  }: {
5590
- value: Array<PortableTextBlock>
5596
+ context: Pick<EditorContext, 'schema' | 'value'>
5591
5597
  selectionPoint: EditorSelectionPoint
5592
5598
  }): BlockOffset | undefined
5593
5599
 
@@ -5607,21 +5613,21 @@ declare type Serializer<TMIMEType extends MIMEType> = ({
5607
5613
  * @public
5608
5614
  */
5609
5615
  export declare function sliceBlocks({
5616
+ context,
5610
5617
  blocks,
5611
- selection,
5612
5618
  }: {
5619
+ context: Pick<EditorContext, 'schema' | 'selection'>
5613
5620
  blocks: Array<PortableTextBlock>
5614
- selection: EditorSelection
5615
5621
  }): Array<PortableTextBlock>
5616
5622
 
5617
5623
  /**
5618
5624
  * @public
5619
5625
  */
5620
5626
  export declare function spanSelectionPointToBlockOffset({
5621
- value,
5627
+ context,
5622
5628
  selectionPoint,
5623
5629
  }: {
5624
- value: Array<PortableTextBlock>
5630
+ context: Pick<EditorContext, 'schema' | 'value'>
5625
5631
  selectionPoint: EditorSelectionPoint
5626
5632
  }): BlockOffset | undefined
5627
5633