@portabletext/editor 1.47.9 → 1.47.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/lib/_chunks-cjs/editor-provider.cjs +105 -73
  2. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  3. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs +0 -4
  4. package/lib/_chunks-cjs/util.is-selection-collapsed.cjs.map +1 -1
  5. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs +8 -0
  6. package/lib/_chunks-cjs/util.selection-point-to-block-offset.cjs.map +1 -1
  7. package/lib/_chunks-es/editor-provider.js +108 -76
  8. package/lib/_chunks-es/editor-provider.js.map +1 -1
  9. package/lib/_chunks-es/util.is-selection-collapsed.js +0 -4
  10. package/lib/_chunks-es/util.is-selection-collapsed.js.map +1 -1
  11. package/lib/_chunks-es/util.selection-point-to-block-offset.js +8 -0
  12. package/lib/_chunks-es/util.selection-point-to-block-offset.js.map +1 -1
  13. package/lib/behaviors/index.d.cts +359 -339
  14. package/lib/behaviors/index.d.ts +359 -339
  15. package/lib/behaviors/index.js +1 -1
  16. package/lib/index.cjs +3 -3
  17. package/lib/index.cjs.map +1 -1
  18. package/lib/index.d.cts +4 -4
  19. package/lib/index.d.ts +4 -4
  20. package/lib/index.js +2 -1
  21. package/lib/index.js.map +1 -1
  22. package/lib/plugins/index.d.cts +4 -4
  23. package/lib/plugins/index.d.ts +4 -4
  24. package/lib/selectors/index.d.cts +4 -4
  25. package/lib/selectors/index.d.ts +4 -4
  26. package/lib/utils/index.cjs +2 -5
  27. package/lib/utils/index.cjs.map +1 -1
  28. package/lib/utils/index.d.cts +4 -4
  29. package/lib/utils/index.d.ts +4 -4
  30. package/lib/utils/index.js +2 -5
  31. package/lib/utils/index.js.map +1 -1
  32. package/package.json +4 -4
  33. package/src/behavior-actions/behavior.actions.ts +0 -9
  34. package/src/behaviors/behavior.abstract.split.ts +162 -0
  35. package/src/behaviors/behavior.default.ts +2 -0
  36. package/src/behaviors/behavior.types.event.ts +4 -4
  37. package/src/behavior-actions/behavior.action.split.block.ts +0 -146
package/lib/index.d.cts CHANGED
@@ -190,6 +190,9 @@ declare type AbstractBehaviorEvent =
190
190
  type: StrictExtract<AbstractBehaviorEventType, 'select.next block'>
191
191
  select?: 'start' | 'end'
192
192
  }
193
+ | {
194
+ type: StrictExtract<AbstractBehaviorEventType, 'split.block'>
195
+ }
193
196
  | {
194
197
  type: StrictExtract<AbstractBehaviorEventType, 'style.add'>
195
198
  style: string
@@ -232,6 +235,7 @@ declare const abstractBehaviorEventTypes: readonly [
232
235
  'serialize',
233
236
  'serialization.success',
234
237
  'serialization.failure',
238
+ 'split.block',
235
239
  'style.add',
236
240
  'style.remove',
237
241
  'style.toggle',
@@ -6752,9 +6756,6 @@ declare type SyntheticBehaviorEvent =
6752
6756
  type: StrictExtract<SyntheticBehaviorEventType, 'select'>
6753
6757
  at: EditorSelection
6754
6758
  }
6755
- | {
6756
- type: StrictExtract<SyntheticBehaviorEventType, 'split.block'>
6757
- }
6758
6759
 
6759
6760
  declare type SyntheticBehaviorEventNamespace =
6760
6761
  ExtractNamespace<SyntheticBehaviorEventType>
@@ -6786,7 +6787,6 @@ declare const syntheticBehaviorEventTypes: readonly [
6786
6787
  'move.block',
6787
6788
  'move.forward',
6788
6789
  'select',
6789
- 'split.block',
6790
6790
  ]
6791
6791
 
6792
6792
  declare type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
package/lib/index.d.ts CHANGED
@@ -190,6 +190,9 @@ declare type AbstractBehaviorEvent =
190
190
  type: StrictExtract<AbstractBehaviorEventType, 'select.next block'>
191
191
  select?: 'start' | 'end'
192
192
  }
193
+ | {
194
+ type: StrictExtract<AbstractBehaviorEventType, 'split.block'>
195
+ }
193
196
  | {
194
197
  type: StrictExtract<AbstractBehaviorEventType, 'style.add'>
195
198
  style: string
@@ -232,6 +235,7 @@ declare const abstractBehaviorEventTypes: readonly [
232
235
  'serialize',
233
236
  'serialization.success',
234
237
  'serialization.failure',
238
+ 'split.block',
235
239
  'style.add',
236
240
  'style.remove',
237
241
  'style.toggle',
@@ -6752,9 +6756,6 @@ declare type SyntheticBehaviorEvent =
6752
6756
  type: StrictExtract<SyntheticBehaviorEventType, 'select'>
6753
6757
  at: EditorSelection
6754
6758
  }
6755
- | {
6756
- type: StrictExtract<SyntheticBehaviorEventType, 'split.block'>
6757
- }
6758
6759
 
6759
6760
  declare type SyntheticBehaviorEventNamespace =
6760
6761
  ExtractNamespace<SyntheticBehaviorEventType>
@@ -6786,7 +6787,6 @@ declare const syntheticBehaviorEventTypes: readonly [
6786
6787
  'move.block',
6787
6788
  'move.forward',
6788
6789
  'select',
6789
- 'split.block',
6790
6790
  ]
6791
6791
 
6792
6792
  declare type TextBlockWithOptionalKey = Omit<PortableTextTextBlock, '_key'> & {
package/lib/index.js CHANGED
@@ -12,9 +12,10 @@ import { isSelectionCollapsed, getFocusTextBlock, getFocusSpan, getSelectedBlock
12
12
  import { getBlockEndPoint, getBlockStartPoint, isKeyedSegment } from "./_chunks-es/util.slice-blocks.js";
13
13
  import { getFocusInlineObject } from "./_chunks-es/selector.get-focus-inline-object.js";
14
14
  import { DOMEditor, isDOMNode } from "slate-dom";
15
- import { isSelectionCollapsed as isSelectionCollapsed$1, getSelectionEndPoint } from "./_chunks-es/util.is-selection-collapsed.js";
15
+ import { isSelectionCollapsed as isSelectionCollapsed$1 } from "./_chunks-es/util.is-selection-collapsed.js";
16
16
  import { parseBlocks } from "./_chunks-es/parse-blocks.js";
17
17
  import isEqual from "lodash/isEqual.js";
18
+ import { getSelectionEndPoint } from "./_chunks-es/util.selection-point-to-block-offset.js";
18
19
  import { isSelectingEntireBlocks } from "./_chunks-es/selector.is-selecting-entire-blocks.js";
19
20
  import { defineBehavior, isHotkey } from "./_chunks-es/behavior.core.js";
20
21
  import uniq from "lodash/uniq.js";