@portabletext/editor 1.27.0 → 1.30.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/README.md +5 -5
- package/lib/_chunks-cjs/behavior.core.cjs +40 -37
- package/lib/_chunks-cjs/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/parse-blocks.cjs +79 -0
- package/lib/_chunks-cjs/parse-blocks.cjs.map +1 -0
- package/lib/_chunks-cjs/plugin.event-listener.cjs +357 -140
- package/lib/_chunks-cjs/plugin.event-listener.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.get-selection-start-point.cjs +15 -0
- package/lib/_chunks-cjs/selector.get-selection-start-point.cjs.map +1 -0
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs +88 -88
- package/lib/_chunks-cjs/selector.is-at-the-start-of-block.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js +40 -37
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/parse-blocks.js +80 -0
- package/lib/_chunks-es/parse-blocks.js.map +1 -0
- package/lib/_chunks-es/plugin.event-listener.js +359 -141
- package/lib/_chunks-es/plugin.event-listener.js.map +1 -1
- package/lib/_chunks-es/selector.get-selection-start-point.js +16 -0
- package/lib/_chunks-es/selector.get-selection-start-point.js.map +1 -0
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js +88 -88
- package/lib/_chunks-es/selector.is-at-the-start-of-block.js.map +1 -1
- package/lib/behaviors/index.d.cts +196 -124
- package/lib/behaviors/index.d.ts +196 -124
- package/lib/index.cjs +22 -21
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +505 -0
- package/lib/index.d.ts +505 -0
- package/lib/index.js +22 -21
- package/lib/index.js.map +1 -1
- package/lib/plugins/index.cjs +249 -1
- package/lib/plugins/index.cjs.map +1 -1
- package/lib/plugins/index.d.cts +246 -1
- package/lib/plugins/index.d.ts +246 -1
- package/lib/plugins/index.js +257 -3
- package/lib/plugins/index.js.map +1 -1
- package/lib/selectors/index.cjs +42 -3
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +39 -0
- package/lib/selectors/index.d.ts +39 -0
- package/lib/selectors/index.js +45 -4
- package/lib/selectors/index.js.map +1 -1
- package/lib/utils/index.cjs +70 -1
- package/lib/utils/index.cjs.map +1 -1
- package/lib/utils/index.d.cts +168 -2
- package/lib/utils/index.d.ts +168 -2
- package/lib/utils/index.js +71 -1
- package/lib/utils/index.js.map +1 -1
- package/package.json +4 -4
- package/src/behavior-actions/behavior.action.delete.ts +18 -0
- package/src/behavior-actions/behavior.action.insert-break.ts +96 -91
- package/src/behavior-actions/behavior.actions.ts +9 -0
- package/src/behaviors/_exports/index.ts +1 -0
- package/src/behaviors/behavior.core.deserialize.ts +52 -38
- package/src/behaviors/behavior.core.ts +4 -11
- package/src/behaviors/behavior.types.ts +4 -0
- package/src/editor/PortableTextEditor.tsx +308 -1
- package/src/editor/components/DefaultObject.tsx +21 -0
- package/src/editor/components/Element.tsx +5 -5
- package/src/editor/components/Leaf.tsx +1 -6
- package/src/internal-utils/__tests__/patchToOperations.test.ts +19 -21
- package/src/internal-utils/applyPatch.ts +11 -3
- package/src/plugins/index.ts +2 -0
- package/src/plugins/plugin.behavior.tsx +22 -0
- package/src/plugins/plugin.one-line.tsx +225 -0
- package/src/selectors/index.ts +7 -2
- package/src/selectors/selector.get-active-annotations.test.ts +122 -0
- package/src/selectors/selector.get-active-annotations.ts +30 -0
- package/src/selectors/selector.get-selection-end-point.ts +17 -0
- package/src/selectors/selector.get-selection-start-point.ts +17 -0
- package/src/selectors/selector.get-selection.ts +8 -0
- package/src/selectors/selector.get-value.ts +11 -0
- package/src/selectors/selector.is-overlapping-selection.ts +46 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/util.is-span.ts +12 -0
- package/src/utils/util.is-text-block.ts +12 -0
- package/src/utils/util.merge-text-blocks.ts +36 -0
- package/src/utils/util.split-text-block.ts +55 -0
- package/src/editor/nodes/DefaultAnnotation.tsx +0 -20
- package/src/editor/nodes/DefaultObject.tsx +0 -18
package/lib/index.d.ts
CHANGED
|
@@ -722,6 +722,10 @@ declare const editorMachine: StateMachine<
|
|
|
722
722
|
type: 'decorator.toggle'
|
|
723
723
|
decorator: string
|
|
724
724
|
}
|
|
725
|
+
| {
|
|
726
|
+
type: 'delete'
|
|
727
|
+
selection: NonNullable<EditorSelection>
|
|
728
|
+
}
|
|
725
729
|
| {
|
|
726
730
|
type: 'delete.backward'
|
|
727
731
|
unit: TextUnit
|
|
@@ -1142,6 +1146,10 @@ declare const editorMachine: StateMachine<
|
|
|
1142
1146
|
type: 'decorator.toggle'
|
|
1143
1147
|
decorator: string
|
|
1144
1148
|
}
|
|
1149
|
+
| {
|
|
1150
|
+
type: 'delete'
|
|
1151
|
+
selection: NonNullable<EditorSelection>
|
|
1152
|
+
}
|
|
1145
1153
|
| {
|
|
1146
1154
|
type: 'delete.backward'
|
|
1147
1155
|
unit: TextUnit
|
|
@@ -1462,6 +1470,10 @@ declare const editorMachine: StateMachine<
|
|
|
1462
1470
|
type: 'decorator.toggle'
|
|
1463
1471
|
decorator: string
|
|
1464
1472
|
}
|
|
1473
|
+
| {
|
|
1474
|
+
type: 'delete'
|
|
1475
|
+
selection: NonNullable<EditorSelection>
|
|
1476
|
+
}
|
|
1465
1477
|
| {
|
|
1466
1478
|
type: 'delete.backward'
|
|
1467
1479
|
unit: TextUnit
|
|
@@ -1807,6 +1819,10 @@ declare const editorMachine: StateMachine<
|
|
|
1807
1819
|
type: 'decorator.toggle'
|
|
1808
1820
|
decorator: string
|
|
1809
1821
|
}
|
|
1822
|
+
| {
|
|
1823
|
+
type: 'delete'
|
|
1824
|
+
selection: NonNullable<EditorSelection>
|
|
1825
|
+
}
|
|
1810
1826
|
| {
|
|
1811
1827
|
type: 'delete.backward'
|
|
1812
1828
|
unit: TextUnit
|
|
@@ -2176,6 +2192,10 @@ declare const editorMachine: StateMachine<
|
|
|
2176
2192
|
type: 'decorator.toggle'
|
|
2177
2193
|
decorator: string
|
|
2178
2194
|
}
|
|
2195
|
+
| {
|
|
2196
|
+
type: 'delete'
|
|
2197
|
+
selection: NonNullable<EditorSelection>
|
|
2198
|
+
}
|
|
2179
2199
|
| {
|
|
2180
2200
|
type: 'delete.backward'
|
|
2181
2201
|
unit: TextUnit
|
|
@@ -2519,6 +2539,10 @@ declare const editorMachine: StateMachine<
|
|
|
2519
2539
|
type: 'decorator.toggle'
|
|
2520
2540
|
decorator: string
|
|
2521
2541
|
}
|
|
2542
|
+
| {
|
|
2543
|
+
type: 'delete'
|
|
2544
|
+
selection: NonNullable<EditorSelection>
|
|
2545
|
+
}
|
|
2522
2546
|
| {
|
|
2523
2547
|
type: 'delete.backward'
|
|
2524
2548
|
unit: TextUnit
|
|
@@ -2807,6 +2831,10 @@ declare const editorMachine: StateMachine<
|
|
|
2807
2831
|
type: 'decorator.toggle'
|
|
2808
2832
|
decorator: string
|
|
2809
2833
|
}
|
|
2834
|
+
| {
|
|
2835
|
+
type: 'delete'
|
|
2836
|
+
selection: NonNullable<EditorSelection>
|
|
2837
|
+
}
|
|
2810
2838
|
| {
|
|
2811
2839
|
type: 'delete.backward'
|
|
2812
2840
|
unit: TextUnit
|
|
@@ -3150,6 +3178,10 @@ declare const editorMachine: StateMachine<
|
|
|
3150
3178
|
type: 'decorator.toggle'
|
|
3151
3179
|
decorator: string
|
|
3152
3180
|
}
|
|
3181
|
+
| {
|
|
3182
|
+
type: 'delete'
|
|
3183
|
+
selection: NonNullable<EditorSelection>
|
|
3184
|
+
}
|
|
3153
3185
|
| {
|
|
3154
3186
|
type: 'delete.backward'
|
|
3155
3187
|
unit: TextUnit
|
|
@@ -3441,6 +3473,10 @@ declare const editorMachine: StateMachine<
|
|
|
3441
3473
|
type: 'decorator.toggle'
|
|
3442
3474
|
decorator: string
|
|
3443
3475
|
}
|
|
3476
|
+
| {
|
|
3477
|
+
type: 'delete'
|
|
3478
|
+
selection: NonNullable<EditorSelection>
|
|
3479
|
+
}
|
|
3444
3480
|
| {
|
|
3445
3481
|
type: 'delete.backward'
|
|
3446
3482
|
unit: TextUnit
|
|
@@ -3784,6 +3820,10 @@ declare const editorMachine: StateMachine<
|
|
|
3784
3820
|
type: 'decorator.toggle'
|
|
3785
3821
|
decorator: string
|
|
3786
3822
|
}
|
|
3823
|
+
| {
|
|
3824
|
+
type: 'delete'
|
|
3825
|
+
selection: NonNullable<EditorSelection>
|
|
3826
|
+
}
|
|
3787
3827
|
| {
|
|
3788
3828
|
type: 'delete.backward'
|
|
3789
3829
|
unit: TextUnit
|
|
@@ -4074,6 +4114,10 @@ declare const editorMachine: StateMachine<
|
|
|
4074
4114
|
type: 'decorator.toggle'
|
|
4075
4115
|
decorator: string
|
|
4076
4116
|
}
|
|
4117
|
+
| {
|
|
4118
|
+
type: 'delete'
|
|
4119
|
+
selection: NonNullable<EditorSelection>
|
|
4120
|
+
}
|
|
4077
4121
|
| {
|
|
4078
4122
|
type: 'delete.backward'
|
|
4079
4123
|
unit: TextUnit
|
|
@@ -4417,6 +4461,10 @@ declare const editorMachine: StateMachine<
|
|
|
4417
4461
|
type: 'decorator.toggle'
|
|
4418
4462
|
decorator: string
|
|
4419
4463
|
}
|
|
4464
|
+
| {
|
|
4465
|
+
type: 'delete'
|
|
4466
|
+
selection: NonNullable<EditorSelection>
|
|
4467
|
+
}
|
|
4420
4468
|
| {
|
|
4421
4469
|
type: 'delete.backward'
|
|
4422
4470
|
unit: TextUnit
|
|
@@ -4706,6 +4754,10 @@ declare const editorMachine: StateMachine<
|
|
|
4706
4754
|
type: 'decorator.toggle'
|
|
4707
4755
|
decorator: string
|
|
4708
4756
|
}
|
|
4757
|
+
| {
|
|
4758
|
+
type: 'delete'
|
|
4759
|
+
selection: NonNullable<EditorSelection>
|
|
4760
|
+
}
|
|
4709
4761
|
| {
|
|
4710
4762
|
type: 'delete.backward'
|
|
4711
4763
|
unit: TextUnit
|
|
@@ -5049,6 +5101,10 @@ declare const editorMachine: StateMachine<
|
|
|
5049
5101
|
type: 'decorator.toggle'
|
|
5050
5102
|
decorator: string
|
|
5051
5103
|
}
|
|
5104
|
+
| {
|
|
5105
|
+
type: 'delete'
|
|
5106
|
+
selection: NonNullable<EditorSelection>
|
|
5107
|
+
}
|
|
5052
5108
|
| {
|
|
5053
5109
|
type: 'delete.backward'
|
|
5054
5110
|
unit: TextUnit
|
|
@@ -5339,6 +5395,10 @@ declare const editorMachine: StateMachine<
|
|
|
5339
5395
|
type: 'decorator.toggle'
|
|
5340
5396
|
decorator: string
|
|
5341
5397
|
}
|
|
5398
|
+
| {
|
|
5399
|
+
type: 'delete'
|
|
5400
|
+
selection: NonNullable<EditorSelection>
|
|
5401
|
+
}
|
|
5342
5402
|
| {
|
|
5343
5403
|
type: 'delete.backward'
|
|
5344
5404
|
unit: TextUnit
|
|
@@ -5700,6 +5760,10 @@ declare const editorMachine: StateMachine<
|
|
|
5700
5760
|
type: 'decorator.toggle'
|
|
5701
5761
|
decorator: string
|
|
5702
5762
|
}
|
|
5763
|
+
| {
|
|
5764
|
+
type: 'delete'
|
|
5765
|
+
selection: NonNullable<EditorSelection>
|
|
5766
|
+
}
|
|
5703
5767
|
| {
|
|
5704
5768
|
type: 'delete.backward'
|
|
5705
5769
|
unit: TextUnit
|
|
@@ -6043,6 +6107,10 @@ declare const editorMachine: StateMachine<
|
|
|
6043
6107
|
type: 'decorator.toggle'
|
|
6044
6108
|
decorator: string
|
|
6045
6109
|
}
|
|
6110
|
+
| {
|
|
6111
|
+
type: 'delete'
|
|
6112
|
+
selection: NonNullable<EditorSelection>
|
|
6113
|
+
}
|
|
6046
6114
|
| {
|
|
6047
6115
|
type: 'delete.backward'
|
|
6048
6116
|
unit: TextUnit
|
|
@@ -6333,6 +6401,10 @@ declare const editorMachine: StateMachine<
|
|
|
6333
6401
|
type: 'decorator.toggle'
|
|
6334
6402
|
decorator: string
|
|
6335
6403
|
}
|
|
6404
|
+
| {
|
|
6405
|
+
type: 'delete'
|
|
6406
|
+
selection: NonNullable<EditorSelection>
|
|
6407
|
+
}
|
|
6336
6408
|
| {
|
|
6337
6409
|
type: 'delete.backward'
|
|
6338
6410
|
unit: TextUnit
|
|
@@ -6676,6 +6748,10 @@ declare const editorMachine: StateMachine<
|
|
|
6676
6748
|
type: 'decorator.toggle'
|
|
6677
6749
|
decorator: string
|
|
6678
6750
|
}
|
|
6751
|
+
| {
|
|
6752
|
+
type: 'delete'
|
|
6753
|
+
selection: NonNullable<EditorSelection>
|
|
6754
|
+
}
|
|
6679
6755
|
| {
|
|
6680
6756
|
type: 'delete.backward'
|
|
6681
6757
|
unit: TextUnit
|
|
@@ -6964,6 +7040,10 @@ declare const editorMachine: StateMachine<
|
|
|
6964
7040
|
type: 'decorator.toggle'
|
|
6965
7041
|
decorator: string
|
|
6966
7042
|
}
|
|
7043
|
+
| {
|
|
7044
|
+
type: 'delete'
|
|
7045
|
+
selection: NonNullable<EditorSelection>
|
|
7046
|
+
}
|
|
6967
7047
|
| {
|
|
6968
7048
|
type: 'delete.backward'
|
|
6969
7049
|
unit: TextUnit
|
|
@@ -7307,6 +7387,10 @@ declare const editorMachine: StateMachine<
|
|
|
7307
7387
|
type: 'decorator.toggle'
|
|
7308
7388
|
decorator: string
|
|
7309
7389
|
}
|
|
7390
|
+
| {
|
|
7391
|
+
type: 'delete'
|
|
7392
|
+
selection: NonNullable<EditorSelection>
|
|
7393
|
+
}
|
|
7310
7394
|
| {
|
|
7311
7395
|
type: 'delete.backward'
|
|
7312
7396
|
unit: TextUnit
|
|
@@ -7596,6 +7680,10 @@ declare const editorMachine: StateMachine<
|
|
|
7596
7680
|
type: 'decorator.toggle'
|
|
7597
7681
|
decorator: string
|
|
7598
7682
|
}
|
|
7683
|
+
| {
|
|
7684
|
+
type: 'delete'
|
|
7685
|
+
selection: NonNullable<EditorSelection>
|
|
7686
|
+
}
|
|
7599
7687
|
| {
|
|
7600
7688
|
type: 'delete.backward'
|
|
7601
7689
|
unit: TextUnit
|
|
@@ -7939,6 +8027,10 @@ declare const editorMachine: StateMachine<
|
|
|
7939
8027
|
type: 'decorator.toggle'
|
|
7940
8028
|
decorator: string
|
|
7941
8029
|
}
|
|
8030
|
+
| {
|
|
8031
|
+
type: 'delete'
|
|
8032
|
+
selection: NonNullable<EditorSelection>
|
|
8033
|
+
}
|
|
7942
8034
|
| {
|
|
7943
8035
|
type: 'delete.backward'
|
|
7944
8036
|
unit: TextUnit
|
|
@@ -8231,6 +8323,10 @@ declare const editorMachine: StateMachine<
|
|
|
8231
8323
|
type: 'decorator.toggle'
|
|
8232
8324
|
decorator: string
|
|
8233
8325
|
}
|
|
8326
|
+
| {
|
|
8327
|
+
type: 'delete'
|
|
8328
|
+
selection: NonNullable<EditorSelection>
|
|
8329
|
+
}
|
|
8234
8330
|
| {
|
|
8235
8331
|
type: 'delete.backward'
|
|
8236
8332
|
unit: TextUnit
|
|
@@ -8574,6 +8670,10 @@ declare const editorMachine: StateMachine<
|
|
|
8574
8670
|
type: 'decorator.toggle'
|
|
8575
8671
|
decorator: string
|
|
8576
8672
|
}
|
|
8673
|
+
| {
|
|
8674
|
+
type: 'delete'
|
|
8675
|
+
selection: NonNullable<EditorSelection>
|
|
8676
|
+
}
|
|
8577
8677
|
| {
|
|
8578
8678
|
type: 'delete.backward'
|
|
8579
8679
|
unit: TextUnit
|
|
@@ -8866,6 +8966,10 @@ declare const editorMachine: StateMachine<
|
|
|
8866
8966
|
type: 'decorator.toggle'
|
|
8867
8967
|
decorator: string
|
|
8868
8968
|
}
|
|
8969
|
+
| {
|
|
8970
|
+
type: 'delete'
|
|
8971
|
+
selection: NonNullable<EditorSelection>
|
|
8972
|
+
}
|
|
8869
8973
|
| {
|
|
8870
8974
|
type: 'delete.backward'
|
|
8871
8975
|
unit: TextUnit
|
|
@@ -9232,6 +9336,10 @@ declare const editorMachine: StateMachine<
|
|
|
9232
9336
|
type: 'decorator.toggle'
|
|
9233
9337
|
decorator: string
|
|
9234
9338
|
}
|
|
9339
|
+
| {
|
|
9340
|
+
type: 'delete'
|
|
9341
|
+
selection: NonNullable<EditorSelection>
|
|
9342
|
+
}
|
|
9235
9343
|
| {
|
|
9236
9344
|
type: 'delete.backward'
|
|
9237
9345
|
unit: TextUnit
|
|
@@ -9595,6 +9703,10 @@ declare const editorMachine: StateMachine<
|
|
|
9595
9703
|
type: 'decorator.toggle'
|
|
9596
9704
|
decorator: string
|
|
9597
9705
|
}
|
|
9706
|
+
| {
|
|
9707
|
+
type: 'delete'
|
|
9708
|
+
selection: NonNullable<EditorSelection>
|
|
9709
|
+
}
|
|
9598
9710
|
| {
|
|
9599
9711
|
type: 'delete.backward'
|
|
9600
9712
|
unit: TextUnit
|
|
@@ -10106,6 +10218,10 @@ declare const editorMachine: StateMachine<
|
|
|
10106
10218
|
type: 'decorator.toggle'
|
|
10107
10219
|
decorator: string
|
|
10108
10220
|
}
|
|
10221
|
+
| {
|
|
10222
|
+
type: 'delete'
|
|
10223
|
+
selection: NonNullable<EditorSelection>
|
|
10224
|
+
}
|
|
10109
10225
|
| {
|
|
10110
10226
|
type: 'delete.backward'
|
|
10111
10227
|
unit: TextUnit
|
|
@@ -10451,6 +10567,10 @@ declare const editorMachine: StateMachine<
|
|
|
10451
10567
|
type: 'decorator.toggle'
|
|
10452
10568
|
decorator: string
|
|
10453
10569
|
}
|
|
10570
|
+
| {
|
|
10571
|
+
type: 'delete'
|
|
10572
|
+
selection: NonNullable<EditorSelection>
|
|
10573
|
+
}
|
|
10454
10574
|
| {
|
|
10455
10575
|
type: 'delete.backward'
|
|
10456
10576
|
unit: TextUnit
|
|
@@ -10746,6 +10866,10 @@ declare const editorMachine: StateMachine<
|
|
|
10746
10866
|
type: 'decorator.toggle'
|
|
10747
10867
|
decorator: string
|
|
10748
10868
|
}
|
|
10869
|
+
| {
|
|
10870
|
+
type: 'delete'
|
|
10871
|
+
selection: NonNullable<EditorSelection>
|
|
10872
|
+
}
|
|
10749
10873
|
| {
|
|
10750
10874
|
type: 'delete.backward'
|
|
10751
10875
|
unit: TextUnit
|
|
@@ -11091,6 +11215,10 @@ declare const editorMachine: StateMachine<
|
|
|
11091
11215
|
type: 'decorator.toggle'
|
|
11092
11216
|
decorator: string
|
|
11093
11217
|
}
|
|
11218
|
+
| {
|
|
11219
|
+
type: 'delete'
|
|
11220
|
+
selection: NonNullable<EditorSelection>
|
|
11221
|
+
}
|
|
11094
11222
|
| {
|
|
11095
11223
|
type: 'delete.backward'
|
|
11096
11224
|
unit: TextUnit
|
|
@@ -11379,6 +11507,10 @@ declare const editorMachine: StateMachine<
|
|
|
11379
11507
|
type: 'decorator.toggle'
|
|
11380
11508
|
decorator: string
|
|
11381
11509
|
}
|
|
11510
|
+
| {
|
|
11511
|
+
type: 'delete'
|
|
11512
|
+
selection: NonNullable<EditorSelection>
|
|
11513
|
+
}
|
|
11382
11514
|
| {
|
|
11383
11515
|
type: 'delete.backward'
|
|
11384
11516
|
unit: TextUnit
|
|
@@ -11724,6 +11856,10 @@ declare const editorMachine: StateMachine<
|
|
|
11724
11856
|
type: 'decorator.toggle'
|
|
11725
11857
|
decorator: string
|
|
11726
11858
|
}
|
|
11859
|
+
| {
|
|
11860
|
+
type: 'delete'
|
|
11861
|
+
selection: NonNullable<EditorSelection>
|
|
11862
|
+
}
|
|
11727
11863
|
| {
|
|
11728
11864
|
type: 'delete.backward'
|
|
11729
11865
|
unit: TextUnit
|
|
@@ -12012,6 +12148,10 @@ declare const editorMachine: StateMachine<
|
|
|
12012
12148
|
type: 'decorator.toggle'
|
|
12013
12149
|
decorator: string
|
|
12014
12150
|
}
|
|
12151
|
+
| {
|
|
12152
|
+
type: 'delete'
|
|
12153
|
+
selection: NonNullable<EditorSelection>
|
|
12154
|
+
}
|
|
12015
12155
|
| {
|
|
12016
12156
|
type: 'delete.backward'
|
|
12017
12157
|
unit: TextUnit
|
|
@@ -12357,6 +12497,10 @@ declare const editorMachine: StateMachine<
|
|
|
12357
12497
|
type: 'decorator.toggle'
|
|
12358
12498
|
decorator: string
|
|
12359
12499
|
}
|
|
12500
|
+
| {
|
|
12501
|
+
type: 'delete'
|
|
12502
|
+
selection: NonNullable<EditorSelection>
|
|
12503
|
+
}
|
|
12360
12504
|
| {
|
|
12361
12505
|
type: 'delete.backward'
|
|
12362
12506
|
unit: TextUnit
|
|
@@ -12654,6 +12798,10 @@ declare const editorMachine: StateMachine<
|
|
|
12654
12798
|
type: 'decorator.toggle'
|
|
12655
12799
|
decorator: string
|
|
12656
12800
|
}
|
|
12801
|
+
| {
|
|
12802
|
+
type: 'delete'
|
|
12803
|
+
selection: NonNullable<EditorSelection>
|
|
12804
|
+
}
|
|
12657
12805
|
| {
|
|
12658
12806
|
type: 'delete.backward'
|
|
12659
12807
|
unit: TextUnit
|
|
@@ -12999,6 +13147,10 @@ declare const editorMachine: StateMachine<
|
|
|
12999
13147
|
type: 'decorator.toggle'
|
|
13000
13148
|
decorator: string
|
|
13001
13149
|
}
|
|
13150
|
+
| {
|
|
13151
|
+
type: 'delete'
|
|
13152
|
+
selection: NonNullable<EditorSelection>
|
|
13153
|
+
}
|
|
13002
13154
|
| {
|
|
13003
13155
|
type: 'delete.backward'
|
|
13004
13156
|
unit: TextUnit
|
|
@@ -13301,6 +13453,10 @@ declare const editorMachine: StateMachine<
|
|
|
13301
13453
|
type: 'decorator.toggle'
|
|
13302
13454
|
decorator: string
|
|
13303
13455
|
}
|
|
13456
|
+
| {
|
|
13457
|
+
type: 'delete'
|
|
13458
|
+
selection: NonNullable<EditorSelection>
|
|
13459
|
+
}
|
|
13304
13460
|
| {
|
|
13305
13461
|
type: 'delete.backward'
|
|
13306
13462
|
unit: TextUnit
|
|
@@ -13646,6 +13802,10 @@ declare const editorMachine: StateMachine<
|
|
|
13646
13802
|
type: 'decorator.toggle'
|
|
13647
13803
|
decorator: string
|
|
13648
13804
|
}
|
|
13805
|
+
| {
|
|
13806
|
+
type: 'delete'
|
|
13807
|
+
selection: NonNullable<EditorSelection>
|
|
13808
|
+
}
|
|
13649
13809
|
| {
|
|
13650
13810
|
type: 'delete.backward'
|
|
13651
13811
|
unit: TextUnit
|
|
@@ -13934,6 +14094,10 @@ declare const editorMachine: StateMachine<
|
|
|
13934
14094
|
type: 'decorator.toggle'
|
|
13935
14095
|
decorator: string
|
|
13936
14096
|
}
|
|
14097
|
+
| {
|
|
14098
|
+
type: 'delete'
|
|
14099
|
+
selection: NonNullable<EditorSelection>
|
|
14100
|
+
}
|
|
13937
14101
|
| {
|
|
13938
14102
|
type: 'delete.backward'
|
|
13939
14103
|
unit: TextUnit
|
|
@@ -14279,6 +14443,10 @@ declare const editorMachine: StateMachine<
|
|
|
14279
14443
|
type: 'decorator.toggle'
|
|
14280
14444
|
decorator: string
|
|
14281
14445
|
}
|
|
14446
|
+
| {
|
|
14447
|
+
type: 'delete'
|
|
14448
|
+
selection: NonNullable<EditorSelection>
|
|
14449
|
+
}
|
|
14282
14450
|
| {
|
|
14283
14451
|
type: 'delete.backward'
|
|
14284
14452
|
unit: TextUnit
|
|
@@ -14621,6 +14789,10 @@ declare const editorMachine: StateMachine<
|
|
|
14621
14789
|
type: 'decorator.toggle'
|
|
14622
14790
|
decorator: string
|
|
14623
14791
|
}
|
|
14792
|
+
| {
|
|
14793
|
+
type: 'delete'
|
|
14794
|
+
selection: NonNullable<EditorSelection>
|
|
14795
|
+
}
|
|
14624
14796
|
| {
|
|
14625
14797
|
type: 'delete.backward'
|
|
14626
14798
|
unit: TextUnit
|
|
@@ -14966,6 +15138,10 @@ declare const editorMachine: StateMachine<
|
|
|
14966
15138
|
type: 'decorator.toggle'
|
|
14967
15139
|
decorator: string
|
|
14968
15140
|
}
|
|
15141
|
+
| {
|
|
15142
|
+
type: 'delete'
|
|
15143
|
+
selection: NonNullable<EditorSelection>
|
|
15144
|
+
}
|
|
14969
15145
|
| {
|
|
14970
15146
|
type: 'delete.backward'
|
|
14971
15147
|
unit: TextUnit
|
|
@@ -15263,6 +15439,10 @@ declare const editorMachine: StateMachine<
|
|
|
15263
15439
|
type: 'decorator.toggle'
|
|
15264
15440
|
decorator: string
|
|
15265
15441
|
}
|
|
15442
|
+
| {
|
|
15443
|
+
type: 'delete'
|
|
15444
|
+
selection: NonNullable<EditorSelection>
|
|
15445
|
+
}
|
|
15266
15446
|
| {
|
|
15267
15447
|
type: 'delete.backward'
|
|
15268
15448
|
unit: TextUnit
|
|
@@ -15608,6 +15788,10 @@ declare const editorMachine: StateMachine<
|
|
|
15608
15788
|
type: 'decorator.toggle'
|
|
15609
15789
|
decorator: string
|
|
15610
15790
|
}
|
|
15791
|
+
| {
|
|
15792
|
+
type: 'delete'
|
|
15793
|
+
selection: NonNullable<EditorSelection>
|
|
15794
|
+
}
|
|
15611
15795
|
| {
|
|
15612
15796
|
type: 'delete.backward'
|
|
15613
15797
|
unit: TextUnit
|
|
@@ -15906,6 +16090,10 @@ declare const editorMachine: StateMachine<
|
|
|
15906
16090
|
type: 'decorator.toggle'
|
|
15907
16091
|
decorator: string
|
|
15908
16092
|
}
|
|
16093
|
+
| {
|
|
16094
|
+
type: 'delete'
|
|
16095
|
+
selection: NonNullable<EditorSelection>
|
|
16096
|
+
}
|
|
15909
16097
|
| {
|
|
15910
16098
|
type: 'delete.backward'
|
|
15911
16099
|
unit: TextUnit
|
|
@@ -16251,6 +16439,10 @@ declare const editorMachine: StateMachine<
|
|
|
16251
16439
|
type: 'decorator.toggle'
|
|
16252
16440
|
decorator: string
|
|
16253
16441
|
}
|
|
16442
|
+
| {
|
|
16443
|
+
type: 'delete'
|
|
16444
|
+
selection: NonNullable<EditorSelection>
|
|
16445
|
+
}
|
|
16254
16446
|
| {
|
|
16255
16447
|
type: 'delete.backward'
|
|
16256
16448
|
unit: TextUnit
|
|
@@ -16540,6 +16732,10 @@ declare const editorMachine: StateMachine<
|
|
|
16540
16732
|
type: 'decorator.toggle'
|
|
16541
16733
|
decorator: string
|
|
16542
16734
|
}
|
|
16735
|
+
| {
|
|
16736
|
+
type: 'delete'
|
|
16737
|
+
selection: NonNullable<EditorSelection>
|
|
16738
|
+
}
|
|
16543
16739
|
| {
|
|
16544
16740
|
type: 'delete.backward'
|
|
16545
16741
|
unit: TextUnit
|
|
@@ -16885,6 +17081,10 @@ declare const editorMachine: StateMachine<
|
|
|
16885
17081
|
type: 'decorator.toggle'
|
|
16886
17082
|
decorator: string
|
|
16887
17083
|
}
|
|
17084
|
+
| {
|
|
17085
|
+
type: 'delete'
|
|
17086
|
+
selection: NonNullable<EditorSelection>
|
|
17087
|
+
}
|
|
16888
17088
|
| {
|
|
16889
17089
|
type: 'delete.backward'
|
|
16890
17090
|
unit: TextUnit
|
|
@@ -17176,6 +17376,10 @@ declare const editorMachine: StateMachine<
|
|
|
17176
17376
|
type: 'decorator.toggle'
|
|
17177
17377
|
decorator: string
|
|
17178
17378
|
}
|
|
17379
|
+
| {
|
|
17380
|
+
type: 'delete'
|
|
17381
|
+
selection: NonNullable<EditorSelection>
|
|
17382
|
+
}
|
|
17179
17383
|
| {
|
|
17180
17384
|
type: 'delete.backward'
|
|
17181
17385
|
unit: TextUnit
|
|
@@ -17521,6 +17725,10 @@ declare const editorMachine: StateMachine<
|
|
|
17521
17725
|
type: 'decorator.toggle'
|
|
17522
17726
|
decorator: string
|
|
17523
17727
|
}
|
|
17728
|
+
| {
|
|
17729
|
+
type: 'delete'
|
|
17730
|
+
selection: NonNullable<EditorSelection>
|
|
17731
|
+
}
|
|
17524
17732
|
| {
|
|
17525
17733
|
type: 'delete.backward'
|
|
17526
17734
|
unit: TextUnit
|
|
@@ -17818,6 +18026,10 @@ declare const editorMachine: StateMachine<
|
|
|
17818
18026
|
type: 'decorator.toggle'
|
|
17819
18027
|
decorator: string
|
|
17820
18028
|
}
|
|
18029
|
+
| {
|
|
18030
|
+
type: 'delete'
|
|
18031
|
+
selection: NonNullable<EditorSelection>
|
|
18032
|
+
}
|
|
17821
18033
|
| {
|
|
17822
18034
|
type: 'delete.backward'
|
|
17823
18035
|
unit: TextUnit
|
|
@@ -18163,6 +18375,10 @@ declare const editorMachine: StateMachine<
|
|
|
18163
18375
|
type: 'decorator.toggle'
|
|
18164
18376
|
decorator: string
|
|
18165
18377
|
}
|
|
18378
|
+
| {
|
|
18379
|
+
type: 'delete'
|
|
18380
|
+
selection: NonNullable<EditorSelection>
|
|
18381
|
+
}
|
|
18166
18382
|
| {
|
|
18167
18383
|
type: 'delete.backward'
|
|
18168
18384
|
unit: TextUnit
|
|
@@ -18460,6 +18676,10 @@ declare const editorMachine: StateMachine<
|
|
|
18460
18676
|
type: 'decorator.toggle'
|
|
18461
18677
|
decorator: string
|
|
18462
18678
|
}
|
|
18679
|
+
| {
|
|
18680
|
+
type: 'delete'
|
|
18681
|
+
selection: NonNullable<EditorSelection>
|
|
18682
|
+
}
|
|
18463
18683
|
| {
|
|
18464
18684
|
type: 'delete.backward'
|
|
18465
18685
|
unit: TextUnit
|
|
@@ -18805,6 +19025,10 @@ declare const editorMachine: StateMachine<
|
|
|
18805
19025
|
type: 'decorator.toggle'
|
|
18806
19026
|
decorator: string
|
|
18807
19027
|
}
|
|
19028
|
+
| {
|
|
19029
|
+
type: 'delete'
|
|
19030
|
+
selection: NonNullable<EditorSelection>
|
|
19031
|
+
}
|
|
18808
19032
|
| {
|
|
18809
19033
|
type: 'delete.backward'
|
|
18810
19034
|
unit: TextUnit
|
|
@@ -19509,11 +19733,46 @@ export declare class PortableTextEditor extends Component<
|
|
|
19509
19733
|
componentDidUpdate(prevProps: PortableTextEditorProps): void
|
|
19510
19734
|
setEditable: (editable: EditableAPI) => void
|
|
19511
19735
|
render(): JSX.Element
|
|
19736
|
+
/**
|
|
19737
|
+
* @deprecated
|
|
19738
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19739
|
+
*
|
|
19740
|
+
* ```
|
|
19741
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19742
|
+
* const editor = useEditor()
|
|
19743
|
+
* const isActive = useEditorSelector(editor, selectors.getActiveAnnotations)
|
|
19744
|
+
* ```
|
|
19745
|
+
*/
|
|
19512
19746
|
static activeAnnotations: (editor: PortableTextEditor) => PortableTextObject[]
|
|
19747
|
+
/**
|
|
19748
|
+
* @deprecated
|
|
19749
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19750
|
+
*
|
|
19751
|
+
* ```
|
|
19752
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19753
|
+
* const editor = useEditor()
|
|
19754
|
+
* const isActive = useEditorSelector(editor, selectors.isActiveAnnotation(...))
|
|
19755
|
+
* ```
|
|
19756
|
+
*/
|
|
19513
19757
|
static isAnnotationActive: (
|
|
19514
19758
|
editor: PortableTextEditor,
|
|
19515
19759
|
annotationType: PortableTextObject['_type'],
|
|
19516
19760
|
) => boolean
|
|
19761
|
+
/**
|
|
19762
|
+
* @deprecated
|
|
19763
|
+
* Use `editor.send(...)` instead
|
|
19764
|
+
*
|
|
19765
|
+
* ```
|
|
19766
|
+
* const editor = useEditor()
|
|
19767
|
+
* editor.send({
|
|
19768
|
+
* type: 'annotation.add',
|
|
19769
|
+
* annotation: {
|
|
19770
|
+
* name: '...',
|
|
19771
|
+
* value: {...},
|
|
19772
|
+
* }
|
|
19773
|
+
* })
|
|
19774
|
+
* ```
|
|
19775
|
+
*/
|
|
19517
19776
|
static addAnnotation: <
|
|
19518
19777
|
TSchemaType extends {
|
|
19519
19778
|
name: string
|
|
@@ -19525,6 +19784,17 @@ export declare class PortableTextEditor extends Component<
|
|
|
19525
19784
|
[prop: string]: unknown
|
|
19526
19785
|
},
|
|
19527
19786
|
) => AddedAnnotationPaths | undefined
|
|
19787
|
+
/**
|
|
19788
|
+
* @deprecated
|
|
19789
|
+
* Use `editor.send(...)` instead
|
|
19790
|
+
*
|
|
19791
|
+
* ```
|
|
19792
|
+
* const editor = useEditor()
|
|
19793
|
+
* editor.send({
|
|
19794
|
+
* type: 'blur',
|
|
19795
|
+
* })
|
|
19796
|
+
* ```
|
|
19797
|
+
*/
|
|
19528
19798
|
static blur: (editor: PortableTextEditor) => void
|
|
19529
19799
|
static delete: (
|
|
19530
19800
|
editor: PortableTextEditor,
|
|
@@ -19547,28 +19817,150 @@ export declare class PortableTextEditor extends Component<
|
|
|
19547
19817
|
),
|
|
19548
19818
|
Path | undefined,
|
|
19549
19819
|
]
|
|
19820
|
+
/**
|
|
19821
|
+
* @deprecated
|
|
19822
|
+
* Use `editor.send(...)` instead
|
|
19823
|
+
*
|
|
19824
|
+
* ```
|
|
19825
|
+
* const editor = useEditor()
|
|
19826
|
+
* editor.send({
|
|
19827
|
+
* type: 'focus',
|
|
19828
|
+
* })
|
|
19829
|
+
* ```
|
|
19830
|
+
*/
|
|
19550
19831
|
static focus: (editor: PortableTextEditor) => void
|
|
19832
|
+
/**
|
|
19833
|
+
* @deprecated
|
|
19834
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19835
|
+
*
|
|
19836
|
+
* ```
|
|
19837
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19838
|
+
* const editor = useEditor()
|
|
19839
|
+
* const focusBlock = useEditorSelector(editor, selectors.getFocusBlock)
|
|
19840
|
+
* ```
|
|
19841
|
+
*/
|
|
19551
19842
|
static focusBlock: (
|
|
19552
19843
|
editor: PortableTextEditor,
|
|
19553
19844
|
) => PortableTextBlock | undefined
|
|
19845
|
+
/**
|
|
19846
|
+
* @deprecated
|
|
19847
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19848
|
+
*
|
|
19849
|
+
* ```
|
|
19850
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19851
|
+
* const editor = useEditor()
|
|
19852
|
+
* const focusChild = useEditorSelector(editor, selectors.getFocusChild)
|
|
19853
|
+
* ```
|
|
19854
|
+
*/
|
|
19554
19855
|
static focusChild: (
|
|
19555
19856
|
editor: PortableTextEditor,
|
|
19556
19857
|
) => PortableTextChild | undefined
|
|
19858
|
+
/**
|
|
19859
|
+
* @deprecated
|
|
19860
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19861
|
+
*
|
|
19862
|
+
* ```
|
|
19863
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19864
|
+
* const editor = useEditor()
|
|
19865
|
+
* const selection = useEditorSelector(editor, selectors.getSelection)
|
|
19866
|
+
* ```
|
|
19867
|
+
*/
|
|
19557
19868
|
static getSelection: (editor: PortableTextEditor) => EditorSelection
|
|
19869
|
+
/**
|
|
19870
|
+
* @deprecated
|
|
19871
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19872
|
+
*
|
|
19873
|
+
* ```
|
|
19874
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19875
|
+
* const editor = useEditor()
|
|
19876
|
+
* const value = useEditorSelector(editor, selectors.getValue)
|
|
19877
|
+
* ```
|
|
19878
|
+
*/
|
|
19558
19879
|
static getValue: (
|
|
19559
19880
|
editor: PortableTextEditor,
|
|
19560
19881
|
) => PortableTextBlock[] | undefined
|
|
19882
|
+
/**
|
|
19883
|
+
* @deprecated
|
|
19884
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19885
|
+
*
|
|
19886
|
+
* ```
|
|
19887
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19888
|
+
* const editor = useEditor()
|
|
19889
|
+
* const isActive = useEditorSelector(editor, selectors.isActiveStyle(...))
|
|
19890
|
+
* ```
|
|
19891
|
+
*/
|
|
19561
19892
|
static hasBlockStyle: (
|
|
19562
19893
|
editor: PortableTextEditor,
|
|
19563
19894
|
blockStyle: string,
|
|
19564
19895
|
) => boolean
|
|
19896
|
+
/**
|
|
19897
|
+
* @deprecated
|
|
19898
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19899
|
+
*
|
|
19900
|
+
* ```
|
|
19901
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19902
|
+
* const editor = useEditor()
|
|
19903
|
+
* const isActive = useEditorSelector(editor, selectors.isActiveListItem(...))
|
|
19904
|
+
* ```
|
|
19905
|
+
*/
|
|
19565
19906
|
static hasListStyle: (
|
|
19566
19907
|
editor: PortableTextEditor,
|
|
19567
19908
|
listStyle: string,
|
|
19568
19909
|
) => boolean
|
|
19910
|
+
/**
|
|
19911
|
+
* @deprecated
|
|
19912
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19913
|
+
*
|
|
19914
|
+
* ```
|
|
19915
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19916
|
+
* const editor = useEditor()
|
|
19917
|
+
* const isSelectionCollapsed = useEditorSelector(editor, selectors.isSelectionCollapsed)
|
|
19918
|
+
* ```
|
|
19919
|
+
*/
|
|
19569
19920
|
static isCollapsedSelection: (editor: PortableTextEditor) => boolean
|
|
19921
|
+
/**
|
|
19922
|
+
* @deprecated
|
|
19923
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19924
|
+
*
|
|
19925
|
+
* ```
|
|
19926
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19927
|
+
* const editor = useEditor()
|
|
19928
|
+
* const isSelectionExpanded = useEditorSelector(editor, selectors.isSelectionExpanded)
|
|
19929
|
+
* ```
|
|
19930
|
+
*/
|
|
19570
19931
|
static isExpandedSelection: (editor: PortableTextEditor) => boolean
|
|
19932
|
+
/**
|
|
19933
|
+
* @deprecated
|
|
19934
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
19935
|
+
*
|
|
19936
|
+
* ```
|
|
19937
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
19938
|
+
* const editor = useEditor()
|
|
19939
|
+
* const isActive = useEditorSelector(editor, selectors.isActiveDecorator(...))
|
|
19940
|
+
* ```
|
|
19941
|
+
*/
|
|
19571
19942
|
static isMarkActive: (editor: PortableTextEditor, mark: string) => boolean
|
|
19943
|
+
/**
|
|
19944
|
+
* @deprecated
|
|
19945
|
+
* Use `editor.send(...)` instead
|
|
19946
|
+
*
|
|
19947
|
+
* ```
|
|
19948
|
+
* const editor = useEditor()
|
|
19949
|
+
* editor.send({
|
|
19950
|
+
* type: 'insert.span',
|
|
19951
|
+
* text: '...',
|
|
19952
|
+
* annotations: [{name: '...', value: {...}}],
|
|
19953
|
+
* decorators: ['...'],
|
|
19954
|
+
* })
|
|
19955
|
+
* editor.send({
|
|
19956
|
+
* type: 'insert.inline object',
|
|
19957
|
+
* inlineObject: {
|
|
19958
|
+
* name: '...',
|
|
19959
|
+
* value: {...},
|
|
19960
|
+
* },
|
|
19961
|
+
* })
|
|
19962
|
+
* ```
|
|
19963
|
+
*/
|
|
19572
19964
|
static insertChild: <
|
|
19573
19965
|
TSchemaType extends {
|
|
19574
19966
|
name: string
|
|
@@ -19580,6 +19972,22 @@ export declare class PortableTextEditor extends Component<
|
|
|
19580
19972
|
[prop: string]: unknown
|
|
19581
19973
|
},
|
|
19582
19974
|
) => Path | undefined
|
|
19975
|
+
/**
|
|
19976
|
+
* @deprecated
|
|
19977
|
+
* Use `editor.send(...)` instead
|
|
19978
|
+
*
|
|
19979
|
+
* ```
|
|
19980
|
+
* const editor = useEditor()
|
|
19981
|
+
* editor.send({
|
|
19982
|
+
* type: 'insert.block object',
|
|
19983
|
+
* blockObject: {
|
|
19984
|
+
* name: '...',
|
|
19985
|
+
* value: {...},
|
|
19986
|
+
* },
|
|
19987
|
+
* placement: 'auto' | 'after' | 'before',
|
|
19988
|
+
* })
|
|
19989
|
+
* ```
|
|
19990
|
+
*/
|
|
19583
19991
|
static insertBlock: <
|
|
19584
19992
|
TSchemaType extends {
|
|
19585
19993
|
name: string
|
|
@@ -19591,6 +19999,17 @@ export declare class PortableTextEditor extends Component<
|
|
|
19591
19999
|
[prop: string]: unknown
|
|
19592
20000
|
},
|
|
19593
20001
|
) => Path | undefined
|
|
20002
|
+
/**
|
|
20003
|
+
* @deprecated
|
|
20004
|
+
* Use `editor.send(...)` instead
|
|
20005
|
+
*
|
|
20006
|
+
* ```
|
|
20007
|
+
* const editor = useEditor()
|
|
20008
|
+
* editor.send({
|
|
20009
|
+
* type: 'insert.break',
|
|
20010
|
+
* })
|
|
20011
|
+
* ```
|
|
20012
|
+
*/
|
|
19594
20013
|
static insertBreak: (editor: PortableTextEditor) => void
|
|
19595
20014
|
static isVoid: (
|
|
19596
20015
|
editor: PortableTextEditor,
|
|
@@ -19598,10 +20017,36 @@ export declare class PortableTextEditor extends Component<
|
|
|
19598
20017
|
) => boolean
|
|
19599
20018
|
static isObjectPath: (_editor: PortableTextEditor, path: Path) => boolean
|
|
19600
20019
|
static marks: (editor: PortableTextEditor) => string[]
|
|
20020
|
+
/**
|
|
20021
|
+
* @deprecated
|
|
20022
|
+
* Use `editor.send(...)` instead
|
|
20023
|
+
*
|
|
20024
|
+
* ```
|
|
20025
|
+
* const editor = useEditor()
|
|
20026
|
+
* editor.send({
|
|
20027
|
+
* type: 'select',
|
|
20028
|
+
* selection: {...},
|
|
20029
|
+
* })
|
|
20030
|
+
* ```
|
|
20031
|
+
*/
|
|
19601
20032
|
static select: (
|
|
19602
20033
|
editor: PortableTextEditor,
|
|
19603
20034
|
selection: EditorSelection | null,
|
|
19604
20035
|
) => void
|
|
20036
|
+
/**
|
|
20037
|
+
* @deprecated
|
|
20038
|
+
* Use `editor.send(...)` instead
|
|
20039
|
+
*
|
|
20040
|
+
* ```
|
|
20041
|
+
* const editor = useEditor()
|
|
20042
|
+
* editor.send({
|
|
20043
|
+
* type: 'annotation.remove',
|
|
20044
|
+
* annotation: {
|
|
20045
|
+
* name: '...',
|
|
20046
|
+
* },
|
|
20047
|
+
* })
|
|
20048
|
+
* ```
|
|
20049
|
+
*/
|
|
19605
20050
|
static removeAnnotation: <
|
|
19606
20051
|
TSchemaType extends {
|
|
19607
20052
|
name: string
|
|
@@ -19610,17 +20055,73 @@ export declare class PortableTextEditor extends Component<
|
|
|
19610
20055
|
editor: PortableTextEditor,
|
|
19611
20056
|
type: TSchemaType,
|
|
19612
20057
|
) => void
|
|
20058
|
+
/**
|
|
20059
|
+
* @deprecated
|
|
20060
|
+
* Use `editor.send(...)` instead
|
|
20061
|
+
*
|
|
20062
|
+
* ```
|
|
20063
|
+
* const editor = useEditor()
|
|
20064
|
+
* editor.send({
|
|
20065
|
+
* type: 'style.toggle',
|
|
20066
|
+
* style: '...',
|
|
20067
|
+
* })
|
|
20068
|
+
* ```
|
|
20069
|
+
*/
|
|
19613
20070
|
static toggleBlockStyle: (
|
|
19614
20071
|
editor: PortableTextEditor,
|
|
19615
20072
|
blockStyle: string,
|
|
19616
20073
|
) => void
|
|
20074
|
+
/**
|
|
20075
|
+
* @deprecated
|
|
20076
|
+
* Use `editor.send(...)` instead
|
|
20077
|
+
*
|
|
20078
|
+
* ```
|
|
20079
|
+
* const editor = useEditor()
|
|
20080
|
+
* editor.send({
|
|
20081
|
+
* type: 'list item.toggle',
|
|
20082
|
+
* listItem: '...',
|
|
20083
|
+
* })
|
|
20084
|
+
* ```
|
|
20085
|
+
*/
|
|
19617
20086
|
static toggleList: (editor: PortableTextEditor, listStyle: string) => void
|
|
20087
|
+
/**
|
|
20088
|
+
* @deprecated
|
|
20089
|
+
* Use `editor.send(...)` instead
|
|
20090
|
+
*
|
|
20091
|
+
* ```
|
|
20092
|
+
* const editor = useEditor()
|
|
20093
|
+
* editor.send({
|
|
20094
|
+
* type: 'decorator.toggle',
|
|
20095
|
+
* decorator: '...',
|
|
20096
|
+
* })
|
|
20097
|
+
* ```
|
|
20098
|
+
*/
|
|
19618
20099
|
static toggleMark: (editor: PortableTextEditor, mark: string) => void
|
|
20100
|
+
/**
|
|
20101
|
+
* @deprecated
|
|
20102
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
20103
|
+
*
|
|
20104
|
+
* ```
|
|
20105
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
20106
|
+
* const editor = useEditor()
|
|
20107
|
+
* const selectedSlice = useEditorSelector(editor, selectors.getSelectedSlice)
|
|
20108
|
+
* ```
|
|
20109
|
+
*/
|
|
19619
20110
|
static getFragment: (
|
|
19620
20111
|
editor: PortableTextEditor,
|
|
19621
20112
|
) => PortableTextBlock[] | undefined
|
|
19622
20113
|
static undo: (editor: PortableTextEditor) => void
|
|
19623
20114
|
static redo: (editor: PortableTextEditor) => void
|
|
20115
|
+
/**
|
|
20116
|
+
* @deprecated
|
|
20117
|
+
* Use built-in selectors or write your own: https://www.portabletext.org/reference/selectors/
|
|
20118
|
+
*
|
|
20119
|
+
* ```
|
|
20120
|
+
* import * as selectors from '@portabletext/editor/selectors'
|
|
20121
|
+
* const editor = useEditor()
|
|
20122
|
+
* const isOverlapping = useEditorSelector(editor, selectors.isOverlappingSelection(selectionB))
|
|
20123
|
+
* ```
|
|
20124
|
+
*/
|
|
19624
20125
|
static isSelectionsOverlapping: (
|
|
19625
20126
|
editor: PortableTextEditor,
|
|
19626
20127
|
selectionA: EditorSelection,
|
|
@@ -19944,6 +20445,10 @@ export declare type SyntheticBehaviorEvent =
|
|
|
19944
20445
|
type: 'decorator.toggle'
|
|
19945
20446
|
decorator: string
|
|
19946
20447
|
}
|
|
20448
|
+
| {
|
|
20449
|
+
type: 'delete'
|
|
20450
|
+
selection: NonNullable<EditorSelection>
|
|
20451
|
+
}
|
|
19947
20452
|
| {
|
|
19948
20453
|
type: 'delete.backward'
|
|
19949
20454
|
unit: TextUnit
|