@portabletext/editor 1.21.0 → 1.21.2
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/index.cjs +83 -15
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +26 -0
- package/lib/index.d.ts +26 -0
- package/lib/index.js +83 -15
- package/lib/index.js.map +1 -1
- package/package.json +4 -4
- package/src/editor/editor-machine.ts +73 -9
- package/src/editor/plugins/create-with-event-listeners.ts +39 -1
package/lib/index.d.cts
CHANGED
|
@@ -688,6 +688,7 @@ export declare const editorMachine: StateMachine<
|
|
|
688
688
|
type: 'behavior event'
|
|
689
689
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
690
690
|
editor: PortableTextSlateEditor
|
|
691
|
+
defaultActionCallback?: () => void
|
|
691
692
|
nativeEvent?: {
|
|
692
693
|
preventDefault: () => void
|
|
693
694
|
}
|
|
@@ -1080,6 +1081,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1080
1081
|
type: 'behavior event'
|
|
1081
1082
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1082
1083
|
editor: PortableTextSlateEditor
|
|
1084
|
+
defaultActionCallback?: () => void
|
|
1083
1085
|
nativeEvent?: {
|
|
1084
1086
|
preventDefault: () => void
|
|
1085
1087
|
}
|
|
@@ -1241,6 +1243,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1241
1243
|
type: 'behavior event'
|
|
1242
1244
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1243
1245
|
editor: PortableTextSlateEditor
|
|
1246
|
+
defaultActionCallback?: () => void
|
|
1244
1247
|
nativeEvent?: {
|
|
1245
1248
|
preventDefault: () => void
|
|
1246
1249
|
}
|
|
@@ -1430,6 +1433,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1430
1433
|
type: 'behavior event'
|
|
1431
1434
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1432
1435
|
editor: PortableTextSlateEditor
|
|
1436
|
+
defaultActionCallback?: () => void
|
|
1433
1437
|
nativeEvent?: {
|
|
1434
1438
|
preventDefault: () => void
|
|
1435
1439
|
}
|
|
@@ -1716,6 +1720,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1716
1720
|
type: 'behavior event'
|
|
1717
1721
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1718
1722
|
editor: PortableTextSlateEditor
|
|
1723
|
+
defaultActionCallback?: () => void
|
|
1719
1724
|
nativeEvent?: {
|
|
1720
1725
|
preventDefault: () => void
|
|
1721
1726
|
}
|
|
@@ -2003,6 +2008,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2003
2008
|
type: 'behavior event'
|
|
2004
2009
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2005
2010
|
editor: PortableTextSlateEditor
|
|
2011
|
+
defaultActionCallback?: () => void
|
|
2006
2012
|
nativeEvent?: {
|
|
2007
2013
|
preventDefault: () => void
|
|
2008
2014
|
}
|
|
@@ -2291,6 +2297,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2291
2297
|
type: 'behavior event'
|
|
2292
2298
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2293
2299
|
editor: PortableTextSlateEditor
|
|
2300
|
+
defaultActionCallback?: () => void
|
|
2294
2301
|
nativeEvent?: {
|
|
2295
2302
|
preventDefault: () => void
|
|
2296
2303
|
}
|
|
@@ -2578,6 +2585,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2578
2585
|
type: 'behavior event'
|
|
2579
2586
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2580
2587
|
editor: PortableTextSlateEditor
|
|
2588
|
+
defaultActionCallback?: () => void
|
|
2581
2589
|
nativeEvent?: {
|
|
2582
2590
|
preventDefault: () => void
|
|
2583
2591
|
}
|
|
@@ -2754,6 +2762,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2754
2762
|
type: 'behavior event'
|
|
2755
2763
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2756
2764
|
editor: PortableTextSlateEditor
|
|
2765
|
+
defaultActionCallback?: () => void
|
|
2757
2766
|
nativeEvent?: {
|
|
2758
2767
|
preventDefault: () => void
|
|
2759
2768
|
}
|
|
@@ -3041,6 +3050,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3041
3050
|
type: 'behavior event'
|
|
3042
3051
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3043
3052
|
editor: PortableTextSlateEditor
|
|
3053
|
+
defaultActionCallback?: () => void
|
|
3044
3054
|
nativeEvent?: {
|
|
3045
3055
|
preventDefault: () => void
|
|
3046
3056
|
}
|
|
@@ -3327,6 +3337,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3327
3337
|
type: 'behavior event'
|
|
3328
3338
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3329
3339
|
editor: PortableTextSlateEditor
|
|
3340
|
+
defaultActionCallback?: () => void
|
|
3330
3341
|
nativeEvent?: {
|
|
3331
3342
|
preventDefault: () => void
|
|
3332
3343
|
}
|
|
@@ -3612,6 +3623,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3612
3623
|
type: 'behavior event'
|
|
3613
3624
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3614
3625
|
editor: PortableTextSlateEditor
|
|
3626
|
+
defaultActionCallback?: () => void
|
|
3615
3627
|
nativeEvent?: {
|
|
3616
3628
|
preventDefault: () => void
|
|
3617
3629
|
}
|
|
@@ -3895,6 +3907,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3895
3907
|
type: 'behavior event'
|
|
3896
3908
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3897
3909
|
editor: PortableTextSlateEditor
|
|
3910
|
+
defaultActionCallback?: () => void
|
|
3898
3911
|
nativeEvent?: {
|
|
3899
3912
|
preventDefault: () => void
|
|
3900
3913
|
}
|
|
@@ -4180,6 +4193,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4180
4193
|
type: 'behavior event'
|
|
4181
4194
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
4182
4195
|
editor: PortableTextSlateEditor
|
|
4196
|
+
defaultActionCallback?: () => void
|
|
4183
4197
|
nativeEvent?: {
|
|
4184
4198
|
preventDefault: () => void
|
|
4185
4199
|
}
|
|
@@ -4472,6 +4486,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4472
4486
|
type: 'behavior event'
|
|
4473
4487
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
4474
4488
|
editor: PortableTextSlateEditor
|
|
4489
|
+
defaultActionCallback?: () => void
|
|
4475
4490
|
nativeEvent?: {
|
|
4476
4491
|
preventDefault: () => void
|
|
4477
4492
|
}
|
|
@@ -4650,6 +4665,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4650
4665
|
type: 'behavior event'
|
|
4651
4666
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
4652
4667
|
editor: PortableTextSlateEditor
|
|
4668
|
+
defaultActionCallback?: () => void
|
|
4653
4669
|
nativeEvent?: {
|
|
4654
4670
|
preventDefault: () => void
|
|
4655
4671
|
}
|
|
@@ -4937,6 +4953,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4937
4953
|
| SyntheticBehaviorEvent
|
|
4938
4954
|
| NativeBehaviorEvent
|
|
4939
4955
|
editor: PortableTextSlateEditor
|
|
4956
|
+
defaultActionCallback?: () => void
|
|
4940
4957
|
nativeEvent?: {
|
|
4941
4958
|
preventDefault: () => void
|
|
4942
4959
|
}
|
|
@@ -5224,6 +5241,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5224
5241
|
| SyntheticBehaviorEvent
|
|
5225
5242
|
| NativeBehaviorEvent
|
|
5226
5243
|
editor: PortableTextSlateEditor
|
|
5244
|
+
defaultActionCallback?: () => void
|
|
5227
5245
|
nativeEvent?: {
|
|
5228
5246
|
preventDefault: () => void
|
|
5229
5247
|
}
|
|
@@ -5513,6 +5531,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5513
5531
|
| SyntheticBehaviorEvent
|
|
5514
5532
|
| NativeBehaviorEvent
|
|
5515
5533
|
editor: PortableTextSlateEditor
|
|
5534
|
+
defaultActionCallback?: () => void
|
|
5516
5535
|
nativeEvent?: {
|
|
5517
5536
|
preventDefault: () => void
|
|
5518
5537
|
}
|
|
@@ -5801,6 +5820,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5801
5820
|
| SyntheticBehaviorEvent
|
|
5802
5821
|
| NativeBehaviorEvent
|
|
5803
5822
|
editor: PortableTextSlateEditor
|
|
5823
|
+
defaultActionCallback?: () => void
|
|
5804
5824
|
nativeEvent?: {
|
|
5805
5825
|
preventDefault: () => void
|
|
5806
5826
|
}
|
|
@@ -6088,6 +6108,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6088
6108
|
| SyntheticBehaviorEvent
|
|
6089
6109
|
| NativeBehaviorEvent
|
|
6090
6110
|
editor: PortableTextSlateEditor
|
|
6111
|
+
defaultActionCallback?: () => void
|
|
6091
6112
|
nativeEvent?: {
|
|
6092
6113
|
preventDefault: () => void
|
|
6093
6114
|
}
|
|
@@ -6391,6 +6412,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6391
6412
|
| SyntheticBehaviorEvent
|
|
6392
6413
|
| NativeBehaviorEvent
|
|
6393
6414
|
editor: PortableTextSlateEditor
|
|
6415
|
+
defaultActionCallback?: () => void
|
|
6394
6416
|
nativeEvent?: {
|
|
6395
6417
|
preventDefault: () => void
|
|
6396
6418
|
}
|
|
@@ -6679,6 +6701,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6679
6701
|
| SyntheticBehaviorEvent
|
|
6680
6702
|
| NativeBehaviorEvent
|
|
6681
6703
|
editor: PortableTextSlateEditor
|
|
6704
|
+
defaultActionCallback?: () => void
|
|
6682
6705
|
nativeEvent?: {
|
|
6683
6706
|
preventDefault: () => void
|
|
6684
6707
|
}
|
|
@@ -6967,6 +6990,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6967
6990
|
| SyntheticBehaviorEvent
|
|
6968
6991
|
| NativeBehaviorEvent
|
|
6969
6992
|
editor: PortableTextSlateEditor
|
|
6993
|
+
defaultActionCallback?: () => void
|
|
6970
6994
|
nativeEvent?: {
|
|
6971
6995
|
preventDefault: () => void
|
|
6972
6996
|
}
|
|
@@ -7255,6 +7279,7 @@ export declare const editorMachine: StateMachine<
|
|
|
7255
7279
|
| SyntheticBehaviorEvent
|
|
7256
7280
|
| NativeBehaviorEvent
|
|
7257
7281
|
editor: PortableTextSlateEditor
|
|
7282
|
+
defaultActionCallback?: () => void
|
|
7258
7283
|
nativeEvent?: {
|
|
7259
7284
|
preventDefault: () => void
|
|
7260
7285
|
}
|
|
@@ -7720,6 +7745,7 @@ export declare type InternalEditorEvent =
|
|
|
7720
7745
|
type: 'behavior event'
|
|
7721
7746
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
7722
7747
|
editor: PortableTextSlateEditor
|
|
7748
|
+
defaultActionCallback?: () => void
|
|
7723
7749
|
nativeEvent?: {
|
|
7724
7750
|
preventDefault: () => void
|
|
7725
7751
|
}
|
package/lib/index.d.ts
CHANGED
|
@@ -688,6 +688,7 @@ export declare const editorMachine: StateMachine<
|
|
|
688
688
|
type: 'behavior event'
|
|
689
689
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
690
690
|
editor: PortableTextSlateEditor
|
|
691
|
+
defaultActionCallback?: () => void
|
|
691
692
|
nativeEvent?: {
|
|
692
693
|
preventDefault: () => void
|
|
693
694
|
}
|
|
@@ -1080,6 +1081,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1080
1081
|
type: 'behavior event'
|
|
1081
1082
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1082
1083
|
editor: PortableTextSlateEditor
|
|
1084
|
+
defaultActionCallback?: () => void
|
|
1083
1085
|
nativeEvent?: {
|
|
1084
1086
|
preventDefault: () => void
|
|
1085
1087
|
}
|
|
@@ -1241,6 +1243,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1241
1243
|
type: 'behavior event'
|
|
1242
1244
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1243
1245
|
editor: PortableTextSlateEditor
|
|
1246
|
+
defaultActionCallback?: () => void
|
|
1244
1247
|
nativeEvent?: {
|
|
1245
1248
|
preventDefault: () => void
|
|
1246
1249
|
}
|
|
@@ -1430,6 +1433,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1430
1433
|
type: 'behavior event'
|
|
1431
1434
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1432
1435
|
editor: PortableTextSlateEditor
|
|
1436
|
+
defaultActionCallback?: () => void
|
|
1433
1437
|
nativeEvent?: {
|
|
1434
1438
|
preventDefault: () => void
|
|
1435
1439
|
}
|
|
@@ -1716,6 +1720,7 @@ export declare const editorMachine: StateMachine<
|
|
|
1716
1720
|
type: 'behavior event'
|
|
1717
1721
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
1718
1722
|
editor: PortableTextSlateEditor
|
|
1723
|
+
defaultActionCallback?: () => void
|
|
1719
1724
|
nativeEvent?: {
|
|
1720
1725
|
preventDefault: () => void
|
|
1721
1726
|
}
|
|
@@ -2003,6 +2008,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2003
2008
|
type: 'behavior event'
|
|
2004
2009
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2005
2010
|
editor: PortableTextSlateEditor
|
|
2011
|
+
defaultActionCallback?: () => void
|
|
2006
2012
|
nativeEvent?: {
|
|
2007
2013
|
preventDefault: () => void
|
|
2008
2014
|
}
|
|
@@ -2291,6 +2297,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2291
2297
|
type: 'behavior event'
|
|
2292
2298
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2293
2299
|
editor: PortableTextSlateEditor
|
|
2300
|
+
defaultActionCallback?: () => void
|
|
2294
2301
|
nativeEvent?: {
|
|
2295
2302
|
preventDefault: () => void
|
|
2296
2303
|
}
|
|
@@ -2578,6 +2585,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2578
2585
|
type: 'behavior event'
|
|
2579
2586
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2580
2587
|
editor: PortableTextSlateEditor
|
|
2588
|
+
defaultActionCallback?: () => void
|
|
2581
2589
|
nativeEvent?: {
|
|
2582
2590
|
preventDefault: () => void
|
|
2583
2591
|
}
|
|
@@ -2754,6 +2762,7 @@ export declare const editorMachine: StateMachine<
|
|
|
2754
2762
|
type: 'behavior event'
|
|
2755
2763
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
2756
2764
|
editor: PortableTextSlateEditor
|
|
2765
|
+
defaultActionCallback?: () => void
|
|
2757
2766
|
nativeEvent?: {
|
|
2758
2767
|
preventDefault: () => void
|
|
2759
2768
|
}
|
|
@@ -3041,6 +3050,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3041
3050
|
type: 'behavior event'
|
|
3042
3051
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3043
3052
|
editor: PortableTextSlateEditor
|
|
3053
|
+
defaultActionCallback?: () => void
|
|
3044
3054
|
nativeEvent?: {
|
|
3045
3055
|
preventDefault: () => void
|
|
3046
3056
|
}
|
|
@@ -3327,6 +3337,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3327
3337
|
type: 'behavior event'
|
|
3328
3338
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3329
3339
|
editor: PortableTextSlateEditor
|
|
3340
|
+
defaultActionCallback?: () => void
|
|
3330
3341
|
nativeEvent?: {
|
|
3331
3342
|
preventDefault: () => void
|
|
3332
3343
|
}
|
|
@@ -3612,6 +3623,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3612
3623
|
type: 'behavior event'
|
|
3613
3624
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3614
3625
|
editor: PortableTextSlateEditor
|
|
3626
|
+
defaultActionCallback?: () => void
|
|
3615
3627
|
nativeEvent?: {
|
|
3616
3628
|
preventDefault: () => void
|
|
3617
3629
|
}
|
|
@@ -3895,6 +3907,7 @@ export declare const editorMachine: StateMachine<
|
|
|
3895
3907
|
type: 'behavior event'
|
|
3896
3908
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
3897
3909
|
editor: PortableTextSlateEditor
|
|
3910
|
+
defaultActionCallback?: () => void
|
|
3898
3911
|
nativeEvent?: {
|
|
3899
3912
|
preventDefault: () => void
|
|
3900
3913
|
}
|
|
@@ -4180,6 +4193,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4180
4193
|
type: 'behavior event'
|
|
4181
4194
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
4182
4195
|
editor: PortableTextSlateEditor
|
|
4196
|
+
defaultActionCallback?: () => void
|
|
4183
4197
|
nativeEvent?: {
|
|
4184
4198
|
preventDefault: () => void
|
|
4185
4199
|
}
|
|
@@ -4472,6 +4486,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4472
4486
|
type: 'behavior event'
|
|
4473
4487
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
4474
4488
|
editor: PortableTextSlateEditor
|
|
4489
|
+
defaultActionCallback?: () => void
|
|
4475
4490
|
nativeEvent?: {
|
|
4476
4491
|
preventDefault: () => void
|
|
4477
4492
|
}
|
|
@@ -4650,6 +4665,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4650
4665
|
type: 'behavior event'
|
|
4651
4666
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
4652
4667
|
editor: PortableTextSlateEditor
|
|
4668
|
+
defaultActionCallback?: () => void
|
|
4653
4669
|
nativeEvent?: {
|
|
4654
4670
|
preventDefault: () => void
|
|
4655
4671
|
}
|
|
@@ -4937,6 +4953,7 @@ export declare const editorMachine: StateMachine<
|
|
|
4937
4953
|
| SyntheticBehaviorEvent
|
|
4938
4954
|
| NativeBehaviorEvent
|
|
4939
4955
|
editor: PortableTextSlateEditor
|
|
4956
|
+
defaultActionCallback?: () => void
|
|
4940
4957
|
nativeEvent?: {
|
|
4941
4958
|
preventDefault: () => void
|
|
4942
4959
|
}
|
|
@@ -5224,6 +5241,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5224
5241
|
| SyntheticBehaviorEvent
|
|
5225
5242
|
| NativeBehaviorEvent
|
|
5226
5243
|
editor: PortableTextSlateEditor
|
|
5244
|
+
defaultActionCallback?: () => void
|
|
5227
5245
|
nativeEvent?: {
|
|
5228
5246
|
preventDefault: () => void
|
|
5229
5247
|
}
|
|
@@ -5513,6 +5531,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5513
5531
|
| SyntheticBehaviorEvent
|
|
5514
5532
|
| NativeBehaviorEvent
|
|
5515
5533
|
editor: PortableTextSlateEditor
|
|
5534
|
+
defaultActionCallback?: () => void
|
|
5516
5535
|
nativeEvent?: {
|
|
5517
5536
|
preventDefault: () => void
|
|
5518
5537
|
}
|
|
@@ -5801,6 +5820,7 @@ export declare const editorMachine: StateMachine<
|
|
|
5801
5820
|
| SyntheticBehaviorEvent
|
|
5802
5821
|
| NativeBehaviorEvent
|
|
5803
5822
|
editor: PortableTextSlateEditor
|
|
5823
|
+
defaultActionCallback?: () => void
|
|
5804
5824
|
nativeEvent?: {
|
|
5805
5825
|
preventDefault: () => void
|
|
5806
5826
|
}
|
|
@@ -6088,6 +6108,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6088
6108
|
| SyntheticBehaviorEvent
|
|
6089
6109
|
| NativeBehaviorEvent
|
|
6090
6110
|
editor: PortableTextSlateEditor
|
|
6111
|
+
defaultActionCallback?: () => void
|
|
6091
6112
|
nativeEvent?: {
|
|
6092
6113
|
preventDefault: () => void
|
|
6093
6114
|
}
|
|
@@ -6391,6 +6412,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6391
6412
|
| SyntheticBehaviorEvent
|
|
6392
6413
|
| NativeBehaviorEvent
|
|
6393
6414
|
editor: PortableTextSlateEditor
|
|
6415
|
+
defaultActionCallback?: () => void
|
|
6394
6416
|
nativeEvent?: {
|
|
6395
6417
|
preventDefault: () => void
|
|
6396
6418
|
}
|
|
@@ -6679,6 +6701,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6679
6701
|
| SyntheticBehaviorEvent
|
|
6680
6702
|
| NativeBehaviorEvent
|
|
6681
6703
|
editor: PortableTextSlateEditor
|
|
6704
|
+
defaultActionCallback?: () => void
|
|
6682
6705
|
nativeEvent?: {
|
|
6683
6706
|
preventDefault: () => void
|
|
6684
6707
|
}
|
|
@@ -6967,6 +6990,7 @@ export declare const editorMachine: StateMachine<
|
|
|
6967
6990
|
| SyntheticBehaviorEvent
|
|
6968
6991
|
| NativeBehaviorEvent
|
|
6969
6992
|
editor: PortableTextSlateEditor
|
|
6993
|
+
defaultActionCallback?: () => void
|
|
6970
6994
|
nativeEvent?: {
|
|
6971
6995
|
preventDefault: () => void
|
|
6972
6996
|
}
|
|
@@ -7255,6 +7279,7 @@ export declare const editorMachine: StateMachine<
|
|
|
7255
7279
|
| SyntheticBehaviorEvent
|
|
7256
7280
|
| NativeBehaviorEvent
|
|
7257
7281
|
editor: PortableTextSlateEditor
|
|
7282
|
+
defaultActionCallback?: () => void
|
|
7258
7283
|
nativeEvent?: {
|
|
7259
7284
|
preventDefault: () => void
|
|
7260
7285
|
}
|
|
@@ -7720,6 +7745,7 @@ export declare type InternalEditorEvent =
|
|
|
7720
7745
|
type: 'behavior event'
|
|
7721
7746
|
behaviorEvent: SyntheticBehaviorEvent | NativeBehaviorEvent
|
|
7722
7747
|
editor: PortableTextSlateEditor
|
|
7748
|
+
defaultActionCallback?: () => void
|
|
7723
7749
|
nativeEvent?: {
|
|
7724
7750
|
preventDefault: () => void
|
|
7725
7751
|
}
|
package/lib/index.js
CHANGED
|
@@ -2881,9 +2881,18 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
2881
2881
|
};
|
|
2882
2882
|
});
|
|
2883
2883
|
const {
|
|
2884
|
+
deleteBackward: deleteBackward2,
|
|
2885
|
+
deleteForward: deleteForward2,
|
|
2886
|
+
insertBreak,
|
|
2887
|
+
insertSoftBreak,
|
|
2888
|
+
insertText: insertText2,
|
|
2884
2889
|
select
|
|
2885
2890
|
} = editor;
|
|
2886
2891
|
return editor.deleteBackward = (unit) => {
|
|
2892
|
+
if (isApplyingBehaviorActions(editor)) {
|
|
2893
|
+
deleteBackward2(unit);
|
|
2894
|
+
return;
|
|
2895
|
+
}
|
|
2887
2896
|
editorActor.send({
|
|
2888
2897
|
type: "behavior event",
|
|
2889
2898
|
behaviorEvent: {
|
|
@@ -2893,6 +2902,10 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
2893
2902
|
editor
|
|
2894
2903
|
});
|
|
2895
2904
|
}, editor.deleteForward = (unit) => {
|
|
2905
|
+
if (isApplyingBehaviorActions(editor)) {
|
|
2906
|
+
deleteForward2(unit);
|
|
2907
|
+
return;
|
|
2908
|
+
}
|
|
2896
2909
|
editorActor.send({
|
|
2897
2910
|
type: "behavior event",
|
|
2898
2911
|
behaviorEvent: {
|
|
@@ -2902,6 +2915,10 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
2902
2915
|
editor
|
|
2903
2916
|
});
|
|
2904
2917
|
}, editor.insertBreak = () => {
|
|
2918
|
+
if (isApplyingBehaviorActions(editor)) {
|
|
2919
|
+
insertBreak();
|
|
2920
|
+
return;
|
|
2921
|
+
}
|
|
2905
2922
|
editorActor.send({
|
|
2906
2923
|
type: "behavior event",
|
|
2907
2924
|
behaviorEvent: {
|
|
@@ -2910,6 +2927,10 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
2910
2927
|
editor
|
|
2911
2928
|
});
|
|
2912
2929
|
}, editor.insertSoftBreak = () => {
|
|
2930
|
+
if (isApplyingBehaviorActions(editor)) {
|
|
2931
|
+
insertSoftBreak();
|
|
2932
|
+
return;
|
|
2933
|
+
}
|
|
2913
2934
|
editorActor.send({
|
|
2914
2935
|
type: "behavior event",
|
|
2915
2936
|
behaviorEvent: {
|
|
@@ -2918,6 +2939,10 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
2918
2939
|
editor
|
|
2919
2940
|
});
|
|
2920
2941
|
}, editor.insertText = (text, options) => {
|
|
2942
|
+
if (isApplyingBehaviorActions(editor)) {
|
|
2943
|
+
insertText2(text, options);
|
|
2944
|
+
return;
|
|
2945
|
+
}
|
|
2921
2946
|
editorActor.send({
|
|
2922
2947
|
type: "behavior event",
|
|
2923
2948
|
behaviorEvent: {
|
|
@@ -2925,7 +2950,10 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
2925
2950
|
text,
|
|
2926
2951
|
options
|
|
2927
2952
|
},
|
|
2928
|
-
editor
|
|
2953
|
+
editor,
|
|
2954
|
+
defaultActionCallback: () => {
|
|
2955
|
+
insertText2(text, options);
|
|
2956
|
+
}
|
|
2929
2957
|
});
|
|
2930
2958
|
}, editor.select = (location) => {
|
|
2931
2959
|
if (isApplyingBehaviorActions(editor)) {
|
|
@@ -2939,7 +2967,10 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
2939
2967
|
type: "select",
|
|
2940
2968
|
selection: toPortableTextRange(fromSlateValue(editor.children, editorActor.getSnapshot().context.schema.block.name, KEY_TO_VALUE_ELEMENT.get(editor)), range, editorActor.getSnapshot().context.schema)
|
|
2941
2969
|
},
|
|
2942
|
-
editor
|
|
2970
|
+
editor,
|
|
2971
|
+
defaultActionCallback: () => {
|
|
2972
|
+
select(location);
|
|
2973
|
+
}
|
|
2943
2974
|
});
|
|
2944
2975
|
}, editor;
|
|
2945
2976
|
};
|
|
@@ -5619,16 +5650,32 @@ const editorMachine = setup({
|
|
|
5619
5650
|
const defaultAction = event.type === "custom behavior event" || event.behaviorEvent.type === "copy" || event.behaviorEvent.type === "key.down" || event.behaviorEvent.type === "key.up" || event.behaviorEvent.type === "paste" ? void 0 : {
|
|
5620
5651
|
...event.behaviorEvent,
|
|
5621
5652
|
editor: event.editor
|
|
5622
|
-
}, eventBehaviors = [...context.behaviors.values()].filter((behavior) => behavior.on === event.behaviorEvent.type);
|
|
5653
|
+
}, defaultActionCallback = event.type === "behavior event" ? event.defaultActionCallback : void 0, eventBehaviors = [...context.behaviors.values()].filter((behavior) => behavior.on === event.behaviorEvent.type);
|
|
5623
5654
|
if (eventBehaviors.length === 0) {
|
|
5655
|
+
if (defaultActionCallback) {
|
|
5656
|
+
withApplyingBehaviorActions(event.editor, () => {
|
|
5657
|
+
Editor.withoutNormalizing(event.editor, () => {
|
|
5658
|
+
try {
|
|
5659
|
+
defaultActionCallback();
|
|
5660
|
+
} catch (error) {
|
|
5661
|
+
console.error(new Error(`Performing action "${event.behaviorEvent.type}" failed due to: ${error.message}`));
|
|
5662
|
+
}
|
|
5663
|
+
});
|
|
5664
|
+
});
|
|
5665
|
+
return;
|
|
5666
|
+
}
|
|
5624
5667
|
if (!defaultAction)
|
|
5625
5668
|
return;
|
|
5626
5669
|
withApplyingBehaviorActions(event.editor, () => {
|
|
5627
5670
|
Editor.withoutNormalizing(event.editor, () => {
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5671
|
+
try {
|
|
5672
|
+
performAction({
|
|
5673
|
+
context,
|
|
5674
|
+
action: defaultAction
|
|
5675
|
+
});
|
|
5676
|
+
} catch (error) {
|
|
5677
|
+
console.error(new Error(`Performing action "${defaultAction.type}" as a result of "${event.behaviorEvent.type}" failed due to: ${error.message}`));
|
|
5678
|
+
}
|
|
5632
5679
|
});
|
|
5633
5680
|
}), event.editor.onChange();
|
|
5634
5681
|
return;
|
|
@@ -5675,10 +5722,15 @@ const editorMachine = setup({
|
|
|
5675
5722
|
...actionIntend,
|
|
5676
5723
|
editor: event.editor
|
|
5677
5724
|
};
|
|
5678
|
-
|
|
5679
|
-
|
|
5680
|
-
|
|
5681
|
-
|
|
5725
|
+
try {
|
|
5726
|
+
performAction({
|
|
5727
|
+
context,
|
|
5728
|
+
action
|
|
5729
|
+
});
|
|
5730
|
+
} catch (error) {
|
|
5731
|
+
console.error(new Error(`Performing action "${action.type}" as a result of "${event.behaviorEvent.type}" failed due to: ${error.message}`));
|
|
5732
|
+
break;
|
|
5733
|
+
}
|
|
5682
5734
|
}
|
|
5683
5735
|
});
|
|
5684
5736
|
}), event.editor.onChange();
|
|
@@ -5688,14 +5740,30 @@ const editorMachine = setup({
|
|
|
5688
5740
|
}
|
|
5689
5741
|
}
|
|
5690
5742
|
if (!behaviorOverwritten) {
|
|
5743
|
+
if (defaultActionCallback) {
|
|
5744
|
+
withApplyingBehaviorActions(event.editor, () => {
|
|
5745
|
+
Editor.withoutNormalizing(event.editor, () => {
|
|
5746
|
+
try {
|
|
5747
|
+
defaultActionCallback();
|
|
5748
|
+
} catch (error) {
|
|
5749
|
+
console.error(new Error(`Performing "${event.behaviorEvent.type}" failed due to: ${error.message}`));
|
|
5750
|
+
}
|
|
5751
|
+
});
|
|
5752
|
+
});
|
|
5753
|
+
return;
|
|
5754
|
+
}
|
|
5691
5755
|
if (!defaultAction)
|
|
5692
5756
|
return;
|
|
5693
5757
|
withApplyingBehaviorActions(event.editor, () => {
|
|
5694
5758
|
Editor.withoutNormalizing(event.editor, () => {
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5759
|
+
try {
|
|
5760
|
+
performAction({
|
|
5761
|
+
context,
|
|
5762
|
+
action: defaultAction
|
|
5763
|
+
});
|
|
5764
|
+
} catch (error) {
|
|
5765
|
+
console.error(new Error(`Performing action "${defaultAction.type}" as a result of "${event.behaviorEvent.type}" failed due to: ${error.message}`));
|
|
5766
|
+
}
|
|
5699
5767
|
});
|
|
5700
5768
|
}), event.editor.onChange();
|
|
5701
5769
|
}
|