@portabletext/editor 1.20.0 → 1.21.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 (128) hide show
  1. package/lib/_chunks-cjs/behavior.core.cjs +8 -68
  2. package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
  3. package/lib/_chunks-cjs/selector.get-text-before.cjs +11 -39
  4. package/lib/_chunks-cjs/selector.get-text-before.cjs.map +1 -1
  5. package/lib/_chunks-cjs/util.get-block-start-point.cjs +30 -0
  6. package/lib/_chunks-cjs/util.get-block-start-point.cjs.map +1 -0
  7. package/lib/_chunks-cjs/util.is-empty-text-block.cjs +71 -0
  8. package/lib/_chunks-cjs/util.is-empty-text-block.cjs.map +1 -0
  9. package/lib/_chunks-cjs/util.is-keyed-segment.cjs +6 -0
  10. package/lib/_chunks-cjs/util.is-keyed-segment.cjs.map +1 -0
  11. package/lib/_chunks-es/behavior.core.js +7 -66
  12. package/lib/_chunks-es/behavior.core.js.map +1 -1
  13. package/lib/_chunks-es/selector.get-text-before.js +5 -31
  14. package/lib/_chunks-es/selector.get-text-before.js.map +1 -1
  15. package/lib/_chunks-es/util.get-block-start-point.js +31 -0
  16. package/lib/_chunks-es/util.get-block-start-point.js.map +1 -0
  17. package/lib/_chunks-es/util.is-empty-text-block.js +73 -0
  18. package/lib/_chunks-es/util.is-empty-text-block.js.map +1 -0
  19. package/lib/_chunks-es/util.is-keyed-segment.js +7 -0
  20. package/lib/_chunks-es/util.is-keyed-segment.js.map +1 -0
  21. package/lib/behaviors/index.cjs +7 -7
  22. package/lib/behaviors/index.cjs.map +1 -1
  23. package/lib/behaviors/index.d.cts +179 -119
  24. package/lib/behaviors/index.d.ts +179 -119
  25. package/lib/behaviors/index.js +3 -2
  26. package/lib/behaviors/index.js.map +1 -1
  27. package/lib/index.cjs +112 -21
  28. package/lib/index.cjs.map +1 -1
  29. package/lib/index.d.cts +870 -141
  30. package/lib/index.d.ts +870 -141
  31. package/lib/index.js +111 -19
  32. package/lib/index.js.map +1 -1
  33. package/lib/selectors/index.cjs +73 -1
  34. package/lib/selectors/index.cjs.map +1 -1
  35. package/lib/selectors/index.d.cts +14 -0
  36. package/lib/selectors/index.d.ts +14 -0
  37. package/lib/selectors/index.js +73 -0
  38. package/lib/selectors/index.js.map +1 -1
  39. package/lib/utils/index.cjs +11 -0
  40. package/lib/utils/index.cjs.map +1 -0
  41. package/lib/utils/index.d.cts +87 -0
  42. package/lib/utils/index.d.ts +87 -0
  43. package/lib/utils/index.js +13 -0
  44. package/lib/utils/index.js.map +1 -0
  45. package/package.json +15 -9
  46. package/src/behavior-actions/behavior.action-utils.insert-block.ts +1 -1
  47. package/src/behavior-actions/behavior.action.insert-block-object.ts +1 -1
  48. package/src/behavior-actions/behavior.action.insert-inline-object.ts +1 -1
  49. package/src/behavior-actions/behavior.action.text-block.set.ts +1 -1
  50. package/src/behavior-actions/behavior.action.text-block.unset.ts +1 -1
  51. package/src/behavior-actions/behavior.actions.ts +5 -5
  52. package/src/behaviors/behavior.code-editor.ts +1 -1
  53. package/src/behaviors/behavior.core.block-objects.ts +2 -2
  54. package/src/behaviors/behavior.core.decorators.ts +1 -1
  55. package/src/behaviors/behavior.core.lists.ts +2 -2
  56. package/src/behaviors/behavior.emoji-picker.ts +1 -1
  57. package/src/behaviors/behavior.links.ts +1 -1
  58. package/src/behaviors/behavior.markdown.ts +2 -2
  59. package/src/behaviors/behavior.types.ts +52 -19
  60. package/src/behaviors/index.ts +1 -0
  61. package/src/editor/Editable.tsx +12 -12
  62. package/src/editor/PortableTextEditor.tsx +2 -2
  63. package/src/editor/components/DraggableBlock.tsx +2 -2
  64. package/src/editor/components/Element.tsx +3 -3
  65. package/src/editor/components/Leaf.tsx +1 -1
  66. package/src/editor/components/Synchronizer.tsx +1 -1
  67. package/src/editor/create-editor.ts +22 -20
  68. package/src/editor/create-slate-editor.tsx +5 -2
  69. package/src/editor/editor-machine.ts +115 -23
  70. package/src/editor/get-value.ts +2 -2
  71. package/src/editor/hooks/usePortableTextEditorSelection.tsx +1 -1
  72. package/src/editor/mutation-machine.ts +2 -2
  73. package/src/editor/plugins/create-with-event-listeners.ts +50 -4
  74. package/src/editor/plugins/createWithEditableAPI.ts +7 -7
  75. package/src/editor/plugins/createWithHotKeys.ts +2 -2
  76. package/src/editor/plugins/createWithInsertData.ts +7 -7
  77. package/src/editor/plugins/createWithMaxBlocks.ts +2 -2
  78. package/src/editor/plugins/createWithObjectKeys.ts +2 -2
  79. package/src/editor/plugins/createWithPatches.ts +10 -10
  80. package/src/editor/plugins/createWithPlaceholderBlock.ts +3 -3
  81. package/src/editor/plugins/createWithPortableTextBlockStyle.ts +1 -1
  82. package/src/editor/plugins/createWithPortableTextMarkModel.ts +4 -4
  83. package/src/editor/plugins/createWithPortableTextSelections.ts +6 -6
  84. package/src/editor/plugins/createWithSchemaTypes.ts +1 -1
  85. package/src/editor/plugins/createWithUndoRedo.ts +5 -5
  86. package/src/editor/plugins/createWithUtils.ts +2 -2
  87. package/src/editor/plugins/with-plugins.ts +1 -1
  88. package/src/editor/sync-machine.ts +8 -5
  89. package/src/index.ts +5 -1
  90. package/src/selectors/index.ts +2 -0
  91. package/src/selectors/selector.get-selection-text.test.ts +75 -0
  92. package/src/selectors/selector.get-selection-text.ts +3 -3
  93. package/src/selectors/selector.get-text-before.ts +7 -4
  94. package/src/selectors/selector.is-point-after-selection.ts +82 -0
  95. package/src/selectors/selector.is-point-before-selection.ts +82 -0
  96. package/src/utils/_exports/index.ts +1 -0
  97. package/src/utils/index.ts +11 -0
  98. package/src/{editor/utils/utils.block-offset.test.ts → utils/util.block-offset.test.ts} +1 -1
  99. package/src/{editor/utils/utils.block-offset.ts → utils/util.block-offset.ts} +23 -7
  100. package/src/{editor/utils/utils.get-start-point.ts → utils/util.get-block-start-point.ts} +5 -2
  101. package/src/utils/util.get-text-block-text.ts +8 -0
  102. package/src/{editor/utils/utils.ts → utils/util.is-empty-text-block.ts} +4 -5
  103. package/src/{editor/utils/utils.is-keyed-segment.ts → utils/util.is-keyed-segment.ts} +3 -0
  104. package/src/{editor/utils/utils.reverse-selection.ts → utils/util.reverse-selection.ts} +4 -1
  105. /package/src/{utils → internal-utils}/__tests__/dmpToOperations.test.ts +0 -0
  106. /package/src/{utils → internal-utils}/__tests__/operationToPatches.test.ts +0 -0
  107. /package/src/{utils → internal-utils}/__tests__/patchToOperations.test.ts +0 -0
  108. /package/src/{utils → internal-utils}/__tests__/ranges.test.ts +0 -0
  109. /package/src/{utils → internal-utils}/__tests__/valueNormalization.test.tsx +0 -0
  110. /package/src/{utils → internal-utils}/__tests__/values.test.ts +0 -0
  111. /package/src/{utils → internal-utils}/applyPatch.ts +0 -0
  112. /package/src/{utils → internal-utils}/debug.ts +0 -0
  113. /package/src/{utils → internal-utils}/is-hotkey.test.ts +0 -0
  114. /package/src/{utils → internal-utils}/is-hotkey.ts +0 -0
  115. /package/src/{utils → internal-utils}/looks-like-url.test.ts +0 -0
  116. /package/src/{utils → internal-utils}/looks-like-url.ts +0 -0
  117. /package/src/{utils → internal-utils}/operationToPatches.ts +0 -0
  118. /package/src/{utils → internal-utils}/paths.ts +0 -0
  119. /package/src/{utils → internal-utils}/ranges.ts +0 -0
  120. /package/src/{utils → internal-utils}/schema.ts +0 -0
  121. /package/src/{utils → internal-utils}/selection.ts +0 -0
  122. /package/src/{utils → internal-utils}/sibling-utils.ts +0 -0
  123. /package/src/{utils → internal-utils}/validateValue.ts +0 -0
  124. /package/src/{utils → internal-utils}/values.ts +0 -0
  125. /package/src/{utils → internal-utils}/weakMaps.ts +0 -0
  126. /package/src/{utils → internal-utils}/withChanges.ts +0 -0
  127. /package/src/{utils → internal-utils}/withUndoRedo.ts +0 -0
  128. /package/src/{utils → internal-utils}/withoutPatching.ts +0 -0
package/lib/index.d.ts CHANGED
@@ -64,6 +64,7 @@ import {
64
64
  Values,
65
65
  } from 'xstate'
66
66
  import {GuardArgs} from 'xstate/guards'
67
+ import {PortableTextMemberSchemaTypes as PortableTextMemberSchemaTypes_2} from '..'
67
68
 
68
69
  /**
69
70
  * @public
@@ -97,6 +98,7 @@ export declare type BaseDefinition = {
97
98
  export declare type Behavior<
98
99
  TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
99
100
  TGuardResponse = true,
101
+ TBehaviorEvent extends BehaviorEvent = BehaviorEvent,
100
102
  > = {
101
103
  /**
102
104
  * The internal editor event that triggers this behavior.
@@ -107,14 +109,11 @@ export declare type Behavior<
107
109
  * Returning a non-nullable value from the guard will pass the value to the
108
110
  * actions and execute them.
109
111
  */
110
- guard?: BehaviorGuard<
111
- PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>,
112
- TGuardResponse
113
- >
112
+ guard?: BehaviorGuard<TBehaviorEvent, TGuardResponse>
114
113
  /**
115
114
  * Array of behavior action sets.
116
115
  */
117
- actions: Array<BehaviorActionIntendSet<TBehaviorEventType, TGuardResponse>>
116
+ actions: Array<BehaviorActionIntendSet<TBehaviorEvent, TGuardResponse>>
118
117
  }
119
118
 
120
119
  /**
@@ -124,7 +123,7 @@ export declare type BehaviorActionIntend =
124
123
  | SyntheticBehaviorEvent
125
124
  | {
126
125
  type: 'raise'
127
- event: SyntheticBehaviorEvent
126
+ event: SyntheticBehaviorEvent | CustomBehaviorEvent
128
127
  }
129
128
  | {
130
129
  type: 'annotation.toggle'
@@ -228,16 +227,13 @@ export declare type BehaviorActionIntend =
228
227
  /**
229
228
  * @beta
230
229
  */
231
- export declare type BehaviorActionIntendSet<
232
- TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
233
- TGuardResponse = true,
234
- > = (
230
+ export declare type BehaviorActionIntendSet<TBehaviorEvent, TGuardResponse> = (
235
231
  {
236
232
  context,
237
233
  event,
238
234
  }: {
239
235
  context: EditorContext
240
- event: PickFromUnion<BehaviorEvent, 'type', TBehaviorEventType>
236
+ event: TBehaviorEvent
241
237
  },
242
238
  guardResponse: TGuardResponse,
243
239
  ) => Array<BehaviorActionIntend>
@@ -245,15 +241,15 @@ export declare type BehaviorActionIntendSet<
245
241
  /**
246
242
  * @beta
247
243
  */
248
- export declare type BehaviorEvent = SyntheticBehaviorEvent | NativeBehaviorEvent
244
+ export declare type BehaviorEvent =
245
+ | SyntheticBehaviorEvent
246
+ | NativeBehaviorEvent
247
+ | CustomBehaviorEvent
249
248
 
250
249
  /**
251
250
  * @beta
252
251
  */
253
- export declare type BehaviorGuard<
254
- TBehaviorEvent extends BehaviorEvent,
255
- TGuardResponse,
256
- > = ({
252
+ export declare type BehaviorGuard<TBehaviorEvent, TGuardResponse> = ({
257
253
  context,
258
254
  event,
259
255
  }: {
@@ -368,6 +364,17 @@ export declare type ConnectionChange = {
368
364
  value: 'online' | 'offline'
369
365
  }
370
366
 
367
+ /**
368
+ * @beta
369
+ */
370
+ declare type CustomBehaviorEvent<
371
+ TPayload extends Record<string, unknown> = Record<string, unknown>,
372
+ TType extends string = string,
373
+ TInternalType extends `custom.${TType}` = `custom.${TType}`,
374
+ > = {
375
+ type: TInternalType
376
+ } & TPayload
377
+
371
378
  /**
372
379
  * @public
373
380
  */
@@ -572,24 +579,26 @@ export declare type EditorEmittedEvent = PickFromUnion<
572
579
  /**
573
580
  * @public
574
581
  */
575
- export declare type EditorEvent = PickFromUnion<
576
- InternalEditorEvent,
577
- 'type',
578
- | 'annotation.add'
579
- | 'annotation.remove'
580
- | 'blur'
581
- | 'decorator.toggle'
582
- | 'focus'
583
- | 'insert.block object'
584
- | 'insert.inline object'
585
- | 'list item.toggle'
586
- | 'select'
587
- | 'style.toggle'
588
- | 'patches'
589
- | 'update behaviors'
590
- | 'update readOnly'
591
- | 'update value'
592
- >
582
+ export declare type EditorEvent =
583
+ | PickFromUnion<
584
+ InternalEditorEvent,
585
+ 'type',
586
+ | 'annotation.add'
587
+ | 'annotation.remove'
588
+ | 'blur'
589
+ | 'decorator.toggle'
590
+ | 'focus'
591
+ | 'insert.block object'
592
+ | 'insert.inline object'
593
+ | 'list item.toggle'
594
+ | 'select'
595
+ | 'style.toggle'
596
+ | 'patches'
597
+ | 'update behaviors'
598
+ | 'update readOnly'
599
+ | 'update value'
600
+ >
601
+ | CustomBehaviorEvent
593
602
 
594
603
  /**
595
604
  * @public
@@ -605,7 +614,7 @@ export declare const editorMachine: StateMachine<
605
614
  {
606
615
  behaviors: Set<Behavior>
607
616
  keyGenerator: () => string
608
- pendingEvents: Array<PatchEvent | MutationEvent_2>
617
+ pendingEvents: Array<PatchEvent | MutationEvent>
609
618
  schema: EditorSchema
610
619
  initialReadOnly: boolean
611
620
  maxBlocks: number | undefined
@@ -665,7 +674,7 @@ export declare const editorMachine: StateMachine<
665
674
  style: string
666
675
  }
667
676
  | PatchEvent
668
- | MutationEvent_2
677
+ | MutationEvent
669
678
  | {
670
679
  type: 'normalizing'
671
680
  }
@@ -679,10 +688,20 @@ export declare const editorMachine: StateMachine<
679
688
  type: 'behavior event'
680
689
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
681
690
  editor: PortableTextSlateEditor
691
+ defaultActionCallback?: () => void
692
+ nativeEvent?: {
693
+ preventDefault: () => void
694
+ }
695
+ }
696
+ | {
697
+ type: 'custom behavior event'
698
+ behaviorEvent: CustomBehaviorEvent
699
+ editor: PortableTextSlateEditor
682
700
  nativeEvent?: {
683
701
  preventDefault: () => void
684
702
  }
685
703
  }
704
+ | CustomBehaviorEvent
686
705
  | {
687
706
  type: 'add behavior'
688
707
  behavior: Behavior
@@ -752,6 +771,10 @@ export declare const editorMachine: StateMachine<
752
771
  }
753
772
  | {
754
773
  type: 'done loading'
774
+ }
775
+ | {
776
+ type: 'custom.*'
777
+ event: CustomBehaviorEvent
755
778
  },
756
779
  {},
757
780
  never,
@@ -887,7 +910,7 @@ export declare const editorMachine: StateMachine<
887
910
  style: string
888
911
  }
889
912
  | PatchEvent
890
- | MutationEvent_2
913
+ | MutationEvent
891
914
  | {
892
915
  type: 'ready'
893
916
  }
@@ -938,6 +961,10 @@ export declare const editorMachine: StateMachine<
938
961
  }
939
962
  | {
940
963
  type: 'editable'
964
+ }
965
+ | {
966
+ type: 'custom.*'
967
+ event: CustomBehaviorEvent
941
968
  },
942
969
  MetaObject,
943
970
  {
@@ -980,7 +1007,7 @@ export declare const editorMachine: StateMachine<
980
1007
  {
981
1008
  behaviors: Set<Behavior>
982
1009
  keyGenerator: () => string
983
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1010
+ pendingEvents: Array<PatchEvent | MutationEvent>
984
1011
  schema: EditorSchema
985
1012
  initialReadOnly: boolean
986
1013
  maxBlocks: number | undefined
@@ -1040,7 +1067,7 @@ export declare const editorMachine: StateMachine<
1040
1067
  style: string
1041
1068
  }
1042
1069
  | PatchEvent
1043
- | MutationEvent_2
1070
+ | MutationEvent
1044
1071
  | {
1045
1072
  type: 'normalizing'
1046
1073
  }
@@ -1054,10 +1081,20 @@ export declare const editorMachine: StateMachine<
1054
1081
  type: 'behavior event'
1055
1082
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1056
1083
  editor: PortableTextSlateEditor
1084
+ defaultActionCallback?: () => void
1085
+ nativeEvent?: {
1086
+ preventDefault: () => void
1087
+ }
1088
+ }
1089
+ | {
1090
+ type: 'custom behavior event'
1091
+ behaviorEvent: CustomBehaviorEvent
1092
+ editor: PortableTextSlateEditor
1057
1093
  nativeEvent?: {
1058
1094
  preventDefault: () => void
1059
1095
  }
1060
1096
  }
1097
+ | CustomBehaviorEvent
1061
1098
  | {
1062
1099
  type: 'add behavior'
1063
1100
  behavior: Behavior
@@ -1127,6 +1164,10 @@ export declare const editorMachine: StateMachine<
1127
1164
  }
1128
1165
  | {
1129
1166
  type: 'done loading'
1167
+ }
1168
+ | {
1169
+ type: 'custom.*'
1170
+ event: CustomBehaviorEvent
1130
1171
  },
1131
1172
  Record<string, AnyActorRef | undefined>,
1132
1173
  StateValue,
@@ -1188,7 +1229,7 @@ export declare const editorMachine: StateMachine<
1188
1229
  style: string
1189
1230
  }
1190
1231
  | PatchEvent
1191
- | MutationEvent_2
1232
+ | MutationEvent
1192
1233
  | {
1193
1234
  type: 'normalizing'
1194
1235
  }
@@ -1202,10 +1243,20 @@ export declare const editorMachine: StateMachine<
1202
1243
  type: 'behavior event'
1203
1244
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1204
1245
  editor: PortableTextSlateEditor
1246
+ defaultActionCallback?: () => void
1247
+ nativeEvent?: {
1248
+ preventDefault: () => void
1249
+ }
1250
+ }
1251
+ | {
1252
+ type: 'custom behavior event'
1253
+ behaviorEvent: CustomBehaviorEvent
1254
+ editor: PortableTextSlateEditor
1205
1255
  nativeEvent?: {
1206
1256
  preventDefault: () => void
1207
1257
  }
1208
1258
  }
1259
+ | CustomBehaviorEvent
1209
1260
  | {
1210
1261
  type: 'add behavior'
1211
1262
  behavior: Behavior
@@ -1275,6 +1326,10 @@ export declare const editorMachine: StateMachine<
1275
1326
  }
1276
1327
  | {
1277
1328
  type: 'done loading'
1329
+ }
1330
+ | {
1331
+ type: 'custom.*'
1332
+ event: CustomBehaviorEvent
1278
1333
  },
1279
1334
  AnyEventObject
1280
1335
  >
@@ -1282,7 +1337,7 @@ export declare const editorMachine: StateMachine<
1282
1337
  behaviors: Set<Behavior>
1283
1338
  keyGenerator: () => string
1284
1339
  pendingEvents: never[]
1285
- schema: PortableTextMemberSchemaTypes
1340
+ schema: PortableTextMemberSchemaTypes_2
1286
1341
  selection: null
1287
1342
  initialReadOnly: boolean
1288
1343
  maxBlocks: number | undefined
@@ -1300,7 +1355,7 @@ export declare const editorMachine: StateMachine<
1300
1355
  {
1301
1356
  behaviors: Set<Behavior>
1302
1357
  keyGenerator: () => string
1303
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1358
+ pendingEvents: Array<PatchEvent | MutationEvent>
1304
1359
  schema: EditorSchema
1305
1360
  initialReadOnly: boolean
1306
1361
  maxBlocks: number | undefined
@@ -1364,7 +1419,7 @@ export declare const editorMachine: StateMachine<
1364
1419
  style: string
1365
1420
  }
1366
1421
  | PatchEvent
1367
- | MutationEvent_2
1422
+ | MutationEvent
1368
1423
  | {
1369
1424
  type: 'normalizing'
1370
1425
  }
@@ -1378,10 +1433,20 @@ export declare const editorMachine: StateMachine<
1378
1433
  type: 'behavior event'
1379
1434
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1380
1435
  editor: PortableTextSlateEditor
1436
+ defaultActionCallback?: () => void
1437
+ nativeEvent?: {
1438
+ preventDefault: () => void
1439
+ }
1440
+ }
1441
+ | {
1442
+ type: 'custom behavior event'
1443
+ behaviorEvent: CustomBehaviorEvent
1444
+ editor: PortableTextSlateEditor
1381
1445
  nativeEvent?: {
1382
1446
  preventDefault: () => void
1383
1447
  }
1384
1448
  }
1449
+ | CustomBehaviorEvent
1385
1450
  | {
1386
1451
  type: 'add behavior'
1387
1452
  behavior: Behavior
@@ -1451,6 +1516,10 @@ export declare const editorMachine: StateMachine<
1451
1516
  }
1452
1517
  | {
1453
1518
  type: 'done loading'
1519
+ }
1520
+ | {
1521
+ type: 'custom.*'
1522
+ event: CustomBehaviorEvent
1454
1523
  },
1455
1524
  undefined,
1456
1525
  never,
@@ -1510,7 +1579,7 @@ export declare const editorMachine: StateMachine<
1510
1579
  style: string
1511
1580
  }
1512
1581
  | PatchEvent
1513
- | MutationEvent_2
1582
+ | MutationEvent
1514
1583
  | {
1515
1584
  type: 'ready'
1516
1585
  }
@@ -1562,6 +1631,10 @@ export declare const editorMachine: StateMachine<
1562
1631
  | {
1563
1632
  type: 'editable'
1564
1633
  }
1634
+ | {
1635
+ type: 'custom.*'
1636
+ event: CustomBehaviorEvent
1637
+ }
1565
1638
  >
1566
1639
  }
1567
1640
  readonly 'value changed': {
@@ -1569,7 +1642,7 @@ export declare const editorMachine: StateMachine<
1569
1642
  {
1570
1643
  behaviors: Set<Behavior>
1571
1644
  keyGenerator: () => string
1572
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1645
+ pendingEvents: Array<PatchEvent | MutationEvent>
1573
1646
  schema: EditorSchema
1574
1647
  initialReadOnly: boolean
1575
1648
  maxBlocks: number | undefined
@@ -1633,7 +1706,7 @@ export declare const editorMachine: StateMachine<
1633
1706
  style: string
1634
1707
  }
1635
1708
  | PatchEvent
1636
- | MutationEvent_2
1709
+ | MutationEvent
1637
1710
  | {
1638
1711
  type: 'normalizing'
1639
1712
  }
@@ -1647,10 +1720,20 @@ export declare const editorMachine: StateMachine<
1647
1720
  type: 'behavior event'
1648
1721
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1649
1722
  editor: PortableTextSlateEditor
1723
+ defaultActionCallback?: () => void
1724
+ nativeEvent?: {
1725
+ preventDefault: () => void
1726
+ }
1727
+ }
1728
+ | {
1729
+ type: 'custom behavior event'
1730
+ behaviorEvent: CustomBehaviorEvent
1731
+ editor: PortableTextSlateEditor
1650
1732
  nativeEvent?: {
1651
1733
  preventDefault: () => void
1652
1734
  }
1653
1735
  }
1736
+ | CustomBehaviorEvent
1654
1737
  | {
1655
1738
  type: 'add behavior'
1656
1739
  behavior: Behavior
@@ -1720,6 +1803,10 @@ export declare const editorMachine: StateMachine<
1720
1803
  }
1721
1804
  | {
1722
1805
  type: 'done loading'
1806
+ }
1807
+ | {
1808
+ type: 'custom.*'
1809
+ event: CustomBehaviorEvent
1723
1810
  },
1724
1811
  undefined,
1725
1812
  never,
@@ -1779,7 +1866,7 @@ export declare const editorMachine: StateMachine<
1779
1866
  style: string
1780
1867
  }
1781
1868
  | PatchEvent
1782
- | MutationEvent_2
1869
+ | MutationEvent
1783
1870
  | {
1784
1871
  type: 'ready'
1785
1872
  }
@@ -1831,6 +1918,10 @@ export declare const editorMachine: StateMachine<
1831
1918
  | {
1832
1919
  type: 'editable'
1833
1920
  }
1921
+ | {
1922
+ type: 'custom.*'
1923
+ event: CustomBehaviorEvent
1924
+ }
1834
1925
  >
1835
1926
  }
1836
1927
  readonly 'invalid value': {
@@ -1838,7 +1929,7 @@ export declare const editorMachine: StateMachine<
1838
1929
  {
1839
1930
  behaviors: Set<Behavior>
1840
1931
  keyGenerator: () => string
1841
- pendingEvents: Array<PatchEvent | MutationEvent_2>
1932
+ pendingEvents: Array<PatchEvent | MutationEvent>
1842
1933
  schema: EditorSchema
1843
1934
  initialReadOnly: boolean
1844
1935
  maxBlocks: number | undefined
@@ -1903,7 +1994,7 @@ export declare const editorMachine: StateMachine<
1903
1994
  style: string
1904
1995
  }
1905
1996
  | PatchEvent
1906
- | MutationEvent_2
1997
+ | MutationEvent
1907
1998
  | {
1908
1999
  type: 'normalizing'
1909
2000
  }
@@ -1917,10 +2008,20 @@ export declare const editorMachine: StateMachine<
1917
2008
  type: 'behavior event'
1918
2009
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
1919
2010
  editor: PortableTextSlateEditor
2011
+ defaultActionCallback?: () => void
2012
+ nativeEvent?: {
2013
+ preventDefault: () => void
2014
+ }
2015
+ }
2016
+ | {
2017
+ type: 'custom behavior event'
2018
+ behaviorEvent: CustomBehaviorEvent
2019
+ editor: PortableTextSlateEditor
1920
2020
  nativeEvent?: {
1921
2021
  preventDefault: () => void
1922
2022
  }
1923
2023
  }
2024
+ | CustomBehaviorEvent
1924
2025
  | {
1925
2026
  type: 'add behavior'
1926
2027
  behavior: Behavior
@@ -1990,6 +2091,10 @@ export declare const editorMachine: StateMachine<
1990
2091
  }
1991
2092
  | {
1992
2093
  type: 'done loading'
2094
+ }
2095
+ | {
2096
+ type: 'custom.*'
2097
+ event: CustomBehaviorEvent
1993
2098
  },
1994
2099
  undefined,
1995
2100
  never,
@@ -2049,7 +2154,7 @@ export declare const editorMachine: StateMachine<
2049
2154
  style: string
2050
2155
  }
2051
2156
  | PatchEvent
2052
- | MutationEvent_2
2157
+ | MutationEvent
2053
2158
  | {
2054
2159
  type: 'ready'
2055
2160
  }
@@ -2101,6 +2206,10 @@ export declare const editorMachine: StateMachine<
2101
2206
  | {
2102
2207
  type: 'editable'
2103
2208
  }
2209
+ | {
2210
+ type: 'custom.*'
2211
+ event: CustomBehaviorEvent
2212
+ }
2104
2213
  >
2105
2214
  }
2106
2215
  readonly 'error': {
@@ -2108,7 +2217,7 @@ export declare const editorMachine: StateMachine<
2108
2217
  {
2109
2218
  behaviors: Set<Behavior>
2110
2219
  keyGenerator: () => string
2111
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2220
+ pendingEvents: Array<PatchEvent | MutationEvent>
2112
2221
  schema: EditorSchema
2113
2222
  initialReadOnly: boolean
2114
2223
  maxBlocks: number | undefined
@@ -2174,7 +2283,7 @@ export declare const editorMachine: StateMachine<
2174
2283
  style: string
2175
2284
  }
2176
2285
  | PatchEvent
2177
- | MutationEvent_2
2286
+ | MutationEvent
2178
2287
  | {
2179
2288
  type: 'normalizing'
2180
2289
  }
@@ -2188,10 +2297,20 @@ export declare const editorMachine: StateMachine<
2188
2297
  type: 'behavior event'
2189
2298
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
2190
2299
  editor: PortableTextSlateEditor
2300
+ defaultActionCallback?: () => void
2301
+ nativeEvent?: {
2302
+ preventDefault: () => void
2303
+ }
2304
+ }
2305
+ | {
2306
+ type: 'custom behavior event'
2307
+ behaviorEvent: CustomBehaviorEvent
2308
+ editor: PortableTextSlateEditor
2191
2309
  nativeEvent?: {
2192
2310
  preventDefault: () => void
2193
2311
  }
2194
2312
  }
2313
+ | CustomBehaviorEvent
2195
2314
  | {
2196
2315
  type: 'add behavior'
2197
2316
  behavior: Behavior
@@ -2261,6 +2380,10 @@ export declare const editorMachine: StateMachine<
2261
2380
  }
2262
2381
  | {
2263
2382
  type: 'done loading'
2383
+ }
2384
+ | {
2385
+ type: 'custom.*'
2386
+ event: CustomBehaviorEvent
2264
2387
  },
2265
2388
  undefined,
2266
2389
  never,
@@ -2320,7 +2443,7 @@ export declare const editorMachine: StateMachine<
2320
2443
  style: string
2321
2444
  }
2322
2445
  | PatchEvent
2323
- | MutationEvent_2
2446
+ | MutationEvent
2324
2447
  | {
2325
2448
  type: 'ready'
2326
2449
  }
@@ -2372,6 +2495,10 @@ export declare const editorMachine: StateMachine<
2372
2495
  | {
2373
2496
  type: 'editable'
2374
2497
  }
2498
+ | {
2499
+ type: 'custom.*'
2500
+ event: CustomBehaviorEvent
2501
+ }
2375
2502
  >
2376
2503
  }
2377
2504
  readonly 'selection': {
@@ -2380,7 +2507,7 @@ export declare const editorMachine: StateMachine<
2380
2507
  {
2381
2508
  behaviors: Set<Behavior>
2382
2509
  keyGenerator: () => string
2383
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2510
+ pendingEvents: Array<PatchEvent | MutationEvent>
2384
2511
  schema: EditorSchema
2385
2512
  initialReadOnly: boolean
2386
2513
  maxBlocks: number | undefined
@@ -2444,7 +2571,7 @@ export declare const editorMachine: StateMachine<
2444
2571
  style: string
2445
2572
  }
2446
2573
  | PatchEvent
2447
- | MutationEvent_2
2574
+ | MutationEvent
2448
2575
  | {
2449
2576
  type: 'normalizing'
2450
2577
  }
@@ -2458,10 +2585,20 @@ export declare const editorMachine: StateMachine<
2458
2585
  type: 'behavior event'
2459
2586
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
2460
2587
  editor: PortableTextSlateEditor
2588
+ defaultActionCallback?: () => void
2589
+ nativeEvent?: {
2590
+ preventDefault: () => void
2591
+ }
2592
+ }
2593
+ | {
2594
+ type: 'custom behavior event'
2595
+ behaviorEvent: CustomBehaviorEvent
2596
+ editor: PortableTextSlateEditor
2461
2597
  nativeEvent?: {
2462
2598
  preventDefault: () => void
2463
2599
  }
2464
2600
  }
2601
+ | CustomBehaviorEvent
2465
2602
  | {
2466
2603
  type: 'add behavior'
2467
2604
  behavior: Behavior
@@ -2531,6 +2668,10 @@ export declare const editorMachine: StateMachine<
2531
2668
  }
2532
2669
  | {
2533
2670
  type: 'done loading'
2671
+ }
2672
+ | {
2673
+ type: 'custom.*'
2674
+ event: CustomBehaviorEvent
2534
2675
  },
2535
2676
  undefined,
2536
2677
  never,
@@ -2543,7 +2684,7 @@ export declare const editorMachine: StateMachine<
2543
2684
  {
2544
2685
  behaviors: Set<Behavior>
2545
2686
  keyGenerator: () => string
2546
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2687
+ pendingEvents: Array<PatchEvent | MutationEvent>
2547
2688
  schema: EditorSchema
2548
2689
  initialReadOnly: boolean
2549
2690
  maxBlocks: number | undefined
@@ -2607,7 +2748,7 @@ export declare const editorMachine: StateMachine<
2607
2748
  style: string
2608
2749
  }
2609
2750
  | PatchEvent
2610
- | MutationEvent_2
2751
+ | MutationEvent
2611
2752
  | {
2612
2753
  type: 'normalizing'
2613
2754
  }
@@ -2621,10 +2762,20 @@ export declare const editorMachine: StateMachine<
2621
2762
  type: 'behavior event'
2622
2763
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
2623
2764
  editor: PortableTextSlateEditor
2765
+ defaultActionCallback?: () => void
2766
+ nativeEvent?: {
2767
+ preventDefault: () => void
2768
+ }
2769
+ }
2770
+ | {
2771
+ type: 'custom behavior event'
2772
+ behaviorEvent: CustomBehaviorEvent
2773
+ editor: PortableTextSlateEditor
2624
2774
  nativeEvent?: {
2625
2775
  preventDefault: () => void
2626
2776
  }
2627
2777
  }
2778
+ | CustomBehaviorEvent
2628
2779
  | {
2629
2780
  type: 'add behavior'
2630
2781
  behavior: Behavior
@@ -2694,6 +2845,10 @@ export declare const editorMachine: StateMachine<
2694
2845
  }
2695
2846
  | {
2696
2847
  type: 'done loading'
2848
+ }
2849
+ | {
2850
+ type: 'custom.*'
2851
+ event: CustomBehaviorEvent
2697
2852
  },
2698
2853
  undefined,
2699
2854
  never,
@@ -2753,7 +2908,7 @@ export declare const editorMachine: StateMachine<
2753
2908
  style: string
2754
2909
  }
2755
2910
  | PatchEvent
2756
- | MutationEvent_2
2911
+ | MutationEvent
2757
2912
  | {
2758
2913
  type: 'ready'
2759
2914
  }
@@ -2805,6 +2960,10 @@ export declare const editorMachine: StateMachine<
2805
2960
  | {
2806
2961
  type: 'editable'
2807
2962
  }
2963
+ | {
2964
+ type: 'custom.*'
2965
+ event: CustomBehaviorEvent
2966
+ }
2808
2967
  >,
2809
2968
  ]
2810
2969
  }
@@ -2813,7 +2972,7 @@ export declare const editorMachine: StateMachine<
2813
2972
  {
2814
2973
  behaviors: Set<Behavior>
2815
2974
  keyGenerator: () => string
2816
- pendingEvents: Array<PatchEvent | MutationEvent_2>
2975
+ pendingEvents: Array<PatchEvent | MutationEvent>
2817
2976
  schema: EditorSchema
2818
2977
  initialReadOnly: boolean
2819
2978
  maxBlocks: number | undefined
@@ -2877,7 +3036,7 @@ export declare const editorMachine: StateMachine<
2877
3036
  style: string
2878
3037
  }
2879
3038
  | PatchEvent
2880
- | MutationEvent_2
3039
+ | MutationEvent
2881
3040
  | {
2882
3041
  type: 'normalizing'
2883
3042
  }
@@ -2891,10 +3050,20 @@ export declare const editorMachine: StateMachine<
2891
3050
  type: 'behavior event'
2892
3051
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
2893
3052
  editor: PortableTextSlateEditor
3053
+ defaultActionCallback?: () => void
3054
+ nativeEvent?: {
3055
+ preventDefault: () => void
3056
+ }
3057
+ }
3058
+ | {
3059
+ type: 'custom behavior event'
3060
+ behaviorEvent: CustomBehaviorEvent
3061
+ editor: PortableTextSlateEditor
2894
3062
  nativeEvent?: {
2895
3063
  preventDefault: () => void
2896
3064
  }
2897
3065
  }
3066
+ | CustomBehaviorEvent
2898
3067
  | {
2899
3068
  type: 'add behavior'
2900
3069
  behavior: Behavior
@@ -2964,6 +3133,10 @@ export declare const editorMachine: StateMachine<
2964
3133
  }
2965
3134
  | {
2966
3135
  type: 'done loading'
3136
+ }
3137
+ | {
3138
+ type: 'custom.*'
3139
+ event: CustomBehaviorEvent
2967
3140
  },
2968
3141
  undefined,
2969
3142
  never,
@@ -3023,7 +3196,7 @@ export declare const editorMachine: StateMachine<
3023
3196
  style: string
3024
3197
  }
3025
3198
  | PatchEvent
3026
- | MutationEvent_2
3199
+ | MutationEvent
3027
3200
  | {
3028
3201
  type: 'ready'
3029
3202
  }
@@ -3075,6 +3248,10 @@ export declare const editorMachine: StateMachine<
3075
3248
  | {
3076
3249
  type: 'editable'
3077
3250
  }
3251
+ | {
3252
+ type: 'custom.*'
3253
+ event: CustomBehaviorEvent
3254
+ }
3078
3255
  >
3079
3256
  }
3080
3257
  readonly 'focused': {
@@ -3082,7 +3259,7 @@ export declare const editorMachine: StateMachine<
3082
3259
  {
3083
3260
  behaviors: Set<Behavior>
3084
3261
  keyGenerator: () => string
3085
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3262
+ pendingEvents: Array<PatchEvent | MutationEvent>
3086
3263
  schema: EditorSchema
3087
3264
  initialReadOnly: boolean
3088
3265
  maxBlocks: number | undefined
@@ -3146,7 +3323,7 @@ export declare const editorMachine: StateMachine<
3146
3323
  style: string
3147
3324
  }
3148
3325
  | PatchEvent
3149
- | MutationEvent_2
3326
+ | MutationEvent
3150
3327
  | {
3151
3328
  type: 'normalizing'
3152
3329
  }
@@ -3160,10 +3337,20 @@ export declare const editorMachine: StateMachine<
3160
3337
  type: 'behavior event'
3161
3338
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
3162
3339
  editor: PortableTextSlateEditor
3340
+ defaultActionCallback?: () => void
3341
+ nativeEvent?: {
3342
+ preventDefault: () => void
3343
+ }
3344
+ }
3345
+ | {
3346
+ type: 'custom behavior event'
3347
+ behaviorEvent: CustomBehaviorEvent
3348
+ editor: PortableTextSlateEditor
3163
3349
  nativeEvent?: {
3164
3350
  preventDefault: () => void
3165
3351
  }
3166
3352
  }
3353
+ | CustomBehaviorEvent
3167
3354
  | {
3168
3355
  type: 'add behavior'
3169
3356
  behavior: Behavior
@@ -3233,6 +3420,10 @@ export declare const editorMachine: StateMachine<
3233
3420
  }
3234
3421
  | {
3235
3422
  type: 'done loading'
3423
+ }
3424
+ | {
3425
+ type: 'custom.*'
3426
+ event: CustomBehaviorEvent
3236
3427
  },
3237
3428
  undefined,
3238
3429
  never,
@@ -3292,7 +3483,7 @@ export declare const editorMachine: StateMachine<
3292
3483
  style: string
3293
3484
  }
3294
3485
  | PatchEvent
3295
- | MutationEvent_2
3486
+ | MutationEvent
3296
3487
  | {
3297
3488
  type: 'ready'
3298
3489
  }
@@ -3344,6 +3535,10 @@ export declare const editorMachine: StateMachine<
3344
3535
  | {
3345
3536
  type: 'editable'
3346
3537
  }
3538
+ | {
3539
+ type: 'custom.*'
3540
+ event: CustomBehaviorEvent
3541
+ }
3347
3542
  >
3348
3543
  }
3349
3544
  readonly 'loading': {
@@ -3351,7 +3546,7 @@ export declare const editorMachine: StateMachine<
3351
3546
  {
3352
3547
  behaviors: Set<Behavior>
3353
3548
  keyGenerator: () => string
3354
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3549
+ pendingEvents: Array<PatchEvent | MutationEvent>
3355
3550
  schema: EditorSchema
3356
3551
  initialReadOnly: boolean
3357
3552
  maxBlocks: number | undefined
@@ -3414,7 +3609,7 @@ export declare const editorMachine: StateMachine<
3414
3609
  style: string
3415
3610
  }
3416
3611
  | PatchEvent
3417
- | MutationEvent_2
3612
+ | MutationEvent
3418
3613
  | {
3419
3614
  type: 'normalizing'
3420
3615
  }
@@ -3428,10 +3623,20 @@ export declare const editorMachine: StateMachine<
3428
3623
  type: 'behavior event'
3429
3624
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
3430
3625
  editor: PortableTextSlateEditor
3626
+ defaultActionCallback?: () => void
3627
+ nativeEvent?: {
3628
+ preventDefault: () => void
3629
+ }
3630
+ }
3631
+ | {
3632
+ type: 'custom behavior event'
3633
+ behaviorEvent: CustomBehaviorEvent
3634
+ editor: PortableTextSlateEditor
3431
3635
  nativeEvent?: {
3432
3636
  preventDefault: () => void
3433
3637
  }
3434
3638
  }
3639
+ | CustomBehaviorEvent
3435
3640
  | {
3436
3641
  type: 'add behavior'
3437
3642
  behavior: Behavior
@@ -3501,6 +3706,10 @@ export declare const editorMachine: StateMachine<
3501
3706
  }
3502
3707
  | {
3503
3708
  type: 'done loading'
3709
+ }
3710
+ | {
3711
+ type: 'custom.*'
3712
+ event: CustomBehaviorEvent
3504
3713
  },
3505
3714
  undefined,
3506
3715
  never,
@@ -3560,7 +3769,7 @@ export declare const editorMachine: StateMachine<
3560
3769
  style: string
3561
3770
  }
3562
3771
  | PatchEvent
3563
- | MutationEvent_2
3772
+ | MutationEvent
3564
3773
  | {
3565
3774
  type: 'ready'
3566
3775
  }
@@ -3612,6 +3821,10 @@ export declare const editorMachine: StateMachine<
3612
3821
  | {
3613
3822
  type: 'editable'
3614
3823
  }
3824
+ | {
3825
+ type: 'custom.*'
3826
+ event: CustomBehaviorEvent
3827
+ }
3615
3828
  >
3616
3829
  }
3617
3830
  readonly 'patches': {
@@ -3619,7 +3832,7 @@ export declare const editorMachine: StateMachine<
3619
3832
  {
3620
3833
  behaviors: Set<Behavior>
3621
3834
  keyGenerator: () => string
3622
- pendingEvents: Array<PatchEvent | MutationEvent_2>
3835
+ pendingEvents: Array<PatchEvent | MutationEvent>
3623
3836
  schema: EditorSchema
3624
3837
  initialReadOnly: boolean
3625
3838
  maxBlocks: number | undefined
@@ -3680,7 +3893,7 @@ export declare const editorMachine: StateMachine<
3680
3893
  style: string
3681
3894
  }
3682
3895
  | PatchEvent
3683
- | MutationEvent_2
3896
+ | MutationEvent
3684
3897
  | {
3685
3898
  type: 'normalizing'
3686
3899
  }
@@ -3694,10 +3907,20 @@ export declare const editorMachine: StateMachine<
3694
3907
  type: 'behavior event'
3695
3908
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
3696
3909
  editor: PortableTextSlateEditor
3910
+ defaultActionCallback?: () => void
3911
+ nativeEvent?: {
3912
+ preventDefault: () => void
3913
+ }
3914
+ }
3915
+ | {
3916
+ type: 'custom behavior event'
3917
+ behaviorEvent: CustomBehaviorEvent
3918
+ editor: PortableTextSlateEditor
3697
3919
  nativeEvent?: {
3698
3920
  preventDefault: () => void
3699
3921
  }
3700
3922
  }
3923
+ | CustomBehaviorEvent
3701
3924
  | {
3702
3925
  type: 'add behavior'
3703
3926
  behavior: Behavior
@@ -3767,6 +3990,10 @@ export declare const editorMachine: StateMachine<
3767
3990
  }
3768
3991
  | {
3769
3992
  type: 'done loading'
3993
+ }
3994
+ | {
3995
+ type: 'custom.*'
3996
+ event: CustomBehaviorEvent
3770
3997
  },
3771
3998
  undefined,
3772
3999
  never,
@@ -3826,7 +4053,7 @@ export declare const editorMachine: StateMachine<
3826
4053
  style: string
3827
4054
  }
3828
4055
  | PatchEvent
3829
- | MutationEvent_2
4056
+ | MutationEvent
3830
4057
  | {
3831
4058
  type: 'ready'
3832
4059
  }
@@ -3878,6 +4105,10 @@ export declare const editorMachine: StateMachine<
3878
4105
  | {
3879
4106
  type: 'editable'
3880
4107
  }
4108
+ | {
4109
+ type: 'custom.*'
4110
+ event: CustomBehaviorEvent
4111
+ }
3881
4112
  >
3882
4113
  }
3883
4114
  readonly 'done loading': {
@@ -3885,7 +4116,7 @@ export declare const editorMachine: StateMachine<
3885
4116
  {
3886
4117
  behaviors: Set<Behavior>
3887
4118
  keyGenerator: () => string
3888
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4119
+ pendingEvents: Array<PatchEvent | MutationEvent>
3889
4120
  schema: EditorSchema
3890
4121
  initialReadOnly: boolean
3891
4122
  maxBlocks: number | undefined
@@ -3948,7 +4179,7 @@ export declare const editorMachine: StateMachine<
3948
4179
  style: string
3949
4180
  }
3950
4181
  | PatchEvent
3951
- | MutationEvent_2
4182
+ | MutationEvent
3952
4183
  | {
3953
4184
  type: 'normalizing'
3954
4185
  }
@@ -3962,10 +4193,20 @@ export declare const editorMachine: StateMachine<
3962
4193
  type: 'behavior event'
3963
4194
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
3964
4195
  editor: PortableTextSlateEditor
4196
+ defaultActionCallback?: () => void
4197
+ nativeEvent?: {
4198
+ preventDefault: () => void
4199
+ }
4200
+ }
4201
+ | {
4202
+ type: 'custom behavior event'
4203
+ behaviorEvent: CustomBehaviorEvent
4204
+ editor: PortableTextSlateEditor
3965
4205
  nativeEvent?: {
3966
4206
  preventDefault: () => void
3967
4207
  }
3968
4208
  }
4209
+ | CustomBehaviorEvent
3969
4210
  | {
3970
4211
  type: 'add behavior'
3971
4212
  behavior: Behavior
@@ -4035,6 +4276,10 @@ export declare const editorMachine: StateMachine<
4035
4276
  }
4036
4277
  | {
4037
4278
  type: 'done loading'
4279
+ }
4280
+ | {
4281
+ type: 'custom.*'
4282
+ event: CustomBehaviorEvent
4038
4283
  },
4039
4284
  undefined,
4040
4285
  never,
@@ -4094,7 +4339,7 @@ export declare const editorMachine: StateMachine<
4094
4339
  style: string
4095
4340
  }
4096
4341
  | PatchEvent
4097
- | MutationEvent_2
4342
+ | MutationEvent
4098
4343
  | {
4099
4344
  type: 'ready'
4100
4345
  }
@@ -4146,6 +4391,10 @@ export declare const editorMachine: StateMachine<
4146
4391
  | {
4147
4392
  type: 'editable'
4148
4393
  }
4394
+ | {
4395
+ type: 'custom.*'
4396
+ event: CustomBehaviorEvent
4397
+ }
4149
4398
  >
4150
4399
  }
4151
4400
  readonly 'update behaviors': {
@@ -4159,7 +4408,7 @@ export declare const editorMachine: StateMachine<
4159
4408
  {
4160
4409
  behaviors: Set<Behavior>
4161
4410
  keyGenerator: () => string
4162
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4411
+ pendingEvents: Array<PatchEvent | MutationEvent>
4163
4412
  schema: EditorSchema
4164
4413
  initialReadOnly: boolean
4165
4414
  maxBlocks: number | undefined
@@ -4223,7 +4472,7 @@ export declare const editorMachine: StateMachine<
4223
4472
  style: string
4224
4473
  }
4225
4474
  | PatchEvent
4226
- | MutationEvent_2
4475
+ | MutationEvent
4227
4476
  | {
4228
4477
  type: 'normalizing'
4229
4478
  }
@@ -4237,10 +4486,20 @@ export declare const editorMachine: StateMachine<
4237
4486
  type: 'behavior event'
4238
4487
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
4239
4488
  editor: PortableTextSlateEditor
4489
+ defaultActionCallback?: () => void
4490
+ nativeEvent?: {
4491
+ preventDefault: () => void
4492
+ }
4493
+ }
4494
+ | {
4495
+ type: 'custom behavior event'
4496
+ behaviorEvent: CustomBehaviorEvent
4497
+ editor: PortableTextSlateEditor
4240
4498
  nativeEvent?: {
4241
4499
  preventDefault: () => void
4242
4500
  }
4243
4501
  }
4502
+ | CustomBehaviorEvent
4244
4503
  | {
4245
4504
  type: 'add behavior'
4246
4505
  behavior: Behavior
@@ -4310,6 +4569,10 @@ export declare const editorMachine: StateMachine<
4310
4569
  }
4311
4570
  | {
4312
4571
  type: 'done loading'
4572
+ }
4573
+ | {
4574
+ type: 'custom.*'
4575
+ event: CustomBehaviorEvent
4313
4576
  },
4314
4577
  undefined,
4315
4578
  never,
@@ -4324,7 +4587,7 @@ export declare const editorMachine: StateMachine<
4324
4587
  {
4325
4588
  behaviors: Set<Behavior>
4326
4589
  keyGenerator: () => string
4327
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4590
+ pendingEvents: Array<PatchEvent | MutationEvent>
4328
4591
  schema: EditorSchema
4329
4592
  initialReadOnly: boolean
4330
4593
  maxBlocks: number | undefined
@@ -4388,7 +4651,7 @@ export declare const editorMachine: StateMachine<
4388
4651
  style: string
4389
4652
  }
4390
4653
  | PatchEvent
4391
- | MutationEvent_2
4654
+ | MutationEvent
4392
4655
  | {
4393
4656
  type: 'normalizing'
4394
4657
  }
@@ -4402,10 +4665,20 @@ export declare const editorMachine: StateMachine<
4402
4665
  type: 'behavior event'
4403
4666
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
4404
4667
  editor: PortableTextSlateEditor
4668
+ defaultActionCallback?: () => void
4669
+ nativeEvent?: {
4670
+ preventDefault: () => void
4671
+ }
4672
+ }
4673
+ | {
4674
+ type: 'custom behavior event'
4675
+ behaviorEvent: CustomBehaviorEvent
4676
+ editor: PortableTextSlateEditor
4405
4677
  nativeEvent?: {
4406
4678
  preventDefault: () => void
4407
4679
  }
4408
4680
  }
4681
+ | CustomBehaviorEvent
4409
4682
  | {
4410
4683
  type: 'add behavior'
4411
4684
  behavior: Behavior
@@ -4475,6 +4748,10 @@ export declare const editorMachine: StateMachine<
4475
4748
  }
4476
4749
  | {
4477
4750
  type: 'done loading'
4751
+ }
4752
+ | {
4753
+ type: 'custom.*'
4754
+ event: CustomBehaviorEvent
4478
4755
  },
4479
4756
  undefined,
4480
4757
  never,
@@ -4504,7 +4781,7 @@ export declare const editorMachine: StateMachine<
4504
4781
  {
4505
4782
  behaviors: Set<Behavior>
4506
4783
  keyGenerator: () => string
4507
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4784
+ pendingEvents: Array<PatchEvent | MutationEvent>
4508
4785
  schema: EditorSchema
4509
4786
  initialReadOnly: boolean
4510
4787
  maxBlocks: number | undefined
@@ -4531,7 +4808,7 @@ export declare const editorMachine: StateMachine<
4531
4808
  {
4532
4809
  behaviors: Set<Behavior>
4533
4810
  keyGenerator: () => string
4534
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4811
+ pendingEvents: Array<PatchEvent | MutationEvent>
4535
4812
  schema: EditorSchema
4536
4813
  initialReadOnly: boolean
4537
4814
  maxBlocks: number | undefined
@@ -4559,7 +4836,7 @@ export declare const editorMachine: StateMachine<
4559
4836
  {
4560
4837
  behaviors: Set<Behavior>
4561
4838
  keyGenerator: () => string
4562
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4839
+ pendingEvents: Array<PatchEvent | MutationEvent>
4563
4840
  schema: EditorSchema
4564
4841
  initialReadOnly: boolean
4565
4842
  maxBlocks: number | undefined
@@ -4577,12 +4854,15 @@ export declare const editorMachine: StateMachine<
4577
4854
  readonly 'behavior event': {
4578
4855
  readonly actions: 'handle behavior event'
4579
4856
  }
4857
+ readonly 'custom behavior event': {
4858
+ readonly actions: 'handle behavior event'
4859
+ }
4580
4860
  readonly 'annotation.*': {
4581
4861
  readonly actions: ActionFunction<
4582
4862
  {
4583
4863
  behaviors: Set<Behavior>
4584
4864
  keyGenerator: () => string
4585
- pendingEvents: Array<PatchEvent | MutationEvent_2>
4865
+ pendingEvents: Array<PatchEvent | MutationEvent>
4586
4866
  schema: EditorSchema
4587
4867
  initialReadOnly: boolean
4588
4868
  maxBlocks: number | undefined
@@ -4657,7 +4937,7 @@ export declare const editorMachine: StateMachine<
4657
4937
  style: string
4658
4938
  }
4659
4939
  | PatchEvent
4660
- | MutationEvent_2
4940
+ | MutationEvent
4661
4941
  | {
4662
4942
  type: 'normalizing'
4663
4943
  }
@@ -4673,10 +4953,20 @@ export declare const editorMachine: StateMachine<
4673
4953
  | SyntheticBehaviorEvent
4674
4954
  | NativeBehaviorEvent
4675
4955
  editor: PortableTextSlateEditor
4956
+ defaultActionCallback?: () => void
4957
+ nativeEvent?: {
4958
+ preventDefault: () => void
4959
+ }
4960
+ }
4961
+ | {
4962
+ type: 'custom behavior event'
4963
+ behaviorEvent: CustomBehaviorEvent
4964
+ editor: PortableTextSlateEditor
4676
4965
  nativeEvent?: {
4677
4966
  preventDefault: () => void
4678
4967
  }
4679
4968
  }
4969
+ | CustomBehaviorEvent
4680
4970
  | {
4681
4971
  type: 'add behavior'
4682
4972
  behavior: Behavior
@@ -4746,6 +5036,10 @@ export declare const editorMachine: StateMachine<
4746
5036
  }
4747
5037
  | {
4748
5038
  type: 'done loading'
5039
+ }
5040
+ | {
5041
+ type: 'custom.*'
5042
+ event: CustomBehaviorEvent
4749
5043
  },
4750
5044
  undefined,
4751
5045
  never,
@@ -4805,7 +5099,7 @@ export declare const editorMachine: StateMachine<
4805
5099
  style: string
4806
5100
  }
4807
5101
  | PatchEvent
4808
- | MutationEvent_2
5102
+ | MutationEvent
4809
5103
  | {
4810
5104
  type: 'ready'
4811
5105
  }
@@ -4857,6 +5151,10 @@ export declare const editorMachine: StateMachine<
4857
5151
  | {
4858
5152
  type: 'editable'
4859
5153
  }
5154
+ | {
5155
+ type: 'custom.*'
5156
+ event: CustomBehaviorEvent
5157
+ }
4860
5158
  >
4861
5159
  }
4862
5160
  readonly 'blur': {
@@ -4864,7 +5162,7 @@ export declare const editorMachine: StateMachine<
4864
5162
  {
4865
5163
  behaviors: Set<Behavior>
4866
5164
  keyGenerator: () => string
4867
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5165
+ pendingEvents: Array<PatchEvent | MutationEvent>
4868
5166
  schema: EditorSchema
4869
5167
  initialReadOnly: boolean
4870
5168
  maxBlocks: number | undefined
@@ -4927,7 +5225,7 @@ export declare const editorMachine: StateMachine<
4927
5225
  style: string
4928
5226
  }
4929
5227
  | PatchEvent
4930
- | MutationEvent_2
5228
+ | MutationEvent
4931
5229
  | {
4932
5230
  type: 'normalizing'
4933
5231
  }
@@ -4943,10 +5241,20 @@ export declare const editorMachine: StateMachine<
4943
5241
  | SyntheticBehaviorEvent
4944
5242
  | NativeBehaviorEvent
4945
5243
  editor: PortableTextSlateEditor
5244
+ defaultActionCallback?: () => void
5245
+ nativeEvent?: {
5246
+ preventDefault: () => void
5247
+ }
5248
+ }
5249
+ | {
5250
+ type: 'custom behavior event'
5251
+ behaviorEvent: CustomBehaviorEvent
5252
+ editor: PortableTextSlateEditor
4946
5253
  nativeEvent?: {
4947
5254
  preventDefault: () => void
4948
5255
  }
4949
5256
  }
5257
+ | CustomBehaviorEvent
4950
5258
  | {
4951
5259
  type: 'add behavior'
4952
5260
  behavior: Behavior
@@ -5016,6 +5324,10 @@ export declare const editorMachine: StateMachine<
5016
5324
  }
5017
5325
  | {
5018
5326
  type: 'done loading'
5327
+ }
5328
+ | {
5329
+ type: 'custom.*'
5330
+ event: CustomBehaviorEvent
5019
5331
  },
5020
5332
  undefined,
5021
5333
  never,
@@ -5075,7 +5387,7 @@ export declare const editorMachine: StateMachine<
5075
5387
  style: string
5076
5388
  }
5077
5389
  | PatchEvent
5078
- | MutationEvent_2
5390
+ | MutationEvent
5079
5391
  | {
5080
5392
  type: 'ready'
5081
5393
  }
@@ -5127,24 +5439,29 @@ export declare const editorMachine: StateMachine<
5127
5439
  | {
5128
5440
  type: 'editable'
5129
5441
  }
5442
+ | {
5443
+ type: 'custom.*'
5444
+ event: CustomBehaviorEvent
5445
+ }
5130
5446
  >
5131
5447
  }
5132
- readonly 'decorator.*': {
5448
+ readonly 'custom.*': {
5133
5449
  readonly actions: ActionFunction<
5134
5450
  {
5135
5451
  behaviors: Set<Behavior>
5136
5452
  keyGenerator: () => string
5137
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5453
+ pendingEvents: Array<PatchEvent | MutationEvent>
5138
5454
  schema: EditorSchema
5139
5455
  initialReadOnly: boolean
5140
5456
  maxBlocks: number | undefined
5141
5457
  selection: EditorSelection
5142
5458
  value: Array<PortableTextBlock> | undefined
5143
5459
  },
5144
- {
5145
- type: 'decorator.toggle'
5146
- decorator: string
5147
- },
5460
+ | CustomBehaviorEvent
5461
+ | {
5462
+ type: 'custom.*'
5463
+ event: CustomBehaviorEvent
5464
+ },
5148
5465
  | {
5149
5466
  type: 'annotation.add'
5150
5467
  annotation: {
@@ -5198,7 +5515,7 @@ export declare const editorMachine: StateMachine<
5198
5515
  style: string
5199
5516
  }
5200
5517
  | PatchEvent
5201
- | MutationEvent_2
5518
+ | MutationEvent
5202
5519
  | {
5203
5520
  type: 'normalizing'
5204
5521
  }
@@ -5214,10 +5531,20 @@ export declare const editorMachine: StateMachine<
5214
5531
  | SyntheticBehaviorEvent
5215
5532
  | NativeBehaviorEvent
5216
5533
  editor: PortableTextSlateEditor
5534
+ defaultActionCallback?: () => void
5535
+ nativeEvent?: {
5536
+ preventDefault: () => void
5537
+ }
5538
+ }
5539
+ | {
5540
+ type: 'custom behavior event'
5541
+ behaviorEvent: CustomBehaviorEvent
5542
+ editor: PortableTextSlateEditor
5217
5543
  nativeEvent?: {
5218
5544
  preventDefault: () => void
5219
5545
  }
5220
5546
  }
5547
+ | CustomBehaviorEvent
5221
5548
  | {
5222
5549
  type: 'add behavior'
5223
5550
  behavior: Behavior
@@ -5287,6 +5614,10 @@ export declare const editorMachine: StateMachine<
5287
5614
  }
5288
5615
  | {
5289
5616
  type: 'done loading'
5617
+ }
5618
+ | {
5619
+ type: 'custom.*'
5620
+ event: CustomBehaviorEvent
5290
5621
  },
5291
5622
  undefined,
5292
5623
  never,
@@ -5346,7 +5677,7 @@ export declare const editorMachine: StateMachine<
5346
5677
  style: string
5347
5678
  }
5348
5679
  | PatchEvent
5349
- | MutationEvent_2
5680
+ | MutationEvent
5350
5681
  | {
5351
5682
  type: 'ready'
5352
5683
  }
@@ -5398,14 +5729,18 @@ export declare const editorMachine: StateMachine<
5398
5729
  | {
5399
5730
  type: 'editable'
5400
5731
  }
5732
+ | {
5733
+ type: 'custom.*'
5734
+ event: CustomBehaviorEvent
5735
+ }
5401
5736
  >
5402
5737
  }
5403
- readonly 'focus': {
5738
+ readonly 'decorator.*': {
5404
5739
  readonly actions: ActionFunction<
5405
5740
  {
5406
5741
  behaviors: Set<Behavior>
5407
5742
  keyGenerator: () => string
5408
- pendingEvents: Array<PatchEvent | MutationEvent_2>
5743
+ pendingEvents: Array<PatchEvent | MutationEvent>
5409
5744
  schema: EditorSchema
5410
5745
  initialReadOnly: boolean
5411
5746
  maxBlocks: number | undefined
@@ -5413,7 +5748,8 @@ export declare const editorMachine: StateMachine<
5413
5748
  value: Array<PortableTextBlock> | undefined
5414
5749
  },
5415
5750
  {
5416
- type: 'focus'
5751
+ type: 'decorator.toggle'
5752
+ decorator: string
5417
5753
  },
5418
5754
  | {
5419
5755
  type: 'annotation.add'
@@ -5468,7 +5804,7 @@ export declare const editorMachine: StateMachine<
5468
5804
  style: string
5469
5805
  }
5470
5806
  | PatchEvent
5471
- | MutationEvent_2
5807
+ | MutationEvent
5472
5808
  | {
5473
5809
  type: 'normalizing'
5474
5810
  }
@@ -5484,10 +5820,20 @@ export declare const editorMachine: StateMachine<
5484
5820
  | SyntheticBehaviorEvent
5485
5821
  | NativeBehaviorEvent
5486
5822
  editor: PortableTextSlateEditor
5823
+ defaultActionCallback?: () => void
5824
+ nativeEvent?: {
5825
+ preventDefault: () => void
5826
+ }
5827
+ }
5828
+ | {
5829
+ type: 'custom behavior event'
5830
+ behaviorEvent: CustomBehaviorEvent
5831
+ editor: PortableTextSlateEditor
5487
5832
  nativeEvent?: {
5488
5833
  preventDefault: () => void
5489
5834
  }
5490
5835
  }
5836
+ | CustomBehaviorEvent
5491
5837
  | {
5492
5838
  type: 'add behavior'
5493
5839
  behavior: Behavior
@@ -5557,6 +5903,10 @@ export declare const editorMachine: StateMachine<
5557
5903
  }
5558
5904
  | {
5559
5905
  type: 'done loading'
5906
+ }
5907
+ | {
5908
+ type: 'custom.*'
5909
+ event: CustomBehaviorEvent
5560
5910
  },
5561
5911
  undefined,
5562
5912
  never,
@@ -5616,7 +5966,7 @@ export declare const editorMachine: StateMachine<
5616
5966
  style: string
5617
5967
  }
5618
5968
  | PatchEvent
5619
- | MutationEvent_2
5969
+ | MutationEvent
5620
5970
  | {
5621
5971
  type: 'ready'
5622
5972
  }
@@ -5668,39 +6018,27 @@ export declare const editorMachine: StateMachine<
5668
6018
  | {
5669
6019
  type: 'editable'
5670
6020
  }
6021
+ | {
6022
+ type: 'custom.*'
6023
+ event: CustomBehaviorEvent
6024
+ }
5671
6025
  >
5672
6026
  }
5673
- readonly 'insert.*': {
6027
+ readonly 'focus': {
5674
6028
  readonly actions: ActionFunction<
5675
6029
  {
5676
6030
  behaviors: Set<Behavior>
5677
6031
  keyGenerator: () => string
5678
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6032
+ pendingEvents: Array<PatchEvent | MutationEvent>
5679
6033
  schema: EditorSchema
5680
6034
  initialReadOnly: boolean
5681
6035
  maxBlocks: number | undefined
5682
6036
  selection: EditorSelection
5683
6037
  value: Array<PortableTextBlock> | undefined
5684
6038
  },
5685
- | {
5686
- type: 'insert.block object'
5687
- placement: 'auto' | 'after' | 'before'
5688
- blockObject: {
5689
- name: string
5690
- value?: {
5691
- [prop: string]: unknown
5692
- }
5693
- }
5694
- }
5695
- | {
5696
- type: 'insert.inline object'
5697
- inlineObject: {
5698
- name: string
5699
- value?: {
5700
- [prop: string]: unknown
5701
- }
5702
- }
5703
- },
6039
+ {
6040
+ type: 'focus'
6041
+ },
5704
6042
  | {
5705
6043
  type: 'annotation.add'
5706
6044
  annotation: {
@@ -5754,7 +6092,7 @@ export declare const editorMachine: StateMachine<
5754
6092
  style: string
5755
6093
  }
5756
6094
  | PatchEvent
5757
- | MutationEvent_2
6095
+ | MutationEvent
5758
6096
  | {
5759
6097
  type: 'normalizing'
5760
6098
  }
@@ -5770,16 +6108,26 @@ export declare const editorMachine: StateMachine<
5770
6108
  | SyntheticBehaviorEvent
5771
6109
  | NativeBehaviorEvent
5772
6110
  editor: PortableTextSlateEditor
6111
+ defaultActionCallback?: () => void
5773
6112
  nativeEvent?: {
5774
6113
  preventDefault: () => void
5775
6114
  }
5776
6115
  }
5777
6116
  | {
5778
- type: 'add behavior'
5779
- behavior: Behavior
5780
- }
5781
- | {
5782
- type: 'remove behavior'
6117
+ type: 'custom behavior event'
6118
+ behaviorEvent: CustomBehaviorEvent
6119
+ editor: PortableTextSlateEditor
6120
+ nativeEvent?: {
6121
+ preventDefault: () => void
6122
+ }
6123
+ }
6124
+ | CustomBehaviorEvent
6125
+ | {
6126
+ type: 'add behavior'
6127
+ behavior: Behavior
6128
+ }
6129
+ | {
6130
+ type: 'remove behavior'
5783
6131
  behavior: Behavior
5784
6132
  }
5785
6133
  | {
@@ -5843,6 +6191,10 @@ export declare const editorMachine: StateMachine<
5843
6191
  }
5844
6192
  | {
5845
6193
  type: 'done loading'
6194
+ }
6195
+ | {
6196
+ type: 'custom.*'
6197
+ event: CustomBehaviorEvent
5846
6198
  },
5847
6199
  undefined,
5848
6200
  never,
@@ -5902,7 +6254,7 @@ export declare const editorMachine: StateMachine<
5902
6254
  style: string
5903
6255
  }
5904
6256
  | PatchEvent
5905
- | MutationEvent_2
6257
+ | MutationEvent
5906
6258
  | {
5907
6259
  type: 'ready'
5908
6260
  }
@@ -5954,6 +6306,314 @@ export declare const editorMachine: StateMachine<
5954
6306
  | {
5955
6307
  type: 'editable'
5956
6308
  }
6309
+ | {
6310
+ type: 'custom.*'
6311
+ event: CustomBehaviorEvent
6312
+ }
6313
+ >
6314
+ }
6315
+ readonly 'insert.*': {
6316
+ readonly actions: ActionFunction<
6317
+ {
6318
+ behaviors: Set<Behavior>
6319
+ keyGenerator: () => string
6320
+ pendingEvents: Array<PatchEvent | MutationEvent>
6321
+ schema: EditorSchema
6322
+ initialReadOnly: boolean
6323
+ maxBlocks: number | undefined
6324
+ selection: EditorSelection
6325
+ value: Array<PortableTextBlock> | undefined
6326
+ },
6327
+ | {
6328
+ type: 'insert.block object'
6329
+ placement: 'auto' | 'after' | 'before'
6330
+ blockObject: {
6331
+ name: string
6332
+ value?: {
6333
+ [prop: string]: unknown
6334
+ }
6335
+ }
6336
+ }
6337
+ | {
6338
+ type: 'insert.inline object'
6339
+ inlineObject: {
6340
+ name: string
6341
+ value?: {
6342
+ [prop: string]: unknown
6343
+ }
6344
+ }
6345
+ },
6346
+ | {
6347
+ type: 'annotation.add'
6348
+ annotation: {
6349
+ name: string
6350
+ value: {
6351
+ [prop: string]: unknown
6352
+ }
6353
+ }
6354
+ }
6355
+ | {
6356
+ type: 'annotation.remove'
6357
+ annotation: {
6358
+ name: string
6359
+ }
6360
+ }
6361
+ | {
6362
+ type: 'blur'
6363
+ }
6364
+ | {
6365
+ type: 'decorator.toggle'
6366
+ decorator: string
6367
+ }
6368
+ | {
6369
+ type: 'focus'
6370
+ }
6371
+ | {
6372
+ type: 'insert.block object'
6373
+ placement: 'auto' | 'after' | 'before'
6374
+ blockObject: {
6375
+ name: string
6376
+ value?: {
6377
+ [prop: string]: unknown
6378
+ }
6379
+ }
6380
+ }
6381
+ | {
6382
+ type: 'insert.inline object'
6383
+ inlineObject: {
6384
+ name: string
6385
+ value?: {
6386
+ [prop: string]: unknown
6387
+ }
6388
+ }
6389
+ }
6390
+ | {
6391
+ type: 'list item.toggle'
6392
+ listItem: string
6393
+ }
6394
+ | {
6395
+ type: 'style.toggle'
6396
+ style: string
6397
+ }
6398
+ | PatchEvent
6399
+ | MutationEvent
6400
+ | {
6401
+ type: 'normalizing'
6402
+ }
6403
+ | {
6404
+ type: 'done normalizing'
6405
+ }
6406
+ | {
6407
+ type: 'done syncing initial value'
6408
+ }
6409
+ | {
6410
+ type: 'behavior event'
6411
+ behaviorEvent:
6412
+ | SyntheticBehaviorEvent
6413
+ | NativeBehaviorEvent
6414
+ editor: PortableTextSlateEditor
6415
+ defaultActionCallback?: () => void
6416
+ nativeEvent?: {
6417
+ preventDefault: () => void
6418
+ }
6419
+ }
6420
+ | {
6421
+ type: 'custom behavior event'
6422
+ behaviorEvent: CustomBehaviorEvent
6423
+ editor: PortableTextSlateEditor
6424
+ nativeEvent?: {
6425
+ preventDefault: () => void
6426
+ }
6427
+ }
6428
+ | CustomBehaviorEvent
6429
+ | {
6430
+ type: 'add behavior'
6431
+ behavior: Behavior
6432
+ }
6433
+ | {
6434
+ type: 'remove behavior'
6435
+ behavior: Behavior
6436
+ }
6437
+ | {
6438
+ type: 'update readOnly'
6439
+ readOnly: boolean
6440
+ }
6441
+ | {
6442
+ type: 'update schema'
6443
+ schema: EditorSchema
6444
+ }
6445
+ | {
6446
+ type: 'update behaviors'
6447
+ behaviors: Array<Behavior>
6448
+ }
6449
+ | {
6450
+ type: 'update value'
6451
+ value: Array<PortableTextBlock> | undefined
6452
+ }
6453
+ | {
6454
+ type: 'update maxBlocks'
6455
+ maxBlocks: number | undefined
6456
+ }
6457
+ | PatchesEvent
6458
+ | {
6459
+ type: 'unset'
6460
+ previousValue: Array<PortableTextBlock>
6461
+ }
6462
+ | {
6463
+ type: 'value changed'
6464
+ value: Array<PortableTextBlock> | undefined
6465
+ }
6466
+ | {
6467
+ type: 'invalid value'
6468
+ resolution: InvalidValueResolution | null
6469
+ value: Array<PortableTextBlock> | undefined
6470
+ }
6471
+ | {
6472
+ type: 'error'
6473
+ name: string
6474
+ description: string
6475
+ data: unknown
6476
+ }
6477
+ | {
6478
+ type: 'select'
6479
+ selection: EditorSelection
6480
+ }
6481
+ | {
6482
+ type: 'selection'
6483
+ selection: EditorSelection
6484
+ }
6485
+ | {
6486
+ type: 'blurred'
6487
+ event: FocusEvent_2<HTMLDivElement, Element>
6488
+ }
6489
+ | {
6490
+ type: 'focused'
6491
+ event: FocusEvent_2<HTMLDivElement, Element>
6492
+ }
6493
+ | {
6494
+ type: 'loading'
6495
+ }
6496
+ | {
6497
+ type: 'done loading'
6498
+ }
6499
+ | {
6500
+ type: 'custom.*'
6501
+ event: CustomBehaviorEvent
6502
+ },
6503
+ undefined,
6504
+ never,
6505
+ never,
6506
+ never,
6507
+ never,
6508
+ | {
6509
+ type: 'annotation.add'
6510
+ annotation: {
6511
+ name: string
6512
+ value: {
6513
+ [prop: string]: unknown
6514
+ }
6515
+ }
6516
+ }
6517
+ | {
6518
+ type: 'annotation.remove'
6519
+ annotation: {
6520
+ name: string
6521
+ }
6522
+ }
6523
+ | {
6524
+ type: 'blur'
6525
+ }
6526
+ | {
6527
+ type: 'decorator.toggle'
6528
+ decorator: string
6529
+ }
6530
+ | {
6531
+ type: 'focus'
6532
+ }
6533
+ | {
6534
+ type: 'insert.block object'
6535
+ placement: 'auto' | 'after' | 'before'
6536
+ blockObject: {
6537
+ name: string
6538
+ value?: {
6539
+ [prop: string]: unknown
6540
+ }
6541
+ }
6542
+ }
6543
+ | {
6544
+ type: 'insert.inline object'
6545
+ inlineObject: {
6546
+ name: string
6547
+ value?: {
6548
+ [prop: string]: unknown
6549
+ }
6550
+ }
6551
+ }
6552
+ | {
6553
+ type: 'list item.toggle'
6554
+ listItem: string
6555
+ }
6556
+ | {
6557
+ type: 'style.toggle'
6558
+ style: string
6559
+ }
6560
+ | PatchEvent
6561
+ | MutationEvent
6562
+ | {
6563
+ type: 'ready'
6564
+ }
6565
+ | PatchesEvent
6566
+ | {
6567
+ type: 'unset'
6568
+ previousValue: Array<PortableTextBlock>
6569
+ }
6570
+ | {
6571
+ type: 'value changed'
6572
+ value: Array<PortableTextBlock> | undefined
6573
+ }
6574
+ | {
6575
+ type: 'invalid value'
6576
+ resolution: InvalidValueResolution | null
6577
+ value: Array<PortableTextBlock> | undefined
6578
+ }
6579
+ | {
6580
+ type: 'error'
6581
+ name: string
6582
+ description: string
6583
+ data: unknown
6584
+ }
6585
+ | {
6586
+ type: 'select'
6587
+ selection: EditorSelection
6588
+ }
6589
+ | {
6590
+ type: 'selection'
6591
+ selection: EditorSelection
6592
+ }
6593
+ | {
6594
+ type: 'blurred'
6595
+ event: FocusEvent_2<HTMLDivElement, Element>
6596
+ }
6597
+ | {
6598
+ type: 'focused'
6599
+ event: FocusEvent_2<HTMLDivElement, Element>
6600
+ }
6601
+ | {
6602
+ type: 'loading'
6603
+ }
6604
+ | {
6605
+ type: 'done loading'
6606
+ }
6607
+ | {
6608
+ type: 'read only'
6609
+ }
6610
+ | {
6611
+ type: 'editable'
6612
+ }
6613
+ | {
6614
+ type: 'custom.*'
6615
+ event: CustomBehaviorEvent
6616
+ }
5957
6617
  >
5958
6618
  }
5959
6619
  readonly 'list item.*': {
@@ -5961,7 +6621,7 @@ export declare const editorMachine: StateMachine<
5961
6621
  {
5962
6622
  behaviors: Set<Behavior>
5963
6623
  keyGenerator: () => string
5964
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6624
+ pendingEvents: Array<PatchEvent | MutationEvent>
5965
6625
  schema: EditorSchema
5966
6626
  initialReadOnly: boolean
5967
6627
  maxBlocks: number | undefined
@@ -6025,7 +6685,7 @@ export declare const editorMachine: StateMachine<
6025
6685
  style: string
6026
6686
  }
6027
6687
  | PatchEvent
6028
- | MutationEvent_2
6688
+ | MutationEvent
6029
6689
  | {
6030
6690
  type: 'normalizing'
6031
6691
  }
@@ -6041,10 +6701,20 @@ export declare const editorMachine: StateMachine<
6041
6701
  | SyntheticBehaviorEvent
6042
6702
  | NativeBehaviorEvent
6043
6703
  editor: PortableTextSlateEditor
6704
+ defaultActionCallback?: () => void
6044
6705
  nativeEvent?: {
6045
6706
  preventDefault: () => void
6046
6707
  }
6047
6708
  }
6709
+ | {
6710
+ type: 'custom behavior event'
6711
+ behaviorEvent: CustomBehaviorEvent
6712
+ editor: PortableTextSlateEditor
6713
+ nativeEvent?: {
6714
+ preventDefault: () => void
6715
+ }
6716
+ }
6717
+ | CustomBehaviorEvent
6048
6718
  | {
6049
6719
  type: 'add behavior'
6050
6720
  behavior: Behavior
@@ -6114,6 +6784,10 @@ export declare const editorMachine: StateMachine<
6114
6784
  }
6115
6785
  | {
6116
6786
  type: 'done loading'
6787
+ }
6788
+ | {
6789
+ type: 'custom.*'
6790
+ event: CustomBehaviorEvent
6117
6791
  },
6118
6792
  undefined,
6119
6793
  never,
@@ -6173,7 +6847,7 @@ export declare const editorMachine: StateMachine<
6173
6847
  style: string
6174
6848
  }
6175
6849
  | PatchEvent
6176
- | MutationEvent_2
6850
+ | MutationEvent
6177
6851
  | {
6178
6852
  type: 'ready'
6179
6853
  }
@@ -6225,6 +6899,10 @@ export declare const editorMachine: StateMachine<
6225
6899
  | {
6226
6900
  type: 'editable'
6227
6901
  }
6902
+ | {
6903
+ type: 'custom.*'
6904
+ event: CustomBehaviorEvent
6905
+ }
6228
6906
  >
6229
6907
  }
6230
6908
  readonly 'select': {
@@ -6232,7 +6910,7 @@ export declare const editorMachine: StateMachine<
6232
6910
  {
6233
6911
  behaviors: Set<Behavior>
6234
6912
  keyGenerator: () => string
6235
- pendingEvents: Array<PatchEvent | MutationEvent_2>
6913
+ pendingEvents: Array<PatchEvent | MutationEvent>
6236
6914
  schema: EditorSchema
6237
6915
  initialReadOnly: boolean
6238
6916
  maxBlocks: number | undefined
@@ -6296,7 +6974,7 @@ export declare const editorMachine: StateMachine<
6296
6974
  style: string
6297
6975
  }
6298
6976
  | PatchEvent
6299
- | MutationEvent_2
6977
+ | MutationEvent
6300
6978
  | {
6301
6979
  type: 'normalizing'
6302
6980
  }
@@ -6312,10 +6990,20 @@ export declare const editorMachine: StateMachine<
6312
6990
  | SyntheticBehaviorEvent
6313
6991
  | NativeBehaviorEvent
6314
6992
  editor: PortableTextSlateEditor
6993
+ defaultActionCallback?: () => void
6315
6994
  nativeEvent?: {
6316
6995
  preventDefault: () => void
6317
6996
  }
6318
6997
  }
6998
+ | {
6999
+ type: 'custom behavior event'
7000
+ behaviorEvent: CustomBehaviorEvent
7001
+ editor: PortableTextSlateEditor
7002
+ nativeEvent?: {
7003
+ preventDefault: () => void
7004
+ }
7005
+ }
7006
+ | CustomBehaviorEvent
6319
7007
  | {
6320
7008
  type: 'add behavior'
6321
7009
  behavior: Behavior
@@ -6385,6 +7073,10 @@ export declare const editorMachine: StateMachine<
6385
7073
  }
6386
7074
  | {
6387
7075
  type: 'done loading'
7076
+ }
7077
+ | {
7078
+ type: 'custom.*'
7079
+ event: CustomBehaviorEvent
6388
7080
  },
6389
7081
  undefined,
6390
7082
  never,
@@ -6444,7 +7136,7 @@ export declare const editorMachine: StateMachine<
6444
7136
  style: string
6445
7137
  }
6446
7138
  | PatchEvent
6447
- | MutationEvent_2
7139
+ | MutationEvent
6448
7140
  | {
6449
7141
  type: 'ready'
6450
7142
  }
@@ -6496,6 +7188,10 @@ export declare const editorMachine: StateMachine<
6496
7188
  | {
6497
7189
  type: 'editable'
6498
7190
  }
7191
+ | {
7192
+ type: 'custom.*'
7193
+ event: CustomBehaviorEvent
7194
+ }
6499
7195
  >
6500
7196
  }
6501
7197
  readonly 'style.*': {
@@ -6503,7 +7199,7 @@ export declare const editorMachine: StateMachine<
6503
7199
  {
6504
7200
  behaviors: Set<Behavior>
6505
7201
  keyGenerator: () => string
6506
- pendingEvents: Array<PatchEvent | MutationEvent_2>
7202
+ pendingEvents: Array<PatchEvent | MutationEvent>
6507
7203
  schema: EditorSchema
6508
7204
  initialReadOnly: boolean
6509
7205
  maxBlocks: number | undefined
@@ -6567,7 +7263,7 @@ export declare const editorMachine: StateMachine<
6567
7263
  style: string
6568
7264
  }
6569
7265
  | PatchEvent
6570
- | MutationEvent_2
7266
+ | MutationEvent
6571
7267
  | {
6572
7268
  type: 'normalizing'
6573
7269
  }
@@ -6583,10 +7279,20 @@ export declare const editorMachine: StateMachine<
6583
7279
  | SyntheticBehaviorEvent
6584
7280
  | NativeBehaviorEvent
6585
7281
  editor: PortableTextSlateEditor
7282
+ defaultActionCallback?: () => void
6586
7283
  nativeEvent?: {
6587
7284
  preventDefault: () => void
6588
7285
  }
6589
7286
  }
7287
+ | {
7288
+ type: 'custom behavior event'
7289
+ behaviorEvent: CustomBehaviorEvent
7290
+ editor: PortableTextSlateEditor
7291
+ nativeEvent?: {
7292
+ preventDefault: () => void
7293
+ }
7294
+ }
7295
+ | CustomBehaviorEvent
6590
7296
  | {
6591
7297
  type: 'add behavior'
6592
7298
  behavior: Behavior
@@ -6656,6 +7362,10 @@ export declare const editorMachine: StateMachine<
6656
7362
  }
6657
7363
  | {
6658
7364
  type: 'done loading'
7365
+ }
7366
+ | {
7367
+ type: 'custom.*'
7368
+ event: CustomBehaviorEvent
6659
7369
  },
6660
7370
  undefined,
6661
7371
  never,
@@ -6715,7 +7425,7 @@ export declare const editorMachine: StateMachine<
6715
7425
  style: string
6716
7426
  }
6717
7427
  | PatchEvent
6718
- | MutationEvent_2
7428
+ | MutationEvent
6719
7429
  | {
6720
7430
  type: 'ready'
6721
7431
  }
@@ -6767,6 +7477,10 @@ export declare const editorMachine: StateMachine<
6767
7477
  | {
6768
7478
  type: 'editable'
6769
7479
  }
7480
+ | {
7481
+ type: 'custom.*'
7482
+ event: CustomBehaviorEvent
7483
+ }
6770
7484
  >
6771
7485
  }
6772
7486
  }
@@ -6948,7 +7662,7 @@ export declare type InternalEditorEmittedEvent =
6948
7662
  }
6949
7663
  | PatchEvent
6950
7664
  | PatchesEvent
6951
- | MutationEvent_2
7665
+ | MutationEvent
6952
7666
  | {
6953
7667
  type: 'unset'
6954
7668
  previousValue: Array<PortableTextBlock>
@@ -7009,6 +7723,10 @@ export declare type InternalEditorEmittedEvent =
7009
7723
  | 'focus'
7010
7724
  | 'style.toggle'
7011
7725
  >
7726
+ | {
7727
+ type: 'custom.*'
7728
+ event: CustomBehaviorEvent
7729
+ }
7012
7730
 
7013
7731
  /**
7014
7732
  * @internal
@@ -7027,10 +7745,20 @@ export declare type InternalEditorEvent =
7027
7745
  type: 'behavior event'
7028
7746
  behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
7029
7747
  editor: PortableTextSlateEditor
7748
+ defaultActionCallback?: () => void
7749
+ nativeEvent?: {
7750
+ preventDefault: () => void
7751
+ }
7752
+ }
7753
+ | {
7754
+ type: 'custom behavior event'
7755
+ behaviorEvent: CustomBehaviorEvent
7756
+ editor: PortableTextSlateEditor
7030
7757
  nativeEvent?: {
7031
7758
  preventDefault: () => void
7032
7759
  }
7033
7760
  }
7761
+ | CustomBehaviorEvent
7034
7762
  | {
7035
7763
  type: 'add behavior'
7036
7764
  behavior: Behavior
@@ -7123,7 +7851,7 @@ export declare type MutationChange = {
7123
7851
  /**
7124
7852
  * @internal
7125
7853
  */
7126
- declare type MutationEvent_2 = {
7854
+ export declare type MutationEvent = {
7127
7855
  type: 'mutation'
7128
7856
  patches: Array<Patch>
7129
7857
  /**
@@ -7132,7 +7860,6 @@ declare type MutationEvent_2 = {
7132
7860
  snapshot: Array<PortableTextBlock> | undefined
7133
7861
  value: Array<PortableTextBlock> | undefined
7134
7862
  }
7135
- export {MutationEvent_2 as MutationEvent}
7136
7863
 
7137
7864
  /**
7138
7865
  * @beta
@@ -7345,9 +8072,9 @@ export declare class PortableTextEditor extends Component<
7345
8072
  path: Path,
7346
8073
  ) => [
7347
8074
  (
7348
- | PortableTextTextBlock<PortableTextObject | PortableTextSpan>
7349
- | PortableTextObject
7350
8075
  | PortableTextSpan
8076
+ | PortableTextObject
8077
+ | PortableTextTextBlock<PortableTextSpan | PortableTextObject>
7351
8078
  | undefined
7352
8079
  ),
7353
8080
  Path | undefined,
@@ -7543,6 +8270,8 @@ export declare interface PortableTextSlateEditor extends ReactEditor {
7543
8270
  redo: () => void
7544
8271
  }
7545
8272
 
8273
+ export {PortableTextSpan}
8274
+
7546
8275
  /**
7547
8276
  * A range decoration is a UI affordance that wraps a given selection range in the editor
7548
8277
  * with a custom component. This can be used to highlight search results,