@portabletext/editor 1.34.1 → 1.35.1

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 (131) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +57 -118
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/behavior.markdown.cjs +27 -67
  4. package/lib/_chunks-cjs/behavior.markdown.cjs.map +1 -1
  5. package/lib/_chunks-cjs/{plugin.event-listener.cjs → editor-provider.cjs} +101 -87
  6. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -0
  7. package/lib/_chunks-cjs/selector.get-text-before.cjs +5 -7
  8. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  9. package/lib/_chunks-cjs/selector.is-active-style.cjs +22 -36
  10. package/lib/_chunks-cjs/selector.is-active-style.cjs.map +1 -1
  11. package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs +68 -153
  12. package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs.map +1 -1
  13. package/lib/_chunks-cjs/util.block-offsets-to-selection.cjs.map +1 -1
  14. package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
  15. package/lib/_chunks-es/behavior.core.js +57 -118
  16. package/lib/_chunks-es/behavior.core.js.map +1 -1
  17. package/lib/_chunks-es/behavior.markdown.js +27 -67
  18. package/lib/_chunks-es/behavior.markdown.js.map +1 -1
  19. package/lib/_chunks-es/{plugin.event-listener.js → editor-provider.js} +102 -88
  20. package/lib/_chunks-es/editor-provider.js.map +1 -0
  21. package/lib/_chunks-es/selector.get-text-before.js +5 -7
  22. package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
  23. package/lib/_chunks-es/selector.is-active-style.js +22 -36
  24. package/lib/_chunks-es/selector.is-active-style.js.map +1 -1
  25. package/lib/_chunks-es/selector.is-at-the-start-of-block.js +68 -153
  26. package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
  27. package/lib/_chunks-es/util.block-offsets-to-selection.js.map +1 -1
  28. package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
  29. package/lib/behaviors/index.cjs +18 -48
  30. package/lib/behaviors/index.cjs.map +1 -1
  31. package/lib/behaviors/index.d.cts +19392 -214
  32. package/lib/behaviors/index.d.ts +19392 -214
  33. package/lib/behaviors/index.js +18 -48
  34. package/lib/behaviors/index.js.map +1 -1
  35. package/lib/index.cjs +81 -51
  36. package/lib/index.cjs.map +1 -1
  37. package/lib/index.d.cts +334 -59
  38. package/lib/index.d.ts +334 -59
  39. package/lib/index.js +35 -4
  40. package/lib/index.js.map +1 -1
  41. package/lib/plugins/index.cjs +200 -189
  42. package/lib/plugins/index.cjs.map +1 -1
  43. package/lib/plugins/index.d.cts +344 -25
  44. package/lib/plugins/index.d.ts +344 -25
  45. package/lib/plugins/index.js +198 -187
  46. package/lib/plugins/index.js.map +1 -1
  47. package/lib/selectors/index.cjs +22 -50
  48. package/lib/selectors/index.cjs.map +1 -1
  49. package/lib/selectors/index.d.cts +19485 -174
  50. package/lib/selectors/index.d.ts +19485 -174
  51. package/lib/selectors/index.js +22 -50
  52. package/lib/selectors/index.js.map +1 -1
  53. package/lib/utils/index.cjs.map +1 -1
  54. package/lib/utils/index.d.cts +19518 -7
  55. package/lib/utils/index.d.ts +19518 -7
  56. package/lib/utils/index.js.map +1 -1
  57. package/package.json +7 -7
  58. package/src/behavior-actions/behavior.action.decorator.add.ts +1 -0
  59. package/src/behavior-actions/behavior.action.delete.text.ts +1 -0
  60. package/src/behaviors/behavior.code-editor.ts +6 -6
  61. package/src/behaviors/behavior.core.annotations.ts +5 -4
  62. package/src/behaviors/behavior.core.block-objects.ts +17 -17
  63. package/src/behaviors/behavior.core.decorators.ts +12 -8
  64. package/src/behaviors/behavior.core.insert-break.ts +27 -29
  65. package/src/behaviors/behavior.core.lists.ts +19 -19
  66. package/src/behaviors/behavior.decorator-pair.ts +201 -0
  67. package/src/behaviors/behavior.default.ts +35 -30
  68. package/src/behaviors/behavior.emoji-picker.ts +12 -12
  69. package/src/behaviors/behavior.links.ts +7 -7
  70. package/src/behaviors/behavior.markdown.ts +41 -42
  71. package/src/behaviors/behavior.types.ts +14 -17
  72. package/src/behaviors/index.ts +0 -1
  73. package/src/converters/converter.json.ts +6 -6
  74. package/src/converters/converter.portable-text.deserialize.test.ts +27 -29
  75. package/src/converters/converter.portable-text.ts +13 -7
  76. package/src/converters/converter.text-html.deserialize.test.ts +16 -18
  77. package/src/converters/converter.text-html.serialize.test.ts +56 -57
  78. package/src/converters/converter.text-html.ts +14 -10
  79. package/src/converters/converter.text-plain.test.ts +17 -17
  80. package/src/converters/converter.text-plain.ts +15 -11
  81. package/src/converters/converter.types.ts +5 -5
  82. package/src/editor/Editable.tsx +26 -0
  83. package/src/editor/editor-machine.ts +170 -142
  84. package/src/editor/editor-selector.ts +3 -0
  85. package/src/editor/editor-snapshot.ts +13 -0
  86. package/src/editor-event-listener.tsx +30 -0
  87. package/src/index.ts +3 -3
  88. package/src/internal-utils/create-test-snapshot.ts +23 -0
  89. package/src/internal-utils/get-text-to-emphasize.ts +29 -7
  90. package/src/plugins/plugin.decorator-shortcut.ts +235 -0
  91. package/src/plugins/plugin.markdown.tsx +56 -8
  92. package/src/plugins/plugin.one-line.tsx +17 -17
  93. package/src/selectors/selector.get-active-annotations.test.ts +4 -13
  94. package/src/selectors/selector.get-active-list-item.ts +4 -4
  95. package/src/selectors/selector.get-active-style.ts +6 -6
  96. package/src/selectors/selector.get-anchor-block.ts +5 -5
  97. package/src/selectors/selector.get-anchor-child.ts +5 -5
  98. package/src/selectors/selector.get-anchor-span.ts +2 -2
  99. package/src/selectors/selector.get-anchor-text-block.ts +2 -2
  100. package/src/selectors/selector.get-block-offsets.ts +8 -7
  101. package/src/selectors/selector.get-caret-word-selection.test.ts +3 -7
  102. package/src/selectors/selector.get-caret-word-selection.ts +19 -16
  103. package/src/selectors/selector.get-next-inline-object.ts +4 -4
  104. package/src/selectors/selector.get-previous-inline-object.ts +4 -4
  105. package/src/selectors/selector.get-selected-slice.ts +7 -4
  106. package/src/selectors/selector.get-selected-spans.test.ts +5 -9
  107. package/src/selectors/selector.get-selected-spans.ts +9 -9
  108. package/src/selectors/selector.get-selection-end-point.ts +5 -5
  109. package/src/selectors/selector.get-selection-start-point.ts +5 -5
  110. package/src/selectors/selector.get-selection-text.test.ts +5 -7
  111. package/src/selectors/selector.get-selection-text.ts +2 -2
  112. package/src/selectors/selector.get-selection.ts +2 -2
  113. package/src/selectors/selector.get-text-before.ts +8 -8
  114. package/src/selectors/selector.get-trimmed-selection.test.ts +3 -5
  115. package/src/selectors/selector.get-trimmed-selection.ts +15 -13
  116. package/src/selectors/selector.get-value.ts +4 -4
  117. package/src/selectors/selector.is-active-decorator.test.ts +5 -9
  118. package/src/selectors/selector.is-at-the-end-of-block.ts +6 -3
  119. package/src/selectors/selector.is-at-the-start-of-block.ts +3 -3
  120. package/src/selectors/selector.is-overlapping-selection.ts +8 -6
  121. package/src/selectors/selector.is-selection-collapsed.ts +6 -5
  122. package/src/selectors/selector.is-selection-expanded.ts +2 -2
  123. package/src/selectors/selectors.ts +59 -59
  124. package/src/types/block-offset.ts +9 -0
  125. package/src/utils/index.ts +0 -1
  126. package/src/utils/util.block-offset.ts +1 -1
  127. package/src/utils/util.block-offsets-to-selection.ts +1 -1
  128. package/src/utils/util.child-selection-point-to-block-offset.ts +1 -1
  129. package/lib/_chunks-cjs/plugin.event-listener.cjs.map +0 -1
  130. package/lib/_chunks-es/plugin.event-listener.js.map +0 -1
  131. package/src/behaviors/behavior.markdown-emphasis.ts +0 -437
package/lib/index.d.ts CHANGED
@@ -146,11 +146,13 @@ export declare type BehaviorActionIntend =
146
146
  * @beta
147
147
  */
148
148
  export declare type BehaviorActionIntendSet<TBehaviorEvent, TGuardResponse> = (
149
- {
150
- context,
151
- event,
152
- }: {
149
+ payload: {
150
+ /**
151
+ * @deprecated
152
+ * Use `snapshot` instead
153
+ */
153
154
  context: EditorContext
155
+ snapshot: EditorSnapshot
154
156
  event: TBehaviorEvent
155
157
  },
156
158
  guardResponse: TGuardResponse,
@@ -167,11 +169,13 @@ export declare type BehaviorEvent =
167
169
  /**
168
170
  * @beta
169
171
  */
170
- export declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = ({
171
- context,
172
- event,
173
- }: {
172
+ export declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
173
+ /**
174
+ * @deprecated
175
+ * Use `snapshot` instead
176
+ */
174
177
  context: EditorContext
178
+ snapshot: EditorSnapshot
175
179
  event: TBehaviorEvent
176
180
  }) => TGuardResponse | false
177
181
 
@@ -359,10 +363,10 @@ export declare function defineSchema<
359
363
  >(definition: TSchemaDefinition): TSchemaDefinition
360
364
 
361
365
  declare type Deserializer<TMIMEType extends MIMEType> = ({
362
- context,
366
+ snapshot,
363
367
  event,
364
368
  }: {
365
- context: EditorContext
369
+ snapshot: EditorSnapshot
366
370
  event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'deserialize'>
367
371
  }) => PickFromUnion<
368
372
  ConverterEvent<TMIMEType>,
@@ -603,52 +607,12 @@ export declare type EditorEvent =
603
607
 
604
608
  /**
605
609
  * @public
606
- * Listen for events emitted by the editor. Must be used inside `EditorProvider`. Events available include:
607
- * - 'blurred'
608
- * - 'done loading'
609
- * - 'editable'
610
- * - 'error'
611
- * - 'focused'
612
- * - 'invalid value'
613
- * - 'loading'
614
- * - 'mutation'
615
- * - 'patch'
616
- * - 'read only'
617
- * - 'ready'
618
- * - 'selection'
619
- * - 'value changed'
610
+ * @deprecated
611
+ * This component has been renamed. Use `EventListenerPlugin` instead.
620
612
  *
621
- * @example
622
- * Listen and log events.
623
- * ```tsx
624
- * import {EditorProvider} from '@portabletext/editor'
625
- * import {EventListenerPlugin} from '@portabletext/editor/plugins'
626
- *
627
- * function MyComponent() {
628
- * return (
629
- * <EditorProvider>
630
- * <EventListenerPlugin
631
- * on={(event) => {
632
- * console.log(event)
633
- * }
634
- * } />
635
- * { ... }
636
- * </EditorProvider>
637
- * )
638
- * }
639
613
  * ```
640
- * @example
641
- * Handle events when there is a mutation.
642
- * ```tsx
643
- * <EventListenerPlugin
644
- * on={(event) => {
645
- * if (event.type === 'mutation') {
646
- * console.log('Value changed:', event.snapshot)
647
- * }
648
- * }}
649
- * />
614
+ * import {EventListenerPlugin} from '@portabletext/editor/plugins'
650
615
  * ```
651
- * @group Components
652
616
  */
653
617
  export declare function EditorEventListener(props: {
654
618
  on: (event: EditorEmittedEvent) => void
@@ -1009,6 +973,15 @@ declare const editorMachine: StateMachine<
1009
973
  | {
1010
974
  type: 'notify.unset'
1011
975
  previousValue: Array<PortableTextBlock>
976
+ }
977
+ | {
978
+ type: 'dragstart'
979
+ }
980
+ | {
981
+ type: 'dragend'
982
+ }
983
+ | {
984
+ type: 'drop'
1012
985
  },
1013
986
  {},
1014
987
  never,
@@ -1070,7 +1043,9 @@ declare const editorMachine: StateMachine<
1070
1043
  never,
1071
1044
  {
1072
1045
  'edit mode':
1073
- | 'editable'
1046
+ | {
1047
+ editable: 'dragging internally' | 'idle'
1048
+ }
1074
1049
  | {
1075
1050
  'read only': 'read only' | 'determine initial edit mode'
1076
1051
  }
@@ -1081,7 +1056,7 @@ declare const editorMachine: StateMachine<
1081
1056
  pristine: 'normalizing' | 'idle'
1082
1057
  }
1083
1058
  },
1084
- string,
1059
+ 'dragging internally',
1085
1060
  {
1086
1061
  behaviors?: Array<Behavior>
1087
1062
  converters?: Array<Converter>
@@ -1755,6 +1730,15 @@ declare const editorMachine: StateMachine<
1755
1730
  | {
1756
1731
  type: 'notify.unset'
1757
1732
  previousValue: Array<PortableTextBlock>
1733
+ }
1734
+ | {
1735
+ type: 'dragstart'
1736
+ }
1737
+ | {
1738
+ type: 'dragend'
1739
+ }
1740
+ | {
1741
+ type: 'drop'
1758
1742
  },
1759
1743
  Record<string, AnyActorRef | undefined>,
1760
1744
  StateValue,
@@ -2103,6 +2087,15 @@ declare const editorMachine: StateMachine<
2103
2087
  | {
2104
2088
  type: 'notify.unset'
2105
2089
  previousValue: Array<PortableTextBlock>
2090
+ }
2091
+ | {
2092
+ type: 'dragstart'
2093
+ }
2094
+ | {
2095
+ type: 'dragend'
2096
+ }
2097
+ | {
2098
+ type: 'drop'
2106
2099
  },
2107
2100
  AnyEventObject
2108
2101
  >
@@ -2475,6 +2468,15 @@ declare const editorMachine: StateMachine<
2475
2468
  | {
2476
2469
  type: 'notify.unset'
2477
2470
  previousValue: Array<PortableTextBlock>
2471
+ }
2472
+ | {
2473
+ type: 'dragstart'
2474
+ }
2475
+ | {
2476
+ type: 'dragend'
2477
+ }
2478
+ | {
2479
+ type: 'drop'
2478
2480
  },
2479
2481
  undefined,
2480
2482
  never,
@@ -3112,6 +3114,15 @@ declare const editorMachine: StateMachine<
3112
3114
  | {
3113
3115
  type: 'notify.unset'
3114
3116
  previousValue: Array<PortableTextBlock>
3117
+ }
3118
+ | {
3119
+ type: 'dragstart'
3120
+ }
3121
+ | {
3122
+ type: 'dragend'
3123
+ }
3124
+ | {
3125
+ type: 'drop'
3115
3126
  },
3116
3127
  undefined,
3117
3128
  never,
@@ -3752,6 +3763,15 @@ declare const editorMachine: StateMachine<
3752
3763
  | {
3753
3764
  type: 'notify.unset'
3754
3765
  previousValue: Array<PortableTextBlock>
3766
+ }
3767
+ | {
3768
+ type: 'dragstart'
3769
+ }
3770
+ | {
3771
+ type: 'dragend'
3772
+ }
3773
+ | {
3774
+ type: 'drop'
3755
3775
  },
3756
3776
  undefined,
3757
3777
  never,
@@ -4391,6 +4411,15 @@ declare const editorMachine: StateMachine<
4391
4411
  | {
4392
4412
  type: 'notify.unset'
4393
4413
  previousValue: Array<PortableTextBlock>
4414
+ }
4415
+ | {
4416
+ type: 'dragstart'
4417
+ }
4418
+ | {
4419
+ type: 'dragend'
4420
+ }
4421
+ | {
4422
+ type: 'drop'
4394
4423
  },
4395
4424
  undefined,
4396
4425
  never,
@@ -5029,6 +5058,15 @@ declare const editorMachine: StateMachine<
5029
5058
  | {
5030
5059
  type: 'notify.unset'
5031
5060
  previousValue: Array<PortableTextBlock>
5061
+ }
5062
+ | {
5063
+ type: 'dragstart'
5064
+ }
5065
+ | {
5066
+ type: 'dragend'
5067
+ }
5068
+ | {
5069
+ type: 'drop'
5032
5070
  },
5033
5071
  undefined,
5034
5072
  never,
@@ -5668,6 +5706,15 @@ declare const editorMachine: StateMachine<
5668
5706
  | {
5669
5707
  type: 'notify.unset'
5670
5708
  previousValue: Array<PortableTextBlock>
5709
+ }
5710
+ | {
5711
+ type: 'dragstart'
5712
+ }
5713
+ | {
5714
+ type: 'dragend'
5715
+ }
5716
+ | {
5717
+ type: 'drop'
5671
5718
  },
5672
5719
  undefined,
5673
5720
  never,
@@ -6032,6 +6079,15 @@ declare const editorMachine: StateMachine<
6032
6079
  | {
6033
6080
  type: 'notify.unset'
6034
6081
  previousValue: Array<PortableTextBlock>
6082
+ }
6083
+ | {
6084
+ type: 'dragstart'
6085
+ }
6086
+ | {
6087
+ type: 'dragend'
6088
+ }
6089
+ | {
6090
+ type: 'drop'
6035
6091
  },
6036
6092
  undefined,
6037
6093
  never,
@@ -6671,6 +6727,15 @@ declare const editorMachine: StateMachine<
6671
6727
  | {
6672
6728
  type: 'notify.unset'
6673
6729
  previousValue: Array<PortableTextBlock>
6730
+ }
6731
+ | {
6732
+ type: 'dragstart'
6733
+ }
6734
+ | {
6735
+ type: 'dragend'
6736
+ }
6737
+ | {
6738
+ type: 'drop'
6674
6739
  },
6675
6740
  undefined,
6676
6741
  never,
@@ -7308,6 +7373,15 @@ declare const editorMachine: StateMachine<
7308
7373
  | {
7309
7374
  type: 'notify.unset'
7310
7375
  previousValue: Array<PortableTextBlock>
7376
+ }
7377
+ | {
7378
+ type: 'dragstart'
7379
+ }
7380
+ | {
7381
+ type: 'dragend'
7382
+ }
7383
+ | {
7384
+ type: 'drop'
7311
7385
  },
7312
7386
  undefined,
7313
7387
  never,
@@ -7946,6 +8020,15 @@ declare const editorMachine: StateMachine<
7946
8020
  | {
7947
8021
  type: 'notify.unset'
7948
8022
  previousValue: Array<PortableTextBlock>
8023
+ }
8024
+ | {
8025
+ type: 'dragstart'
8026
+ }
8027
+ | {
8028
+ type: 'dragend'
8029
+ }
8030
+ | {
8031
+ type: 'drop'
7949
8032
  },
7950
8033
  undefined,
7951
8034
  never,
@@ -8587,6 +8670,15 @@ declare const editorMachine: StateMachine<
8587
8670
  | {
8588
8671
  type: 'notify.unset'
8589
8672
  previousValue: Array<PortableTextBlock>
8673
+ }
8674
+ | {
8675
+ type: 'dragstart'
8676
+ }
8677
+ | {
8678
+ type: 'dragend'
8679
+ }
8680
+ | {
8681
+ type: 'drop'
8590
8682
  },
8591
8683
  undefined,
8592
8684
  never,
@@ -9228,6 +9320,15 @@ declare const editorMachine: StateMachine<
9228
9320
  | {
9229
9321
  type: 'notify.unset'
9230
9322
  previousValue: Array<PortableTextBlock>
9323
+ }
9324
+ | {
9325
+ type: 'dragstart'
9326
+ }
9327
+ | {
9328
+ type: 'dragend'
9329
+ }
9330
+ | {
9331
+ type: 'drop'
9231
9332
  },
9232
9333
  undefined,
9233
9334
  never,
@@ -9597,6 +9698,15 @@ declare const editorMachine: StateMachine<
9597
9698
  | {
9598
9699
  type: 'notify.unset'
9599
9700
  previousValue: Array<PortableTextBlock>
9701
+ }
9702
+ | {
9703
+ type: 'dragstart'
9704
+ }
9705
+ | {
9706
+ type: 'dragend'
9707
+ }
9708
+ | {
9709
+ type: 'drop'
9600
9710
  },
9601
9711
  undefined,
9602
9712
  never,
@@ -9963,6 +10073,15 @@ declare const editorMachine: StateMachine<
9963
10073
  | {
9964
10074
  type: 'notify.unset'
9965
10075
  previousValue: Array<PortableTextBlock>
10076
+ }
10077
+ | {
10078
+ type: 'dragstart'
10079
+ }
10080
+ | {
10081
+ type: 'dragend'
10082
+ }
10083
+ | {
10084
+ type: 'drop'
9966
10085
  },
9967
10086
  undefined,
9968
10087
  never,
@@ -10479,6 +10598,15 @@ declare const editorMachine: StateMachine<
10479
10598
  | {
10480
10599
  type: 'notify.unset'
10481
10600
  previousValue: Array<PortableTextBlock>
10601
+ }
10602
+ | {
10603
+ type: 'dragstart'
10604
+ }
10605
+ | {
10606
+ type: 'dragend'
10607
+ }
10608
+ | {
10609
+ type: 'drop'
10482
10610
  },
10483
10611
  undefined,
10484
10612
  never,
@@ -11125,6 +11253,15 @@ declare const editorMachine: StateMachine<
11125
11253
  | {
11126
11254
  type: 'notify.unset'
11127
11255
  previousValue: Array<PortableTextBlock>
11256
+ }
11257
+ | {
11258
+ type: 'dragstart'
11259
+ }
11260
+ | {
11261
+ type: 'dragend'
11262
+ }
11263
+ | {
11264
+ type: 'drop'
11128
11265
  },
11129
11266
  undefined,
11130
11267
  never,
@@ -11764,6 +11901,15 @@ declare const editorMachine: StateMachine<
11764
11901
  | {
11765
11902
  type: 'notify.unset'
11766
11903
  previousValue: Array<PortableTextBlock>
11904
+ }
11905
+ | {
11906
+ type: 'dragstart'
11907
+ }
11908
+ | {
11909
+ type: 'dragend'
11910
+ }
11911
+ | {
11912
+ type: 'drop'
11767
11913
  },
11768
11914
  undefined,
11769
11915
  never,
@@ -12403,6 +12549,15 @@ declare const editorMachine: StateMachine<
12403
12549
  | {
12404
12550
  type: 'notify.unset'
12405
12551
  previousValue: Array<PortableTextBlock>
12552
+ }
12553
+ | {
12554
+ type: 'dragstart'
12555
+ }
12556
+ | {
12557
+ type: 'dragend'
12558
+ }
12559
+ | {
12560
+ type: 'drop'
12406
12561
  },
12407
12562
  undefined,
12408
12563
  never,
@@ -13055,6 +13210,15 @@ declare const editorMachine: StateMachine<
13055
13210
  | {
13056
13211
  type: 'notify.unset'
13057
13212
  previousValue: Array<PortableTextBlock>
13213
+ }
13214
+ | {
13215
+ type: 'dragstart'
13216
+ }
13217
+ | {
13218
+ type: 'dragend'
13219
+ }
13220
+ | {
13221
+ type: 'drop'
13058
13222
  },
13059
13223
  undefined,
13060
13224
  never,
@@ -13708,6 +13872,15 @@ declare const editorMachine: StateMachine<
13708
13872
  | {
13709
13873
  type: 'notify.unset'
13710
13874
  previousValue: Array<PortableTextBlock>
13875
+ }
13876
+ | {
13877
+ type: 'dragstart'
13878
+ }
13879
+ | {
13880
+ type: 'dragend'
13881
+ }
13882
+ | {
13883
+ type: 'drop'
13711
13884
  },
13712
13885
  undefined,
13713
13886
  never,
@@ -14347,6 +14520,15 @@ declare const editorMachine: StateMachine<
14347
14520
  | {
14348
14521
  type: 'notify.unset'
14349
14522
  previousValue: Array<PortableTextBlock>
14523
+ }
14524
+ | {
14525
+ type: 'dragstart'
14526
+ }
14527
+ | {
14528
+ type: 'dragend'
14529
+ }
14530
+ | {
14531
+ type: 'drop'
14350
14532
  },
14351
14533
  undefined,
14352
14534
  never,
@@ -14989,6 +15171,15 @@ declare const editorMachine: StateMachine<
14989
15171
  | {
14990
15172
  type: 'notify.unset'
14991
15173
  previousValue: Array<PortableTextBlock>
15174
+ }
15175
+ | {
15176
+ type: 'dragstart'
15177
+ }
15178
+ | {
15179
+ type: 'dragend'
15180
+ }
15181
+ | {
15182
+ type: 'drop'
14992
15183
  },
14993
15184
  undefined,
14994
15185
  never,
@@ -15682,6 +15873,15 @@ declare const editorMachine: StateMachine<
15682
15873
  | {
15683
15874
  type: 'notify.unset'
15684
15875
  previousValue: Array<PortableTextBlock>
15876
+ }
15877
+ | {
15878
+ type: 'dragstart'
15879
+ }
15880
+ | {
15881
+ type: 'dragend'
15882
+ }
15883
+ | {
15884
+ type: 'drop'
15685
15885
  },
15686
15886
  undefined,
15687
15887
  never,
@@ -16330,6 +16530,15 @@ declare const editorMachine: StateMachine<
16330
16530
  | {
16331
16531
  type: 'notify.unset'
16332
16532
  previousValue: Array<PortableTextBlock>
16533
+ }
16534
+ | {
16535
+ type: 'dragstart'
16536
+ }
16537
+ | {
16538
+ type: 'dragend'
16539
+ }
16540
+ | {
16541
+ type: 'drop'
16333
16542
  },
16334
16543
  undefined,
16335
16544
  never,
@@ -16979,6 +17188,15 @@ declare const editorMachine: StateMachine<
16979
17188
  | {
16980
17189
  type: 'notify.unset'
16981
17190
  previousValue: Array<PortableTextBlock>
17191
+ }
17192
+ | {
17193
+ type: 'dragstart'
17194
+ }
17195
+ | {
17196
+ type: 'dragend'
17197
+ }
17198
+ | {
17199
+ type: 'drop'
16982
17200
  },
16983
17201
  undefined,
16984
17202
  never,
@@ -17619,6 +17837,15 @@ declare const editorMachine: StateMachine<
17619
17837
  | {
17620
17838
  type: 'notify.unset'
17621
17839
  previousValue: Array<PortableTextBlock>
17840
+ }
17841
+ | {
17842
+ type: 'dragstart'
17843
+ }
17844
+ | {
17845
+ type: 'dragend'
17846
+ }
17847
+ | {
17848
+ type: 'drop'
17622
17849
  },
17623
17850
  undefined,
17624
17851
  never,
@@ -18261,6 +18488,15 @@ declare const editorMachine: StateMachine<
18261
18488
  | {
18262
18489
  type: 'notify.unset'
18263
18490
  previousValue: Array<PortableTextBlock>
18491
+ }
18492
+ | {
18493
+ type: 'dragstart'
18494
+ }
18495
+ | {
18496
+ type: 'dragend'
18497
+ }
18498
+ | {
18499
+ type: 'drop'
18264
18500
  },
18265
18501
  undefined,
18266
18502
  never,
@@ -18909,6 +19145,15 @@ declare const editorMachine: StateMachine<
18909
19145
  | {
18910
19146
  type: 'notify.unset'
18911
19147
  previousValue: Array<PortableTextBlock>
19148
+ }
19149
+ | {
19150
+ type: 'dragstart'
19151
+ }
19152
+ | {
19153
+ type: 'dragend'
19154
+ }
19155
+ | {
19156
+ type: 'drop'
18912
19157
  },
18913
19158
  undefined,
18914
19159
  never,
@@ -19204,6 +19449,27 @@ declare const editorMachine: StateMachine<
19204
19449
  >
19205
19450
  }
19206
19451
  }
19452
+ readonly initial: 'idle'
19453
+ readonly states: {
19454
+ readonly 'idle': {
19455
+ readonly on: {
19456
+ readonly dragstart: {
19457
+ readonly target: 'dragging internally'
19458
+ }
19459
+ }
19460
+ }
19461
+ readonly 'dragging internally': {
19462
+ readonly tags: readonly ['dragging internally']
19463
+ readonly on: {
19464
+ readonly dragend: {
19465
+ readonly target: 'idle'
19466
+ }
19467
+ readonly drop: {
19468
+ readonly target: 'idle'
19469
+ }
19470
+ }
19471
+ }
19472
+ }
19207
19473
  }
19208
19474
  }
19209
19475
  }
@@ -19343,6 +19609,13 @@ export declare type EditorSelector<TSelected> = (
19343
19609
  */
19344
19610
  export declare type EditorSnapshot = {
19345
19611
  context: EditorContext
19612
+ /**
19613
+ * @beta
19614
+ * Do not rely on this externally
19615
+ */
19616
+ beta: {
19617
+ hasTag: HasTag
19618
+ }
19346
19619
  }
19347
19620
 
19348
19621
  /**
@@ -19402,6 +19675,8 @@ export declare type FocusChange = {
19402
19675
  event: FocusEvent_2<HTMLDivElement, Element>
19403
19676
  }
19404
19677
 
19678
+ declare type HasTag = ReturnType<EditorActor['getSnapshot']>['hasTag']
19679
+
19405
19680
  /** @internal */
19406
19681
  declare interface History_2 {
19407
19682
  redos: HistoryItem[]
@@ -19767,9 +20042,9 @@ export declare class PortableTextEditor extends Component<
19767
20042
  path: Path,
19768
20043
  ) => [
19769
20044
  (
19770
- | PortableTextSpan
20045
+ | PortableTextTextBlock<PortableTextObject | PortableTextSpan>
19771
20046
  | PortableTextObject
19772
- | PortableTextTextBlock<PortableTextSpan | PortableTextObject>
20047
+ | PortableTextSpan
19773
20048
  | undefined
19774
20049
  ),
19775
20050
  Path | undefined,
@@ -20320,10 +20595,10 @@ export declare type SelectionChange = {
20320
20595
  }
20321
20596
 
20322
20597
  declare type Serializer<TMIMEType extends MIMEType> = ({
20323
- context,
20598
+ snapshot,
20324
20599
  event,
20325
20600
  }: {
20326
- context: EditorContext
20601
+ snapshot: EditorSnapshot
20327
20602
  event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'serialize'>
20328
20603
  }) => PickFromUnion<
20329
20604
  ConverterEvent<TMIMEType>,