@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
package/lib/index.d.ts CHANGED
@@ -326,6 +326,11 @@ declare type BehaviorActionSet<TBehaviorEvent, TGuardResponse> = (
326
326
  guardResponse: TGuardResponse,
327
327
  ) => Array<BehaviorAction>
328
328
 
329
+ declare type BehaviorConfig = {
330
+ behavior: Behavior
331
+ priority: EditorPriority
332
+ }
333
+
329
334
  /**
330
335
  * @beta
331
336
  */
@@ -871,7 +876,7 @@ export declare function EditorEventListener(props: {
871
876
  */
872
877
  declare const editorMachine: StateMachine<
873
878
  {
874
- behaviors: Set<Behavior>
879
+ behaviors: Set<BehaviorConfig>
875
880
  converters: Set<Converter>
876
881
  getLegacySchema: () => PortableTextMemberSchemaTypes
877
882
  keyGenerator: () => string
@@ -891,14 +896,6 @@ declare const editorMachine: StateMachine<
891
896
  | InternalPatchEvent
892
897
  | MutationEvent
893
898
  | PatchesEvent
894
- | {
895
- type: 'add behavior'
896
- behavior: Behavior
897
- }
898
- | {
899
- type: 'remove behavior'
900
- behavior: Behavior
901
- }
902
899
  | {
903
900
  type: 'update readOnly'
904
901
  readOnly: boolean
@@ -919,6 +916,14 @@ declare const editorMachine: StateMachine<
919
916
  type: 'update maxBlocks'
920
917
  maxBlocks: number | undefined
921
918
  }
919
+ | {
920
+ type: 'add behavior'
921
+ behaviorConfig: BehaviorConfig
922
+ }
923
+ | {
924
+ type: 'remove behavior'
925
+ behaviorConfig: BehaviorConfig
926
+ }
922
927
  | {
923
928
  type: 'blur'
924
929
  editor: PortableTextSlateEditor
@@ -1215,7 +1220,7 @@ declare const editorMachine: StateMachine<
1215
1220
  self: ActorRef<
1216
1221
  MachineSnapshot<
1217
1222
  {
1218
- behaviors: Set<Behavior>
1223
+ behaviors: Set<BehaviorConfig>
1219
1224
  converters: Set<Converter>
1220
1225
  getLegacySchema: () => PortableTextMemberSchemaTypes
1221
1226
  keyGenerator: () => string
@@ -1235,14 +1240,6 @@ declare const editorMachine: StateMachine<
1235
1240
  | InternalPatchEvent
1236
1241
  | MutationEvent
1237
1242
  | PatchesEvent
1238
- | {
1239
- type: 'add behavior'
1240
- behavior: Behavior
1241
- }
1242
- | {
1243
- type: 'remove behavior'
1244
- behavior: Behavior
1245
- }
1246
1243
  | {
1247
1244
  type: 'update readOnly'
1248
1245
  readOnly: boolean
@@ -1263,6 +1260,14 @@ declare const editorMachine: StateMachine<
1263
1260
  type: 'update maxBlocks'
1264
1261
  maxBlocks: number | undefined
1265
1262
  }
1263
+ | {
1264
+ type: 'add behavior'
1265
+ behaviorConfig: BehaviorConfig
1266
+ }
1267
+ | {
1268
+ type: 'remove behavior'
1269
+ behaviorConfig: BehaviorConfig
1270
+ }
1266
1271
  | {
1267
1272
  type: 'blur'
1268
1273
  editor: PortableTextSlateEditor
@@ -1368,14 +1373,6 @@ declare const editorMachine: StateMachine<
1368
1373
  | InternalPatchEvent
1369
1374
  | MutationEvent
1370
1375
  | PatchesEvent
1371
- | {
1372
- type: 'add behavior'
1373
- behavior: Behavior
1374
- }
1375
- | {
1376
- type: 'remove behavior'
1377
- behavior: Behavior
1378
- }
1379
1376
  | {
1380
1377
  type: 'update readOnly'
1381
1378
  readOnly: boolean
@@ -1396,6 +1393,14 @@ declare const editorMachine: StateMachine<
1396
1393
  type: 'update maxBlocks'
1397
1394
  maxBlocks: number | undefined
1398
1395
  }
1396
+ | {
1397
+ type: 'add behavior'
1398
+ behaviorConfig: BehaviorConfig
1399
+ }
1400
+ | {
1401
+ type: 'remove behavior'
1402
+ behaviorConfig: BehaviorConfig
1403
+ }
1399
1404
  | {
1400
1405
  type: 'blur'
1401
1406
  editor: PortableTextSlateEditor
@@ -1510,7 +1515,7 @@ declare const editorMachine: StateMachine<
1510
1515
  readonly 'notify.blurred': {
1511
1516
  readonly actions: ActionFunction<
1512
1517
  {
1513
- behaviors: Set<Behavior>
1518
+ behaviors: Set<BehaviorConfig>
1514
1519
  converters: Set<Converter>
1515
1520
  getLegacySchema: () => PortableTextMemberSchemaTypes
1516
1521
  keyGenerator: () => string
@@ -1534,14 +1539,6 @@ declare const editorMachine: StateMachine<
1534
1539
  | InternalPatchEvent
1535
1540
  | MutationEvent
1536
1541
  | PatchesEvent
1537
- | {
1538
- type: 'add behavior'
1539
- behavior: Behavior
1540
- }
1541
- | {
1542
- type: 'remove behavior'
1543
- behavior: Behavior
1544
- }
1545
1542
  | {
1546
1543
  type: 'update readOnly'
1547
1544
  readOnly: boolean
@@ -1562,6 +1559,14 @@ declare const editorMachine: StateMachine<
1562
1559
  type: 'update maxBlocks'
1563
1560
  maxBlocks: number | undefined
1564
1561
  }
1562
+ | {
1563
+ type: 'add behavior'
1564
+ behaviorConfig: BehaviorConfig
1565
+ }
1566
+ | {
1567
+ type: 'remove behavior'
1568
+ behaviorConfig: BehaviorConfig
1569
+ }
1565
1570
  | {
1566
1571
  type: 'blur'
1567
1572
  editor: PortableTextSlateEditor
@@ -1714,7 +1719,7 @@ declare const editorMachine: StateMachine<
1714
1719
  readonly 'notify.done loading': {
1715
1720
  readonly actions: ActionFunction<
1716
1721
  {
1717
- behaviors: Set<Behavior>
1722
+ behaviors: Set<BehaviorConfig>
1718
1723
  converters: Set<Converter>
1719
1724
  getLegacySchema: () => PortableTextMemberSchemaTypes
1720
1725
  keyGenerator: () => string
@@ -1737,14 +1742,6 @@ declare const editorMachine: StateMachine<
1737
1742
  | InternalPatchEvent
1738
1743
  | MutationEvent
1739
1744
  | PatchesEvent
1740
- | {
1741
- type: 'add behavior'
1742
- behavior: Behavior
1743
- }
1744
- | {
1745
- type: 'remove behavior'
1746
- behavior: Behavior
1747
- }
1748
1745
  | {
1749
1746
  type: 'update readOnly'
1750
1747
  readOnly: boolean
@@ -1765,6 +1762,14 @@ declare const editorMachine: StateMachine<
1765
1762
  type: 'update maxBlocks'
1766
1763
  maxBlocks: number | undefined
1767
1764
  }
1765
+ | {
1766
+ type: 'add behavior'
1767
+ behaviorConfig: BehaviorConfig
1768
+ }
1769
+ | {
1770
+ type: 'remove behavior'
1771
+ behaviorConfig: BehaviorConfig
1772
+ }
1768
1773
  | {
1769
1774
  type: 'blur'
1770
1775
  editor: PortableTextSlateEditor
@@ -1917,7 +1922,7 @@ declare const editorMachine: StateMachine<
1917
1922
  readonly 'notify.error': {
1918
1923
  readonly actions: ActionFunction<
1919
1924
  {
1920
- behaviors: Set<Behavior>
1925
+ behaviors: Set<BehaviorConfig>
1921
1926
  converters: Set<Converter>
1922
1927
  getLegacySchema: () => PortableTextMemberSchemaTypes
1923
1928
  keyGenerator: () => string
@@ -1943,14 +1948,6 @@ declare const editorMachine: StateMachine<
1943
1948
  | InternalPatchEvent
1944
1949
  | MutationEvent
1945
1950
  | PatchesEvent
1946
- | {
1947
- type: 'add behavior'
1948
- behavior: Behavior
1949
- }
1950
- | {
1951
- type: 'remove behavior'
1952
- behavior: Behavior
1953
- }
1954
1951
  | {
1955
1952
  type: 'update readOnly'
1956
1953
  readOnly: boolean
@@ -1971,6 +1968,14 @@ declare const editorMachine: StateMachine<
1971
1968
  type: 'update maxBlocks'
1972
1969
  maxBlocks: number | undefined
1973
1970
  }
1971
+ | {
1972
+ type: 'add behavior'
1973
+ behaviorConfig: BehaviorConfig
1974
+ }
1975
+ | {
1976
+ type: 'remove behavior'
1977
+ behaviorConfig: BehaviorConfig
1978
+ }
1974
1979
  | {
1975
1980
  type: 'blur'
1976
1981
  editor: PortableTextSlateEditor
@@ -2123,7 +2128,7 @@ declare const editorMachine: StateMachine<
2123
2128
  readonly 'notify.invalid value': {
2124
2129
  readonly actions: ActionFunction<
2125
2130
  {
2126
- behaviors: Set<Behavior>
2131
+ behaviors: Set<BehaviorConfig>
2127
2132
  converters: Set<Converter>
2128
2133
  getLegacySchema: () => PortableTextMemberSchemaTypes
2129
2134
  keyGenerator: () => string
@@ -2148,14 +2153,6 @@ declare const editorMachine: StateMachine<
2148
2153
  | InternalPatchEvent
2149
2154
  | MutationEvent
2150
2155
  | PatchesEvent
2151
- | {
2152
- type: 'add behavior'
2153
- behavior: Behavior
2154
- }
2155
- | {
2156
- type: 'remove behavior'
2157
- behavior: Behavior
2158
- }
2159
2156
  | {
2160
2157
  type: 'update readOnly'
2161
2158
  readOnly: boolean
@@ -2176,6 +2173,14 @@ declare const editorMachine: StateMachine<
2176
2173
  type: 'update maxBlocks'
2177
2174
  maxBlocks: number | undefined
2178
2175
  }
2176
+ | {
2177
+ type: 'add behavior'
2178
+ behaviorConfig: BehaviorConfig
2179
+ }
2180
+ | {
2181
+ type: 'remove behavior'
2182
+ behaviorConfig: BehaviorConfig
2183
+ }
2179
2184
  | {
2180
2185
  type: 'blur'
2181
2186
  editor: PortableTextSlateEditor
@@ -2328,7 +2333,7 @@ declare const editorMachine: StateMachine<
2328
2333
  readonly 'notify.focused': {
2329
2334
  readonly actions: ActionFunction<
2330
2335
  {
2331
- behaviors: Set<Behavior>
2336
+ behaviors: Set<BehaviorConfig>
2332
2337
  converters: Set<Converter>
2333
2338
  getLegacySchema: () => PortableTextMemberSchemaTypes
2334
2339
  keyGenerator: () => string
@@ -2352,14 +2357,6 @@ declare const editorMachine: StateMachine<
2352
2357
  | InternalPatchEvent
2353
2358
  | MutationEvent
2354
2359
  | PatchesEvent
2355
- | {
2356
- type: 'add behavior'
2357
- behavior: Behavior
2358
- }
2359
- | {
2360
- type: 'remove behavior'
2361
- behavior: Behavior
2362
- }
2363
2360
  | {
2364
2361
  type: 'update readOnly'
2365
2362
  readOnly: boolean
@@ -2380,6 +2377,14 @@ declare const editorMachine: StateMachine<
2380
2377
  type: 'update maxBlocks'
2381
2378
  maxBlocks: number | undefined
2382
2379
  }
2380
+ | {
2381
+ type: 'add behavior'
2382
+ behaviorConfig: BehaviorConfig
2383
+ }
2384
+ | {
2385
+ type: 'remove behavior'
2386
+ behaviorConfig: BehaviorConfig
2387
+ }
2383
2388
  | {
2384
2389
  type: 'blur'
2385
2390
  editor: PortableTextSlateEditor
@@ -2533,7 +2538,7 @@ declare const editorMachine: StateMachine<
2533
2538
  readonly actions: readonly [
2534
2539
  ActionFunction<
2535
2540
  {
2536
- behaviors: Set<Behavior>
2541
+ behaviors: Set<BehaviorConfig>
2537
2542
  converters: Set<Converter>
2538
2543
  getLegacySchema: () => PortableTextMemberSchemaTypes
2539
2544
  keyGenerator: () => string
@@ -2557,14 +2562,6 @@ declare const editorMachine: StateMachine<
2557
2562
  | InternalPatchEvent
2558
2563
  | MutationEvent
2559
2564
  | PatchesEvent
2560
- | {
2561
- type: 'add behavior'
2562
- behavior: Behavior
2563
- }
2564
- | {
2565
- type: 'remove behavior'
2566
- behavior: Behavior
2567
- }
2568
2565
  | {
2569
2566
  type: 'update readOnly'
2570
2567
  readOnly: boolean
@@ -2585,6 +2582,14 @@ declare const editorMachine: StateMachine<
2585
2582
  type: 'update maxBlocks'
2586
2583
  maxBlocks: number | undefined
2587
2584
  }
2585
+ | {
2586
+ type: 'add behavior'
2587
+ behaviorConfig: BehaviorConfig
2588
+ }
2589
+ | {
2590
+ type: 'remove behavior'
2591
+ behaviorConfig: BehaviorConfig
2592
+ }
2588
2593
  | {
2589
2594
  type: 'blur'
2590
2595
  editor: PortableTextSlateEditor
@@ -2689,7 +2694,7 @@ declare const editorMachine: StateMachine<
2689
2694
  >,
2690
2695
  ActionFunction<
2691
2696
  {
2692
- behaviors: Set<Behavior>
2697
+ behaviors: Set<BehaviorConfig>
2693
2698
  converters: Set<Converter>
2694
2699
  getLegacySchema: () => PortableTextMemberSchemaTypes
2695
2700
  keyGenerator: () => string
@@ -2713,14 +2718,6 @@ declare const editorMachine: StateMachine<
2713
2718
  | InternalPatchEvent
2714
2719
  | MutationEvent
2715
2720
  | PatchesEvent
2716
- | {
2717
- type: 'add behavior'
2718
- behavior: Behavior
2719
- }
2720
- | {
2721
- type: 'remove behavior'
2722
- behavior: Behavior
2723
- }
2724
2721
  | {
2725
2722
  type: 'update readOnly'
2726
2723
  readOnly: boolean
@@ -2741,6 +2738,14 @@ declare const editorMachine: StateMachine<
2741
2738
  type: 'update maxBlocks'
2742
2739
  maxBlocks: number | undefined
2743
2740
  }
2741
+ | {
2742
+ type: 'add behavior'
2743
+ behaviorConfig: BehaviorConfig
2744
+ }
2745
+ | {
2746
+ type: 'remove behavior'
2747
+ behaviorConfig: BehaviorConfig
2748
+ }
2744
2749
  | {
2745
2750
  type: 'blur'
2746
2751
  editor: PortableTextSlateEditor
@@ -2894,7 +2899,7 @@ declare const editorMachine: StateMachine<
2894
2899
  readonly 'notify.unset': {
2895
2900
  readonly actions: ActionFunction<
2896
2901
  {
2897
- behaviors: Set<Behavior>
2902
+ behaviors: Set<BehaviorConfig>
2898
2903
  converters: Set<Converter>
2899
2904
  getLegacySchema: () => PortableTextMemberSchemaTypes
2900
2905
  keyGenerator: () => string
@@ -2918,14 +2923,6 @@ declare const editorMachine: StateMachine<
2918
2923
  | InternalPatchEvent
2919
2924
  | MutationEvent
2920
2925
  | PatchesEvent
2921
- | {
2922
- type: 'add behavior'
2923
- behavior: Behavior
2924
- }
2925
- | {
2926
- type: 'remove behavior'
2927
- behavior: Behavior
2928
- }
2929
2926
  | {
2930
2927
  type: 'update readOnly'
2931
2928
  readOnly: boolean
@@ -2946,6 +2943,14 @@ declare const editorMachine: StateMachine<
2946
2943
  type: 'update maxBlocks'
2947
2944
  maxBlocks: number | undefined
2948
2945
  }
2946
+ | {
2947
+ type: 'add behavior'
2948
+ behaviorConfig: BehaviorConfig
2949
+ }
2950
+ | {
2951
+ type: 'remove behavior'
2952
+ behaviorConfig: BehaviorConfig
2953
+ }
2949
2954
  | {
2950
2955
  type: 'blur'
2951
2956
  editor: PortableTextSlateEditor
@@ -3098,7 +3103,7 @@ declare const editorMachine: StateMachine<
3098
3103
  readonly 'notify.loading': {
3099
3104
  readonly actions: ActionFunction<
3100
3105
  {
3101
- behaviors: Set<Behavior>
3106
+ behaviors: Set<BehaviorConfig>
3102
3107
  converters: Set<Converter>
3103
3108
  getLegacySchema: () => PortableTextMemberSchemaTypes
3104
3109
  keyGenerator: () => string
@@ -3121,14 +3126,6 @@ declare const editorMachine: StateMachine<
3121
3126
  | InternalPatchEvent
3122
3127
  | MutationEvent
3123
3128
  | PatchesEvent
3124
- | {
3125
- type: 'add behavior'
3126
- behavior: Behavior
3127
- }
3128
- | {
3129
- type: 'remove behavior'
3130
- behavior: Behavior
3131
- }
3132
3129
  | {
3133
3130
  type: 'update readOnly'
3134
3131
  readOnly: boolean
@@ -3149,6 +3146,14 @@ declare const editorMachine: StateMachine<
3149
3146
  type: 'update maxBlocks'
3150
3147
  maxBlocks: number | undefined
3151
3148
  }
3149
+ | {
3150
+ type: 'add behavior'
3151
+ behaviorConfig: BehaviorConfig
3152
+ }
3153
+ | {
3154
+ type: 'remove behavior'
3155
+ behaviorConfig: BehaviorConfig
3156
+ }
3152
3157
  | {
3153
3158
  type: 'blur'
3154
3159
  editor: PortableTextSlateEditor
@@ -3301,7 +3306,7 @@ declare const editorMachine: StateMachine<
3301
3306
  readonly 'notify.value changed': {
3302
3307
  readonly actions: ActionFunction<
3303
3308
  {
3304
- behaviors: Set<Behavior>
3309
+ behaviors: Set<BehaviorConfig>
3305
3310
  converters: Set<Converter>
3306
3311
  getLegacySchema: () => PortableTextMemberSchemaTypes
3307
3312
  keyGenerator: () => string
@@ -3325,14 +3330,6 @@ declare const editorMachine: StateMachine<
3325
3330
  | InternalPatchEvent
3326
3331
  | MutationEvent
3327
3332
  | PatchesEvent
3328
- | {
3329
- type: 'add behavior'
3330
- behavior: Behavior
3331
- }
3332
- | {
3333
- type: 'remove behavior'
3334
- behavior: Behavior
3335
- }
3336
3333
  | {
3337
3334
  type: 'update readOnly'
3338
3335
  readOnly: boolean
@@ -3353,6 +3350,14 @@ declare const editorMachine: StateMachine<
3353
3350
  type: 'update maxBlocks'
3354
3351
  maxBlocks: number | undefined
3355
3352
  }
3353
+ | {
3354
+ type: 'add behavior'
3355
+ behaviorConfig: BehaviorConfig
3356
+ }
3357
+ | {
3358
+ type: 'remove behavior'
3359
+ behaviorConfig: BehaviorConfig
3360
+ }
3356
3361
  | {
3357
3362
  type: 'blur'
3358
3363
  editor: PortableTextSlateEditor
@@ -3511,7 +3516,7 @@ declare const editorMachine: StateMachine<
3511
3516
  readonly 'update key generator': {
3512
3517
  readonly actions: ActionFunction<
3513
3518
  {
3514
- behaviors: Set<Behavior>
3519
+ behaviors: Set<BehaviorConfig>
3515
3520
  converters: Set<Converter>
3516
3521
  getLegacySchema: () => PortableTextMemberSchemaTypes
3517
3522
  keyGenerator: () => string
@@ -3535,14 +3540,6 @@ declare const editorMachine: StateMachine<
3535
3540
  | InternalPatchEvent
3536
3541
  | MutationEvent
3537
3542
  | PatchesEvent
3538
- | {
3539
- type: 'add behavior'
3540
- behavior: Behavior
3541
- }
3542
- | {
3543
- type: 'remove behavior'
3544
- behavior: Behavior
3545
- }
3546
3543
  | {
3547
3544
  type: 'update readOnly'
3548
3545
  readOnly: boolean
@@ -3563,6 +3560,14 @@ declare const editorMachine: StateMachine<
3563
3560
  type: 'update maxBlocks'
3564
3561
  maxBlocks: number | undefined
3565
3562
  }
3563
+ | {
3564
+ type: 'add behavior'
3565
+ behaviorConfig: BehaviorConfig
3566
+ }
3567
+ | {
3568
+ type: 'remove behavior'
3569
+ behaviorConfig: BehaviorConfig
3570
+ }
3566
3571
  | {
3567
3572
  type: 'blur'
3568
3573
  editor: PortableTextSlateEditor
@@ -3672,7 +3677,7 @@ declare const editorMachine: StateMachine<
3672
3677
  readonly 'update value': {
3673
3678
  readonly actions: ActionFunction<
3674
3679
  {
3675
- behaviors: Set<Behavior>
3680
+ behaviors: Set<BehaviorConfig>
3676
3681
  converters: Set<Converter>
3677
3682
  getLegacySchema: () => PortableTextMemberSchemaTypes
3678
3683
  keyGenerator: () => string
@@ -3696,14 +3701,6 @@ declare const editorMachine: StateMachine<
3696
3701
  | InternalPatchEvent
3697
3702
  | MutationEvent
3698
3703
  | PatchesEvent
3699
- | {
3700
- type: 'add behavior'
3701
- behavior: Behavior
3702
- }
3703
- | {
3704
- type: 'remove behavior'
3705
- behavior: Behavior
3706
- }
3707
3704
  | {
3708
3705
  type: 'update readOnly'
3709
3706
  readOnly: boolean
@@ -3724,6 +3721,14 @@ declare const editorMachine: StateMachine<
3724
3721
  type: 'update maxBlocks'
3725
3722
  maxBlocks: number | undefined
3726
3723
  }
3724
+ | {
3725
+ type: 'add behavior'
3726
+ behaviorConfig: BehaviorConfig
3727
+ }
3728
+ | {
3729
+ type: 'remove behavior'
3730
+ behaviorConfig: BehaviorConfig
3731
+ }
3727
3732
  | {
3728
3733
  type: 'blur'
3729
3734
  editor: PortableTextSlateEditor
@@ -3830,7 +3835,7 @@ declare const editorMachine: StateMachine<
3830
3835
  readonly 'update maxBlocks': {
3831
3836
  readonly actions: ActionFunction<
3832
3837
  {
3833
- behaviors: Set<Behavior>
3838
+ behaviors: Set<BehaviorConfig>
3834
3839
  converters: Set<Converter>
3835
3840
  getLegacySchema: () => PortableTextMemberSchemaTypes
3836
3841
  keyGenerator: () => string
@@ -3854,14 +3859,6 @@ declare const editorMachine: StateMachine<
3854
3859
  | InternalPatchEvent
3855
3860
  | MutationEvent
3856
3861
  | PatchesEvent
3857
- | {
3858
- type: 'add behavior'
3859
- behavior: Behavior
3860
- }
3861
- | {
3862
- type: 'remove behavior'
3863
- behavior: Behavior
3864
- }
3865
3862
  | {
3866
3863
  type: 'update readOnly'
3867
3864
  readOnly: boolean
@@ -3882,6 +3879,14 @@ declare const editorMachine: StateMachine<
3882
3879
  type: 'update maxBlocks'
3883
3880
  maxBlocks: number | undefined
3884
3881
  }
3882
+ | {
3883
+ type: 'add behavior'
3884
+ behaviorConfig: BehaviorConfig
3885
+ }
3886
+ | {
3887
+ type: 'remove behavior'
3888
+ behaviorConfig: BehaviorConfig
3889
+ }
3885
3890
  | {
3886
3891
  type: 'blur'
3887
3892
  editor: PortableTextSlateEditor
@@ -4000,7 +4005,7 @@ declare const editorMachine: StateMachine<
4000
4005
  event,
4001
4006
  }: GuardArgs<
4002
4007
  {
4003
- behaviors: Set<Behavior>
4008
+ behaviors: Set<BehaviorConfig>
4004
4009
  converters: Set<Converter>
4005
4010
  getLegacySchema: () => PortableTextMemberSchemaTypes
4006
4011
  keyGenerator: () => string
@@ -4038,7 +4043,7 @@ declare const editorMachine: StateMachine<
4038
4043
  context,
4039
4044
  }: GuardArgs<
4040
4045
  {
4041
- behaviors: Set<Behavior>
4046
+ behaviors: Set<BehaviorConfig>
4042
4047
  converters: Set<Converter>
4043
4048
  getLegacySchema: () => PortableTextMemberSchemaTypes
4044
4049
  keyGenerator: () => string
@@ -4075,7 +4080,7 @@ declare const editorMachine: StateMachine<
4075
4080
  event,
4076
4081
  }: GuardArgs<
4077
4082
  {
4078
- behaviors: Set<Behavior>
4083
+ behaviors: Set<BehaviorConfig>
4079
4084
  converters: Set<Converter>
4080
4085
  getLegacySchema: () => PortableTextMemberSchemaTypes
4081
4086
  keyGenerator: () => string
@@ -4111,7 +4116,7 @@ declare const editorMachine: StateMachine<
4111
4116
  event,
4112
4117
  }: GuardArgs<
4113
4118
  {
4114
- behaviors: Set<Behavior>
4119
+ behaviors: Set<BehaviorConfig>
4115
4120
  converters: Set<Converter>
4116
4121
  getLegacySchema: () => PortableTextMemberSchemaTypes
4117
4122
  keyGenerator: () => string
@@ -4147,7 +4152,7 @@ declare const editorMachine: StateMachine<
4147
4152
  readonly actions: readonly [
4148
4153
  ActionFunction<
4149
4154
  {
4150
- behaviors: Set<Behavior>
4155
+ behaviors: Set<BehaviorConfig>
4151
4156
  converters: Set<Converter>
4152
4157
  getLegacySchema: () => PortableTextMemberSchemaTypes
4153
4158
  keyGenerator: () => string
@@ -4171,14 +4176,6 @@ declare const editorMachine: StateMachine<
4171
4176
  | InternalPatchEvent
4172
4177
  | MutationEvent
4173
4178
  | PatchesEvent
4174
- | {
4175
- type: 'add behavior'
4176
- behavior: Behavior
4177
- }
4178
- | {
4179
- type: 'remove behavior'
4180
- behavior: Behavior
4181
- }
4182
4179
  | {
4183
4180
  type: 'update readOnly'
4184
4181
  readOnly: boolean
@@ -4199,6 +4196,14 @@ declare const editorMachine: StateMachine<
4199
4196
  type: 'update maxBlocks'
4200
4197
  maxBlocks: number | undefined
4201
4198
  }
4199
+ | {
4200
+ type: 'add behavior'
4201
+ behaviorConfig: BehaviorConfig
4202
+ }
4203
+ | {
4204
+ type: 'remove behavior'
4205
+ behaviorConfig: BehaviorConfig
4206
+ }
4202
4207
  | {
4203
4208
  type: 'blur'
4204
4209
  editor: PortableTextSlateEditor
@@ -4312,7 +4317,7 @@ declare const editorMachine: StateMachine<
4312
4317
  readonly actions: readonly [
4313
4318
  ActionFunction<
4314
4319
  {
4315
- behaviors: Set<Behavior>
4320
+ behaviors: Set<BehaviorConfig>
4316
4321
  converters: Set<Converter>
4317
4322
  getLegacySchema: () => PortableTextMemberSchemaTypes
4318
4323
  keyGenerator: () => string
@@ -4339,14 +4344,6 @@ declare const editorMachine: StateMachine<
4339
4344
  | InternalPatchEvent
4340
4345
  | MutationEvent
4341
4346
  | PatchesEvent
4342
- | {
4343
- type: 'add behavior'
4344
- behavior: Behavior
4345
- }
4346
- | {
4347
- type: 'remove behavior'
4348
- behavior: Behavior
4349
- }
4350
4347
  | {
4351
4348
  type: 'update readOnly'
4352
4349
  readOnly: boolean
@@ -4367,6 +4364,14 @@ declare const editorMachine: StateMachine<
4367
4364
  type: 'update maxBlocks'
4368
4365
  maxBlocks: number | undefined
4369
4366
  }
4367
+ | {
4368
+ type: 'add behavior'
4369
+ behaviorConfig: BehaviorConfig
4370
+ }
4371
+ | {
4372
+ type: 'remove behavior'
4373
+ behaviorConfig: BehaviorConfig
4374
+ }
4370
4375
  | {
4371
4376
  type: 'blur'
4372
4377
  editor: PortableTextSlateEditor
@@ -4504,7 +4509,7 @@ declare const editorMachine: StateMachine<
4504
4509
  context,
4505
4510
  }: ActionArgs<
4506
4511
  {
4507
- behaviors: Set<Behavior>
4512
+ behaviors: Set<BehaviorConfig>
4508
4513
  converters: Set<Converter>
4509
4514
  getLegacySchema: () => PortableTextMemberSchemaTypes
4510
4515
  keyGenerator: () => string
@@ -4524,14 +4529,6 @@ declare const editorMachine: StateMachine<
4524
4529
  | InternalPatchEvent
4525
4530
  | MutationEvent
4526
4531
  | PatchesEvent
4527
- | {
4528
- type: 'add behavior'
4529
- behavior: Behavior
4530
- }
4531
- | {
4532
- type: 'remove behavior'
4533
- behavior: Behavior
4534
- }
4535
4532
  | {
4536
4533
  type: 'update readOnly'
4537
4534
  readOnly: boolean
@@ -4552,6 +4549,14 @@ declare const editorMachine: StateMachine<
4552
4549
  type: 'update maxBlocks'
4553
4550
  maxBlocks: number | undefined
4554
4551
  }
4552
+ | {
4553
+ type: 'add behavior'
4554
+ behaviorConfig: BehaviorConfig
4555
+ }
4556
+ | {
4557
+ type: 'remove behavior'
4558
+ behaviorConfig: BehaviorConfig
4559
+ }
4555
4560
  | {
4556
4561
  type: 'blur'
4557
4562
  editor: PortableTextSlateEditor
@@ -4650,14 +4655,6 @@ declare const editorMachine: StateMachine<
4650
4655
  | InternalPatchEvent
4651
4656
  | MutationEvent
4652
4657
  | PatchesEvent
4653
- | {
4654
- type: 'add behavior'
4655
- behavior: Behavior
4656
- }
4657
- | {
4658
- type: 'remove behavior'
4659
- behavior: Behavior
4660
- }
4661
4658
  | {
4662
4659
  type: 'update readOnly'
4663
4660
  readOnly: boolean
@@ -4678,6 +4675,14 @@ declare const editorMachine: StateMachine<
4678
4675
  type: 'update maxBlocks'
4679
4676
  maxBlocks: number | undefined
4680
4677
  }
4678
+ | {
4679
+ type: 'add behavior'
4680
+ behaviorConfig: BehaviorConfig
4681
+ }
4682
+ | {
4683
+ type: 'remove behavior'
4684
+ behaviorConfig: BehaviorConfig
4685
+ }
4681
4686
  | {
4682
4687
  type: 'blur'
4683
4688
  editor: PortableTextSlateEditor
@@ -4776,7 +4781,7 @@ declare const editorMachine: StateMachine<
4776
4781
  >) => void,
4777
4782
  ActionFunction<
4778
4783
  {
4779
- behaviors: Set<Behavior>
4784
+ behaviors: Set<BehaviorConfig>
4780
4785
  converters: Set<Converter>
4781
4786
  getLegacySchema: () => PortableTextMemberSchemaTypes
4782
4787
  keyGenerator: () => string
@@ -4796,14 +4801,6 @@ declare const editorMachine: StateMachine<
4796
4801
  | InternalPatchEvent
4797
4802
  | MutationEvent
4798
4803
  | PatchesEvent
4799
- | {
4800
- type: 'add behavior'
4801
- behavior: Behavior
4802
- }
4803
- | {
4804
- type: 'remove behavior'
4805
- behavior: Behavior
4806
- }
4807
4804
  | {
4808
4805
  type: 'update readOnly'
4809
4806
  readOnly: boolean
@@ -4824,6 +4821,14 @@ declare const editorMachine: StateMachine<
4824
4821
  type: 'update maxBlocks'
4825
4822
  maxBlocks: number | undefined
4826
4823
  }
4824
+ | {
4825
+ type: 'add behavior'
4826
+ behaviorConfig: BehaviorConfig
4827
+ }
4828
+ | {
4829
+ type: 'remove behavior'
4830
+ behaviorConfig: BehaviorConfig
4831
+ }
4827
4832
  | {
4828
4833
  type: 'blur'
4829
4834
  editor: PortableTextSlateEditor
@@ -4922,14 +4927,6 @@ declare const editorMachine: StateMachine<
4922
4927
  | InternalPatchEvent
4923
4928
  | MutationEvent
4924
4929
  | PatchesEvent
4925
- | {
4926
- type: 'add behavior'
4927
- behavior: Behavior
4928
- }
4929
- | {
4930
- type: 'remove behavior'
4931
- behavior: Behavior
4932
- }
4933
4930
  | {
4934
4931
  type: 'update readOnly'
4935
4932
  readOnly: boolean
@@ -4950,6 +4947,14 @@ declare const editorMachine: StateMachine<
4950
4947
  type: 'update maxBlocks'
4951
4948
  maxBlocks: number | undefined
4952
4949
  }
4950
+ | {
4951
+ type: 'add behavior'
4952
+ behaviorConfig: BehaviorConfig
4953
+ }
4954
+ | {
4955
+ type: 'remove behavior'
4956
+ behaviorConfig: BehaviorConfig
4957
+ }
4953
4958
  | {
4954
4959
  type: 'blur'
4955
4960
  editor: PortableTextSlateEditor
@@ -5103,7 +5108,7 @@ declare const editorMachine: StateMachine<
5103
5108
  readonly actions: readonly [
5104
5109
  ActionFunction<
5105
5110
  {
5106
- behaviors: Set<Behavior>
5111
+ behaviors: Set<BehaviorConfig>
5107
5112
  converters: Set<Converter>
5108
5113
  getLegacySchema: () => PortableTextMemberSchemaTypes
5109
5114
  keyGenerator: () => string
@@ -5128,14 +5133,6 @@ declare const editorMachine: StateMachine<
5128
5133
  | InternalPatchEvent
5129
5134
  | MutationEvent
5130
5135
  | PatchesEvent
5131
- | {
5132
- type: 'add behavior'
5133
- behavior: Behavior
5134
- }
5135
- | {
5136
- type: 'remove behavior'
5137
- behavior: Behavior
5138
- }
5139
5136
  | {
5140
5137
  type: 'update readOnly'
5141
5138
  readOnly: boolean
@@ -5156,6 +5153,14 @@ declare const editorMachine: StateMachine<
5156
5153
  type: 'update maxBlocks'
5157
5154
  maxBlocks: number | undefined
5158
5155
  }
5156
+ | {
5157
+ type: 'add behavior'
5158
+ behaviorConfig: BehaviorConfig
5159
+ }
5160
+ | {
5161
+ type: 'remove behavior'
5162
+ behaviorConfig: BehaviorConfig
5163
+ }
5159
5164
  | {
5160
5165
  type: 'blur'
5161
5166
  editor: PortableTextSlateEditor
@@ -5387,6 +5392,15 @@ declare const editorMachine: StateMachine<
5387
5392
  }
5388
5393
  >
5389
5394
 
5395
+ declare type EditorPriority = {
5396
+ id: string
5397
+ name?: string
5398
+ reference?: {
5399
+ priority: EditorPriority
5400
+ importance: 'higher' | 'lower'
5401
+ }
5402
+ }
5403
+
5390
5404
  /**
5391
5405
  * @public
5392
5406
  * The EditorProvider component is used to set up the editor context and configure the Portable Text Editor.
@@ -5573,14 +5587,6 @@ declare type ExternalBehaviorEventType<
5573
5587
  * @public
5574
5588
  */
5575
5589
  declare type ExternalEditorEvent =
5576
- | {
5577
- type: 'add behavior'
5578
- behavior: Behavior
5579
- }
5580
- | {
5581
- type: 'remove behavior'
5582
- behavior: Behavior
5583
- }
5584
5590
  | {
5585
5591
  type: 'update readOnly'
5586
5592
  readOnly: boolean