@portabletext/editor 1.48.14 → 1.49.0

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 (48) hide show
  1. package/lib/_chunks-cjs/editor-provider.cjs +117 -34
  2. package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
  3. package/lib/_chunks-cjs/util.slice-blocks.cjs +2 -0
  4. package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
  5. package/lib/_chunks-es/editor-provider.js +117 -34
  6. package/lib/_chunks-es/editor-provider.js.map +1 -1
  7. package/lib/_chunks-es/util.slice-blocks.js +2 -0
  8. package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
  9. package/lib/behaviors/index.d.cts +222 -208
  10. package/lib/behaviors/index.d.ts +222 -208
  11. package/lib/index.cjs +346 -257
  12. package/lib/index.cjs.map +1 -1
  13. package/lib/index.d.cts +222 -216
  14. package/lib/index.d.ts +222 -216
  15. package/lib/index.js +353 -264
  16. package/lib/index.js.map +1 -1
  17. package/lib/plugins/index.d.cts +222 -216
  18. package/lib/plugins/index.d.ts +222 -216
  19. package/lib/selectors/index.d.cts +222 -208
  20. package/lib/selectors/index.d.ts +222 -208
  21. package/lib/utils/index.d.cts +222 -208
  22. package/lib/utils/index.d.ts +222 -208
  23. package/package.json +1 -1
  24. package/src/behaviors/behavior.config.ts +7 -0
  25. package/src/behaviors/behavior.core.block-element.ts +108 -0
  26. package/src/behaviors/behavior.core.ts +6 -2
  27. package/src/converters/converter.portable-text.ts +4 -1
  28. package/src/converters/converter.text-html.ts +4 -1
  29. package/src/converters/converter.text-plain.ts +4 -1
  30. package/src/editor/Editable.tsx +2 -4
  31. package/src/editor/__tests__/PortableTextEditor.test.tsx +6 -0
  32. package/src/editor/components/Leaf.tsx +8 -1
  33. package/src/editor/components/render-block-object.tsx +90 -0
  34. package/src/editor/components/render-default-object.tsx +21 -0
  35. package/src/editor/components/render-element.tsx +140 -0
  36. package/src/editor/components/render-inline-object.tsx +93 -0
  37. package/src/editor/components/render-text-block.tsx +148 -0
  38. package/src/editor/components/use-core-block-element-behaviors.ts +39 -0
  39. package/src/editor/create-editor.ts +17 -5
  40. package/src/editor/editor-machine.ts +21 -18
  41. package/src/internal-utils/parse-blocks.ts +2 -2
  42. package/src/internal-utils/slate-utils.ts +1 -1
  43. package/src/priority/priority.core.ts +3 -0
  44. package/src/priority/priority.sort.test.ts +319 -0
  45. package/src/priority/priority.sort.ts +121 -0
  46. package/src/priority/priority.types.ts +24 -0
  47. package/src/editor/components/DefaultObject.tsx +0 -21
  48. package/src/editor/components/Element.tsx +0 -435
@@ -288,6 +288,11 @@ declare type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (
288
288
  guardResponse: TGuardResponse,
289
289
  ) => Array<BehaviorAction>
290
290
 
291
+ declare type BehaviorConfig = {
292
+ behavior: Behavior
293
+ priority: EditorPriority
294
+ }
295
+
291
296
  /**
292
297
  * @beta
293
298
  */
@@ -664,7 +669,7 @@ declare type EditorEvent = ExternalEditorEvent | ExternalBehaviorEvent
664
669
  */
665
670
  declare const editorMachine: StateMachine<
666
671
  {
667
- behaviors: Set<Behavior>
672
+ behaviors: Set<BehaviorConfig>
668
673
  converters: Set<Converter>
669
674
  getLegacySchema: () => PortableTextMemberSchemaTypes
670
675
  keyGenerator: () => string
@@ -684,14 +689,6 @@ declare const editorMachine: StateMachine<
684
689
  | InternalPatchEvent
685
690
  | MutationEvent
686
691
  | PatchesEvent
687
- | {
688
- type: 'add behavior'
689
- behavior: Behavior
690
- }
691
- | {
692
- type: 'remove behavior'
693
- behavior: Behavior
694
- }
695
692
  | {
696
693
  type: 'update readOnly'
697
694
  readOnly: boolean
@@ -712,6 +709,14 @@ declare const editorMachine: StateMachine<
712
709
  type: 'update maxBlocks'
713
710
  maxBlocks: number | undefined
714
711
  }
712
+ | {
713
+ type: 'add behavior'
714
+ behaviorConfig: BehaviorConfig
715
+ }
716
+ | {
717
+ type: 'remove behavior'
718
+ behaviorConfig: BehaviorConfig
719
+ }
715
720
  | {
716
721
  type: 'blur'
717
722
  editor: PortableTextSlateEditor
@@ -1008,7 +1013,7 @@ declare const editorMachine: StateMachine<
1008
1013
  self: ActorRef<
1009
1014
  MachineSnapshot<
1010
1015
  {
1011
- behaviors: Set<Behavior>
1016
+ behaviors: Set<BehaviorConfig>
1012
1017
  converters: Set<Converter>
1013
1018
  getLegacySchema: () => PortableTextMemberSchemaTypes
1014
1019
  keyGenerator: () => string
@@ -1028,14 +1033,6 @@ declare const editorMachine: StateMachine<
1028
1033
  | InternalPatchEvent
1029
1034
  | MutationEvent
1030
1035
  | PatchesEvent
1031
- | {
1032
- type: 'add behavior'
1033
- behavior: Behavior
1034
- }
1035
- | {
1036
- type: 'remove behavior'
1037
- behavior: Behavior
1038
- }
1039
1036
  | {
1040
1037
  type: 'update readOnly'
1041
1038
  readOnly: boolean
@@ -1056,6 +1053,14 @@ declare const editorMachine: StateMachine<
1056
1053
  type: 'update maxBlocks'
1057
1054
  maxBlocks: number | undefined
1058
1055
  }
1056
+ | {
1057
+ type: 'add behavior'
1058
+ behaviorConfig: BehaviorConfig
1059
+ }
1060
+ | {
1061
+ type: 'remove behavior'
1062
+ behaviorConfig: BehaviorConfig
1063
+ }
1059
1064
  | {
1060
1065
  type: 'blur'
1061
1066
  editor: PortableTextSlateEditor
@@ -1161,14 +1166,6 @@ declare const editorMachine: StateMachine<
1161
1166
  | InternalPatchEvent
1162
1167
  | MutationEvent
1163
1168
  | PatchesEvent
1164
- | {
1165
- type: 'add behavior'
1166
- behavior: Behavior
1167
- }
1168
- | {
1169
- type: 'remove behavior'
1170
- behavior: Behavior
1171
- }
1172
1169
  | {
1173
1170
  type: 'update readOnly'
1174
1171
  readOnly: boolean
@@ -1189,6 +1186,14 @@ declare const editorMachine: StateMachine<
1189
1186
  type: 'update maxBlocks'
1190
1187
  maxBlocks: number | undefined
1191
1188
  }
1189
+ | {
1190
+ type: 'add behavior'
1191
+ behaviorConfig: BehaviorConfig
1192
+ }
1193
+ | {
1194
+ type: 'remove behavior'
1195
+ behaviorConfig: BehaviorConfig
1196
+ }
1192
1197
  | {
1193
1198
  type: 'blur'
1194
1199
  editor: PortableTextSlateEditor
@@ -1303,7 +1308,7 @@ declare const editorMachine: StateMachine<
1303
1308
  readonly 'notify.blurred': {
1304
1309
  readonly actions: ActionFunction<
1305
1310
  {
1306
- behaviors: Set<Behavior>
1311
+ behaviors: Set<BehaviorConfig>
1307
1312
  converters: Set<Converter>
1308
1313
  getLegacySchema: () => PortableTextMemberSchemaTypes
1309
1314
  keyGenerator: () => string
@@ -1327,14 +1332,6 @@ declare const editorMachine: StateMachine<
1327
1332
  | InternalPatchEvent
1328
1333
  | MutationEvent
1329
1334
  | PatchesEvent
1330
- | {
1331
- type: 'add behavior'
1332
- behavior: Behavior
1333
- }
1334
- | {
1335
- type: 'remove behavior'
1336
- behavior: Behavior
1337
- }
1338
1335
  | {
1339
1336
  type: 'update readOnly'
1340
1337
  readOnly: boolean
@@ -1355,6 +1352,14 @@ declare const editorMachine: StateMachine<
1355
1352
  type: 'update maxBlocks'
1356
1353
  maxBlocks: number | undefined
1357
1354
  }
1355
+ | {
1356
+ type: 'add behavior'
1357
+ behaviorConfig: BehaviorConfig
1358
+ }
1359
+ | {
1360
+ type: 'remove behavior'
1361
+ behaviorConfig: BehaviorConfig
1362
+ }
1358
1363
  | {
1359
1364
  type: 'blur'
1360
1365
  editor: PortableTextSlateEditor
@@ -1507,7 +1512,7 @@ declare const editorMachine: StateMachine<
1507
1512
  readonly 'notify.done loading': {
1508
1513
  readonly actions: ActionFunction<
1509
1514
  {
1510
- behaviors: Set<Behavior>
1515
+ behaviors: Set<BehaviorConfig>
1511
1516
  converters: Set<Converter>
1512
1517
  getLegacySchema: () => PortableTextMemberSchemaTypes
1513
1518
  keyGenerator: () => string
@@ -1530,14 +1535,6 @@ declare const editorMachine: StateMachine<
1530
1535
  | InternalPatchEvent
1531
1536
  | MutationEvent
1532
1537
  | PatchesEvent
1533
- | {
1534
- type: 'add behavior'
1535
- behavior: Behavior
1536
- }
1537
- | {
1538
- type: 'remove behavior'
1539
- behavior: Behavior
1540
- }
1541
1538
  | {
1542
1539
  type: 'update readOnly'
1543
1540
  readOnly: boolean
@@ -1558,6 +1555,14 @@ declare const editorMachine: StateMachine<
1558
1555
  type: 'update maxBlocks'
1559
1556
  maxBlocks: number | undefined
1560
1557
  }
1558
+ | {
1559
+ type: 'add behavior'
1560
+ behaviorConfig: BehaviorConfig
1561
+ }
1562
+ | {
1563
+ type: 'remove behavior'
1564
+ behaviorConfig: BehaviorConfig
1565
+ }
1561
1566
  | {
1562
1567
  type: 'blur'
1563
1568
  editor: PortableTextSlateEditor
@@ -1710,7 +1715,7 @@ declare const editorMachine: StateMachine<
1710
1715
  readonly 'notify.error': {
1711
1716
  readonly actions: ActionFunction<
1712
1717
  {
1713
- behaviors: Set<Behavior>
1718
+ behaviors: Set<BehaviorConfig>
1714
1719
  converters: Set<Converter>
1715
1720
  getLegacySchema: () => PortableTextMemberSchemaTypes
1716
1721
  keyGenerator: () => string
@@ -1736,14 +1741,6 @@ declare const editorMachine: StateMachine<
1736
1741
  | InternalPatchEvent
1737
1742
  | MutationEvent
1738
1743
  | PatchesEvent
1739
- | {
1740
- type: 'add behavior'
1741
- behavior: Behavior
1742
- }
1743
- | {
1744
- type: 'remove behavior'
1745
- behavior: Behavior
1746
- }
1747
1744
  | {
1748
1745
  type: 'update readOnly'
1749
1746
  readOnly: boolean
@@ -1764,6 +1761,14 @@ declare const editorMachine: StateMachine<
1764
1761
  type: 'update maxBlocks'
1765
1762
  maxBlocks: number | undefined
1766
1763
  }
1764
+ | {
1765
+ type: 'add behavior'
1766
+ behaviorConfig: BehaviorConfig
1767
+ }
1768
+ | {
1769
+ type: 'remove behavior'
1770
+ behaviorConfig: BehaviorConfig
1771
+ }
1767
1772
  | {
1768
1773
  type: 'blur'
1769
1774
  editor: PortableTextSlateEditor
@@ -1916,7 +1921,7 @@ declare const editorMachine: StateMachine<
1916
1921
  readonly 'notify.invalid value': {
1917
1922
  readonly actions: ActionFunction<
1918
1923
  {
1919
- behaviors: Set<Behavior>
1924
+ behaviors: Set<BehaviorConfig>
1920
1925
  converters: Set<Converter>
1921
1926
  getLegacySchema: () => PortableTextMemberSchemaTypes
1922
1927
  keyGenerator: () => string
@@ -1941,14 +1946,6 @@ declare const editorMachine: StateMachine<
1941
1946
  | InternalPatchEvent
1942
1947
  | MutationEvent
1943
1948
  | PatchesEvent
1944
- | {
1945
- type: 'add behavior'
1946
- behavior: Behavior
1947
- }
1948
- | {
1949
- type: 'remove behavior'
1950
- behavior: Behavior
1951
- }
1952
1949
  | {
1953
1950
  type: 'update readOnly'
1954
1951
  readOnly: boolean
@@ -1969,6 +1966,14 @@ declare const editorMachine: StateMachine<
1969
1966
  type: 'update maxBlocks'
1970
1967
  maxBlocks: number | undefined
1971
1968
  }
1969
+ | {
1970
+ type: 'add behavior'
1971
+ behaviorConfig: BehaviorConfig
1972
+ }
1973
+ | {
1974
+ type: 'remove behavior'
1975
+ behaviorConfig: BehaviorConfig
1976
+ }
1972
1977
  | {
1973
1978
  type: 'blur'
1974
1979
  editor: PortableTextSlateEditor
@@ -2121,7 +2126,7 @@ declare const editorMachine: StateMachine<
2121
2126
  readonly 'notify.focused': {
2122
2127
  readonly actions: ActionFunction<
2123
2128
  {
2124
- behaviors: Set<Behavior>
2129
+ behaviors: Set<BehaviorConfig>
2125
2130
  converters: Set<Converter>
2126
2131
  getLegacySchema: () => PortableTextMemberSchemaTypes
2127
2132
  keyGenerator: () => string
@@ -2145,14 +2150,6 @@ declare const editorMachine: StateMachine<
2145
2150
  | InternalPatchEvent
2146
2151
  | MutationEvent
2147
2152
  | PatchesEvent
2148
- | {
2149
- type: 'add behavior'
2150
- behavior: Behavior
2151
- }
2152
- | {
2153
- type: 'remove behavior'
2154
- behavior: Behavior
2155
- }
2156
2153
  | {
2157
2154
  type: 'update readOnly'
2158
2155
  readOnly: boolean
@@ -2173,6 +2170,14 @@ declare const editorMachine: StateMachine<
2173
2170
  type: 'update maxBlocks'
2174
2171
  maxBlocks: number | undefined
2175
2172
  }
2173
+ | {
2174
+ type: 'add behavior'
2175
+ behaviorConfig: BehaviorConfig
2176
+ }
2177
+ | {
2178
+ type: 'remove behavior'
2179
+ behaviorConfig: BehaviorConfig
2180
+ }
2176
2181
  | {
2177
2182
  type: 'blur'
2178
2183
  editor: PortableTextSlateEditor
@@ -2326,7 +2331,7 @@ declare const editorMachine: StateMachine<
2326
2331
  readonly actions: readonly [
2327
2332
  ActionFunction<
2328
2333
  {
2329
- behaviors: Set<Behavior>
2334
+ behaviors: Set<BehaviorConfig>
2330
2335
  converters: Set<Converter>
2331
2336
  getLegacySchema: () => PortableTextMemberSchemaTypes
2332
2337
  keyGenerator: () => string
@@ -2350,14 +2355,6 @@ declare const editorMachine: StateMachine<
2350
2355
  | InternalPatchEvent
2351
2356
  | MutationEvent
2352
2357
  | PatchesEvent
2353
- | {
2354
- type: 'add behavior'
2355
- behavior: Behavior
2356
- }
2357
- | {
2358
- type: 'remove behavior'
2359
- behavior: Behavior
2360
- }
2361
2358
  | {
2362
2359
  type: 'update readOnly'
2363
2360
  readOnly: boolean
@@ -2378,6 +2375,14 @@ declare const editorMachine: StateMachine<
2378
2375
  type: 'update maxBlocks'
2379
2376
  maxBlocks: number | undefined
2380
2377
  }
2378
+ | {
2379
+ type: 'add behavior'
2380
+ behaviorConfig: BehaviorConfig
2381
+ }
2382
+ | {
2383
+ type: 'remove behavior'
2384
+ behaviorConfig: BehaviorConfig
2385
+ }
2381
2386
  | {
2382
2387
  type: 'blur'
2383
2388
  editor: PortableTextSlateEditor
@@ -2482,7 +2487,7 @@ declare const editorMachine: StateMachine<
2482
2487
  >,
2483
2488
  ActionFunction<
2484
2489
  {
2485
- behaviors: Set<Behavior>
2490
+ behaviors: Set<BehaviorConfig>
2486
2491
  converters: Set<Converter>
2487
2492
  getLegacySchema: () => PortableTextMemberSchemaTypes
2488
2493
  keyGenerator: () => string
@@ -2506,14 +2511,6 @@ declare const editorMachine: StateMachine<
2506
2511
  | InternalPatchEvent
2507
2512
  | MutationEvent
2508
2513
  | PatchesEvent
2509
- | {
2510
- type: 'add behavior'
2511
- behavior: Behavior
2512
- }
2513
- | {
2514
- type: 'remove behavior'
2515
- behavior: Behavior
2516
- }
2517
2514
  | {
2518
2515
  type: 'update readOnly'
2519
2516
  readOnly: boolean
@@ -2534,6 +2531,14 @@ declare const editorMachine: StateMachine<
2534
2531
  type: 'update maxBlocks'
2535
2532
  maxBlocks: number | undefined
2536
2533
  }
2534
+ | {
2535
+ type: 'add behavior'
2536
+ behaviorConfig: BehaviorConfig
2537
+ }
2538
+ | {
2539
+ type: 'remove behavior'
2540
+ behaviorConfig: BehaviorConfig
2541
+ }
2537
2542
  | {
2538
2543
  type: 'blur'
2539
2544
  editor: PortableTextSlateEditor
@@ -2687,7 +2692,7 @@ declare const editorMachine: StateMachine<
2687
2692
  readonly 'notify.unset': {
2688
2693
  readonly actions: ActionFunction<
2689
2694
  {
2690
- behaviors: Set<Behavior>
2695
+ behaviors: Set<BehaviorConfig>
2691
2696
  converters: Set<Converter>
2692
2697
  getLegacySchema: () => PortableTextMemberSchemaTypes
2693
2698
  keyGenerator: () => string
@@ -2711,14 +2716,6 @@ declare const editorMachine: StateMachine<
2711
2716
  | InternalPatchEvent
2712
2717
  | MutationEvent
2713
2718
  | PatchesEvent
2714
- | {
2715
- type: 'add behavior'
2716
- behavior: Behavior
2717
- }
2718
- | {
2719
- type: 'remove behavior'
2720
- behavior: Behavior
2721
- }
2722
2719
  | {
2723
2720
  type: 'update readOnly'
2724
2721
  readOnly: boolean
@@ -2739,6 +2736,14 @@ declare const editorMachine: StateMachine<
2739
2736
  type: 'update maxBlocks'
2740
2737
  maxBlocks: number | undefined
2741
2738
  }
2739
+ | {
2740
+ type: 'add behavior'
2741
+ behaviorConfig: BehaviorConfig
2742
+ }
2743
+ | {
2744
+ type: 'remove behavior'
2745
+ behaviorConfig: BehaviorConfig
2746
+ }
2742
2747
  | {
2743
2748
  type: 'blur'
2744
2749
  editor: PortableTextSlateEditor
@@ -2891,7 +2896,7 @@ declare const editorMachine: StateMachine<
2891
2896
  readonly 'notify.loading': {
2892
2897
  readonly actions: ActionFunction<
2893
2898
  {
2894
- behaviors: Set<Behavior>
2899
+ behaviors: Set<BehaviorConfig>
2895
2900
  converters: Set<Converter>
2896
2901
  getLegacySchema: () => PortableTextMemberSchemaTypes
2897
2902
  keyGenerator: () => string
@@ -2914,14 +2919,6 @@ declare const editorMachine: StateMachine<
2914
2919
  | InternalPatchEvent
2915
2920
  | MutationEvent
2916
2921
  | PatchesEvent
2917
- | {
2918
- type: 'add behavior'
2919
- behavior: Behavior
2920
- }
2921
- | {
2922
- type: 'remove behavior'
2923
- behavior: Behavior
2924
- }
2925
2922
  | {
2926
2923
  type: 'update readOnly'
2927
2924
  readOnly: boolean
@@ -2942,6 +2939,14 @@ declare const editorMachine: StateMachine<
2942
2939
  type: 'update maxBlocks'
2943
2940
  maxBlocks: number | undefined
2944
2941
  }
2942
+ | {
2943
+ type: 'add behavior'
2944
+ behaviorConfig: BehaviorConfig
2945
+ }
2946
+ | {
2947
+ type: 'remove behavior'
2948
+ behaviorConfig: BehaviorConfig
2949
+ }
2945
2950
  | {
2946
2951
  type: 'blur'
2947
2952
  editor: PortableTextSlateEditor
@@ -3094,7 +3099,7 @@ declare const editorMachine: StateMachine<
3094
3099
  readonly 'notify.value changed': {
3095
3100
  readonly actions: ActionFunction<
3096
3101
  {
3097
- behaviors: Set<Behavior>
3102
+ behaviors: Set<BehaviorConfig>
3098
3103
  converters: Set<Converter>
3099
3104
  getLegacySchema: () => PortableTextMemberSchemaTypes
3100
3105
  keyGenerator: () => string
@@ -3118,14 +3123,6 @@ declare const editorMachine: StateMachine<
3118
3123
  | InternalPatchEvent
3119
3124
  | MutationEvent
3120
3125
  | PatchesEvent
3121
- | {
3122
- type: 'add behavior'
3123
- behavior: Behavior
3124
- }
3125
- | {
3126
- type: 'remove behavior'
3127
- behavior: Behavior
3128
- }
3129
3126
  | {
3130
3127
  type: 'update readOnly'
3131
3128
  readOnly: boolean
@@ -3146,6 +3143,14 @@ declare const editorMachine: StateMachine<
3146
3143
  type: 'update maxBlocks'
3147
3144
  maxBlocks: number | undefined
3148
3145
  }
3146
+ | {
3147
+ type: 'add behavior'
3148
+ behaviorConfig: BehaviorConfig
3149
+ }
3150
+ | {
3151
+ type: 'remove behavior'
3152
+ behaviorConfig: BehaviorConfig
3153
+ }
3149
3154
  | {
3150
3155
  type: 'blur'
3151
3156
  editor: PortableTextSlateEditor
@@ -3304,7 +3309,7 @@ declare const editorMachine: StateMachine<
3304
3309
  readonly 'update key generator': {
3305
3310
  readonly actions: ActionFunction<
3306
3311
  {
3307
- behaviors: Set<Behavior>
3312
+ behaviors: Set<BehaviorConfig>
3308
3313
  converters: Set<Converter>
3309
3314
  getLegacySchema: () => PortableTextMemberSchemaTypes
3310
3315
  keyGenerator: () => string
@@ -3328,14 +3333,6 @@ declare const editorMachine: StateMachine<
3328
3333
  | InternalPatchEvent
3329
3334
  | MutationEvent
3330
3335
  | PatchesEvent
3331
- | {
3332
- type: 'add behavior'
3333
- behavior: Behavior
3334
- }
3335
- | {
3336
- type: 'remove behavior'
3337
- behavior: Behavior
3338
- }
3339
3336
  | {
3340
3337
  type: 'update readOnly'
3341
3338
  readOnly: boolean
@@ -3356,6 +3353,14 @@ declare const editorMachine: StateMachine<
3356
3353
  type: 'update maxBlocks'
3357
3354
  maxBlocks: number | undefined
3358
3355
  }
3356
+ | {
3357
+ type: 'add behavior'
3358
+ behaviorConfig: BehaviorConfig
3359
+ }
3360
+ | {
3361
+ type: 'remove behavior'
3362
+ behaviorConfig: BehaviorConfig
3363
+ }
3359
3364
  | {
3360
3365
  type: 'blur'
3361
3366
  editor: PortableTextSlateEditor
@@ -3465,7 +3470,7 @@ declare const editorMachine: StateMachine<
3465
3470
  readonly 'update value': {
3466
3471
  readonly actions: ActionFunction<
3467
3472
  {
3468
- behaviors: Set<Behavior>
3473
+ behaviors: Set<BehaviorConfig>
3469
3474
  converters: Set<Converter>
3470
3475
  getLegacySchema: () => PortableTextMemberSchemaTypes
3471
3476
  keyGenerator: () => string
@@ -3489,14 +3494,6 @@ declare const editorMachine: StateMachine<
3489
3494
  | InternalPatchEvent
3490
3495
  | MutationEvent
3491
3496
  | PatchesEvent
3492
- | {
3493
- type: 'add behavior'
3494
- behavior: Behavior
3495
- }
3496
- | {
3497
- type: 'remove behavior'
3498
- behavior: Behavior
3499
- }
3500
3497
  | {
3501
3498
  type: 'update readOnly'
3502
3499
  readOnly: boolean
@@ -3517,6 +3514,14 @@ declare const editorMachine: StateMachine<
3517
3514
  type: 'update maxBlocks'
3518
3515
  maxBlocks: number | undefined
3519
3516
  }
3517
+ | {
3518
+ type: 'add behavior'
3519
+ behaviorConfig: BehaviorConfig
3520
+ }
3521
+ | {
3522
+ type: 'remove behavior'
3523
+ behaviorConfig: BehaviorConfig
3524
+ }
3520
3525
  | {
3521
3526
  type: 'blur'
3522
3527
  editor: PortableTextSlateEditor
@@ -3623,7 +3628,7 @@ declare const editorMachine: StateMachine<
3623
3628
  readonly 'update maxBlocks': {
3624
3629
  readonly actions: ActionFunction<
3625
3630
  {
3626
- behaviors: Set<Behavior>
3631
+ behaviors: Set<BehaviorConfig>
3627
3632
  converters: Set<Converter>
3628
3633
  getLegacySchema: () => PortableTextMemberSchemaTypes
3629
3634
  keyGenerator: () => string
@@ -3647,14 +3652,6 @@ declare const editorMachine: StateMachine<
3647
3652
  | InternalPatchEvent
3648
3653
  | MutationEvent
3649
3654
  | PatchesEvent
3650
- | {
3651
- type: 'add behavior'
3652
- behavior: Behavior
3653
- }
3654
- | {
3655
- type: 'remove behavior'
3656
- behavior: Behavior
3657
- }
3658
3655
  | {
3659
3656
  type: 'update readOnly'
3660
3657
  readOnly: boolean
@@ -3675,6 +3672,14 @@ declare const editorMachine: StateMachine<
3675
3672
  type: 'update maxBlocks'
3676
3673
  maxBlocks: number | undefined
3677
3674
  }
3675
+ | {
3676
+ type: 'add behavior'
3677
+ behaviorConfig: BehaviorConfig
3678
+ }
3679
+ | {
3680
+ type: 'remove behavior'
3681
+ behaviorConfig: BehaviorConfig
3682
+ }
3678
3683
  | {
3679
3684
  type: 'blur'
3680
3685
  editor: PortableTextSlateEditor
@@ -3793,7 +3798,7 @@ declare const editorMachine: StateMachine<
3793
3798
  event,
3794
3799
  }: GuardArgs<
3795
3800
  {
3796
- behaviors: Set<Behavior>
3801
+ behaviors: Set<BehaviorConfig>
3797
3802
  converters: Set<Converter>
3798
3803
  getLegacySchema: () => PortableTextMemberSchemaTypes
3799
3804
  keyGenerator: () => string
@@ -3831,7 +3836,7 @@ declare const editorMachine: StateMachine<
3831
3836
  context,
3832
3837
  }: GuardArgs<
3833
3838
  {
3834
- behaviors: Set<Behavior>
3839
+ behaviors: Set<BehaviorConfig>
3835
3840
  converters: Set<Converter>
3836
3841
  getLegacySchema: () => PortableTextMemberSchemaTypes
3837
3842
  keyGenerator: () => string
@@ -3868,7 +3873,7 @@ declare const editorMachine: StateMachine<
3868
3873
  event,
3869
3874
  }: GuardArgs<
3870
3875
  {
3871
- behaviors: Set<Behavior>
3876
+ behaviors: Set<BehaviorConfig>
3872
3877
  converters: Set<Converter>
3873
3878
  getLegacySchema: () => PortableTextMemberSchemaTypes
3874
3879
  keyGenerator: () => string
@@ -3904,7 +3909,7 @@ declare const editorMachine: StateMachine<
3904
3909
  event,
3905
3910
  }: GuardArgs<
3906
3911
  {
3907
- behaviors: Set<Behavior>
3912
+ behaviors: Set<BehaviorConfig>
3908
3913
  converters: Set<Converter>
3909
3914
  getLegacySchema: () => PortableTextMemberSchemaTypes
3910
3915
  keyGenerator: () => string
@@ -3940,7 +3945,7 @@ declare const editorMachine: StateMachine<
3940
3945
  readonly actions: readonly [
3941
3946
  ActionFunction<
3942
3947
  {
3943
- behaviors: Set<Behavior>
3948
+ behaviors: Set<BehaviorConfig>
3944
3949
  converters: Set<Converter>
3945
3950
  getLegacySchema: () => PortableTextMemberSchemaTypes
3946
3951
  keyGenerator: () => string
@@ -3964,14 +3969,6 @@ declare const editorMachine: StateMachine<
3964
3969
  | InternalPatchEvent
3965
3970
  | MutationEvent
3966
3971
  | PatchesEvent
3967
- | {
3968
- type: 'add behavior'
3969
- behavior: Behavior
3970
- }
3971
- | {
3972
- type: 'remove behavior'
3973
- behavior: Behavior
3974
- }
3975
3972
  | {
3976
3973
  type: 'update readOnly'
3977
3974
  readOnly: boolean
@@ -3992,6 +3989,14 @@ declare const editorMachine: StateMachine<
3992
3989
  type: 'update maxBlocks'
3993
3990
  maxBlocks: number | undefined
3994
3991
  }
3992
+ | {
3993
+ type: 'add behavior'
3994
+ behaviorConfig: BehaviorConfig
3995
+ }
3996
+ | {
3997
+ type: 'remove behavior'
3998
+ behaviorConfig: BehaviorConfig
3999
+ }
3995
4000
  | {
3996
4001
  type: 'blur'
3997
4002
  editor: PortableTextSlateEditor
@@ -4105,7 +4110,7 @@ declare const editorMachine: StateMachine<
4105
4110
  readonly actions: readonly [
4106
4111
  ActionFunction<
4107
4112
  {
4108
- behaviors: Set<Behavior>
4113
+ behaviors: Set<BehaviorConfig>
4109
4114
  converters: Set<Converter>
4110
4115
  getLegacySchema: () => PortableTextMemberSchemaTypes
4111
4116
  keyGenerator: () => string
@@ -4132,14 +4137,6 @@ declare const editorMachine: StateMachine<
4132
4137
  | InternalPatchEvent
4133
4138
  | MutationEvent
4134
4139
  | PatchesEvent
4135
- | {
4136
- type: 'add behavior'
4137
- behavior: Behavior
4138
- }
4139
- | {
4140
- type: 'remove behavior'
4141
- behavior: Behavior
4142
- }
4143
4140
  | {
4144
4141
  type: 'update readOnly'
4145
4142
  readOnly: boolean
@@ -4160,6 +4157,14 @@ declare const editorMachine: StateMachine<
4160
4157
  type: 'update maxBlocks'
4161
4158
  maxBlocks: number | undefined
4162
4159
  }
4160
+ | {
4161
+ type: 'add behavior'
4162
+ behaviorConfig: BehaviorConfig
4163
+ }
4164
+ | {
4165
+ type: 'remove behavior'
4166
+ behaviorConfig: BehaviorConfig
4167
+ }
4163
4168
  | {
4164
4169
  type: 'blur'
4165
4170
  editor: PortableTextSlateEditor
@@ -4297,7 +4302,7 @@ declare const editorMachine: StateMachine<
4297
4302
  context,
4298
4303
  }: ActionArgs<
4299
4304
  {
4300
- behaviors: Set<Behavior>
4305
+ behaviors: Set<BehaviorConfig>
4301
4306
  converters: Set<Converter>
4302
4307
  getLegacySchema: () => PortableTextMemberSchemaTypes
4303
4308
  keyGenerator: () => string
@@ -4317,14 +4322,6 @@ declare const editorMachine: StateMachine<
4317
4322
  | InternalPatchEvent
4318
4323
  | MutationEvent
4319
4324
  | PatchesEvent
4320
- | {
4321
- type: 'add behavior'
4322
- behavior: Behavior
4323
- }
4324
- | {
4325
- type: 'remove behavior'
4326
- behavior: Behavior
4327
- }
4328
4325
  | {
4329
4326
  type: 'update readOnly'
4330
4327
  readOnly: boolean
@@ -4345,6 +4342,14 @@ declare const editorMachine: StateMachine<
4345
4342
  type: 'update maxBlocks'
4346
4343
  maxBlocks: number | undefined
4347
4344
  }
4345
+ | {
4346
+ type: 'add behavior'
4347
+ behaviorConfig: BehaviorConfig
4348
+ }
4349
+ | {
4350
+ type: 'remove behavior'
4351
+ behaviorConfig: BehaviorConfig
4352
+ }
4348
4353
  | {
4349
4354
  type: 'blur'
4350
4355
  editor: PortableTextSlateEditor
@@ -4443,14 +4448,6 @@ declare const editorMachine: StateMachine<
4443
4448
  | InternalPatchEvent
4444
4449
  | MutationEvent
4445
4450
  | PatchesEvent
4446
- | {
4447
- type: 'add behavior'
4448
- behavior: Behavior
4449
- }
4450
- | {
4451
- type: 'remove behavior'
4452
- behavior: Behavior
4453
- }
4454
4451
  | {
4455
4452
  type: 'update readOnly'
4456
4453
  readOnly: boolean
@@ -4471,6 +4468,14 @@ declare const editorMachine: StateMachine<
4471
4468
  type: 'update maxBlocks'
4472
4469
  maxBlocks: number | undefined
4473
4470
  }
4471
+ | {
4472
+ type: 'add behavior'
4473
+ behaviorConfig: BehaviorConfig
4474
+ }
4475
+ | {
4476
+ type: 'remove behavior'
4477
+ behaviorConfig: BehaviorConfig
4478
+ }
4474
4479
  | {
4475
4480
  type: 'blur'
4476
4481
  editor: PortableTextSlateEditor
@@ -4569,7 +4574,7 @@ declare const editorMachine: StateMachine<
4569
4574
  >) => void,
4570
4575
  ActionFunction<
4571
4576
  {
4572
- behaviors: Set<Behavior>
4577
+ behaviors: Set<BehaviorConfig>
4573
4578
  converters: Set<Converter>
4574
4579
  getLegacySchema: () => PortableTextMemberSchemaTypes
4575
4580
  keyGenerator: () => string
@@ -4589,14 +4594,6 @@ declare const editorMachine: StateMachine<
4589
4594
  | InternalPatchEvent
4590
4595
  | MutationEvent
4591
4596
  | PatchesEvent
4592
- | {
4593
- type: 'add behavior'
4594
- behavior: Behavior
4595
- }
4596
- | {
4597
- type: 'remove behavior'
4598
- behavior: Behavior
4599
- }
4600
4597
  | {
4601
4598
  type: 'update readOnly'
4602
4599
  readOnly: boolean
@@ -4617,6 +4614,14 @@ declare const editorMachine: StateMachine<
4617
4614
  type: 'update maxBlocks'
4618
4615
  maxBlocks: number | undefined
4619
4616
  }
4617
+ | {
4618
+ type: 'add behavior'
4619
+ behaviorConfig: BehaviorConfig
4620
+ }
4621
+ | {
4622
+ type: 'remove behavior'
4623
+ behaviorConfig: BehaviorConfig
4624
+ }
4620
4625
  | {
4621
4626
  type: 'blur'
4622
4627
  editor: PortableTextSlateEditor
@@ -4715,14 +4720,6 @@ declare const editorMachine: StateMachine<
4715
4720
  | InternalPatchEvent
4716
4721
  | MutationEvent
4717
4722
  | PatchesEvent
4718
- | {
4719
- type: 'add behavior'
4720
- behavior: Behavior
4721
- }
4722
- | {
4723
- type: 'remove behavior'
4724
- behavior: Behavior
4725
- }
4726
4723
  | {
4727
4724
  type: 'update readOnly'
4728
4725
  readOnly: boolean
@@ -4743,6 +4740,14 @@ declare const editorMachine: StateMachine<
4743
4740
  type: 'update maxBlocks'
4744
4741
  maxBlocks: number | undefined
4745
4742
  }
4743
+ | {
4744
+ type: 'add behavior'
4745
+ behaviorConfig: BehaviorConfig
4746
+ }
4747
+ | {
4748
+ type: 'remove behavior'
4749
+ behaviorConfig: BehaviorConfig
4750
+ }
4746
4751
  | {
4747
4752
  type: 'blur'
4748
4753
  editor: PortableTextSlateEditor
@@ -4896,7 +4901,7 @@ declare const editorMachine: StateMachine<
4896
4901
  readonly actions: readonly [
4897
4902
  ActionFunction<
4898
4903
  {
4899
- behaviors: Set<Behavior>
4904
+ behaviors: Set<BehaviorConfig>
4900
4905
  converters: Set<Converter>
4901
4906
  getLegacySchema: () => PortableTextMemberSchemaTypes
4902
4907
  keyGenerator: () => string
@@ -4921,14 +4926,6 @@ declare const editorMachine: StateMachine<
4921
4926
  | InternalPatchEvent
4922
4927
  | MutationEvent
4923
4928
  | PatchesEvent
4924
- | {
4925
- type: 'add behavior'
4926
- behavior: Behavior
4927
- }
4928
- | {
4929
- type: 'remove behavior'
4930
- behavior: Behavior
4931
- }
4932
4929
  | {
4933
4930
  type: 'update readOnly'
4934
4931
  readOnly: boolean
@@ -4949,6 +4946,14 @@ declare const editorMachine: StateMachine<
4949
4946
  type: 'update maxBlocks'
4950
4947
  maxBlocks: number | undefined
4951
4948
  }
4949
+ | {
4950
+ type: 'add behavior'
4951
+ behaviorConfig: BehaviorConfig
4952
+ }
4953
+ | {
4954
+ type: 'remove behavior'
4955
+ behaviorConfig: BehaviorConfig
4956
+ }
4952
4957
  | {
4953
4958
  type: 'blur'
4954
4959
  editor: PortableTextSlateEditor
@@ -5180,6 +5185,15 @@ declare const editorMachine: StateMachine<
5180
5185
  }
5181
5186
  >
5182
5187
 
5188
+ declare type EditorPriority = {
5189
+ id: string
5190
+ name?: string
5191
+ reference?: {
5192
+ priority: EditorPriority
5193
+ importance: 'higher' | 'lower'
5194
+ }
5195
+ }
5196
+
5183
5197
  /**
5184
5198
  * @beta
5185
5199
  */
@@ -5378,14 +5392,6 @@ declare type ExternalBehaviorEventType<
5378
5392
  * @public
5379
5393
  */
5380
5394
  declare type ExternalEditorEvent =
5381
- | {
5382
- type: 'add behavior'
5383
- behavior: Behavior
5384
- }
5385
- | {
5386
- type: 'remove behavior'
5387
- behavior: Behavior
5388
- }
5389
5395
  | {
5390
5396
  type: 'update readOnly'
5391
5397
  readOnly: boolean