@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
@@ -101,11 +101,13 @@ declare type BehaviorActionIntend =
101
101
  * @beta
102
102
  */
103
103
  declare type BehaviorActionIntendSet<TBehaviorEvent, TGuardResponse> = (
104
- {
105
- context,
106
- event,
107
- }: {
104
+ payload: {
105
+ /**
106
+ * @deprecated
107
+ * Use `snapshot` instead
108
+ */
108
109
  context: EditorContext
110
+ snapshot: EditorSnapshot
109
111
  event: TBehaviorEvent
110
112
  },
111
113
  guardResponse: TGuardResponse,
@@ -122,11 +124,13 @@ declare type BehaviorEvent =
122
124
  /**
123
125
  * @beta
124
126
  */
125
- declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = ({
126
- context,
127
- event,
128
- }: {
127
+ declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = (payload: {
128
+ /**
129
+ * @deprecated
130
+ * Use `snapshot` instead
131
+ */
129
132
  context: EditorContext
133
+ snapshot: EditorSnapshot
130
134
  event: TBehaviorEvent
131
135
  }) => TGuardResponse | false
132
136
 
@@ -195,10 +199,10 @@ declare type CustomBehaviorEvent<
195
199
  } & TPayload
196
200
 
197
201
  declare type Deserializer<TMIMEType extends MIMEType> = ({
198
- context,
202
+ snapshot,
199
203
  event,
200
204
  }: {
201
- context: EditorContext
205
+ snapshot: EditorSnapshot
202
206
  event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'deserialize'>
203
207
  }) => PickFromUnion<
204
208
  ConverterEvent<TMIMEType>,
@@ -742,6 +746,15 @@ declare const editorMachine: StateMachine<
742
746
  | {
743
747
  type: 'notify.unset'
744
748
  previousValue: Array<PortableTextBlock>
749
+ }
750
+ | {
751
+ type: 'dragstart'
752
+ }
753
+ | {
754
+ type: 'dragend'
755
+ }
756
+ | {
757
+ type: 'drop'
745
758
  },
746
759
  {},
747
760
  never,
@@ -803,7 +816,9 @@ declare const editorMachine: StateMachine<
803
816
  never,
804
817
  {
805
818
  'edit mode':
806
- | 'editable'
819
+ | {
820
+ editable: 'dragging internally' | 'idle'
821
+ }
807
822
  | {
808
823
  'read only': 'read only' | 'determine initial edit mode'
809
824
  }
@@ -814,7 +829,7 @@ declare const editorMachine: StateMachine<
814
829
  pristine: 'normalizing' | 'idle'
815
830
  }
816
831
  },
817
- string,
832
+ 'dragging internally',
818
833
  {
819
834
  behaviors?: Array<Behavior>
820
835
  converters?: Array<Converter>
@@ -1488,6 +1503,15 @@ declare const editorMachine: StateMachine<
1488
1503
  | {
1489
1504
  type: 'notify.unset'
1490
1505
  previousValue: Array<PortableTextBlock>
1506
+ }
1507
+ | {
1508
+ type: 'dragstart'
1509
+ }
1510
+ | {
1511
+ type: 'dragend'
1512
+ }
1513
+ | {
1514
+ type: 'drop'
1491
1515
  },
1492
1516
  Record<string, AnyActorRef | undefined>,
1493
1517
  StateValue,
@@ -1836,6 +1860,15 @@ declare const editorMachine: StateMachine<
1836
1860
  | {
1837
1861
  type: 'notify.unset'
1838
1862
  previousValue: Array<PortableTextBlock>
1863
+ }
1864
+ | {
1865
+ type: 'dragstart'
1866
+ }
1867
+ | {
1868
+ type: 'dragend'
1869
+ }
1870
+ | {
1871
+ type: 'drop'
1839
1872
  },
1840
1873
  AnyEventObject
1841
1874
  >
@@ -2208,6 +2241,15 @@ declare const editorMachine: StateMachine<
2208
2241
  | {
2209
2242
  type: 'notify.unset'
2210
2243
  previousValue: Array<PortableTextBlock>
2244
+ }
2245
+ | {
2246
+ type: 'dragstart'
2247
+ }
2248
+ | {
2249
+ type: 'dragend'
2250
+ }
2251
+ | {
2252
+ type: 'drop'
2211
2253
  },
2212
2254
  undefined,
2213
2255
  never,
@@ -2845,6 +2887,15 @@ declare const editorMachine: StateMachine<
2845
2887
  | {
2846
2888
  type: 'notify.unset'
2847
2889
  previousValue: Array<PortableTextBlock>
2890
+ }
2891
+ | {
2892
+ type: 'dragstart'
2893
+ }
2894
+ | {
2895
+ type: 'dragend'
2896
+ }
2897
+ | {
2898
+ type: 'drop'
2848
2899
  },
2849
2900
  undefined,
2850
2901
  never,
@@ -3485,6 +3536,15 @@ declare const editorMachine: StateMachine<
3485
3536
  | {
3486
3537
  type: 'notify.unset'
3487
3538
  previousValue: Array<PortableTextBlock>
3539
+ }
3540
+ | {
3541
+ type: 'dragstart'
3542
+ }
3543
+ | {
3544
+ type: 'dragend'
3545
+ }
3546
+ | {
3547
+ type: 'drop'
3488
3548
  },
3489
3549
  undefined,
3490
3550
  never,
@@ -4124,6 +4184,15 @@ declare const editorMachine: StateMachine<
4124
4184
  | {
4125
4185
  type: 'notify.unset'
4126
4186
  previousValue: Array<PortableTextBlock>
4187
+ }
4188
+ | {
4189
+ type: 'dragstart'
4190
+ }
4191
+ | {
4192
+ type: 'dragend'
4193
+ }
4194
+ | {
4195
+ type: 'drop'
4127
4196
  },
4128
4197
  undefined,
4129
4198
  never,
@@ -4762,6 +4831,15 @@ declare const editorMachine: StateMachine<
4762
4831
  | {
4763
4832
  type: 'notify.unset'
4764
4833
  previousValue: Array<PortableTextBlock>
4834
+ }
4835
+ | {
4836
+ type: 'dragstart'
4837
+ }
4838
+ | {
4839
+ type: 'dragend'
4840
+ }
4841
+ | {
4842
+ type: 'drop'
4765
4843
  },
4766
4844
  undefined,
4767
4845
  never,
@@ -5401,6 +5479,15 @@ declare const editorMachine: StateMachine<
5401
5479
  | {
5402
5480
  type: 'notify.unset'
5403
5481
  previousValue: Array<PortableTextBlock>
5482
+ }
5483
+ | {
5484
+ type: 'dragstart'
5485
+ }
5486
+ | {
5487
+ type: 'dragend'
5488
+ }
5489
+ | {
5490
+ type: 'drop'
5404
5491
  },
5405
5492
  undefined,
5406
5493
  never,
@@ -5765,6 +5852,15 @@ declare const editorMachine: StateMachine<
5765
5852
  | {
5766
5853
  type: 'notify.unset'
5767
5854
  previousValue: Array<PortableTextBlock>
5855
+ }
5856
+ | {
5857
+ type: 'dragstart'
5858
+ }
5859
+ | {
5860
+ type: 'dragend'
5861
+ }
5862
+ | {
5863
+ type: 'drop'
5768
5864
  },
5769
5865
  undefined,
5770
5866
  never,
@@ -6404,6 +6500,15 @@ declare const editorMachine: StateMachine<
6404
6500
  | {
6405
6501
  type: 'notify.unset'
6406
6502
  previousValue: Array<PortableTextBlock>
6503
+ }
6504
+ | {
6505
+ type: 'dragstart'
6506
+ }
6507
+ | {
6508
+ type: 'dragend'
6509
+ }
6510
+ | {
6511
+ type: 'drop'
6407
6512
  },
6408
6513
  undefined,
6409
6514
  never,
@@ -7041,6 +7146,15 @@ declare const editorMachine: StateMachine<
7041
7146
  | {
7042
7147
  type: 'notify.unset'
7043
7148
  previousValue: Array<PortableTextBlock>
7149
+ }
7150
+ | {
7151
+ type: 'dragstart'
7152
+ }
7153
+ | {
7154
+ type: 'dragend'
7155
+ }
7156
+ | {
7157
+ type: 'drop'
7044
7158
  },
7045
7159
  undefined,
7046
7160
  never,
@@ -7679,6 +7793,15 @@ declare const editorMachine: StateMachine<
7679
7793
  | {
7680
7794
  type: 'notify.unset'
7681
7795
  previousValue: Array<PortableTextBlock>
7796
+ }
7797
+ | {
7798
+ type: 'dragstart'
7799
+ }
7800
+ | {
7801
+ type: 'dragend'
7802
+ }
7803
+ | {
7804
+ type: 'drop'
7682
7805
  },
7683
7806
  undefined,
7684
7807
  never,
@@ -8320,6 +8443,15 @@ declare const editorMachine: StateMachine<
8320
8443
  | {
8321
8444
  type: 'notify.unset'
8322
8445
  previousValue: Array<PortableTextBlock>
8446
+ }
8447
+ | {
8448
+ type: 'dragstart'
8449
+ }
8450
+ | {
8451
+ type: 'dragend'
8452
+ }
8453
+ | {
8454
+ type: 'drop'
8323
8455
  },
8324
8456
  undefined,
8325
8457
  never,
@@ -8961,6 +9093,15 @@ declare const editorMachine: StateMachine<
8961
9093
  | {
8962
9094
  type: 'notify.unset'
8963
9095
  previousValue: Array<PortableTextBlock>
9096
+ }
9097
+ | {
9098
+ type: 'dragstart'
9099
+ }
9100
+ | {
9101
+ type: 'dragend'
9102
+ }
9103
+ | {
9104
+ type: 'drop'
8964
9105
  },
8965
9106
  undefined,
8966
9107
  never,
@@ -9330,6 +9471,15 @@ declare const editorMachine: StateMachine<
9330
9471
  | {
9331
9472
  type: 'notify.unset'
9332
9473
  previousValue: Array<PortableTextBlock>
9474
+ }
9475
+ | {
9476
+ type: 'dragstart'
9477
+ }
9478
+ | {
9479
+ type: 'dragend'
9480
+ }
9481
+ | {
9482
+ type: 'drop'
9333
9483
  },
9334
9484
  undefined,
9335
9485
  never,
@@ -9696,6 +9846,15 @@ declare const editorMachine: StateMachine<
9696
9846
  | {
9697
9847
  type: 'notify.unset'
9698
9848
  previousValue: Array<PortableTextBlock>
9849
+ }
9850
+ | {
9851
+ type: 'dragstart'
9852
+ }
9853
+ | {
9854
+ type: 'dragend'
9855
+ }
9856
+ | {
9857
+ type: 'drop'
9699
9858
  },
9700
9859
  undefined,
9701
9860
  never,
@@ -10212,6 +10371,15 @@ declare const editorMachine: StateMachine<
10212
10371
  | {
10213
10372
  type: 'notify.unset'
10214
10373
  previousValue: Array<PortableTextBlock>
10374
+ }
10375
+ | {
10376
+ type: 'dragstart'
10377
+ }
10378
+ | {
10379
+ type: 'dragend'
10380
+ }
10381
+ | {
10382
+ type: 'drop'
10215
10383
  },
10216
10384
  undefined,
10217
10385
  never,
@@ -10858,6 +11026,15 @@ declare const editorMachine: StateMachine<
10858
11026
  | {
10859
11027
  type: 'notify.unset'
10860
11028
  previousValue: Array<PortableTextBlock>
11029
+ }
11030
+ | {
11031
+ type: 'dragstart'
11032
+ }
11033
+ | {
11034
+ type: 'dragend'
11035
+ }
11036
+ | {
11037
+ type: 'drop'
10861
11038
  },
10862
11039
  undefined,
10863
11040
  never,
@@ -11497,6 +11674,15 @@ declare const editorMachine: StateMachine<
11497
11674
  | {
11498
11675
  type: 'notify.unset'
11499
11676
  previousValue: Array<PortableTextBlock>
11677
+ }
11678
+ | {
11679
+ type: 'dragstart'
11680
+ }
11681
+ | {
11682
+ type: 'dragend'
11683
+ }
11684
+ | {
11685
+ type: 'drop'
11500
11686
  },
11501
11687
  undefined,
11502
11688
  never,
@@ -12136,6 +12322,15 @@ declare const editorMachine: StateMachine<
12136
12322
  | {
12137
12323
  type: 'notify.unset'
12138
12324
  previousValue: Array<PortableTextBlock>
12325
+ }
12326
+ | {
12327
+ type: 'dragstart'
12328
+ }
12329
+ | {
12330
+ type: 'dragend'
12331
+ }
12332
+ | {
12333
+ type: 'drop'
12139
12334
  },
12140
12335
  undefined,
12141
12336
  never,
@@ -12788,6 +12983,15 @@ declare const editorMachine: StateMachine<
12788
12983
  | {
12789
12984
  type: 'notify.unset'
12790
12985
  previousValue: Array<PortableTextBlock>
12986
+ }
12987
+ | {
12988
+ type: 'dragstart'
12989
+ }
12990
+ | {
12991
+ type: 'dragend'
12992
+ }
12993
+ | {
12994
+ type: 'drop'
12791
12995
  },
12792
12996
  undefined,
12793
12997
  never,
@@ -13441,6 +13645,15 @@ declare const editorMachine: StateMachine<
13441
13645
  | {
13442
13646
  type: 'notify.unset'
13443
13647
  previousValue: Array<PortableTextBlock>
13648
+ }
13649
+ | {
13650
+ type: 'dragstart'
13651
+ }
13652
+ | {
13653
+ type: 'dragend'
13654
+ }
13655
+ | {
13656
+ type: 'drop'
13444
13657
  },
13445
13658
  undefined,
13446
13659
  never,
@@ -14080,6 +14293,15 @@ declare const editorMachine: StateMachine<
14080
14293
  | {
14081
14294
  type: 'notify.unset'
14082
14295
  previousValue: Array<PortableTextBlock>
14296
+ }
14297
+ | {
14298
+ type: 'dragstart'
14299
+ }
14300
+ | {
14301
+ type: 'dragend'
14302
+ }
14303
+ | {
14304
+ type: 'drop'
14083
14305
  },
14084
14306
  undefined,
14085
14307
  never,
@@ -14722,6 +14944,15 @@ declare const editorMachine: StateMachine<
14722
14944
  | {
14723
14945
  type: 'notify.unset'
14724
14946
  previousValue: Array<PortableTextBlock>
14947
+ }
14948
+ | {
14949
+ type: 'dragstart'
14950
+ }
14951
+ | {
14952
+ type: 'dragend'
14953
+ }
14954
+ | {
14955
+ type: 'drop'
14725
14956
  },
14726
14957
  undefined,
14727
14958
  never,
@@ -15415,6 +15646,15 @@ declare const editorMachine: StateMachine<
15415
15646
  | {
15416
15647
  type: 'notify.unset'
15417
15648
  previousValue: Array<PortableTextBlock>
15649
+ }
15650
+ | {
15651
+ type: 'dragstart'
15652
+ }
15653
+ | {
15654
+ type: 'dragend'
15655
+ }
15656
+ | {
15657
+ type: 'drop'
15418
15658
  },
15419
15659
  undefined,
15420
15660
  never,
@@ -16063,6 +16303,15 @@ declare const editorMachine: StateMachine<
16063
16303
  | {
16064
16304
  type: 'notify.unset'
16065
16305
  previousValue: Array<PortableTextBlock>
16306
+ }
16307
+ | {
16308
+ type: 'dragstart'
16309
+ }
16310
+ | {
16311
+ type: 'dragend'
16312
+ }
16313
+ | {
16314
+ type: 'drop'
16066
16315
  },
16067
16316
  undefined,
16068
16317
  never,
@@ -16712,6 +16961,15 @@ declare const editorMachine: StateMachine<
16712
16961
  | {
16713
16962
  type: 'notify.unset'
16714
16963
  previousValue: Array<PortableTextBlock>
16964
+ }
16965
+ | {
16966
+ type: 'dragstart'
16967
+ }
16968
+ | {
16969
+ type: 'dragend'
16970
+ }
16971
+ | {
16972
+ type: 'drop'
16715
16973
  },
16716
16974
  undefined,
16717
16975
  never,
@@ -17352,6 +17610,15 @@ declare const editorMachine: StateMachine<
17352
17610
  | {
17353
17611
  type: 'notify.unset'
17354
17612
  previousValue: Array<PortableTextBlock>
17613
+ }
17614
+ | {
17615
+ type: 'dragstart'
17616
+ }
17617
+ | {
17618
+ type: 'dragend'
17619
+ }
17620
+ | {
17621
+ type: 'drop'
17355
17622
  },
17356
17623
  undefined,
17357
17624
  never,
@@ -17994,6 +18261,15 @@ declare const editorMachine: StateMachine<
17994
18261
  | {
17995
18262
  type: 'notify.unset'
17996
18263
  previousValue: Array<PortableTextBlock>
18264
+ }
18265
+ | {
18266
+ type: 'dragstart'
18267
+ }
18268
+ | {
18269
+ type: 'dragend'
18270
+ }
18271
+ | {
18272
+ type: 'drop'
17997
18273
  },
17998
18274
  undefined,
17999
18275
  never,
@@ -18642,6 +18918,15 @@ declare const editorMachine: StateMachine<
18642
18918
  | {
18643
18919
  type: 'notify.unset'
18644
18920
  previousValue: Array<PortableTextBlock>
18921
+ }
18922
+ | {
18923
+ type: 'dragstart'
18924
+ }
18925
+ | {
18926
+ type: 'dragend'
18927
+ }
18928
+ | {
18929
+ type: 'drop'
18645
18930
  },
18646
18931
  undefined,
18647
18932
  never,
@@ -18937,6 +19222,27 @@ declare const editorMachine: StateMachine<
18937
19222
  >
18938
19223
  }
18939
19224
  }
19225
+ readonly initial: 'idle'
19226
+ readonly states: {
19227
+ readonly 'idle': {
19228
+ readonly on: {
19229
+ readonly dragstart: {
19230
+ readonly target: 'dragging internally'
19231
+ }
19232
+ }
19233
+ }
19234
+ readonly 'dragging internally': {
19235
+ readonly tags: readonly ['dragging internally']
19236
+ readonly on: {
19237
+ readonly dragend: {
19238
+ readonly target: 'idle'
19239
+ }
19240
+ readonly drop: {
19241
+ readonly target: 'idle'
19242
+ }
19243
+ }
19244
+ }
19245
+ }
18940
19246
  }
18941
19247
  }
18942
19248
  }
@@ -19040,6 +19346,13 @@ declare type EditorSelectionPoint = {
19040
19346
  */
19041
19347
  declare type EditorSnapshot = {
19042
19348
  context: EditorContext
19349
+ /**
19350
+ * @beta
19351
+ * Do not rely on this externally
19352
+ */
19353
+ beta: {
19354
+ hasTag: HasTag
19355
+ }
19043
19356
  }
19044
19357
 
19045
19358
  /**
@@ -19133,6 +19446,8 @@ declare type ExternalEditorEvent =
19133
19446
  }
19134
19447
  | PatchesEvent
19135
19448
 
19449
+ declare type HasTag = ReturnType<EditorActor['getSnapshot']>['hasTag']
19450
+
19136
19451
  /** @internal */
19137
19452
  declare interface History_2 {
19138
19453
  redos: HistoryItem[]
@@ -19190,14 +19505,6 @@ declare type MarkdownBehaviorsConfig = {
19190
19505
  orderedListStyle?: (context: {schema: EditorSchema}) => string | undefined
19191
19506
  }
19192
19507
 
19193
- /**
19194
- * @beta
19195
- */
19196
- declare type MarkdownEmphasisBehaviorsConfig = {
19197
- boldDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
19198
- italicDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
19199
- }
19200
-
19201
19508
  /**
19202
19509
  * @beta
19203
19510
  * Add markdown behaviors for common markdown actions such as converting ### to headings, --- to HRs, and more.
@@ -19215,8 +19522,12 @@ declare type MarkdownEmphasisBehaviorsConfig = {
19215
19522
  * config={{
19216
19523
  * boldDecorator: ({schema}) =>
19217
19524
  * schema.decorators.find((decorator) => decorator.value === 'strong')?.value,
19525
+ * codeDecorator: ({schema}) =>
19526
+ * schema.decorators.find((decorator) => decorator.value === 'code')?.value,
19218
19527
  * italicDecorator: ({schema}) =>
19219
19528
  * schema.decorators.find((decorator) => decorator.value === 'em')?.value,
19529
+ * strikeThroughDecorator: ({schema}) =>
19530
+ * schema.decorators.find((decorator) => decorator.value === 'strike-through')?.value,
19220
19531
  * horizontalRuleObject: ({schema}) => {
19221
19532
  * const name = schema.blockObjects.find(
19222
19533
  * (object) => object.name === 'break',
@@ -19243,13 +19554,21 @@ declare type MarkdownEmphasisBehaviorsConfig = {
19243
19554
  */
19244
19555
  export declare function MarkdownPlugin(props: {
19245
19556
  config: MarkdownPluginConfig
19246
- }): null
19557
+ }): JSX.Element
19247
19558
 
19248
19559
  /**
19249
19560
  * @beta
19250
19561
  */
19251
- export declare type MarkdownPluginConfig = MarkdownBehaviorsConfig &
19252
- MarkdownEmphasisBehaviorsConfig
19562
+ export declare type MarkdownPluginConfig = MarkdownBehaviorsConfig & {
19563
+ boldDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
19564
+ codeDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
19565
+ italicDecorator?: ({schema}: {schema: EditorSchema}) => string | undefined
19566
+ strikeThroughDecorator?: ({
19567
+ schema,
19568
+ }: {
19569
+ schema: EditorSchema
19570
+ }) => string | undefined
19571
+ }
19253
19572
 
19254
19573
  declare type MIMEType = `${string}/${string}`
19255
19574
 
@@ -19385,10 +19704,10 @@ declare interface PortableTextSlateEditor extends ReactEditor {
19385
19704
  }
19386
19705
 
19387
19706
  declare type Serializer<TMIMEType extends MIMEType> = ({
19388
- context,
19707
+ snapshot,
19389
19708
  event,
19390
19709
  }: {
19391
- context: EditorContext
19710
+ snapshot: EditorSnapshot
19392
19711
  event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'serialize'>
19393
19712
  }) => PickFromUnion<
19394
19713
  ConverterEvent<TMIMEType>,