@portabletext/editor 2.6.3 → 2.6.5

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 (133) hide show
  1. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs +29 -29
  2. package/lib/_chunks-cjs/selector.is-selecting-entire-blocks.cjs.map +1 -1
  3. package/lib/_chunks-cjs/selector.is-selection-expanded.cjs +5 -5
  4. package/lib/_chunks-cjs/selector.is-selection-expanded.cjs.map +1 -1
  5. package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs +3 -3
  6. package/lib/_chunks-cjs/util.child-selection-point-to-block-offset.cjs.map +1 -1
  7. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs +5 -5
  8. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +1 -1
  9. package/lib/_chunks-cjs/util.merge-text-blocks.cjs +2 -6
  10. package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
  11. package/lib/_chunks-cjs/util.slice-blocks.cjs +106 -117
  12. package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
  13. package/lib/_chunks-cjs/util.slice-text-block.cjs +3 -3
  14. package/lib/_chunks-cjs/util.slice-text-block.cjs.map +1 -1
  15. package/lib/_chunks-dts/behavior.types.action.d.ts +115 -115
  16. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js +3 -2
  17. package/lib/_chunks-es/selector.is-selecting-entire-blocks.js.map +1 -1
  18. package/lib/_chunks-es/selector.is-selection-expanded.js +3 -2
  19. package/lib/_chunks-es/selector.is-selection-expanded.js.map +1 -1
  20. package/lib/_chunks-es/util.child-selection-point-to-block-offset.js +2 -1
  21. package/lib/_chunks-es/util.child-selection-point-to-block-offset.js.map +1 -1
  22. package/lib/_chunks-es/util.is-selection-collapsed.js +2 -1
  23. package/lib/_chunks-es/util.is-selection-collapsed.js.map +1 -1
  24. package/lib/_chunks-es/util.merge-text-blocks.js +2 -5
  25. package/lib/_chunks-es/util.merge-text-blocks.js.map +1 -1
  26. package/lib/_chunks-es/util.slice-blocks.js +101 -112
  27. package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
  28. package/lib/_chunks-es/util.slice-text-block.js +2 -1
  29. package/lib/_chunks-es/util.slice-text-block.js.map +1 -1
  30. package/lib/index.cjs +133 -96
  31. package/lib/index.cjs.map +1 -1
  32. package/lib/index.js +43 -6
  33. package/lib/index.js.map +1 -1
  34. package/lib/plugins/index.cjs +5 -5
  35. package/lib/plugins/index.cjs.map +1 -1
  36. package/lib/plugins/index.d.cts +3 -3
  37. package/lib/plugins/index.d.ts +3 -3
  38. package/lib/plugins/index.js +6 -5
  39. package/lib/plugins/index.js.map +1 -1
  40. package/lib/selectors/index.cjs +3 -3
  41. package/lib/selectors/index.cjs.map +1 -1
  42. package/lib/selectors/index.js +2 -1
  43. package/lib/selectors/index.js.map +1 -1
  44. package/lib/utils/index.cjs +14 -4
  45. package/lib/utils/index.cjs.map +1 -1
  46. package/lib/utils/index.d.cts +2 -9
  47. package/lib/utils/index.d.ts +4 -11
  48. package/lib/utils/index.js +4 -3
  49. package/lib/utils/index.js.map +1 -1
  50. package/package.json +14 -13
  51. package/src/behaviors/behavior.abstract.delete.ts +1 -1
  52. package/src/behaviors/behavior.abstract.deserialize.ts +1 -1
  53. package/src/behaviors/behavior.abstract.split.ts +2 -1
  54. package/src/behaviors/behavior.core.block-objects.ts +1 -1
  55. package/src/behaviors/behavior.core.lists.ts +2 -1
  56. package/src/behaviors/behavior.markdown.ts +1 -1
  57. package/src/converters/converter.text-plain.ts +2 -1
  58. package/src/editor/__tests__/PortableTextEditor.test.tsx +1 -1
  59. package/src/editor/__tests__/RangeDecorations.test.tsx +1 -1
  60. package/src/editor/__tests__/self-solving.test.tsx +1 -1
  61. package/src/editor/components/render-element.tsx +1 -1
  62. package/src/editor/plugins/__tests__/withEditableAPIDelete.test.tsx +1 -1
  63. package/src/editor/plugins/__tests__/withEditableAPIGetFragment.test.tsx +2 -3
  64. package/src/editor/plugins/__tests__/withEditableAPIInsert.test.tsx +1 -1
  65. package/src/editor/plugins/__tests__/withEditableAPISelectionsOverlapping.test.tsx +1 -1
  66. package/src/editor/plugins/__tests__/withPortableTextLists.test.tsx +1 -1
  67. package/src/editor/plugins/__tests__/withPortableTextMarkModel.test.tsx +1 -1
  68. package/src/editor/plugins/__tests__/withPortableTextSelections.test.tsx +1 -1
  69. package/src/editor/plugins/__tests__/withUndoRedo.test.tsx +1 -1
  70. package/src/editor/plugins/createWithObjectKeys.ts +1 -1
  71. package/src/editor/plugins/createWithPortableTextMarkModel.ts +1 -1
  72. package/src/editor/plugins/createWithSchemaTypes.ts +2 -5
  73. package/src/internal-utils/__tests__/valueNormalization.test.tsx +1 -1
  74. package/src/internal-utils/apply-operation-to-portable-text.test.ts +1 -1
  75. package/src/internal-utils/build-index-maps.ts +1 -1
  76. package/src/internal-utils/create-test-snapshot.ts +1 -1
  77. package/src/internal-utils/drag-selection.test.ts +1 -1
  78. package/src/internal-utils/editor-selection.ts +1 -1
  79. package/src/internal-utils/operation-to-patches.ts +1 -1
  80. package/src/internal-utils/parse-blocks.test.ts +1 -1
  81. package/src/internal-utils/parse-blocks.ts +1 -38
  82. package/src/internal-utils/selection-focus-text.ts +1 -1
  83. package/src/internal-utils/selection-text.ts +1 -1
  84. package/src/internal-utils/test-editor.tsx +1 -1
  85. package/src/internal-utils/text-block-key.ts +1 -1
  86. package/src/internal-utils/text-marks.ts +1 -1
  87. package/src/internal-utils/text-selection.ts +1 -1
  88. package/src/internal-utils/to-slate-range.test.ts +1 -1
  89. package/src/internal-utils/to-slate-range.ts +1 -1
  90. package/src/internal-utils/validateValue.ts +1 -1
  91. package/src/internal-utils/value-annotations.ts +1 -1
  92. package/src/operations/behavior.operation.block.unset.ts +2 -1
  93. package/src/operations/behavior.operation.delete.ts +98 -2
  94. package/src/operations/behavior.operation.insert.block.ts +2 -1
  95. package/src/operations/behavior.operation.select.ts +5 -0
  96. package/src/plugins/plugin.behavior.tsx +3 -1
  97. package/src/plugins/plugin.internal.auto-close-brackets.test.tsx +1 -2
  98. package/src/plugins/plugin.markdown.test.tsx +1 -2
  99. package/src/selectors/selector.get-active-annotations.ts +1 -1
  100. package/src/selectors/selector.get-active-list-item.ts +1 -1
  101. package/src/selectors/selector.get-active-style.ts +1 -1
  102. package/src/selectors/selector.get-anchor-text-block.ts +1 -1
  103. package/src/selectors/selector.get-caret-word-selection.test.ts +1 -1
  104. package/src/selectors/selector.get-focus-block-object.ts +1 -1
  105. package/src/selectors/selector.get-focus-span.ts +1 -1
  106. package/src/selectors/selector.get-focus-text-block.ts +1 -1
  107. package/src/selectors/selector.get-list-state.ts +1 -1
  108. package/src/selectors/selector.get-next-span.ts +1 -1
  109. package/src/selectors/selector.get-previous-span.ts +1 -1
  110. package/src/selectors/selector.get-selected-spans.ts +1 -1
  111. package/src/selectors/selector.get-selected-text-blocks.ts +1 -1
  112. package/src/selectors/selector.get-selection-text.ts +1 -1
  113. package/src/selectors/selector.get-trimmed-selection.test.ts +1 -1
  114. package/src/selectors/selector.get-trimmed-selection.ts +1 -1
  115. package/src/selectors/selector.is-active-annotation.ts +1 -1
  116. package/src/selectors/selector.is-point-after-selection.ts +1 -1
  117. package/src/selectors/selector.is-point-before-selection.ts +1 -1
  118. package/src/utils/index.ts +1 -2
  119. package/src/utils/util.at-the-beginning-of-block.ts +1 -1
  120. package/src/utils/util.block-offset.ts +1 -1
  121. package/src/utils/util.child-selection-point-to-block-offset.ts +1 -1
  122. package/src/utils/util.get-block-end-point.ts +1 -1
  123. package/src/utils/util.get-block-start-point.ts +1 -1
  124. package/src/utils/util.is-empty-text-block.ts +1 -1
  125. package/src/utils/util.merge-text-blocks.ts +1 -1
  126. package/src/utils/util.slice-blocks.ts +2 -2
  127. package/src/utils/util.slice-text-block.ts +2 -2
  128. package/src/utils/util.split-text-block.ts +1 -1
  129. package/src/internal-utils/terse-pt.test.ts +0 -175
  130. package/src/internal-utils/terse-pt.ts +0 -150
  131. package/src/internal-utils/test-key-generator.ts +0 -9
  132. package/src/utils/util.is-span.ts +0 -12
  133. package/src/utils/util.is-text-block.ts +0 -13
@@ -1,6 +1,7 @@
1
1
  import { BlockOffset, BlockPath, ChildPath, EditorContext, EditorSelection, EditorSelectionPoint } from "../_chunks-dts/behavior.types.action.js";
2
- import * as _sanity_types8 from "@sanity/types";
3
- import { KeyedSegment, PortableTextBlock, PortableTextChild, PortableTextSpan, PortableTextTextBlock } from "@sanity/types";
2
+ import * as _sanity_types6 from "@sanity/types";
3
+ import { KeyedSegment, PortableTextBlock, PortableTextTextBlock } from "@sanity/types";
4
+ import { isSpan, isTextBlock } from "@portabletext/schema";
4
5
  /**
5
6
  * @public
6
7
  */
@@ -131,14 +132,6 @@ declare function isKeyedSegment(segment: unknown): segment is KeyedSegment;
131
132
  * @public
132
133
  */
133
134
  declare function isSelectionCollapsed(selection: EditorSelection): boolean;
134
- /**
135
- * @public
136
- */
137
- declare function isSpan(context: Pick<EditorContext, 'schema'>, child: PortableTextChild): child is PortableTextSpan;
138
- /**
139
- * @public
140
- */
141
- declare function isTextBlock(context: Pick<EditorContext, 'schema'>, block: unknown): block is PortableTextTextBlock;
142
135
  /**
143
136
  * @beta
144
137
  */
@@ -150,7 +143,7 @@ declare function mergeTextBlocks({
150
143
  context: Pick<EditorContext, 'keyGenerator' | 'schema'>;
151
144
  targetBlock: PortableTextTextBlock;
152
145
  incomingBlock: PortableTextTextBlock;
153
- }): PortableTextTextBlock<_sanity_types8.PortableTextObject | _sanity_types8.PortableTextSpan>;
146
+ }): PortableTextTextBlock<_sanity_types6.PortableTextObject | _sanity_types6.PortableTextSpan>;
154
147
  /**
155
148
  * @public
156
149
  */
@@ -1,9 +1,10 @@
1
- import { isSpan$1 as isSpan } from "../_chunks-es/util.slice-blocks.js";
2
1
  import { blockOffsetToSpanSelectionPoint, getBlockStartPoint, getSelectionEndPoint, getSelectionStartPoint, getTextBlockText, isKeyedSegment, sliceBlocks, spanSelectionPointToBlockOffset } from "../_chunks-es/util.slice-blocks.js";
3
2
  import { blockOffsetToBlockSelectionPoint, blockOffsetToSelectionPoint, blockOffsetsToSelection, childSelectionPointToBlockOffset } from "../_chunks-es/util.child-selection-point-to-block-offset.js";
4
3
  import { isEqualSelectionPoints } from "../_chunks-es/util.is-selection-collapsed.js";
5
4
  import { getBlockEndPoint, isEmptyTextBlock, isSelectionCollapsed } from "../_chunks-es/util.is-selection-collapsed.js";
6
- import { isTextBlock, mergeTextBlocks } from "../_chunks-es/util.merge-text-blocks.js";
5
+ import { isSpan } from "@portabletext/schema";
6
+ import { isSpan as isSpan2, isTextBlock } from "@portabletext/schema";
7
+ import { mergeTextBlocks } from "../_chunks-es/util.merge-text-blocks.js";
7
8
  import { sliceTextBlock } from "../_chunks-es/util.slice-text-block.js";
8
9
  import { selectionPointToBlockOffset } from "../_chunks-es/util.slice-text-block.js";
9
10
  function isEqualSelections(a, b) {
@@ -82,7 +83,7 @@ export {
82
83
  isEqualSelections,
83
84
  isKeyedSegment,
84
85
  isSelectionCollapsed,
85
- isSpan,
86
+ isSpan2 as isSpan,
86
87
  isTextBlock,
87
88
  mergeTextBlocks,
88
89
  reverseSelection,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/utils/util.is-equal-selections.ts","../../src/utils/util.reverse-selection.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 {EditorSelection} from '../types/editor'\n\n/**\n * @public\n */\nexport function reverseSelection<\n TEditorSelection extends NonNullable<EditorSelection> | null,\n>(selection: TEditorSelection): TEditorSelection {\n if (!selection) {\n return selection\n }\n\n if (selection.backward) {\n return {\n anchor: selection.focus,\n focus: selection.anchor,\n backward: false,\n } as TEditorSelection\n }\n\n return {\n anchor: selection.focus,\n focus: selection.anchor,\n backward: true,\n } as TEditorSelection\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 {sliceTextBlock} from './util.slice-text-block'\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 = sliceTextBlock({\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 block,\n })\n const after = sliceTextBlock({\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 block,\n })\n\n return {before, after}\n}\n"],"names":["isEqualSelections","a","b","isEqualSelectionPoints","anchor","focus","reverseSelection","selection","backward","splitTextBlock","context","block","point","firstChild","children","at","lastChild","length","before","sliceTextBlock","schema","path","_key","offset","after","isSpan","text"],"mappings":";;;;;;;;AAMO,SAASA,kBAAkBC,GAAoBC,GAAoB;AACxE,SAAI,CAACD,KAAK,CAACC,IACF,KAGL,CAACD,KAAK,CAACC,IACF,KAIPC,uBAAuBF,EAAEG,QAAQF,EAAEE,MAAM,KACzCD,uBAAuBF,EAAEI,OAAOH,EAAEG,KAAK;AAE3C;ACdO,SAASC,iBAEdC,WAA+C;AAC/C,SAAKA,cAIDA,UAAUC,WACL;AAAA,IACLJ,QAAQG,UAAUF;AAAAA,IAClBA,OAAOE,UAAUH;AAAAA,IACjBI,UAAU;AAAA,EAAA,IAIP;AAAA,IACLJ,QAAQG,UAAUF;AAAAA,IAClBA,OAAOE,UAAUH;AAAAA,IACjBI,UAAU;AAAA,EAAA;AAEd;AChBO,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;AAE7D,MAAI,CAACJ,cAAc,CAACG;AAClB;AAGF,QAAME,SAASC,eAAe;AAAA,IAC5BT,SAAS;AAAA,MACPU,QAAQV,QAAQU;AAAAA,MAChBb,WAAW;AAAA,QACTH,QAAQ;AAAA,UACNiB,MAAM,CAAC;AAAA,YAACC,MAAMX,MAAMW;AAAAA,UAAAA,GAAO,YAAY;AAAA,YAACA,MAAMT,WAAWS;AAAAA,UAAAA,CAAK;AAAA,UAC9DC,QAAQ;AAAA,QAAA;AAAA,QAEVlB,OAAOO;AAAAA,MAAAA;AAAAA,IACT;AAAA,IAEFD;AAAAA,EAAAA,CACD,GACKa,QAAQL,eAAe;AAAA,IAC3BT,SAAS;AAAA,MACPU,QAAQV,QAAQU;AAAAA,MAChBb,WAAW;AAAA,QACTH,QAAQQ;AAAAA,QACRP,OAAO;AAAA,UACLgB,MAAM,CAAC;AAAA,YAACC,MAAMX,MAAMW;AAAAA,UAAAA,GAAO,YAAY;AAAA,YAACA,MAAMN,UAAUM;AAAAA,UAAAA,CAAK;AAAA,UAC7DC,QAAQE,OAAOf,SAASM,SAAS,IAAIA,UAAUU,KAAKT,SAAS;AAAA,QAAA;AAAA,MAC/D;AAAA,IACF;AAAA,IAEFN;AAAAA,EAAAA,CACD;AAED,SAAO;AAAA,IAACO;AAAAA,IAAQM;AAAAA,EAAAA;AAClB;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/utils/util.is-equal-selections.ts","../../src/utils/util.reverse-selection.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 {EditorSelection} from '../types/editor'\n\n/**\n * @public\n */\nexport function reverseSelection<\n TEditorSelection extends NonNullable<EditorSelection> | null,\n>(selection: TEditorSelection): TEditorSelection {\n if (!selection) {\n return selection\n }\n\n if (selection.backward) {\n return {\n anchor: selection.focus,\n focus: selection.anchor,\n backward: false,\n } as TEditorSelection\n }\n\n return {\n anchor: selection.focus,\n focus: selection.anchor,\n backward: true,\n } as TEditorSelection\n}\n","import {isSpan} from '@portabletext/schema'\nimport type {PortableTextTextBlock} from '@sanity/types'\nimport type {EditorSelectionPoint} from '..'\nimport type {EditorContext} from '../editor/editor-snapshot'\nimport {sliceTextBlock} from './util.slice-text-block'\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 = sliceTextBlock({\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 block,\n })\n const after = sliceTextBlock({\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 block,\n })\n\n return {before, after}\n}\n"],"names":["isEqualSelections","a","b","isEqualSelectionPoints","anchor","focus","reverseSelection","selection","backward","splitTextBlock","context","block","point","firstChild","children","at","lastChild","length","before","sliceTextBlock","schema","path","_key","offset","after","isSpan","text"],"mappings":";;;;;;;;;AAMO,SAASA,kBAAkBC,GAAoBC,GAAoB;AACxE,SAAI,CAACD,KAAK,CAACC,IACF,KAGL,CAACD,KAAK,CAACC,IACF,KAIPC,uBAAuBF,EAAEG,QAAQF,EAAEE,MAAM,KACzCD,uBAAuBF,EAAEI,OAAOH,EAAEG,KAAK;AAE3C;ACdO,SAASC,iBAEdC,WAA+C;AAC/C,SAAKA,cAIDA,UAAUC,WACL;AAAA,IACLJ,QAAQG,UAAUF;AAAAA,IAClBA,OAAOE,UAAUH;AAAAA,IACjBI,UAAU;AAAA,EAAA,IAIP;AAAA,IACLJ,QAAQG,UAAUF;AAAAA,IAClBA,OAAOE,UAAUH;AAAAA,IACjBI,UAAU;AAAA,EAAA;AAEd;AChBO,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;AAE7D,MAAI,CAACJ,cAAc,CAACG;AAClB;AAGF,QAAME,SAASC,eAAe;AAAA,IAC5BT,SAAS;AAAA,MACPU,QAAQV,QAAQU;AAAAA,MAChBb,WAAW;AAAA,QACTH,QAAQ;AAAA,UACNiB,MAAM,CAAC;AAAA,YAACC,MAAMX,MAAMW;AAAAA,UAAAA,GAAO,YAAY;AAAA,YAACA,MAAMT,WAAWS;AAAAA,UAAAA,CAAK;AAAA,UAC9DC,QAAQ;AAAA,QAAA;AAAA,QAEVlB,OAAOO;AAAAA,MAAAA;AAAAA,IACT;AAAA,IAEFD;AAAAA,EAAAA,CACD,GACKa,QAAQL,eAAe;AAAA,IAC3BT,SAAS;AAAA,MACPU,QAAQV,QAAQU;AAAAA,MAChBb,WAAW;AAAA,QACTH,QAAQQ;AAAAA,QACRP,OAAO;AAAA,UACLgB,MAAM,CAAC;AAAA,YAACC,MAAMX,MAAMW;AAAAA,UAAAA,GAAO,YAAY;AAAA,YAACA,MAAMN,UAAUM;AAAAA,UAAAA,CAAK;AAAA,UAC7DC,QAAQE,OAAOf,SAASM,SAAS,IAAIA,UAAUU,KAAKT,SAAS;AAAA,QAAA;AAAA,MAC/D;AAAA,IACF;AAAA,IAEFN;AAAAA,EAAAA,CACD;AAED,SAAO;AAAA,IAACO;AAAAA,IAAQM;AAAAA,EAAAA;AAClB;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@portabletext/editor",
3
- "version": "2.6.3",
3
+ "version": "2.6.5",
4
4
  "description": "Portable Text Editor made in React",
5
5
  "keywords": [
6
6
  "sanity",
@@ -75,25 +75,25 @@
75
75
  "lodash": "^4.17.21",
76
76
  "lodash.startcase": "^4.4.0",
77
77
  "react-compiler-runtime": "19.1.0-rc.2",
78
- "slate": "0.118.0",
79
- "slate-dom": "^0.117.4",
78
+ "slate": "0.118.1",
79
+ "slate-dom": "^0.118.1",
80
80
  "slate-react": "0.117.4",
81
81
  "xstate": "^5.20.2",
82
- "@portabletext/block-tools": "^3.3.3",
82
+ "@portabletext/block-tools": "^3.4.1",
83
83
  "@portabletext/keyboard-shortcuts": "^1.1.1",
84
84
  "@portabletext/patches": "^1.1.8",
85
- "@portabletext/schema": "^1.1.0"
85
+ "@portabletext/schema": "^1.2.0"
86
86
  },
87
87
  "devDependencies": {
88
88
  "@sanity/diff-match-patch": "^3.2.0",
89
- "@sanity/pkg-utils": "^7.11.9",
90
- "@sanity/schema": "^4.5.0",
91
- "@sanity/types": "^4.5.0",
89
+ "@sanity/pkg-utils": "^8.0.5",
90
+ "@sanity/schema": "^4.6.0",
91
+ "@sanity/types": "^4.6.0",
92
92
  "@testing-library/react": "^16.3.0",
93
93
  "@types/debug": "^4.1.12",
94
94
  "@types/lodash": "^4.17.20",
95
95
  "@types/lodash.startcase": "^4.4.9",
96
- "@types/react": "^19.1.10",
96
+ "@types/react": "^19.1.11",
97
97
  "@types/react-dom": "^19.1.7",
98
98
  "@typescript-eslint/eslint-plugin": "^8.39.1",
99
99
  "@typescript-eslint/parser": "^8.39.1",
@@ -111,13 +111,14 @@
111
111
  "vite": "^7.1.3",
112
112
  "vitest": "^3.2.4",
113
113
  "vitest-browser-react": "^1.0.1",
114
- "@portabletext/sanity-bridge": "1.1.5",
114
+ "@portabletext/sanity-bridge": "1.1.7",
115
+ "@portabletext/test": "^0.0.0",
115
116
  "racejar": "1.2.14"
116
117
  },
117
118
  "peerDependencies": {
118
- "@portabletext/sanity-bridge": "^1.1.5",
119
- "@sanity/schema": "^4.5.0",
120
- "@sanity/types": "^4.5.0",
119
+ "@portabletext/sanity-bridge": "^1.1.7",
120
+ "@sanity/schema": "^4.6.0",
121
+ "@sanity/types": "^4.6.0",
121
122
  "react": "^18.3 || ^19",
122
123
  "rxjs": "^7.8.2"
123
124
  },
@@ -1,4 +1,4 @@
1
- import {isSpan, isTextBlock} from '../internal-utils/parse-blocks'
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
2
2
  import * as selectors from '../selectors'
3
3
  import * as utils from '../utils'
4
4
  import {raise} from './behavior.types.action'
@@ -1,4 +1,4 @@
1
- import {isTextBlock} from '../internal-utils/parse-blocks'
1
+ import {isTextBlock} from '@portabletext/schema'
2
2
  import * as selectors from '../selectors'
3
3
  import {getActiveDecorators} from '../selectors/selector.get-active-decorators'
4
4
  import {getTextBlockText} from '../utils/util.get-text-block-text'
@@ -1,4 +1,5 @@
1
- import {isTextBlock, parseBlock} from '../internal-utils/parse-blocks'
1
+ import {isTextBlock} from '@portabletext/schema'
2
+ import {parseBlock} from '../internal-utils/parse-blocks'
2
3
  import * as selectors from '../selectors'
3
4
  import * as utils from '../utils'
4
5
  import {sliceTextBlock} from '../utils/util.slice-text-block'
@@ -1,4 +1,4 @@
1
- import {isTextBlock} from '../internal-utils/parse-blocks'
1
+ import {isTextBlock} from '@portabletext/schema'
2
2
  import {defaultKeyboardShortcuts} from '../keyboard-shortcuts/default-keyboard-shortcuts'
3
3
  import * as selectors from '../selectors'
4
4
  import {isEmptyTextBlock} from '../utils/util.is-empty-text-block'
@@ -1,4 +1,5 @@
1
- import {isListBlock, isTextBlock} from '../internal-utils/parse-blocks'
1
+ import {isTextBlock} from '@portabletext/schema'
2
+ import {isListBlock} from '../internal-utils/parse-blocks'
2
3
  import {defaultKeyboardShortcuts} from '../keyboard-shortcuts/default-keyboard-shortcuts'
3
4
  import * as selectors from '../selectors'
4
5
  import {
@@ -1,5 +1,5 @@
1
+ import {isTextBlock} from '@portabletext/schema'
1
2
  import type {EditorSchema} from '../editor/editor-schema'
2
- import {isTextBlock} from '../internal-utils/parse-blocks'
3
3
  import * as selectors from '../selectors'
4
4
  import {spanSelectionPointToBlockOffset} from '../utils/util.block-offset'
5
5
  import {getTextBlockText} from '../utils/util.get-text-block-text'
@@ -1,6 +1,7 @@
1
1
  import {htmlToBlocks} from '@portabletext/block-tools'
2
+ import {isTextBlock} from '@portabletext/schema'
2
3
  import type {PortableTextBlock} from '@sanity/types'
3
- import {isTextBlock, parseBlock} from '../internal-utils/parse-blocks'
4
+ import {parseBlock} from '../internal-utils/parse-blocks'
4
5
  import * as selectors from '../selectors'
5
6
  import type {PortableTextMemberSchemaTypes} from '../types/editor'
6
7
  import {defineConverter} from './converter.types'
@@ -1,9 +1,9 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import type {PortableTextBlock} from '@sanity/types'
2
3
  import {render, waitFor} from '@testing-library/react'
3
4
  import {createRef, type RefObject} from 'react'
4
5
  import {describe, expect, it, vi} from 'vitest'
5
6
  import type {EditorSelection} from '../..'
6
- import {createTestKeyGenerator} from '../../internal-utils/test-key-generator'
7
7
  import {PortableTextEditor} from '../PortableTextEditor'
8
8
  import {PortableTextEditorTester} from './PortableTextEditorTester'
9
9
 
@@ -1,9 +1,9 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import type {PortableTextBlock} from '@sanity/types'
2
3
  import {render, waitFor} from '@testing-library/react'
3
4
  import {createRef, type ReactNode, type RefObject} from 'react'
4
5
  import {describe, expect, it, vi} from 'vitest'
5
6
  import type {RangeDecoration} from '../..'
6
- import {createTestKeyGenerator} from '../../internal-utils/test-key-generator'
7
7
  import type {PortableTextEditor} from '../PortableTextEditor'
8
8
  import {PortableTextEditorTester} from './PortableTextEditorTester'
9
9
 
@@ -1,10 +1,10 @@
1
1
  import type {JSONValue, Patch} from '@portabletext/patches'
2
2
  import {compileSchema, defineSchema} from '@portabletext/schema'
3
+ import {createTestKeyGenerator} from '@portabletext/test'
3
4
  import type {PortableTextBlock, PortableTextSpan} from '@sanity/types'
4
5
  import {render, waitFor} from '@testing-library/react'
5
6
  import {createRef, type ComponentProps, type RefObject} from 'react'
6
7
  import {describe, expect, it, vi} from 'vitest'
7
- import {createTestKeyGenerator} from '../../internal-utils/test-key-generator'
8
8
  import {getTextSelection} from '../../internal-utils/text-selection'
9
9
  import {PortableTextEditor} from '../PortableTextEditor'
10
10
  import {PortableTextEditorTester} from './PortableTextEditorTester'
@@ -1,8 +1,8 @@
1
+ import {isTextBlock} from '@portabletext/schema'
1
2
  import {useSelector} from '@xstate/react'
2
3
  import {useContext, type ReactElement} from 'react'
3
4
  import type {Element as SlateElement} from 'slate'
4
5
  import {useSlateStatic, type RenderElementProps} from 'slate-react'
5
- import {isTextBlock} from '../../internal-utils/parse-blocks'
6
6
  import type {
7
7
  RenderBlockFunction,
8
8
  RenderChildFunction,
@@ -1,8 +1,8 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import {render, waitFor} from '@testing-library/react'
2
3
  import {createRef, type RefObject} from 'react'
3
4
  import {describe, expect, it, vi} from 'vitest'
4
5
  import {PortableTextEditorTester} from '../../__tests__/PortableTextEditorTester'
5
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
6
6
  import {PortableTextEditor} from '../../PortableTextEditor'
7
7
 
8
8
  const initialValue = [
@@ -1,4 +1,5 @@
1
- import {compileSchema} from '@portabletext/schema'
1
+ import {compileSchema, isTextBlock} from '@portabletext/schema'
2
+ import {createTestKeyGenerator} from '@portabletext/test'
2
3
  import {render, waitFor} from '@testing-library/react'
3
4
  import {createRef, type RefObject} from 'react'
4
5
  import {describe, expect, it, vi} from 'vitest'
@@ -6,8 +7,6 @@ import {
6
7
  PortableTextEditorTester,
7
8
  schemaDefinition,
8
9
  } from '../../__tests__/PortableTextEditorTester'
9
- import {isTextBlock} from '../../../internal-utils/parse-blocks'
10
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
11
10
  import {PortableTextEditor} from '../../PortableTextEditor'
12
11
 
13
12
  const initialValue = [
@@ -1,8 +1,8 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import {render, waitFor} from '@testing-library/react'
2
3
  import {createRef, type RefObject} from 'react'
3
4
  import {describe, expect, it, vi} from 'vitest'
4
5
  import {PortableTextEditorTester} from '../../__tests__/PortableTextEditorTester'
5
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
6
6
  import {PortableTextEditor} from '../../PortableTextEditor'
7
7
 
8
8
  const initialValue = [
@@ -1,9 +1,9 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import type {PortableTextBlock} from '@sanity/types'
2
3
  import {render, waitFor} from '@testing-library/react'
3
4
  import {createRef, type RefObject} from 'react'
4
5
  import {describe, expect, it, vi} from 'vitest'
5
6
  import {PortableTextEditorTester} from '../../__tests__/PortableTextEditorTester'
6
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
7
7
  import {PortableTextEditor} from '../../PortableTextEditor'
8
8
 
9
9
  const INITIAL_VALUE: PortableTextBlock[] = [
@@ -1,8 +1,8 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import {render, waitFor} from '@testing-library/react'
2
3
  import {createRef, type RefObject} from 'react'
3
4
  import {describe, expect, it, vi} from 'vitest'
4
5
  import {PortableTextEditorTester} from '../../__tests__/PortableTextEditorTester'
5
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
6
6
  import {PortableTextEditor} from '../../PortableTextEditor'
7
7
 
8
8
  describe('plugin:withPortableTextLists', () => {
@@ -1,8 +1,8 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import {render, waitFor} from '@testing-library/react'
2
3
  import {createRef, type RefObject} from 'react'
3
4
  import {describe, expect, it, vi} from 'vitest'
4
5
  import {PortableTextEditorTester} from '../../__tests__/PortableTextEditorTester'
5
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
6
6
  import type {EditorSelection} from '../../../types/editor'
7
7
  import {PortableTextEditor} from '../../PortableTextEditor'
8
8
 
@@ -1,8 +1,8 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import {render, waitFor} from '@testing-library/react'
2
3
  import {createRef, type RefObject} from 'react'
3
4
  import {describe, expect, it, vi} from 'vitest'
4
5
  import {PortableTextEditorTester} from '../../__tests__/PortableTextEditorTester'
5
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
6
6
  import {PortableTextEditor} from '../../PortableTextEditor'
7
7
 
8
8
  const initialValue = [
@@ -1,8 +1,8 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import {render, waitFor} from '@testing-library/react'
2
3
  import {createRef, type RefObject} from 'react'
3
4
  import {describe, expect, it, vi} from 'vitest'
4
5
  import {PortableTextEditorTester} from '../../__tests__/PortableTextEditorTester'
5
- import {createTestKeyGenerator} from '../../../internal-utils/test-key-generator'
6
6
  import {PortableTextEditor} from '../../PortableTextEditor'
7
7
 
8
8
  const initialValue = [
@@ -1,6 +1,6 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import {isEqual} from 'lodash'
2
3
  import {Editor, Element, Node, Path, Transforms} from 'slate'
3
- import {isSpan, isTextBlock} from '../../internal-utils/parse-blocks'
4
4
  import {isChangingRemotely} from '../../internal-utils/withChanges'
5
5
  import {isRedoing, isUndoing} from '../../internal-utils/withUndoRedo'
6
6
  import type {PortableTextSlateEditor} from '../../types/editor'
@@ -4,11 +4,11 @@
4
4
  *
5
5
  */
6
6
 
7
+ import {isSpan, isTextBlock} from '@portabletext/schema'
7
8
  import type {PortableTextObject, PortableTextSpan} from '@sanity/types'
8
9
  import {isEqual, uniq} from 'lodash'
9
10
  import {Editor, Element, Node, Path, Range, Text, Transforms} from 'slate'
10
11
  import {debugWithName} from '../../internal-utils/debug'
11
- import {isSpan, isTextBlock} from '../../internal-utils/parse-blocks'
12
12
  import {getNextSpan, getPreviousSpan} from '../../internal-utils/sibling-utils'
13
13
  import {isChangingRemotely} from '../../internal-utils/withChanges'
14
14
  import {isRedoing, isUndoing} from '../../internal-utils/withUndoRedo'
@@ -1,3 +1,4 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import type {
2
3
  PortableTextListBlock,
3
4
  PortableTextSpan,
@@ -5,11 +6,7 @@ import type {
5
6
  } from '@sanity/types'
6
7
  import {Editor, Transforms, type Element} from 'slate'
7
8
  import {debugWithName} from '../../internal-utils/debug'
8
- import {
9
- isListBlock,
10
- isSpan,
11
- isTextBlock,
12
- } from '../../internal-utils/parse-blocks'
9
+ import {isListBlock} from '../../internal-utils/parse-blocks'
13
10
  import type {PortableTextSlateEditor} from '../../types/editor'
14
11
  import type {EditorActor} from '../editor-machine'
15
12
 
@@ -1,9 +1,9 @@
1
+ import {createTestKeyGenerator} from '@portabletext/test'
1
2
  import {render, waitFor} from '@testing-library/react'
2
3
  import {createRef, type RefObject} from 'react'
3
4
  import {describe, expect, it, vi} from 'vitest'
4
5
  import {PortableTextEditorTester} from '../../editor/__tests__/PortableTextEditorTester'
5
6
  import {PortableTextEditor} from '../../editor/PortableTextEditor'
6
- import {createTestKeyGenerator} from '../test-key-generator'
7
7
 
8
8
  describe('values: normalization', () => {
9
9
  it("accepts incoming value with blocks without a style or markDefs prop, but doesn't leave them without them when editing them", async () => {
@@ -1,7 +1,7 @@
1
1
  import {compileSchema, defineSchema} from '@portabletext/schema'
2
+ import {createTestKeyGenerator} from '@portabletext/test'
2
3
  import {describe, expect, test} from 'vitest'
3
4
  import {applyOperationToPortableText} from './apply-operation-to-portable-text'
4
- import {createTestKeyGenerator} from './test-key-generator'
5
5
 
6
6
  function createContext() {
7
7
  const keyGenerator = createTestKeyGenerator()
@@ -1,5 +1,5 @@
1
+ import {isTextBlock} from '@portabletext/schema'
1
2
  import type {EditorContext} from '../editor/editor-snapshot'
2
- import {isTextBlock} from './parse-blocks'
3
3
 
4
4
  // Maps for each list type, keeping track of the current list count for each
5
5
  // level.
@@ -1,6 +1,6 @@
1
1
  import {compileSchema, defineSchema} from '@portabletext/schema'
2
+ import {createTestKeyGenerator} from '@portabletext/test'
2
3
  import type {EditorSnapshot} from '..'
3
- import {createTestKeyGenerator} from './test-key-generator'
4
4
 
5
5
  export function createTestSnapshot(snapshot: {
6
6
  context?: Partial<EditorSnapshot['context']>
@@ -1,9 +1,9 @@
1
1
  import {compileSchema, defineSchema} from '@portabletext/schema'
2
+ import {createTestKeyGenerator} from '@portabletext/test'
2
3
  import {describe, expect, test} from 'vitest'
3
4
  import type {EditorSelection} from '../types/editor'
4
5
  import {createTestSnapshot} from './create-test-snapshot'
5
6
  import {getDragSelection} from './drag-selection'
6
- import {createTestKeyGenerator} from './test-key-generator'
7
7
 
8
8
  describe(getDragSelection.name, () => {
9
9
  const keyGenerator = createTestKeyGenerator()
@@ -1,6 +1,6 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import type {EditorContext} from '../editor/editor-snapshot'
2
3
  import type {EditorSelection, EditorSelectionPoint} from '../types/editor'
3
- import {isSpan, isTextBlock} from './parse-blocks'
4
4
 
5
5
  export function getEditorSelection(
6
6
  context: Pick<EditorContext, 'schema' | 'value'>,
@@ -7,6 +7,7 @@ import {
7
7
  type InsertPosition,
8
8
  type Patch,
9
9
  } from '@portabletext/patches'
10
+ import {isSpan, isTextBlock} from '@portabletext/schema'
10
11
  import type {Path, PortableTextSpan, PortableTextTextBlock} from '@sanity/types'
11
12
  import {get, isUndefined, omitBy} from 'lodash'
12
13
  import {
@@ -22,7 +23,6 @@ import {
22
23
  type SplitNodeOperation,
23
24
  } from 'slate'
24
25
  import type {EditorSchema} from '../editor/editor-schema'
25
- import {isSpan, isTextBlock} from './parse-blocks'
26
26
  import {fromSlateValue} from './values'
27
27
 
28
28
  export function insertTextPatch(
@@ -1,7 +1,7 @@
1
1
  import {compileSchema, defineSchema} from '@portabletext/schema'
2
+ import {createTestKeyGenerator} from '@portabletext/test'
2
3
  import {describe, expect, test} from 'vitest'
3
4
  import {parseBlock, parseSpan} from './parse-blocks'
4
- import {createTestKeyGenerator} from './test-key-generator'
5
5
 
6
6
  describe(parseBlock.name, () => {
7
7
  test('null', () => {
@@ -1,3 +1,4 @@
1
+ import {isTextBlock} from '@portabletext/schema'
1
2
  import type {
2
3
  PortableTextBlock,
3
4
  PortableTextListBlock,
@@ -93,25 +94,6 @@ export function isListBlock(
93
94
  )
94
95
  }
95
96
 
96
- export function isTextBlock(
97
- context: Pick<EditorContext, 'schema'>,
98
- block: unknown,
99
- ): block is PortableTextTextBlock {
100
- if (!isTypedObject(block)) {
101
- return false
102
- }
103
-
104
- if (block._type !== context.schema.block.name) {
105
- return false
106
- }
107
-
108
- if (!Array.isArray(block.children)) {
109
- return false
110
- }
111
-
112
- return true
113
- }
114
-
115
97
  export function parseTextBlock({
116
98
  block,
117
99
  context,
@@ -259,25 +241,6 @@ export function parseTextBlock({
259
241
  return parsedBlock
260
242
  }
261
243
 
262
- export function isSpan(
263
- context: Pick<EditorContext, 'schema'>,
264
- child: unknown,
265
- ): child is PortableTextSpan {
266
- if (!isTypedObject(child)) {
267
- return false
268
- }
269
-
270
- if (child._type !== context.schema.span.name) {
271
- return false
272
- }
273
-
274
- if (typeof child.text !== 'string') {
275
- return false
276
- }
277
-
278
- return true
279
- }
280
-
281
244
  export function parseSpan({
282
245
  span,
283
246
  context,
@@ -1,9 +1,9 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import type {EditorContext} from '../editor/editor-snapshot'
2
3
  import {
3
4
  getBlockKeyFromSelectionPoint,
4
5
  getChildKeyFromSelectionPoint,
5
6
  } from '../selection/selection-point'
6
- import {isSpan, isTextBlock} from './parse-blocks'
7
7
 
8
8
  export function getSelectionFocusText(
9
9
  context: Pick<EditorContext, 'schema' | 'value' | 'selection'>,
@@ -1,6 +1,6 @@
1
+ import {getTersePt} from '@portabletext/test'
1
2
  import type {EditorContext} from '../editor/editor-snapshot'
2
3
  import {sliceBlocks} from '../utils/util.slice-blocks'
3
- import {getTersePt} from './terse-pt'
4
4
 
5
5
  export function getSelectionText(
6
6
  context: Pick<EditorContext, 'schema' | 'value' | 'selection'>,
@@ -1,4 +1,5 @@
1
1
  import {defineSchema, type SchemaDefinition} from '@portabletext/schema'
2
+ import {createTestKeyGenerator} from '@portabletext/test'
2
3
  import type {PortableTextBlock} from '@sanity/types'
3
4
  import {page} from '@vitest/browser/context'
4
5
  import React from 'react'
@@ -14,7 +15,6 @@ import {EventListenerPlugin} from '../plugins/plugin.event-listener'
14
15
  import {InternalEditorAfterRefPlugin} from '../plugins/plugin.internal.editor-actor-ref'
15
16
  import {InternalSlateEditorRefPlugin} from '../plugins/plugin.internal.slate-editor-ref'
16
17
  import type {PortableTextSlateEditor} from '../types/editor'
17
- import {createTestKeyGenerator} from './test-key-generator'
18
18
 
19
19
  export async function createTestEditor(
20
20
  options: {
@@ -1,5 +1,5 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import type {EditorContext} from '../editor/editor-snapshot'
2
- import {isSpan, isTextBlock} from './parse-blocks'
3
3
 
4
4
  export function getTextBlockKey(
5
5
  context: Pick<EditorContext, 'schema' | 'value'>,
@@ -1,5 +1,5 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import type {EditorContext} from '../editor/editor-snapshot'
2
- import {isSpan, isTextBlock} from './parse-blocks'
3
3
 
4
4
  export function getTextMarks(
5
5
  context: Pick<EditorContext, 'schema' | 'value'>,
@@ -1,7 +1,7 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import type {EditorContext} from '../editor/editor-snapshot'
2
3
  import type {EditorSelection, EditorSelectionPoint} from '../types/editor'
3
4
  import {collapseSelection} from './collapse-selection'
4
- import {isSpan, isTextBlock} from './parse-blocks'
5
5
  import {splitString} from './split-string'
6
6
  import {stringOverlap} from './string-overlap'
7
7
 
@@ -1,6 +1,6 @@
1
1
  import {compileSchema, defineSchema} from '@portabletext/schema'
2
+ import {createTestKeyGenerator} from '@portabletext/test'
2
3
  import {describe, expect, test} from 'vitest'
3
- import {createTestKeyGenerator} from './test-key-generator'
4
4
  import {toSlateRange} from './to-slate-range'
5
5
 
6
6
  describe(toSlateRange.name, () => {
@@ -1,3 +1,4 @@
1
+ import {isSpan, isTextBlock} from '@portabletext/schema'
1
2
  import type {PortableTextObject, PortableTextSpan} from '@sanity/types'
2
3
  import type {Path, Range} from 'slate'
3
4
  import type {EditorContext, EditorSnapshot} from '../editor/editor-snapshot'
@@ -8,7 +9,6 @@ import {
8
9
  import type {EditorSelectionPoint} from '../types/editor'
9
10
  import {isEqualSelectionPoints} from '../utils'
10
11
  import {blockOffsetToSpanSelectionPoint} from '../utils/util.block-offset'
11
- import {isSpan, isTextBlock} from './parse-blocks'
12
12
 
13
13
  export function toSlateRange(
14
14
  snapshot: {