@portabletext/editor 1.9.0 → 1.10.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.
- package/README.md +21 -6
- package/lib/index.d.mts +302 -28
- package/lib/index.d.ts +302 -28
- package/lib/index.esm.js +84 -50
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +84 -50
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +84 -50
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/editor/PortableTextEditor.tsx +25 -15
- package/src/editor/behavior/behavior.links.ts +3 -3
- package/src/editor/behavior/behavior.markdown.ts +53 -41
- package/src/editor/components/Synchronizer.tsx +2 -2
- package/src/editor/editor-machine.ts +16 -4
- package/src/editor/use-editor.ts +3 -0
package/lib/index.d.mts
CHANGED
|
@@ -752,6 +752,7 @@ export declare type EditorChanges = Subject<EditorChange>
|
|
|
752
752
|
export declare type EditorConfig = {
|
|
753
753
|
behaviors?: Array<Behavior>
|
|
754
754
|
keyGenerator?: () => string
|
|
755
|
+
initialValue?: Array<PortableTextBlock>
|
|
755
756
|
} & (
|
|
756
757
|
| {
|
|
757
758
|
schemaDefinition: SchemaDefinition
|
|
@@ -774,6 +775,7 @@ export declare type EditorEvent = PickFromUnion<
|
|
|
774
775
|
| 'patches'
|
|
775
776
|
| 'toggle readOnly'
|
|
776
777
|
| 'update behaviors'
|
|
778
|
+
| 'update value'
|
|
777
779
|
>
|
|
778
780
|
|
|
779
781
|
/**
|
|
@@ -787,6 +789,7 @@ export declare const editorMachine: StateMachine<
|
|
|
787
789
|
schema: PortableTextMemberSchemaTypes
|
|
788
790
|
readOnly: boolean
|
|
789
791
|
maxBlocks: number | undefined
|
|
792
|
+
value: Array<PortableTextBlock> | undefined
|
|
790
793
|
},
|
|
791
794
|
| {
|
|
792
795
|
type: 'annotation.add'
|
|
@@ -841,6 +844,10 @@ export declare const editorMachine: StateMachine<
|
|
|
841
844
|
type: 'update behaviors'
|
|
842
845
|
behaviors: Array<Behavior>
|
|
843
846
|
}
|
|
847
|
+
| {
|
|
848
|
+
type: 'update value'
|
|
849
|
+
value: Array<PortableTextBlock> | undefined
|
|
850
|
+
}
|
|
844
851
|
| {
|
|
845
852
|
type: 'toggle readOnly'
|
|
846
853
|
}
|
|
@@ -952,6 +959,7 @@ export declare const editorMachine: StateMachine<
|
|
|
952
959
|
behaviors?: Array<Behavior>
|
|
953
960
|
keyGenerator: () => string
|
|
954
961
|
schema: PortableTextMemberSchemaTypes
|
|
962
|
+
value?: Array<PortableTextBlock>
|
|
955
963
|
},
|
|
956
964
|
NonReducibleUnknown,
|
|
957
965
|
| {
|
|
@@ -1107,6 +1115,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1107
1115
|
behaviors?: Array<Behavior>
|
|
1108
1116
|
keyGenerator: () => string
|
|
1109
1117
|
schema: PortableTextMemberSchemaTypes
|
|
1118
|
+
value?: Array<PortableTextBlock>
|
|
1110
1119
|
}
|
|
1111
1120
|
self: ActorRef<
|
|
1112
1121
|
MachineSnapshot<
|
|
@@ -1117,6 +1126,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1117
1126
|
schema: PortableTextMemberSchemaTypes
|
|
1118
1127
|
readOnly: boolean
|
|
1119
1128
|
maxBlocks: number | undefined
|
|
1129
|
+
value: Array<PortableTextBlock> | undefined
|
|
1120
1130
|
},
|
|
1121
1131
|
| {
|
|
1122
1132
|
type: 'annotation.add'
|
|
@@ -1171,6 +1181,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1171
1181
|
type: 'update behaviors'
|
|
1172
1182
|
behaviors: Array<Behavior>
|
|
1173
1183
|
}
|
|
1184
|
+
| {
|
|
1185
|
+
type: 'update value'
|
|
1186
|
+
value: Array<PortableTextBlock> | undefined
|
|
1187
|
+
}
|
|
1174
1188
|
| {
|
|
1175
1189
|
type: 'toggle readOnly'
|
|
1176
1190
|
}
|
|
@@ -1285,6 +1299,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1285
1299
|
type: 'update behaviors'
|
|
1286
1300
|
behaviors: Array<Behavior>
|
|
1287
1301
|
}
|
|
1302
|
+
| {
|
|
1303
|
+
type: 'update value'
|
|
1304
|
+
value: Array<PortableTextBlock> | undefined
|
|
1305
|
+
}
|
|
1288
1306
|
| {
|
|
1289
1307
|
type: 'toggle readOnly'
|
|
1290
1308
|
}
|
|
@@ -1348,6 +1366,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1348
1366
|
schema: PortableTextMemberSchemaTypes
|
|
1349
1367
|
readOnly: false
|
|
1350
1368
|
maxBlocks: undefined
|
|
1369
|
+
value: PortableTextBlock[] | undefined
|
|
1351
1370
|
}
|
|
1352
1371
|
readonly invoke: {
|
|
1353
1372
|
readonly id: 'networkLogic'
|
|
@@ -1363,6 +1382,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1363
1382
|
schema: PortableTextMemberSchemaTypes
|
|
1364
1383
|
readOnly: boolean
|
|
1365
1384
|
maxBlocks: number | undefined
|
|
1385
|
+
value: Array<PortableTextBlock> | undefined
|
|
1366
1386
|
},
|
|
1367
1387
|
{
|
|
1368
1388
|
type: 'annotation.add'
|
|
@@ -1426,6 +1446,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1426
1446
|
type: 'update behaviors'
|
|
1427
1447
|
behaviors: Array<Behavior>
|
|
1428
1448
|
}
|
|
1449
|
+
| {
|
|
1450
|
+
type: 'update value'
|
|
1451
|
+
value: Array<PortableTextBlock> | undefined
|
|
1452
|
+
}
|
|
1429
1453
|
| {
|
|
1430
1454
|
type: 'toggle readOnly'
|
|
1431
1455
|
}
|
|
@@ -1572,6 +1596,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1572
1596
|
schema: PortableTextMemberSchemaTypes
|
|
1573
1597
|
readOnly: boolean
|
|
1574
1598
|
maxBlocks: number | undefined
|
|
1599
|
+
value: Array<PortableTextBlock> | undefined
|
|
1575
1600
|
},
|
|
1576
1601
|
{
|
|
1577
1602
|
type: 'annotation.add'
|
|
@@ -1593,6 +1618,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1593
1618
|
schema: PortableTextMemberSchemaTypes
|
|
1594
1619
|
readOnly: boolean
|
|
1595
1620
|
maxBlocks: number | undefined
|
|
1621
|
+
value: Array<PortableTextBlock> | undefined
|
|
1596
1622
|
},
|
|
1597
1623
|
{
|
|
1598
1624
|
type: 'annotation.remove'
|
|
@@ -1653,6 +1679,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1653
1679
|
type: 'update behaviors'
|
|
1654
1680
|
behaviors: Array<Behavior>
|
|
1655
1681
|
}
|
|
1682
|
+
| {
|
|
1683
|
+
type: 'update value'
|
|
1684
|
+
value: Array<PortableTextBlock> | undefined
|
|
1685
|
+
}
|
|
1656
1686
|
| {
|
|
1657
1687
|
type: 'toggle readOnly'
|
|
1658
1688
|
}
|
|
@@ -1799,6 +1829,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1799
1829
|
schema: PortableTextMemberSchemaTypes
|
|
1800
1830
|
readOnly: boolean
|
|
1801
1831
|
maxBlocks: number | undefined
|
|
1832
|
+
value: Array<PortableTextBlock> | undefined
|
|
1802
1833
|
},
|
|
1803
1834
|
{
|
|
1804
1835
|
type: 'annotation.remove'
|
|
@@ -1817,6 +1848,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1817
1848
|
schema: PortableTextMemberSchemaTypes
|
|
1818
1849
|
readOnly: boolean
|
|
1819
1850
|
maxBlocks: number | undefined
|
|
1851
|
+
value: Array<PortableTextBlock> | undefined
|
|
1820
1852
|
},
|
|
1821
1853
|
{
|
|
1822
1854
|
type: 'annotation.toggle'
|
|
@@ -1880,6 +1912,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1880
1912
|
type: 'update behaviors'
|
|
1881
1913
|
behaviors: Array<Behavior>
|
|
1882
1914
|
}
|
|
1915
|
+
| {
|
|
1916
|
+
type: 'update value'
|
|
1917
|
+
value: Array<PortableTextBlock> | undefined
|
|
1918
|
+
}
|
|
1883
1919
|
| {
|
|
1884
1920
|
type: 'toggle readOnly'
|
|
1885
1921
|
}
|
|
@@ -2026,6 +2062,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2026
2062
|
schema: PortableTextMemberSchemaTypes
|
|
2027
2063
|
readOnly: boolean
|
|
2028
2064
|
maxBlocks: number | undefined
|
|
2065
|
+
value: Array<PortableTextBlock> | undefined
|
|
2029
2066
|
},
|
|
2030
2067
|
{
|
|
2031
2068
|
type: 'annotation.toggle'
|
|
@@ -2047,6 +2084,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2047
2084
|
schema: PortableTextMemberSchemaTypes
|
|
2048
2085
|
readOnly: boolean
|
|
2049
2086
|
maxBlocks: number | undefined
|
|
2087
|
+
value: Array<PortableTextBlock> | undefined
|
|
2050
2088
|
},
|
|
2051
2089
|
{
|
|
2052
2090
|
type: 'focus'
|
|
@@ -2104,6 +2142,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2104
2142
|
type: 'update behaviors'
|
|
2105
2143
|
behaviors: Array<Behavior>
|
|
2106
2144
|
}
|
|
2145
|
+
| {
|
|
2146
|
+
type: 'update value'
|
|
2147
|
+
value: Array<PortableTextBlock> | undefined
|
|
2148
|
+
}
|
|
2107
2149
|
| {
|
|
2108
2150
|
type: 'toggle readOnly'
|
|
2109
2151
|
}
|
|
@@ -2250,6 +2292,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2250
2292
|
schema: PortableTextMemberSchemaTypes
|
|
2251
2293
|
readOnly: boolean
|
|
2252
2294
|
maxBlocks: number | undefined
|
|
2295
|
+
value: Array<PortableTextBlock> | undefined
|
|
2253
2296
|
},
|
|
2254
2297
|
{
|
|
2255
2298
|
type: 'focus'
|
|
@@ -2265,6 +2308,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2265
2308
|
schema: PortableTextMemberSchemaTypes
|
|
2266
2309
|
readOnly: boolean
|
|
2267
2310
|
maxBlocks: number | undefined
|
|
2311
|
+
value: Array<PortableTextBlock> | undefined
|
|
2268
2312
|
},
|
|
2269
2313
|
{
|
|
2270
2314
|
type: 'ready'
|
|
@@ -2322,6 +2366,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2322
2366
|
type: 'update behaviors'
|
|
2323
2367
|
behaviors: Array<Behavior>
|
|
2324
2368
|
}
|
|
2369
|
+
| {
|
|
2370
|
+
type: 'update value'
|
|
2371
|
+
value: Array<PortableTextBlock> | undefined
|
|
2372
|
+
}
|
|
2325
2373
|
| {
|
|
2326
2374
|
type: 'toggle readOnly'
|
|
2327
2375
|
}
|
|
@@ -2468,6 +2516,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2468
2516
|
schema: PortableTextMemberSchemaTypes
|
|
2469
2517
|
readOnly: boolean
|
|
2470
2518
|
maxBlocks: number | undefined
|
|
2519
|
+
value: Array<PortableTextBlock> | undefined
|
|
2471
2520
|
},
|
|
2472
2521
|
{
|
|
2473
2522
|
type: 'unset'
|
|
@@ -2526,6 +2575,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2526
2575
|
type: 'update behaviors'
|
|
2527
2576
|
behaviors: Array<Behavior>
|
|
2528
2577
|
}
|
|
2578
|
+
| {
|
|
2579
|
+
type: 'update value'
|
|
2580
|
+
value: Array<PortableTextBlock> | undefined
|
|
2581
|
+
}
|
|
2529
2582
|
| {
|
|
2530
2583
|
type: 'toggle readOnly'
|
|
2531
2584
|
}
|
|
@@ -2672,6 +2725,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2672
2725
|
schema: PortableTextMemberSchemaTypes
|
|
2673
2726
|
readOnly: boolean
|
|
2674
2727
|
maxBlocks: number | undefined
|
|
2728
|
+
value: Array<PortableTextBlock> | undefined
|
|
2675
2729
|
},
|
|
2676
2730
|
{
|
|
2677
2731
|
type: 'value changed'
|
|
@@ -2730,6 +2784,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2730
2784
|
type: 'update behaviors'
|
|
2731
2785
|
behaviors: Array<Behavior>
|
|
2732
2786
|
}
|
|
2787
|
+
| {
|
|
2788
|
+
type: 'update value'
|
|
2789
|
+
value: Array<PortableTextBlock> | undefined
|
|
2790
|
+
}
|
|
2733
2791
|
| {
|
|
2734
2792
|
type: 'toggle readOnly'
|
|
2735
2793
|
}
|
|
@@ -2876,6 +2934,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2876
2934
|
schema: PortableTextMemberSchemaTypes
|
|
2877
2935
|
readOnly: boolean
|
|
2878
2936
|
maxBlocks: number | undefined
|
|
2937
|
+
value: Array<PortableTextBlock> | undefined
|
|
2879
2938
|
},
|
|
2880
2939
|
{
|
|
2881
2940
|
type: 'invalid value'
|
|
@@ -2935,6 +2994,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2935
2994
|
type: 'update behaviors'
|
|
2936
2995
|
behaviors: Array<Behavior>
|
|
2937
2996
|
}
|
|
2997
|
+
| {
|
|
2998
|
+
type: 'update value'
|
|
2999
|
+
value: Array<PortableTextBlock> | undefined
|
|
3000
|
+
}
|
|
2938
3001
|
| {
|
|
2939
3002
|
type: 'toggle readOnly'
|
|
2940
3003
|
}
|
|
@@ -3081,6 +3144,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3081
3144
|
schema: PortableTextMemberSchemaTypes
|
|
3082
3145
|
readOnly: boolean
|
|
3083
3146
|
maxBlocks: number | undefined
|
|
3147
|
+
value: Array<PortableTextBlock> | undefined
|
|
3084
3148
|
},
|
|
3085
3149
|
{
|
|
3086
3150
|
type: 'error'
|
|
@@ -3141,6 +3205,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3141
3205
|
type: 'update behaviors'
|
|
3142
3206
|
behaviors: Array<Behavior>
|
|
3143
3207
|
}
|
|
3208
|
+
| {
|
|
3209
|
+
type: 'update value'
|
|
3210
|
+
value: Array<PortableTextBlock> | undefined
|
|
3211
|
+
}
|
|
3144
3212
|
| {
|
|
3145
3213
|
type: 'toggle readOnly'
|
|
3146
3214
|
}
|
|
@@ -3287,6 +3355,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3287
3355
|
schema: PortableTextMemberSchemaTypes
|
|
3288
3356
|
readOnly: boolean
|
|
3289
3357
|
maxBlocks: number | undefined
|
|
3358
|
+
value: Array<PortableTextBlock> | undefined
|
|
3290
3359
|
},
|
|
3291
3360
|
{
|
|
3292
3361
|
type: 'selection'
|
|
@@ -3345,6 +3414,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3345
3414
|
type: 'update behaviors'
|
|
3346
3415
|
behaviors: Array<Behavior>
|
|
3347
3416
|
}
|
|
3417
|
+
| {
|
|
3418
|
+
type: 'update value'
|
|
3419
|
+
value: Array<PortableTextBlock> | undefined
|
|
3420
|
+
}
|
|
3348
3421
|
| {
|
|
3349
3422
|
type: 'toggle readOnly'
|
|
3350
3423
|
}
|
|
@@ -3491,6 +3564,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3491
3564
|
schema: PortableTextMemberSchemaTypes
|
|
3492
3565
|
readOnly: boolean
|
|
3493
3566
|
maxBlocks: number | undefined
|
|
3567
|
+
value: Array<PortableTextBlock> | undefined
|
|
3494
3568
|
},
|
|
3495
3569
|
{
|
|
3496
3570
|
type: 'blur'
|
|
@@ -3549,6 +3623,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3549
3623
|
type: 'update behaviors'
|
|
3550
3624
|
behaviors: Array<Behavior>
|
|
3551
3625
|
}
|
|
3626
|
+
| {
|
|
3627
|
+
type: 'update value'
|
|
3628
|
+
value: Array<PortableTextBlock> | undefined
|
|
3629
|
+
}
|
|
3552
3630
|
| {
|
|
3553
3631
|
type: 'toggle readOnly'
|
|
3554
3632
|
}
|
|
@@ -3695,6 +3773,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3695
3773
|
schema: PortableTextMemberSchemaTypes
|
|
3696
3774
|
readOnly: boolean
|
|
3697
3775
|
maxBlocks: number | undefined
|
|
3776
|
+
value: Array<PortableTextBlock> | undefined
|
|
3698
3777
|
},
|
|
3699
3778
|
{
|
|
3700
3779
|
type: 'focused'
|
|
@@ -3753,6 +3832,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3753
3832
|
type: 'update behaviors'
|
|
3754
3833
|
behaviors: Array<Behavior>
|
|
3755
3834
|
}
|
|
3835
|
+
| {
|
|
3836
|
+
type: 'update value'
|
|
3837
|
+
value: Array<PortableTextBlock> | undefined
|
|
3838
|
+
}
|
|
3756
3839
|
| {
|
|
3757
3840
|
type: 'toggle readOnly'
|
|
3758
3841
|
}
|
|
@@ -3899,6 +3982,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3899
3982
|
schema: PortableTextMemberSchemaTypes
|
|
3900
3983
|
readOnly: boolean
|
|
3901
3984
|
maxBlocks: number | undefined
|
|
3985
|
+
value: Array<PortableTextBlock> | undefined
|
|
3902
3986
|
},
|
|
3903
3987
|
{
|
|
3904
3988
|
type: 'online'
|
|
@@ -3956,6 +4040,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3956
4040
|
type: 'update behaviors'
|
|
3957
4041
|
behaviors: Array<Behavior>
|
|
3958
4042
|
}
|
|
4043
|
+
| {
|
|
4044
|
+
type: 'update value'
|
|
4045
|
+
value: Array<PortableTextBlock> | undefined
|
|
4046
|
+
}
|
|
3959
4047
|
| {
|
|
3960
4048
|
type: 'toggle readOnly'
|
|
3961
4049
|
}
|
|
@@ -4102,6 +4190,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4102
4190
|
schema: PortableTextMemberSchemaTypes
|
|
4103
4191
|
readOnly: boolean
|
|
4104
4192
|
maxBlocks: number | undefined
|
|
4193
|
+
value: Array<PortableTextBlock> | undefined
|
|
4105
4194
|
},
|
|
4106
4195
|
{
|
|
4107
4196
|
type: 'offline'
|
|
@@ -4159,6 +4248,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4159
4248
|
type: 'update behaviors'
|
|
4160
4249
|
behaviors: Array<Behavior>
|
|
4161
4250
|
}
|
|
4251
|
+
| {
|
|
4252
|
+
type: 'update value'
|
|
4253
|
+
value: Array<PortableTextBlock> | undefined
|
|
4254
|
+
}
|
|
4162
4255
|
| {
|
|
4163
4256
|
type: 'toggle readOnly'
|
|
4164
4257
|
}
|
|
@@ -4305,6 +4398,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4305
4398
|
schema: PortableTextMemberSchemaTypes
|
|
4306
4399
|
readOnly: boolean
|
|
4307
4400
|
maxBlocks: number | undefined
|
|
4401
|
+
value: Array<PortableTextBlock> | undefined
|
|
4308
4402
|
},
|
|
4309
4403
|
{
|
|
4310
4404
|
type: 'loading'
|
|
@@ -4362,6 +4456,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4362
4456
|
type: 'update behaviors'
|
|
4363
4457
|
behaviors: Array<Behavior>
|
|
4364
4458
|
}
|
|
4459
|
+
| {
|
|
4460
|
+
type: 'update value'
|
|
4461
|
+
value: Array<PortableTextBlock> | undefined
|
|
4462
|
+
}
|
|
4365
4463
|
| {
|
|
4366
4464
|
type: 'toggle readOnly'
|
|
4367
4465
|
}
|
|
@@ -4508,6 +4606,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4508
4606
|
schema: PortableTextMemberSchemaTypes
|
|
4509
4607
|
readOnly: boolean
|
|
4510
4608
|
maxBlocks: number | undefined
|
|
4609
|
+
value: Array<PortableTextBlock> | undefined
|
|
4511
4610
|
},
|
|
4512
4611
|
PatchesEvent,
|
|
4513
4612
|
| {
|
|
@@ -4563,6 +4662,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4563
4662
|
type: 'update behaviors'
|
|
4564
4663
|
behaviors: Array<Behavior>
|
|
4565
4664
|
}
|
|
4665
|
+
| {
|
|
4666
|
+
type: 'update value'
|
|
4667
|
+
value: Array<PortableTextBlock> | undefined
|
|
4668
|
+
}
|
|
4566
4669
|
| {
|
|
4567
4670
|
type: 'toggle readOnly'
|
|
4568
4671
|
}
|
|
@@ -4709,6 +4812,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4709
4812
|
schema: PortableTextMemberSchemaTypes
|
|
4710
4813
|
readOnly: boolean
|
|
4711
4814
|
maxBlocks: number | undefined
|
|
4815
|
+
value: Array<PortableTextBlock> | undefined
|
|
4712
4816
|
},
|
|
4713
4817
|
{
|
|
4714
4818
|
type: 'done loading'
|
|
@@ -4766,6 +4870,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4766
4870
|
type: 'update behaviors'
|
|
4767
4871
|
behaviors: Array<Behavior>
|
|
4768
4872
|
}
|
|
4873
|
+
| {
|
|
4874
|
+
type: 'update value'
|
|
4875
|
+
value: Array<PortableTextBlock> | undefined
|
|
4876
|
+
}
|
|
4769
4877
|
| {
|
|
4770
4878
|
type: 'toggle readOnly'
|
|
4771
4879
|
}
|
|
@@ -4909,6 +5017,148 @@ export declare const editorMachine: StateMachine<
|
|
|
4909
5017
|
readonly 'update schema': {
|
|
4910
5018
|
readonly actions: 'assign schema'
|
|
4911
5019
|
}
|
|
5020
|
+
readonly 'update value': {
|
|
5021
|
+
readonly actions: ActionFunction<
|
|
5022
|
+
{
|
|
5023
|
+
behaviors: Array<Behavior>
|
|
5024
|
+
keyGenerator: () => string
|
|
5025
|
+
pendingEvents: Array<PatchEvent | MutationEvent_2>
|
|
5026
|
+
schema: PortableTextMemberSchemaTypes
|
|
5027
|
+
readOnly: boolean
|
|
5028
|
+
maxBlocks: number | undefined
|
|
5029
|
+
value: Array<PortableTextBlock> | undefined
|
|
5030
|
+
},
|
|
5031
|
+
{
|
|
5032
|
+
type: 'update value'
|
|
5033
|
+
value: Array<PortableTextBlock> | undefined
|
|
5034
|
+
},
|
|
5035
|
+
| {
|
|
5036
|
+
type: 'annotation.add'
|
|
5037
|
+
annotation: {
|
|
5038
|
+
name: string
|
|
5039
|
+
value: {
|
|
5040
|
+
[prop: string]: unknown
|
|
5041
|
+
}
|
|
5042
|
+
}
|
|
5043
|
+
}
|
|
5044
|
+
| {
|
|
5045
|
+
type: 'annotation.remove'
|
|
5046
|
+
annotation: {
|
|
5047
|
+
name: string
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
| {
|
|
5051
|
+
type: 'annotation.toggle'
|
|
5052
|
+
annotation: {
|
|
5053
|
+
name: string
|
|
5054
|
+
value: {
|
|
5055
|
+
[prop: string]: unknown
|
|
5056
|
+
}
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
5059
|
+
| {
|
|
5060
|
+
type: 'focus'
|
|
5061
|
+
}
|
|
5062
|
+
| PatchEvent
|
|
5063
|
+
| MutationEvent_2
|
|
5064
|
+
| {
|
|
5065
|
+
type: 'normalizing'
|
|
5066
|
+
}
|
|
5067
|
+
| {
|
|
5068
|
+
type: 'done normalizing'
|
|
5069
|
+
}
|
|
5070
|
+
| {
|
|
5071
|
+
type: 'behavior event'
|
|
5072
|
+
behaviorEvent: BehaviorEvent
|
|
5073
|
+
editor: PortableTextSlateEditor
|
|
5074
|
+
}
|
|
5075
|
+
| {
|
|
5076
|
+
type: 'behavior action intends'
|
|
5077
|
+
editor: PortableTextSlateEditor
|
|
5078
|
+
actionIntends: Array<BehaviorActionIntend>
|
|
5079
|
+
}
|
|
5080
|
+
| {
|
|
5081
|
+
type: 'update schema'
|
|
5082
|
+
schema: PortableTextMemberSchemaTypes
|
|
5083
|
+
}
|
|
5084
|
+
| {
|
|
5085
|
+
type: 'update behaviors'
|
|
5086
|
+
behaviors: Array<Behavior>
|
|
5087
|
+
}
|
|
5088
|
+
| {
|
|
5089
|
+
type: 'update value'
|
|
5090
|
+
value: Array<PortableTextBlock> | undefined
|
|
5091
|
+
}
|
|
5092
|
+
| {
|
|
5093
|
+
type: 'toggle readOnly'
|
|
5094
|
+
}
|
|
5095
|
+
| {
|
|
5096
|
+
type: 'update maxBlocks'
|
|
5097
|
+
maxBlocks: number | undefined
|
|
5098
|
+
}
|
|
5099
|
+
| {
|
|
5100
|
+
type: 'ready'
|
|
5101
|
+
}
|
|
5102
|
+
| PatchesEvent
|
|
5103
|
+
| {
|
|
5104
|
+
type: 'unset'
|
|
5105
|
+
previousValue: Array<PortableTextBlock>
|
|
5106
|
+
}
|
|
5107
|
+
| {
|
|
5108
|
+
type: 'value changed'
|
|
5109
|
+
value: Array<PortableTextBlock> | undefined
|
|
5110
|
+
}
|
|
5111
|
+
| {
|
|
5112
|
+
type: 'invalid value'
|
|
5113
|
+
resolution: InvalidValueResolution | null
|
|
5114
|
+
value: Array<PortableTextBlock> | undefined
|
|
5115
|
+
}
|
|
5116
|
+
| {
|
|
5117
|
+
type: 'error'
|
|
5118
|
+
name: string
|
|
5119
|
+
description: string
|
|
5120
|
+
data: unknown
|
|
5121
|
+
}
|
|
5122
|
+
| {
|
|
5123
|
+
type: 'selection'
|
|
5124
|
+
selection: EditorSelection
|
|
5125
|
+
}
|
|
5126
|
+
| {
|
|
5127
|
+
type: 'blur'
|
|
5128
|
+
event: FocusEvent_2<HTMLDivElement, Element>
|
|
5129
|
+
}
|
|
5130
|
+
| {
|
|
5131
|
+
type: 'focused'
|
|
5132
|
+
event: FocusEvent_2<HTMLDivElement, Element>
|
|
5133
|
+
}
|
|
5134
|
+
| {
|
|
5135
|
+
type: 'online'
|
|
5136
|
+
}
|
|
5137
|
+
| {
|
|
5138
|
+
type: 'offline'
|
|
5139
|
+
}
|
|
5140
|
+
| {
|
|
5141
|
+
type: 'loading'
|
|
5142
|
+
}
|
|
5143
|
+
| {
|
|
5144
|
+
type: 'done loading'
|
|
5145
|
+
},
|
|
5146
|
+
undefined,
|
|
5147
|
+
{
|
|
5148
|
+
src: 'networkLogic'
|
|
5149
|
+
logic: CallbackActorLogic<
|
|
5150
|
+
EventObject,
|
|
5151
|
+
NonReducibleUnknown,
|
|
5152
|
+
EventObject
|
|
5153
|
+
>
|
|
5154
|
+
id: string | undefined
|
|
5155
|
+
},
|
|
5156
|
+
never,
|
|
5157
|
+
never,
|
|
5158
|
+
never,
|
|
5159
|
+
never
|
|
5160
|
+
>
|
|
5161
|
+
}
|
|
4912
5162
|
readonly 'toggle readOnly': {
|
|
4913
5163
|
readonly actions: ActionFunction<
|
|
4914
5164
|
{
|
|
@@ -4918,6 +5168,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4918
5168
|
schema: PortableTextMemberSchemaTypes
|
|
4919
5169
|
readOnly: boolean
|
|
4920
5170
|
maxBlocks: number | undefined
|
|
5171
|
+
value: Array<PortableTextBlock> | undefined
|
|
4921
5172
|
},
|
|
4922
5173
|
{
|
|
4923
5174
|
type: 'toggle readOnly'
|
|
@@ -4975,6 +5226,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4975
5226
|
type: 'update behaviors'
|
|
4976
5227
|
behaviors: Array<Behavior>
|
|
4977
5228
|
}
|
|
5229
|
+
| {
|
|
5230
|
+
type: 'update value'
|
|
5231
|
+
value: Array<PortableTextBlock> | undefined
|
|
5232
|
+
}
|
|
4978
5233
|
| {
|
|
4979
5234
|
type: 'toggle readOnly'
|
|
4980
5235
|
}
|
|
@@ -5054,6 +5309,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5054
5309
|
schema: PortableTextMemberSchemaTypes
|
|
5055
5310
|
readOnly: boolean
|
|
5056
5311
|
maxBlocks: number | undefined
|
|
5312
|
+
value: Array<PortableTextBlock> | undefined
|
|
5057
5313
|
},
|
|
5058
5314
|
{
|
|
5059
5315
|
type: 'update maxBlocks'
|
|
@@ -5112,6 +5368,10 @@ export declare const editorMachine: StateMachine<
|
|
|
5112
5368
|
type: 'update behaviors'
|
|
5113
5369
|
behaviors: Array<Behavior>
|
|
5114
5370
|
}
|
|
5371
|
+
| {
|
|
5372
|
+
type: 'update value'
|
|
5373
|
+
value: Array<PortableTextBlock> | undefined
|
|
5374
|
+
}
|
|
5115
5375
|
| {
|
|
5116
5376
|
type: 'toggle readOnly'
|
|
5117
5377
|
}
|
|
@@ -5194,6 +5454,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5194
5454
|
schema: PortableTextMemberSchemaTypes
|
|
5195
5455
|
readOnly: boolean
|
|
5196
5456
|
maxBlocks: number | undefined
|
|
5457
|
+
value: Array<PortableTextBlock> | undefined
|
|
5197
5458
|
},
|
|
5198
5459
|
{
|
|
5199
5460
|
type: 'behavior event'
|
|
@@ -5215,6 +5476,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5215
5476
|
schema: PortableTextMemberSchemaTypes
|
|
5216
5477
|
readOnly: boolean
|
|
5217
5478
|
maxBlocks: number | undefined
|
|
5479
|
+
value: Array<PortableTextBlock> | undefined
|
|
5218
5480
|
},
|
|
5219
5481
|
{
|
|
5220
5482
|
type: 'behavior action intends'
|
|
@@ -5274,6 +5536,10 @@ export declare const editorMachine: StateMachine<
|
|
|
5274
5536
|
type: 'update behaviors'
|
|
5275
5537
|
behaviors: Array<Behavior>
|
|
5276
5538
|
}
|
|
5539
|
+
| {
|
|
5540
|
+
type: 'update value'
|
|
5541
|
+
value: Array<PortableTextBlock> | undefined
|
|
5542
|
+
}
|
|
5277
5543
|
| {
|
|
5278
5544
|
type: 'toggle readOnly'
|
|
5279
5545
|
}
|
|
@@ -5337,6 +5603,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5337
5603
|
schema: PortableTextMemberSchemaTypes
|
|
5338
5604
|
readOnly: boolean
|
|
5339
5605
|
maxBlocks: number | undefined
|
|
5606
|
+
value: Array<PortableTextBlock> | undefined
|
|
5340
5607
|
},
|
|
5341
5608
|
{
|
|
5342
5609
|
type: 'behavior action intends'
|
|
@@ -5396,6 +5663,10 @@ export declare const editorMachine: StateMachine<
|
|
|
5396
5663
|
type: 'update behaviors'
|
|
5397
5664
|
behaviors: Array<Behavior>
|
|
5398
5665
|
}
|
|
5666
|
+
| {
|
|
5667
|
+
type: 'update value'
|
|
5668
|
+
value: Array<PortableTextBlock> | undefined
|
|
5669
|
+
}
|
|
5399
5670
|
| {
|
|
5400
5671
|
type: 'toggle readOnly'
|
|
5401
5672
|
}
|
|
@@ -5775,6 +6046,10 @@ export declare type InternalEditorEvent =
|
|
|
5775
6046
|
type: 'update behaviors'
|
|
5776
6047
|
behaviors: Array<Behavior>
|
|
5777
6048
|
}
|
|
6049
|
+
| {
|
|
6050
|
+
type: 'update value'
|
|
6051
|
+
value: Array<PortableTextBlock> | undefined
|
|
6052
|
+
}
|
|
5778
6053
|
| {
|
|
5779
6054
|
type: 'toggle readOnly'
|
|
5780
6055
|
}
|
|
@@ -5825,7 +6100,7 @@ export declare const keyGenerator: () => string
|
|
|
5825
6100
|
* @alpha
|
|
5826
6101
|
*/
|
|
5827
6102
|
export declare type LinkBehaviorsConfig = {
|
|
5828
|
-
|
|
6103
|
+
linkAnnotation?: (context: {
|
|
5829
6104
|
schema: PortableTextMemberSchemaTypes
|
|
5830
6105
|
url: string
|
|
5831
6106
|
}) =>
|
|
@@ -5851,7 +6126,7 @@ export declare type LoadingChange = {
|
|
|
5851
6126
|
* @alpha
|
|
5852
6127
|
*/
|
|
5853
6128
|
export declare type MarkdownBehaviorsConfig = {
|
|
5854
|
-
|
|
6129
|
+
horizontalRuleObject?: (context: {schema: PortableTextMemberSchemaTypes}) =>
|
|
5855
6130
|
| {
|
|
5856
6131
|
name: string
|
|
5857
6132
|
value?: {
|
|
@@ -5859,22 +6134,22 @@ export declare type MarkdownBehaviorsConfig = {
|
|
|
5859
6134
|
}
|
|
5860
6135
|
}
|
|
5861
6136
|
| undefined
|
|
5862
|
-
|
|
5863
|
-
schema: PortableTextMemberSchemaTypes
|
|
5864
|
-
) => string | undefined
|
|
5865
|
-
|
|
5866
|
-
schema: PortableTextMemberSchemaTypes
|
|
5867
|
-
level: number
|
|
5868
|
-
) => string | undefined
|
|
5869
|
-
|
|
5870
|
-
schema: PortableTextMemberSchemaTypes
|
|
5871
|
-
) => string | undefined
|
|
5872
|
-
|
|
5873
|
-
schema: PortableTextMemberSchemaTypes
|
|
5874
|
-
) => string | undefined
|
|
5875
|
-
|
|
5876
|
-
schema: PortableTextMemberSchemaTypes
|
|
5877
|
-
) => string | undefined
|
|
6137
|
+
defaultStyle?: (context: {
|
|
6138
|
+
schema: PortableTextMemberSchemaTypes
|
|
6139
|
+
}) => string | undefined
|
|
6140
|
+
headingStyle?: (context: {
|
|
6141
|
+
schema: PortableTextMemberSchemaTypes
|
|
6142
|
+
level: number
|
|
6143
|
+
}) => string | undefined
|
|
6144
|
+
blockquoteStyle?: (context: {
|
|
6145
|
+
schema: PortableTextMemberSchemaTypes
|
|
6146
|
+
}) => string | undefined
|
|
6147
|
+
unorderedListStyle?: (context: {
|
|
6148
|
+
schema: PortableTextMemberSchemaTypes
|
|
6149
|
+
}) => string | undefined
|
|
6150
|
+
orderedListStyle?: (context: {
|
|
6151
|
+
schema: PortableTextMemberSchemaTypes
|
|
6152
|
+
}) => string | undefined
|
|
5878
6153
|
}
|
|
5879
6154
|
|
|
5880
6155
|
/**
|
|
@@ -6214,16 +6489,15 @@ export declare type PortableTextEditorProps<
|
|
|
6214
6489
|
* Whether or not the editor should be in read-only mode
|
|
6215
6490
|
*/
|
|
6216
6491
|
readOnly?: boolean
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
}
|
|
6492
|
+
/**
|
|
6493
|
+
* The current value of the portable text field
|
|
6494
|
+
*/
|
|
6495
|
+
value?: PortableTextBlock[]
|
|
6496
|
+
/**
|
|
6497
|
+
* A ref to the editor instance
|
|
6498
|
+
*/
|
|
6499
|
+
editorRef?: MutableRefObject<PortableTextEditor | null>
|
|
6500
|
+
}) & {}
|
|
6227
6501
|
>
|
|
6228
6502
|
|
|
6229
6503
|
/** @internal */
|