@portabletext/editor 1.22.0 → 1.24.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.
- package/lib/_chunks-cjs/behavior.core.cjs +65 -2
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/util.slice-blocks.cjs +26 -12
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +65 -2
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/util.slice-blocks.js +26 -12
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/behaviors/index.d.cts +1111 -44
- package/lib/behaviors/index.d.ts +1111 -44
- package/lib/index.cjs +542 -333
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +446 -1
- package/lib/index.d.ts +446 -1
- package/lib/index.js +546 -335
- package/lib/index.js.map +1 -1
- package/lib/selectors/index.d.cts +73 -0
- package/lib/selectors/index.d.ts +73 -0
- package/package.json +23 -18
- package/src/behavior-actions/behavior.action.data-transfer-set.ts +7 -0
- package/src/behavior-actions/behavior.action.insert-blocks.ts +61 -0
- package/src/behavior-actions/behavior.actions.ts +75 -0
- package/src/behaviors/behavior.core.deserialize.ts +46 -0
- package/src/behaviors/behavior.core.serialize.ts +44 -0
- package/src/behaviors/behavior.core.ts +7 -0
- package/src/behaviors/behavior.types.ts +39 -2
- package/src/converters/converter.json.ts +53 -0
- package/src/converters/converter.portable-text.deserialize.test.ts +686 -0
- package/src/converters/converter.portable-text.ts +59 -0
- package/src/converters/converter.text-html.deserialize.test.ts +349 -0
- package/src/converters/converter.text-html.serialize.test.ts +233 -0
- package/src/converters/converter.text-html.ts +61 -0
- package/src/converters/converter.text-plain.test.ts +241 -0
- package/src/converters/converter.text-plain.ts +91 -0
- package/src/converters/converter.ts +65 -0
- package/src/converters/converters.ts +11 -0
- package/src/editor/Editable.tsx +3 -13
- package/src/editor/create-editor.ts +3 -0
- package/src/editor/editor-machine.ts +25 -1
- package/src/editor/editor-selector.ts +1 -0
- package/src/editor/editor-snapshot.ts +5 -0
- package/src/editor/plugins/create-with-event-listeners.ts +44 -0
- package/src/internal-utils/asserters.ts +9 -0
- package/src/internal-utils/mime-type.ts +1 -0
- package/src/internal-utils/parse-blocks.ts +136 -0
- package/src/internal-utils/test-key-generator.ts +9 -0
- package/src/selectors/selector.get-selected-spans.test.ts +1 -0
- package/src/selectors/selector.get-selection-text.test.ts +1 -0
- package/src/selectors/selector.is-active-decorator.test.ts +1 -0
- package/src/utils/util.slice-blocks.test.ts +216 -35
- package/src/utils/util.slice-blocks.ts +37 -10
- package/src/editor/plugins/__tests__/createWithInsertData.test.tsx +0 -181
- package/src/editor/plugins/createWithInsertData.ts +0 -425
package/lib/index.d.cts
CHANGED
|
@@ -98,7 +98,11 @@ export declare type BaseDefinition = {
|
|
|
98
98
|
export declare type Behavior<
|
|
99
99
|
TBehaviorEventType extends BehaviorEvent['type'] = BehaviorEvent['type'],
|
|
100
100
|
TGuardResponse = true,
|
|
101
|
-
TBehaviorEvent extends BehaviorEvent =
|
|
101
|
+
TBehaviorEvent extends BehaviorEvent = PickFromUnion<
|
|
102
|
+
BehaviorEvent,
|
|
103
|
+
'type',
|
|
104
|
+
TBehaviorEventType
|
|
105
|
+
>,
|
|
102
106
|
> = {
|
|
103
107
|
/**
|
|
104
108
|
* The internal editor event that triggers this behavior.
|
|
@@ -364,6 +368,43 @@ export declare type ConnectionChange = {
|
|
|
364
368
|
value: 'online' | 'offline'
|
|
365
369
|
}
|
|
366
370
|
|
|
371
|
+
declare type Converter<TMIMEType extends MIMEType = MIMEType> = {
|
|
372
|
+
mimeType: TMIMEType
|
|
373
|
+
serialize: Serializer<TMIMEType>
|
|
374
|
+
deserialize: Deserializer<TMIMEType>
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
declare type ConverterEvent<TMIMEType extends MIMEType = MIMEType> =
|
|
378
|
+
| {
|
|
379
|
+
type: 'serialize'
|
|
380
|
+
originEvent: 'copy' | 'cut' | 'unknown'
|
|
381
|
+
}
|
|
382
|
+
| {
|
|
383
|
+
type: 'serialization.failure'
|
|
384
|
+
mimeType: TMIMEType
|
|
385
|
+
reason: string
|
|
386
|
+
}
|
|
387
|
+
| {
|
|
388
|
+
type: 'serialization.success'
|
|
389
|
+
data: string
|
|
390
|
+
mimeType: TMIMEType
|
|
391
|
+
originEvent: 'copy' | 'cut' | 'unknown'
|
|
392
|
+
}
|
|
393
|
+
| {
|
|
394
|
+
type: 'deserialize'
|
|
395
|
+
data: string
|
|
396
|
+
}
|
|
397
|
+
| {
|
|
398
|
+
type: 'deserialization.failure'
|
|
399
|
+
mimeType: TMIMEType
|
|
400
|
+
reason: string
|
|
401
|
+
}
|
|
402
|
+
| {
|
|
403
|
+
type: 'deserialization.success'
|
|
404
|
+
data: Array<PortableTextBlock>
|
|
405
|
+
mimeType: TMIMEType
|
|
406
|
+
}
|
|
407
|
+
|
|
367
408
|
/**
|
|
368
409
|
* @beta
|
|
369
410
|
*/
|
|
@@ -402,6 +443,18 @@ export declare function defineSchema<
|
|
|
402
443
|
const TSchemaDefinition extends SchemaDefinition,
|
|
403
444
|
>(definition: TSchemaDefinition): TSchemaDefinition
|
|
404
445
|
|
|
446
|
+
declare type Deserializer<TMIMEType extends MIMEType> = ({
|
|
447
|
+
context,
|
|
448
|
+
event,
|
|
449
|
+
}: {
|
|
450
|
+
context: EditorContext
|
|
451
|
+
event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'deserialize'>
|
|
452
|
+
}) => PickFromUnion<
|
|
453
|
+
ConverterEvent<TMIMEType>,
|
|
454
|
+
'type',
|
|
455
|
+
'deserialization.success' | 'deserialization.failure'
|
|
456
|
+
>
|
|
457
|
+
|
|
405
458
|
/** @beta */
|
|
406
459
|
export declare interface EditableAPI {
|
|
407
460
|
activeAnnotations: () => PortableTextObject[]
|
|
@@ -569,6 +622,7 @@ export declare type EditorConfig = {
|
|
|
569
622
|
*/
|
|
570
623
|
export declare type EditorContext = {
|
|
571
624
|
activeDecorators: Array<string>
|
|
625
|
+
converters: Array<Converter>
|
|
572
626
|
keyGenerator: () => string
|
|
573
627
|
schema: EditorSchema
|
|
574
628
|
selection: EditorSelection
|
|
@@ -615,6 +669,7 @@ export declare type EditorEvent =
|
|
|
615
669
|
| 'style.toggle'
|
|
616
670
|
| 'patches'
|
|
617
671
|
| 'update behaviors'
|
|
672
|
+
| 'update key generator'
|
|
618
673
|
| 'update readOnly'
|
|
619
674
|
| 'update value'
|
|
620
675
|
>
|
|
@@ -678,6 +733,7 @@ export declare function EditorEventListener(props: {
|
|
|
678
733
|
export declare const editorMachine: StateMachine<
|
|
679
734
|
{
|
|
680
735
|
behaviors: Set<Behavior>
|
|
736
|
+
converters: Set<Converter>
|
|
681
737
|
keyGenerator: () => string
|
|
682
738
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
683
739
|
schema: EditorSchema
|
|
@@ -787,6 +843,10 @@ export declare const editorMachine: StateMachine<
|
|
|
787
843
|
type: 'update behaviors'
|
|
788
844
|
behaviors: Array<Behavior>
|
|
789
845
|
}
|
|
846
|
+
| {
|
|
847
|
+
type: 'update key generator'
|
|
848
|
+
keyGenerator: () => string
|
|
849
|
+
}
|
|
790
850
|
| {
|
|
791
851
|
type: 'update value'
|
|
792
852
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -915,6 +975,7 @@ export declare const editorMachine: StateMachine<
|
|
|
915
975
|
string,
|
|
916
976
|
{
|
|
917
977
|
behaviors?: Array<Behavior>
|
|
978
|
+
converters?: Array<Converter>
|
|
918
979
|
keyGenerator: () => string
|
|
919
980
|
maxBlocks?: number
|
|
920
981
|
readOnly?: boolean
|
|
@@ -1061,6 +1122,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1061
1122
|
}
|
|
1062
1123
|
input: {
|
|
1063
1124
|
behaviors?: Array<Behavior>
|
|
1125
|
+
converters?: Array<Converter>
|
|
1064
1126
|
keyGenerator: () => string
|
|
1065
1127
|
maxBlocks?: number
|
|
1066
1128
|
readOnly?: boolean
|
|
@@ -1071,6 +1133,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1071
1133
|
MachineSnapshot<
|
|
1072
1134
|
{
|
|
1073
1135
|
behaviors: Set<Behavior>
|
|
1136
|
+
converters: Set<Converter>
|
|
1074
1137
|
keyGenerator: () => string
|
|
1075
1138
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
1076
1139
|
schema: EditorSchema
|
|
@@ -1180,6 +1243,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1180
1243
|
type: 'update behaviors'
|
|
1181
1244
|
behaviors: Array<Behavior>
|
|
1182
1245
|
}
|
|
1246
|
+
| {
|
|
1247
|
+
type: 'update key generator'
|
|
1248
|
+
keyGenerator: () => string
|
|
1249
|
+
}
|
|
1183
1250
|
| {
|
|
1184
1251
|
type: 'update value'
|
|
1185
1252
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -1342,6 +1409,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1342
1409
|
type: 'update behaviors'
|
|
1343
1410
|
behaviors: Array<Behavior>
|
|
1344
1411
|
}
|
|
1412
|
+
| {
|
|
1413
|
+
type: 'update key generator'
|
|
1414
|
+
keyGenerator: () => string
|
|
1415
|
+
}
|
|
1345
1416
|
| {
|
|
1346
1417
|
type: 'update value'
|
|
1347
1418
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -1400,6 +1471,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1400
1471
|
>
|
|
1401
1472
|
}) => {
|
|
1402
1473
|
behaviors: Set<Behavior>
|
|
1474
|
+
converters: Set<Converter>
|
|
1403
1475
|
keyGenerator: () => string
|
|
1404
1476
|
pendingEvents: never[]
|
|
1405
1477
|
schema: PortableTextMemberSchemaTypes_2
|
|
@@ -1419,6 +1491,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1419
1491
|
readonly actions: ActionFunction<
|
|
1420
1492
|
{
|
|
1421
1493
|
behaviors: Set<Behavior>
|
|
1494
|
+
converters: Set<Converter>
|
|
1422
1495
|
keyGenerator: () => string
|
|
1423
1496
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
1424
1497
|
schema: EditorSchema
|
|
@@ -1532,6 +1605,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1532
1605
|
type: 'update behaviors'
|
|
1533
1606
|
behaviors: Array<Behavior>
|
|
1534
1607
|
}
|
|
1608
|
+
| {
|
|
1609
|
+
type: 'update key generator'
|
|
1610
|
+
keyGenerator: () => string
|
|
1611
|
+
}
|
|
1535
1612
|
| {
|
|
1536
1613
|
type: 'update value'
|
|
1537
1614
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -1706,6 +1783,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1706
1783
|
readonly actions: ActionFunction<
|
|
1707
1784
|
{
|
|
1708
1785
|
behaviors: Set<Behavior>
|
|
1786
|
+
converters: Set<Converter>
|
|
1709
1787
|
keyGenerator: () => string
|
|
1710
1788
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
1711
1789
|
schema: EditorSchema
|
|
@@ -1819,6 +1897,10 @@ export declare const editorMachine: StateMachine<
|
|
|
1819
1897
|
type: 'update behaviors'
|
|
1820
1898
|
behaviors: Array<Behavior>
|
|
1821
1899
|
}
|
|
1900
|
+
| {
|
|
1901
|
+
type: 'update key generator'
|
|
1902
|
+
keyGenerator: () => string
|
|
1903
|
+
}
|
|
1822
1904
|
| {
|
|
1823
1905
|
type: 'update value'
|
|
1824
1906
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -1993,6 +2075,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1993
2075
|
readonly actions: ActionFunction<
|
|
1994
2076
|
{
|
|
1995
2077
|
behaviors: Set<Behavior>
|
|
2078
|
+
converters: Set<Converter>
|
|
1996
2079
|
keyGenerator: () => string
|
|
1997
2080
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
1998
2081
|
schema: EditorSchema
|
|
@@ -2107,6 +2190,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2107
2190
|
type: 'update behaviors'
|
|
2108
2191
|
behaviors: Array<Behavior>
|
|
2109
2192
|
}
|
|
2193
|
+
| {
|
|
2194
|
+
type: 'update key generator'
|
|
2195
|
+
keyGenerator: () => string
|
|
2196
|
+
}
|
|
2110
2197
|
| {
|
|
2111
2198
|
type: 'update value'
|
|
2112
2199
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -2281,6 +2368,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2281
2368
|
readonly actions: ActionFunction<
|
|
2282
2369
|
{
|
|
2283
2370
|
behaviors: Set<Behavior>
|
|
2371
|
+
converters: Set<Converter>
|
|
2284
2372
|
keyGenerator: () => string
|
|
2285
2373
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
2286
2374
|
schema: EditorSchema
|
|
@@ -2396,6 +2484,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2396
2484
|
type: 'update behaviors'
|
|
2397
2485
|
behaviors: Array<Behavior>
|
|
2398
2486
|
}
|
|
2487
|
+
| {
|
|
2488
|
+
type: 'update key generator'
|
|
2489
|
+
keyGenerator: () => string
|
|
2490
|
+
}
|
|
2399
2491
|
| {
|
|
2400
2492
|
type: 'update value'
|
|
2401
2493
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -2571,6 +2663,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2571
2663
|
ActionFunction<
|
|
2572
2664
|
{
|
|
2573
2665
|
behaviors: Set<Behavior>
|
|
2666
|
+
converters: Set<Converter>
|
|
2574
2667
|
keyGenerator: () => string
|
|
2575
2668
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
2576
2669
|
schema: EditorSchema
|
|
@@ -2684,6 +2777,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2684
2777
|
type: 'update behaviors'
|
|
2685
2778
|
behaviors: Array<Behavior>
|
|
2686
2779
|
}
|
|
2780
|
+
| {
|
|
2781
|
+
type: 'update key generator'
|
|
2782
|
+
keyGenerator: () => string
|
|
2783
|
+
}
|
|
2687
2784
|
| {
|
|
2688
2785
|
type: 'update value'
|
|
2689
2786
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -2748,6 +2845,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2748
2845
|
ActionFunction<
|
|
2749
2846
|
{
|
|
2750
2847
|
behaviors: Set<Behavior>
|
|
2848
|
+
converters: Set<Converter>
|
|
2751
2849
|
keyGenerator: () => string
|
|
2752
2850
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
2753
2851
|
schema: EditorSchema
|
|
@@ -2861,6 +2959,10 @@ export declare const editorMachine: StateMachine<
|
|
|
2861
2959
|
type: 'update behaviors'
|
|
2862
2960
|
behaviors: Array<Behavior>
|
|
2863
2961
|
}
|
|
2962
|
+
| {
|
|
2963
|
+
type: 'update key generator'
|
|
2964
|
+
keyGenerator: () => string
|
|
2965
|
+
}
|
|
2864
2966
|
| {
|
|
2865
2967
|
type: 'update value'
|
|
2866
2968
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -3036,6 +3138,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3036
3138
|
readonly actions: ActionFunction<
|
|
3037
3139
|
{
|
|
3038
3140
|
behaviors: Set<Behavior>
|
|
3141
|
+
converters: Set<Converter>
|
|
3039
3142
|
keyGenerator: () => string
|
|
3040
3143
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
3041
3144
|
schema: EditorSchema
|
|
@@ -3149,6 +3252,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3149
3252
|
type: 'update behaviors'
|
|
3150
3253
|
behaviors: Array<Behavior>
|
|
3151
3254
|
}
|
|
3255
|
+
| {
|
|
3256
|
+
type: 'update key generator'
|
|
3257
|
+
keyGenerator: () => string
|
|
3258
|
+
}
|
|
3152
3259
|
| {
|
|
3153
3260
|
type: 'update value'
|
|
3154
3261
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -3323,6 +3430,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3323
3430
|
readonly actions: ActionFunction<
|
|
3324
3431
|
{
|
|
3325
3432
|
behaviors: Set<Behavior>
|
|
3433
|
+
converters: Set<Converter>
|
|
3326
3434
|
keyGenerator: () => string
|
|
3327
3435
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
3328
3436
|
schema: EditorSchema
|
|
@@ -3436,6 +3544,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3436
3544
|
type: 'update behaviors'
|
|
3437
3545
|
behaviors: Array<Behavior>
|
|
3438
3546
|
}
|
|
3547
|
+
| {
|
|
3548
|
+
type: 'update key generator'
|
|
3549
|
+
keyGenerator: () => string
|
|
3550
|
+
}
|
|
3439
3551
|
| {
|
|
3440
3552
|
type: 'update value'
|
|
3441
3553
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -3610,6 +3722,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3610
3722
|
readonly actions: ActionFunction<
|
|
3611
3723
|
{
|
|
3612
3724
|
behaviors: Set<Behavior>
|
|
3725
|
+
converters: Set<Converter>
|
|
3613
3726
|
keyGenerator: () => string
|
|
3614
3727
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
3615
3728
|
schema: EditorSchema
|
|
@@ -3722,6 +3835,10 @@ export declare const editorMachine: StateMachine<
|
|
|
3722
3835
|
type: 'update behaviors'
|
|
3723
3836
|
behaviors: Array<Behavior>
|
|
3724
3837
|
}
|
|
3838
|
+
| {
|
|
3839
|
+
type: 'update key generator'
|
|
3840
|
+
keyGenerator: () => string
|
|
3841
|
+
}
|
|
3725
3842
|
| {
|
|
3726
3843
|
type: 'update value'
|
|
3727
3844
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -3896,6 +4013,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3896
4013
|
readonly actions: ActionFunction<
|
|
3897
4014
|
{
|
|
3898
4015
|
behaviors: Set<Behavior>
|
|
4016
|
+
converters: Set<Converter>
|
|
3899
4017
|
keyGenerator: () => string
|
|
3900
4018
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
3901
4019
|
schema: EditorSchema
|
|
@@ -4006,6 +4124,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4006
4124
|
type: 'update behaviors'
|
|
4007
4125
|
behaviors: Array<Behavior>
|
|
4008
4126
|
}
|
|
4127
|
+
| {
|
|
4128
|
+
type: 'update key generator'
|
|
4129
|
+
keyGenerator: () => string
|
|
4130
|
+
}
|
|
4009
4131
|
| {
|
|
4010
4132
|
type: 'update value'
|
|
4011
4133
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -4180,6 +4302,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4180
4302
|
readonly actions: ActionFunction<
|
|
4181
4303
|
{
|
|
4182
4304
|
behaviors: Set<Behavior>
|
|
4305
|
+
converters: Set<Converter>
|
|
4183
4306
|
keyGenerator: () => string
|
|
4184
4307
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4185
4308
|
schema: EditorSchema
|
|
@@ -4292,6 +4415,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4292
4415
|
type: 'update behaviors'
|
|
4293
4416
|
behaviors: Array<Behavior>
|
|
4294
4417
|
}
|
|
4418
|
+
| {
|
|
4419
|
+
type: 'update key generator'
|
|
4420
|
+
keyGenerator: () => string
|
|
4421
|
+
}
|
|
4295
4422
|
| {
|
|
4296
4423
|
type: 'update value'
|
|
4297
4424
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -4465,6 +4592,190 @@ export declare const editorMachine: StateMachine<
|
|
|
4465
4592
|
readonly 'update behaviors': {
|
|
4466
4593
|
readonly actions: 'assign behaviors'
|
|
4467
4594
|
}
|
|
4595
|
+
readonly 'update key generator': {
|
|
4596
|
+
readonly actions: ActionFunction<
|
|
4597
|
+
{
|
|
4598
|
+
behaviors: Set<Behavior>
|
|
4599
|
+
converters: Set<Converter>
|
|
4600
|
+
keyGenerator: () => string
|
|
4601
|
+
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4602
|
+
schema: EditorSchema
|
|
4603
|
+
initialReadOnly: boolean
|
|
4604
|
+
maxBlocks: number | undefined
|
|
4605
|
+
selection: EditorSelection
|
|
4606
|
+
value: Array<PortableTextBlock> | undefined
|
|
4607
|
+
},
|
|
4608
|
+
{
|
|
4609
|
+
type: 'update key generator'
|
|
4610
|
+
keyGenerator: () => string
|
|
4611
|
+
},
|
|
4612
|
+
| {
|
|
4613
|
+
type: 'annotation.add'
|
|
4614
|
+
annotation: {
|
|
4615
|
+
name: string
|
|
4616
|
+
value: {
|
|
4617
|
+
[prop: string]: unknown
|
|
4618
|
+
}
|
|
4619
|
+
}
|
|
4620
|
+
}
|
|
4621
|
+
| {
|
|
4622
|
+
type: 'annotation.remove'
|
|
4623
|
+
annotation: {
|
|
4624
|
+
name: string
|
|
4625
|
+
}
|
|
4626
|
+
}
|
|
4627
|
+
| {
|
|
4628
|
+
type: 'blur'
|
|
4629
|
+
}
|
|
4630
|
+
| {
|
|
4631
|
+
type: 'decorator.toggle'
|
|
4632
|
+
decorator: string
|
|
4633
|
+
}
|
|
4634
|
+
| {
|
|
4635
|
+
type: 'focus'
|
|
4636
|
+
}
|
|
4637
|
+
| {
|
|
4638
|
+
type: 'insert.block object'
|
|
4639
|
+
placement: 'auto' | 'after' | 'before'
|
|
4640
|
+
blockObject: {
|
|
4641
|
+
name: string
|
|
4642
|
+
value?: {
|
|
4643
|
+
[prop: string]: unknown
|
|
4644
|
+
}
|
|
4645
|
+
}
|
|
4646
|
+
}
|
|
4647
|
+
| {
|
|
4648
|
+
type: 'insert.inline object'
|
|
4649
|
+
inlineObject: {
|
|
4650
|
+
name: string
|
|
4651
|
+
value?: {
|
|
4652
|
+
[prop: string]: unknown
|
|
4653
|
+
}
|
|
4654
|
+
}
|
|
4655
|
+
}
|
|
4656
|
+
| {
|
|
4657
|
+
type: 'list item.toggle'
|
|
4658
|
+
listItem: string
|
|
4659
|
+
}
|
|
4660
|
+
| {
|
|
4661
|
+
type: 'style.toggle'
|
|
4662
|
+
style: string
|
|
4663
|
+
}
|
|
4664
|
+
| PatchEvent
|
|
4665
|
+
| MutationEvent
|
|
4666
|
+
| {
|
|
4667
|
+
type: 'normalizing'
|
|
4668
|
+
}
|
|
4669
|
+
| {
|
|
4670
|
+
type: 'done normalizing'
|
|
4671
|
+
}
|
|
4672
|
+
| {
|
|
4673
|
+
type: 'done syncing initial value'
|
|
4674
|
+
}
|
|
4675
|
+
| {
|
|
4676
|
+
type: 'behavior event'
|
|
4677
|
+
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
4678
|
+
editor: PortableTextSlateEditor
|
|
4679
|
+
defaultActionCallback?: () => void
|
|
4680
|
+
nativeEvent?: {
|
|
4681
|
+
preventDefault: () => void
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
| {
|
|
4685
|
+
type: 'custom behavior event'
|
|
4686
|
+
behaviorEvent: CustomBehaviorEvent
|
|
4687
|
+
editor: PortableTextSlateEditor
|
|
4688
|
+
nativeEvent?: {
|
|
4689
|
+
preventDefault: () => void
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
| CustomBehaviorEvent
|
|
4693
|
+
| {
|
|
4694
|
+
type: 'add behavior'
|
|
4695
|
+
behavior: Behavior
|
|
4696
|
+
}
|
|
4697
|
+
| {
|
|
4698
|
+
type: 'remove behavior'
|
|
4699
|
+
behavior: Behavior
|
|
4700
|
+
}
|
|
4701
|
+
| {
|
|
4702
|
+
type: 'update readOnly'
|
|
4703
|
+
readOnly: boolean
|
|
4704
|
+
}
|
|
4705
|
+
| {
|
|
4706
|
+
type: 'update schema'
|
|
4707
|
+
schema: EditorSchema
|
|
4708
|
+
}
|
|
4709
|
+
| {
|
|
4710
|
+
type: 'update behaviors'
|
|
4711
|
+
behaviors: Array<Behavior>
|
|
4712
|
+
}
|
|
4713
|
+
| {
|
|
4714
|
+
type: 'update key generator'
|
|
4715
|
+
keyGenerator: () => string
|
|
4716
|
+
}
|
|
4717
|
+
| {
|
|
4718
|
+
type: 'update value'
|
|
4719
|
+
value: Array<PortableTextBlock> | undefined
|
|
4720
|
+
}
|
|
4721
|
+
| {
|
|
4722
|
+
type: 'update maxBlocks'
|
|
4723
|
+
maxBlocks: number | undefined
|
|
4724
|
+
}
|
|
4725
|
+
| PatchesEvent
|
|
4726
|
+
| {
|
|
4727
|
+
type: 'unset'
|
|
4728
|
+
previousValue: Array<PortableTextBlock>
|
|
4729
|
+
}
|
|
4730
|
+
| {
|
|
4731
|
+
type: 'value changed'
|
|
4732
|
+
value: Array<PortableTextBlock> | undefined
|
|
4733
|
+
}
|
|
4734
|
+
| {
|
|
4735
|
+
type: 'invalid value'
|
|
4736
|
+
resolution: InvalidValueResolution | null
|
|
4737
|
+
value: Array<PortableTextBlock> | undefined
|
|
4738
|
+
}
|
|
4739
|
+
| {
|
|
4740
|
+
type: 'error'
|
|
4741
|
+
name: string
|
|
4742
|
+
description: string
|
|
4743
|
+
data: unknown
|
|
4744
|
+
}
|
|
4745
|
+
| {
|
|
4746
|
+
type: 'select'
|
|
4747
|
+
selection: EditorSelection
|
|
4748
|
+
}
|
|
4749
|
+
| {
|
|
4750
|
+
type: 'selection'
|
|
4751
|
+
selection: EditorSelection
|
|
4752
|
+
}
|
|
4753
|
+
| {
|
|
4754
|
+
type: 'blurred'
|
|
4755
|
+
event: FocusEvent_2<HTMLDivElement, Element>
|
|
4756
|
+
}
|
|
4757
|
+
| {
|
|
4758
|
+
type: 'focused'
|
|
4759
|
+
event: FocusEvent_2<HTMLDivElement, Element>
|
|
4760
|
+
}
|
|
4761
|
+
| {
|
|
4762
|
+
type: 'loading'
|
|
4763
|
+
}
|
|
4764
|
+
| {
|
|
4765
|
+
type: 'done loading'
|
|
4766
|
+
}
|
|
4767
|
+
| {
|
|
4768
|
+
type: 'custom.*'
|
|
4769
|
+
event: CustomBehaviorEvent
|
|
4770
|
+
},
|
|
4771
|
+
undefined,
|
|
4772
|
+
never,
|
|
4773
|
+
never,
|
|
4774
|
+
never,
|
|
4775
|
+
never,
|
|
4776
|
+
never
|
|
4777
|
+
>
|
|
4778
|
+
}
|
|
4468
4779
|
readonly 'update schema': {
|
|
4469
4780
|
readonly actions: 'assign schema'
|
|
4470
4781
|
}
|
|
@@ -4472,6 +4783,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4472
4783
|
readonly actions: ActionFunction<
|
|
4473
4784
|
{
|
|
4474
4785
|
behaviors: Set<Behavior>
|
|
4786
|
+
converters: Set<Converter>
|
|
4475
4787
|
keyGenerator: () => string
|
|
4476
4788
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4477
4789
|
schema: EditorSchema
|
|
@@ -4585,6 +4897,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4585
4897
|
type: 'update behaviors'
|
|
4586
4898
|
behaviors: Array<Behavior>
|
|
4587
4899
|
}
|
|
4900
|
+
| {
|
|
4901
|
+
type: 'update key generator'
|
|
4902
|
+
keyGenerator: () => string
|
|
4903
|
+
}
|
|
4588
4904
|
| {
|
|
4589
4905
|
type: 'update value'
|
|
4590
4906
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -4651,6 +4967,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4651
4967
|
readonly actions: ActionFunction<
|
|
4652
4968
|
{
|
|
4653
4969
|
behaviors: Set<Behavior>
|
|
4970
|
+
converters: Set<Converter>
|
|
4654
4971
|
keyGenerator: () => string
|
|
4655
4972
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4656
4973
|
schema: EditorSchema
|
|
@@ -4764,6 +5081,10 @@ export declare const editorMachine: StateMachine<
|
|
|
4764
5081
|
type: 'update behaviors'
|
|
4765
5082
|
behaviors: Array<Behavior>
|
|
4766
5083
|
}
|
|
5084
|
+
| {
|
|
5085
|
+
type: 'update key generator'
|
|
5086
|
+
keyGenerator: () => string
|
|
5087
|
+
}
|
|
4767
5088
|
| {
|
|
4768
5089
|
type: 'update value'
|
|
4769
5090
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -4845,6 +5166,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4845
5166
|
}: GuardArgs<
|
|
4846
5167
|
{
|
|
4847
5168
|
behaviors: Set<Behavior>
|
|
5169
|
+
converters: Set<Converter>
|
|
4848
5170
|
keyGenerator: () => string
|
|
4849
5171
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4850
5172
|
schema: EditorSchema
|
|
@@ -4866,12 +5188,42 @@ export declare const editorMachine: StateMachine<
|
|
|
4866
5188
|
}
|
|
4867
5189
|
readonly 'read only': {
|
|
4868
5190
|
readonly on: {
|
|
5191
|
+
readonly 'behavior event': {
|
|
5192
|
+
readonly actions: 'handle behavior event'
|
|
5193
|
+
readonly guard: ({
|
|
5194
|
+
event,
|
|
5195
|
+
}: GuardArgs<
|
|
5196
|
+
{
|
|
5197
|
+
behaviors: Set<Behavior>
|
|
5198
|
+
converters: Set<Converter>
|
|
5199
|
+
keyGenerator: () => string
|
|
5200
|
+
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
5201
|
+
schema: EditorSchema
|
|
5202
|
+
initialReadOnly: boolean
|
|
5203
|
+
maxBlocks: number | undefined
|
|
5204
|
+
selection: EditorSelection
|
|
5205
|
+
value: Array<PortableTextBlock> | undefined
|
|
5206
|
+
},
|
|
5207
|
+
{
|
|
5208
|
+
type: 'behavior event'
|
|
5209
|
+
behaviorEvent:
|
|
5210
|
+
| SyntheticBehaviorEvent
|
|
5211
|
+
| NativeBehaviorEvent
|
|
5212
|
+
editor: PortableTextSlateEditor
|
|
5213
|
+
defaultActionCallback?: () => void
|
|
5214
|
+
nativeEvent?: {
|
|
5215
|
+
preventDefault: () => void
|
|
5216
|
+
}
|
|
5217
|
+
}
|
|
5218
|
+
>) => boolean
|
|
5219
|
+
}
|
|
4869
5220
|
readonly 'update readOnly': {
|
|
4870
5221
|
readonly guard: ({
|
|
4871
5222
|
event,
|
|
4872
5223
|
}: GuardArgs<
|
|
4873
5224
|
{
|
|
4874
5225
|
behaviors: Set<Behavior>
|
|
5226
|
+
converters: Set<Converter>
|
|
4875
5227
|
keyGenerator: () => string
|
|
4876
5228
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4877
5229
|
schema: EditorSchema
|
|
@@ -4900,6 +5252,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4900
5252
|
}: GuardArgs<
|
|
4901
5253
|
{
|
|
4902
5254
|
behaviors: Set<Behavior>
|
|
5255
|
+
converters: Set<Converter>
|
|
4903
5256
|
keyGenerator: () => string
|
|
4904
5257
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4905
5258
|
schema: EditorSchema
|
|
@@ -4926,6 +5279,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4926
5279
|
readonly actions: ActionFunction<
|
|
4927
5280
|
{
|
|
4928
5281
|
behaviors: Set<Behavior>
|
|
5282
|
+
converters: Set<Converter>
|
|
4929
5283
|
keyGenerator: () => string
|
|
4930
5284
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
4931
5285
|
schema: EditorSchema
|
|
@@ -5052,6 +5406,10 @@ export declare const editorMachine: StateMachine<
|
|
|
5052
5406
|
type: 'update behaviors'
|
|
5053
5407
|
behaviors: Array<Behavior>
|
|
5054
5408
|
}
|
|
5409
|
+
| {
|
|
5410
|
+
type: 'update key generator'
|
|
5411
|
+
keyGenerator: () => string
|
|
5412
|
+
}
|
|
5055
5413
|
| {
|
|
5056
5414
|
type: 'update value'
|
|
5057
5415
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -5226,6 +5584,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5226
5584
|
readonly actions: ActionFunction<
|
|
5227
5585
|
{
|
|
5228
5586
|
behaviors: Set<Behavior>
|
|
5587
|
+
converters: Set<Converter>
|
|
5229
5588
|
keyGenerator: () => string
|
|
5230
5589
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
5231
5590
|
schema: EditorSchema
|
|
@@ -5340,6 +5699,10 @@ export declare const editorMachine: StateMachine<
|
|
|
5340
5699
|
type: 'update behaviors'
|
|
5341
5700
|
behaviors: Array<Behavior>
|
|
5342
5701
|
}
|
|
5702
|
+
| {
|
|
5703
|
+
type: 'update key generator'
|
|
5704
|
+
keyGenerator: () => string
|
|
5705
|
+
}
|
|
5343
5706
|
| {
|
|
5344
5707
|
type: 'update value'
|
|
5345
5708
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -5514,6 +5877,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5514
5877
|
readonly actions: ActionFunction<
|
|
5515
5878
|
{
|
|
5516
5879
|
behaviors: Set<Behavior>
|
|
5880
|
+
converters: Set<Converter>
|
|
5517
5881
|
keyGenerator: () => string
|
|
5518
5882
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
5519
5883
|
schema: EditorSchema
|
|
@@ -5630,6 +5994,10 @@ export declare const editorMachine: StateMachine<
|
|
|
5630
5994
|
type: 'update behaviors'
|
|
5631
5995
|
behaviors: Array<Behavior>
|
|
5632
5996
|
}
|
|
5997
|
+
| {
|
|
5998
|
+
type: 'update key generator'
|
|
5999
|
+
keyGenerator: () => string
|
|
6000
|
+
}
|
|
5633
6001
|
| {
|
|
5634
6002
|
type: 'update value'
|
|
5635
6003
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -5804,6 +6172,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5804
6172
|
readonly actions: ActionFunction<
|
|
5805
6173
|
{
|
|
5806
6174
|
behaviors: Set<Behavior>
|
|
6175
|
+
converters: Set<Converter>
|
|
5807
6176
|
keyGenerator: () => string
|
|
5808
6177
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
5809
6178
|
schema: EditorSchema
|
|
@@ -5919,6 +6288,10 @@ export declare const editorMachine: StateMachine<
|
|
|
5919
6288
|
type: 'update behaviors'
|
|
5920
6289
|
behaviors: Array<Behavior>
|
|
5921
6290
|
}
|
|
6291
|
+
| {
|
|
6292
|
+
type: 'update key generator'
|
|
6293
|
+
keyGenerator: () => string
|
|
6294
|
+
}
|
|
5922
6295
|
| {
|
|
5923
6296
|
type: 'update value'
|
|
5924
6297
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -6093,6 +6466,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6093
6466
|
readonly actions: ActionFunction<
|
|
6094
6467
|
{
|
|
6095
6468
|
behaviors: Set<Behavior>
|
|
6469
|
+
converters: Set<Converter>
|
|
6096
6470
|
keyGenerator: () => string
|
|
6097
6471
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
6098
6472
|
schema: EditorSchema
|
|
@@ -6207,6 +6581,10 @@ export declare const editorMachine: StateMachine<
|
|
|
6207
6581
|
type: 'update behaviors'
|
|
6208
6582
|
behaviors: Array<Behavior>
|
|
6209
6583
|
}
|
|
6584
|
+
| {
|
|
6585
|
+
type: 'update key generator'
|
|
6586
|
+
keyGenerator: () => string
|
|
6587
|
+
}
|
|
6210
6588
|
| {
|
|
6211
6589
|
type: 'update value'
|
|
6212
6590
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -6381,6 +6759,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6381
6759
|
readonly actions: ActionFunction<
|
|
6382
6760
|
{
|
|
6383
6761
|
behaviors: Set<Behavior>
|
|
6762
|
+
converters: Set<Converter>
|
|
6384
6763
|
keyGenerator: () => string
|
|
6385
6764
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
6386
6765
|
schema: EditorSchema
|
|
@@ -6511,6 +6890,10 @@ export declare const editorMachine: StateMachine<
|
|
|
6511
6890
|
type: 'update behaviors'
|
|
6512
6891
|
behaviors: Array<Behavior>
|
|
6513
6892
|
}
|
|
6893
|
+
| {
|
|
6894
|
+
type: 'update key generator'
|
|
6895
|
+
keyGenerator: () => string
|
|
6896
|
+
}
|
|
6514
6897
|
| {
|
|
6515
6898
|
type: 'update value'
|
|
6516
6899
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -6685,6 +7068,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6685
7068
|
readonly actions: ActionFunction<
|
|
6686
7069
|
{
|
|
6687
7070
|
behaviors: Set<Behavior>
|
|
7071
|
+
converters: Set<Converter>
|
|
6688
7072
|
keyGenerator: () => string
|
|
6689
7073
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
6690
7074
|
schema: EditorSchema
|
|
@@ -6800,6 +7184,10 @@ export declare const editorMachine: StateMachine<
|
|
|
6800
7184
|
type: 'update behaviors'
|
|
6801
7185
|
behaviors: Array<Behavior>
|
|
6802
7186
|
}
|
|
7187
|
+
| {
|
|
7188
|
+
type: 'update key generator'
|
|
7189
|
+
keyGenerator: () => string
|
|
7190
|
+
}
|
|
6803
7191
|
| {
|
|
6804
7192
|
type: 'update value'
|
|
6805
7193
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -6974,6 +7362,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6974
7362
|
readonly actions: ActionFunction<
|
|
6975
7363
|
{
|
|
6976
7364
|
behaviors: Set<Behavior>
|
|
7365
|
+
converters: Set<Converter>
|
|
6977
7366
|
keyGenerator: () => string
|
|
6978
7367
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
6979
7368
|
schema: EditorSchema
|
|
@@ -7089,6 +7478,10 @@ export declare const editorMachine: StateMachine<
|
|
|
7089
7478
|
type: 'update behaviors'
|
|
7090
7479
|
behaviors: Array<Behavior>
|
|
7091
7480
|
}
|
|
7481
|
+
| {
|
|
7482
|
+
type: 'update key generator'
|
|
7483
|
+
keyGenerator: () => string
|
|
7484
|
+
}
|
|
7092
7485
|
| {
|
|
7093
7486
|
type: 'update value'
|
|
7094
7487
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -7263,6 +7656,7 @@ export declare const editorMachine: StateMachine<
|
|
|
7263
7656
|
readonly actions: ActionFunction<
|
|
7264
7657
|
{
|
|
7265
7658
|
behaviors: Set<Behavior>
|
|
7659
|
+
converters: Set<Converter>
|
|
7266
7660
|
keyGenerator: () => string
|
|
7267
7661
|
pendingEvents: Array<PatchEvent | MutationEvent>
|
|
7268
7662
|
schema: EditorSchema
|
|
@@ -7378,6 +7772,10 @@ export declare const editorMachine: StateMachine<
|
|
|
7378
7772
|
type: 'update behaviors'
|
|
7379
7773
|
behaviors: Array<Behavior>
|
|
7380
7774
|
}
|
|
7775
|
+
| {
|
|
7776
|
+
type: 'update key generator'
|
|
7777
|
+
keyGenerator: () => string
|
|
7778
|
+
}
|
|
7381
7779
|
| {
|
|
7382
7780
|
type: 'update value'
|
|
7383
7781
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -7859,6 +8257,10 @@ export declare type InternalEditorEvent =
|
|
|
7859
8257
|
type: 'update behaviors'
|
|
7860
8258
|
behaviors: Array<Behavior>
|
|
7861
8259
|
}
|
|
8260
|
+
| {
|
|
8261
|
+
type: 'update key generator'
|
|
8262
|
+
keyGenerator: () => string
|
|
8263
|
+
}
|
|
7862
8264
|
| {
|
|
7863
8265
|
type: 'update value'
|
|
7864
8266
|
value: Array<PortableTextBlock> | undefined
|
|
@@ -7919,6 +8321,8 @@ export declare type LoadingChange = {
|
|
|
7919
8321
|
isLoading: boolean
|
|
7920
8322
|
}
|
|
7921
8323
|
|
|
8324
|
+
declare type MIMEType = `${string}/${string}`
|
|
8325
|
+
|
|
7922
8326
|
/**
|
|
7923
8327
|
* The editor has mutated it's content.
|
|
7924
8328
|
* @beta */
|
|
@@ -7949,6 +8353,10 @@ export declare type NativeBehaviorEvent =
|
|
|
7949
8353
|
type: 'copy'
|
|
7950
8354
|
data: DataTransfer
|
|
7951
8355
|
}
|
|
8356
|
+
| {
|
|
8357
|
+
type: 'deserialize'
|
|
8358
|
+
dataTransfer: DataTransfer
|
|
8359
|
+
}
|
|
7952
8360
|
| {
|
|
7953
8361
|
type: 'key.down'
|
|
7954
8362
|
keyboardEvent: Pick<
|
|
@@ -7967,6 +8375,11 @@ export declare type NativeBehaviorEvent =
|
|
|
7967
8375
|
type: 'paste'
|
|
7968
8376
|
data: DataTransfer
|
|
7969
8377
|
}
|
|
8378
|
+
| {
|
|
8379
|
+
type: 'serialize'
|
|
8380
|
+
originEvent: 'copy' | 'cut' | 'unknown'
|
|
8381
|
+
dataTransfer: DataTransfer
|
|
8382
|
+
}
|
|
7970
8383
|
|
|
7971
8384
|
/**
|
|
7972
8385
|
* @alpha
|
|
@@ -8494,6 +8907,18 @@ export declare type SelectionChange = {
|
|
|
8494
8907
|
selection: EditorSelection
|
|
8495
8908
|
}
|
|
8496
8909
|
|
|
8910
|
+
declare type Serializer<TMIMEType extends MIMEType> = ({
|
|
8911
|
+
context,
|
|
8912
|
+
event,
|
|
8913
|
+
}: {
|
|
8914
|
+
context: EditorContext
|
|
8915
|
+
event: PickFromUnion<ConverterEvent<TMIMEType>, 'type', 'serialize'>
|
|
8916
|
+
}) => PickFromUnion<
|
|
8917
|
+
ConverterEvent<TMIMEType>,
|
|
8918
|
+
'type',
|
|
8919
|
+
'serialization.success' | 'serialization.failure'
|
|
8920
|
+
>
|
|
8921
|
+
|
|
8497
8922
|
/**
|
|
8498
8923
|
* @internal
|
|
8499
8924
|
*/
|
|
@@ -8524,6 +8949,12 @@ export declare type SyntheticBehaviorEvent =
|
|
|
8524
8949
|
| {
|
|
8525
8950
|
type: 'blur'
|
|
8526
8951
|
}
|
|
8952
|
+
| {
|
|
8953
|
+
type: 'data transfer.set'
|
|
8954
|
+
data: string
|
|
8955
|
+
dataTransfer: DataTransfer
|
|
8956
|
+
mimeType: MIMEType
|
|
8957
|
+
}
|
|
8527
8958
|
| {
|
|
8528
8959
|
type: 'decorator.toggle'
|
|
8529
8960
|
decorator: string
|
|
@@ -8539,6 +8970,10 @@ export declare type SyntheticBehaviorEvent =
|
|
|
8539
8970
|
| {
|
|
8540
8971
|
type: 'focus'
|
|
8541
8972
|
}
|
|
8973
|
+
| {
|
|
8974
|
+
type: 'insert.blocks'
|
|
8975
|
+
blocks: Array<PortableTextBlock>
|
|
8976
|
+
}
|
|
8542
8977
|
| {
|
|
8543
8978
|
type: 'insert.block object'
|
|
8544
8979
|
placement: 'auto' | 'after' | 'before'
|
|
@@ -8581,6 +9016,16 @@ export declare type SyntheticBehaviorEvent =
|
|
|
8581
9016
|
type: 'style.toggle'
|
|
8582
9017
|
style: string
|
|
8583
9018
|
}
|
|
9019
|
+
| (PickFromUnion<
|
|
9020
|
+
ConverterEvent,
|
|
9021
|
+
'type',
|
|
9022
|
+
| 'deserialization.failure'
|
|
9023
|
+
| 'deserialization.success'
|
|
9024
|
+
| 'serialization.failure'
|
|
9025
|
+
| 'serialization.success'
|
|
9026
|
+
> & {
|
|
9027
|
+
dataTransfer: DataTransfer
|
|
9028
|
+
})
|
|
8584
9029
|
|
|
8585
9030
|
/**
|
|
8586
9031
|
* The editor performed a undo history step
|