@portabletext/editor 1.49.11 → 1.49.13

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.
@@ -622,6 +622,7 @@ declare type EditorEmittedEvent =
622
622
  | {
623
623
  type: 'editable'
624
624
  }
625
+ | ErrorEvent_2
625
626
  | {
626
627
  type: 'focused'
627
628
  event: FocusEvent_2<HTMLDivElement, Element>
@@ -869,6 +870,12 @@ declare const editorMachine: StateMachine<
869
870
  | {
870
871
  type: 'editable'
871
872
  }
873
+ | {
874
+ type: 'error'
875
+ name: string
876
+ description: string
877
+ data: unknown
878
+ }
872
879
  | {
873
880
  type: 'focused'
874
881
  event: FocusEvent_2<HTMLDivElement, Element>
@@ -1293,6 +1300,142 @@ declare const editorMachine: StateMachine<
1293
1300
  never,
1294
1301
  never
1295
1302
  >,
1303
+ ActionFunction<
1304
+ {
1305
+ behaviors: Set<BehaviorConfig>
1306
+ converters: Set<Converter>
1307
+ getLegacySchema: () => PortableTextMemberSchemaTypes
1308
+ keyGenerator: () => string
1309
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1310
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
1311
+ schema: EditorSchema
1312
+ initialReadOnly: boolean
1313
+ maxBlocks: number | undefined
1314
+ selection: EditorSelection
1315
+ initialValue: Array<PortableTextBlock> | undefined
1316
+ internalDrag?: {
1317
+ ghost?: HTMLElement
1318
+ origin: Pick<EventPosition, 'selection'>
1319
+ }
1320
+ slateEditor?: PortableTextSlateEditor
1321
+ },
1322
+ {
1323
+ type: 'update selection'
1324
+ selection: EditorSelection
1325
+ },
1326
+ | InternalPatchEvent
1327
+ | MutationEvent
1328
+ | PatchesEvent
1329
+ | {
1330
+ type: 'update readOnly'
1331
+ readOnly: boolean
1332
+ }
1333
+ | {
1334
+ type: 'update maxBlocks'
1335
+ maxBlocks: number | undefined
1336
+ }
1337
+ | {
1338
+ type: 'add behavior'
1339
+ behaviorConfig: BehaviorConfig
1340
+ }
1341
+ | {
1342
+ type: 'remove behavior'
1343
+ behaviorConfig: BehaviorConfig
1344
+ }
1345
+ | {
1346
+ type: 'blur'
1347
+ editor: PortableTextSlateEditor
1348
+ }
1349
+ | {
1350
+ type: 'focus'
1351
+ editor: PortableTextSlateEditor
1352
+ }
1353
+ | {
1354
+ type: 'normalizing'
1355
+ }
1356
+ | {
1357
+ type: 'update selection'
1358
+ selection: EditorSelection
1359
+ }
1360
+ | {
1361
+ type: 'done normalizing'
1362
+ }
1363
+ | {
1364
+ type: 'done syncing value'
1365
+ }
1366
+ | {
1367
+ type: 'syncing value'
1368
+ }
1369
+ | {
1370
+ type: 'behavior event'
1371
+ behaviorEvent: BehaviorEvent
1372
+ editor: PortableTextSlateEditor
1373
+ nativeEvent?: {
1374
+ preventDefault: () => void
1375
+ }
1376
+ }
1377
+ | {
1378
+ type: 'dragstart'
1379
+ origin: Pick<EventPosition, 'selection'>
1380
+ ghost?: HTMLElement
1381
+ }
1382
+ | {
1383
+ type: 'dragend'
1384
+ }
1385
+ | {
1386
+ type: 'drop'
1387
+ },
1388
+ undefined,
1389
+ never,
1390
+ never,
1391
+ never,
1392
+ never,
1393
+ | InternalPatchEvent
1394
+ | MutationEvent
1395
+ | PatchesEvent
1396
+ | {
1397
+ type: 'blurred'
1398
+ event: FocusEvent_2<HTMLDivElement, Element>
1399
+ }
1400
+ | {
1401
+ type: 'done loading'
1402
+ }
1403
+ | {
1404
+ type: 'editable'
1405
+ }
1406
+ | {
1407
+ type: 'error'
1408
+ name: string
1409
+ description: string
1410
+ data: unknown
1411
+ }
1412
+ | {
1413
+ type: 'focused'
1414
+ event: FocusEvent_2<HTMLDivElement, Element>
1415
+ }
1416
+ | {
1417
+ type: 'invalid value'
1418
+ resolution: InvalidValueResolution | null
1419
+ value: Array<PortableTextBlock> | undefined
1420
+ }
1421
+ | {
1422
+ type: 'loading'
1423
+ }
1424
+ | {
1425
+ type: 'read only'
1426
+ }
1427
+ | {
1428
+ type: 'ready'
1429
+ }
1430
+ | {
1431
+ type: 'selection'
1432
+ selection: EditorSelection
1433
+ }
1434
+ | {
1435
+ type: 'value changed'
1436
+ value: Array<PortableTextBlock> | undefined
1437
+ }
1438
+ >,
1296
1439
  ]
1297
1440
  }
1298
1441
  }
@@ -2145,6 +2288,12 @@ declare const editorMachine: StateMachine<
2145
2288
  | {
2146
2289
  type: 'editable'
2147
2290
  }
2291
+ | {
2292
+ type: 'error'
2293
+ name: string
2294
+ description: string
2295
+ data: unknown
2296
+ }
2148
2297
  | {
2149
2298
  type: 'focused'
2150
2299
  event: FocusEvent_2<HTMLDivElement, Element>
@@ -2374,6 +2523,16 @@ declare type EditorSnapshot = {
2374
2523
  }
2375
2524
  }
2376
2525
 
2526
+ /**
2527
+ * @deprecated The event is no longer emitted
2528
+ */
2529
+ declare type ErrorEvent_2 = {
2530
+ type: 'error'
2531
+ name: string
2532
+ description: string
2533
+ data: unknown
2534
+ }
2535
+
2377
2536
  /**
2378
2537
  * @public
2379
2538
  * Listen for events emitted by the editor. Must be used inside `EditorProvider`. Events available include:
@@ -622,6 +622,7 @@ declare type EditorEmittedEvent =
622
622
  | {
623
623
  type: 'editable'
624
624
  }
625
+ | ErrorEvent_2
625
626
  | {
626
627
  type: 'focused'
627
628
  event: FocusEvent_2<HTMLDivElement, Element>
@@ -869,6 +870,12 @@ declare const editorMachine: StateMachine<
869
870
  | {
870
871
  type: 'editable'
871
872
  }
873
+ | {
874
+ type: 'error'
875
+ name: string
876
+ description: string
877
+ data: unknown
878
+ }
872
879
  | {
873
880
  type: 'focused'
874
881
  event: FocusEvent_2<HTMLDivElement, Element>
@@ -1293,6 +1300,142 @@ declare const editorMachine: StateMachine<
1293
1300
  never,
1294
1301
  never
1295
1302
  >,
1303
+ ActionFunction<
1304
+ {
1305
+ behaviors: Set<BehaviorConfig>
1306
+ converters: Set<Converter>
1307
+ getLegacySchema: () => PortableTextMemberSchemaTypes
1308
+ keyGenerator: () => string
1309
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1310
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
1311
+ schema: EditorSchema
1312
+ initialReadOnly: boolean
1313
+ maxBlocks: number | undefined
1314
+ selection: EditorSelection
1315
+ initialValue: Array<PortableTextBlock> | undefined
1316
+ internalDrag?: {
1317
+ ghost?: HTMLElement
1318
+ origin: Pick<EventPosition, 'selection'>
1319
+ }
1320
+ slateEditor?: PortableTextSlateEditor
1321
+ },
1322
+ {
1323
+ type: 'update selection'
1324
+ selection: EditorSelection
1325
+ },
1326
+ | InternalPatchEvent
1327
+ | MutationEvent
1328
+ | PatchesEvent
1329
+ | {
1330
+ type: 'update readOnly'
1331
+ readOnly: boolean
1332
+ }
1333
+ | {
1334
+ type: 'update maxBlocks'
1335
+ maxBlocks: number | undefined
1336
+ }
1337
+ | {
1338
+ type: 'add behavior'
1339
+ behaviorConfig: BehaviorConfig
1340
+ }
1341
+ | {
1342
+ type: 'remove behavior'
1343
+ behaviorConfig: BehaviorConfig
1344
+ }
1345
+ | {
1346
+ type: 'blur'
1347
+ editor: PortableTextSlateEditor
1348
+ }
1349
+ | {
1350
+ type: 'focus'
1351
+ editor: PortableTextSlateEditor
1352
+ }
1353
+ | {
1354
+ type: 'normalizing'
1355
+ }
1356
+ | {
1357
+ type: 'update selection'
1358
+ selection: EditorSelection
1359
+ }
1360
+ | {
1361
+ type: 'done normalizing'
1362
+ }
1363
+ | {
1364
+ type: 'done syncing value'
1365
+ }
1366
+ | {
1367
+ type: 'syncing value'
1368
+ }
1369
+ | {
1370
+ type: 'behavior event'
1371
+ behaviorEvent: BehaviorEvent
1372
+ editor: PortableTextSlateEditor
1373
+ nativeEvent?: {
1374
+ preventDefault: () => void
1375
+ }
1376
+ }
1377
+ | {
1378
+ type: 'dragstart'
1379
+ origin: Pick<EventPosition, 'selection'>
1380
+ ghost?: HTMLElement
1381
+ }
1382
+ | {
1383
+ type: 'dragend'
1384
+ }
1385
+ | {
1386
+ type: 'drop'
1387
+ },
1388
+ undefined,
1389
+ never,
1390
+ never,
1391
+ never,
1392
+ never,
1393
+ | InternalPatchEvent
1394
+ | MutationEvent
1395
+ | PatchesEvent
1396
+ | {
1397
+ type: 'blurred'
1398
+ event: FocusEvent_2<HTMLDivElement, Element>
1399
+ }
1400
+ | {
1401
+ type: 'done loading'
1402
+ }
1403
+ | {
1404
+ type: 'editable'
1405
+ }
1406
+ | {
1407
+ type: 'error'
1408
+ name: string
1409
+ description: string
1410
+ data: unknown
1411
+ }
1412
+ | {
1413
+ type: 'focused'
1414
+ event: FocusEvent_2<HTMLDivElement, Element>
1415
+ }
1416
+ | {
1417
+ type: 'invalid value'
1418
+ resolution: InvalidValueResolution | null
1419
+ value: Array<PortableTextBlock> | undefined
1420
+ }
1421
+ | {
1422
+ type: 'loading'
1423
+ }
1424
+ | {
1425
+ type: 'read only'
1426
+ }
1427
+ | {
1428
+ type: 'ready'
1429
+ }
1430
+ | {
1431
+ type: 'selection'
1432
+ selection: EditorSelection
1433
+ }
1434
+ | {
1435
+ type: 'value changed'
1436
+ value: Array<PortableTextBlock> | undefined
1437
+ }
1438
+ >,
1296
1439
  ]
1297
1440
  }
1298
1441
  }
@@ -2145,6 +2288,12 @@ declare const editorMachine: StateMachine<
2145
2288
  | {
2146
2289
  type: 'editable'
2147
2290
  }
2291
+ | {
2292
+ type: 'error'
2293
+ name: string
2294
+ description: string
2295
+ data: unknown
2296
+ }
2148
2297
  | {
2149
2298
  type: 'focused'
2150
2299
  event: FocusEvent_2<HTMLDivElement, Element>
@@ -2374,6 +2523,16 @@ declare type EditorSnapshot = {
2374
2523
  }
2375
2524
  }
2376
2525
 
2526
+ /**
2527
+ * @deprecated The event is no longer emitted
2528
+ */
2529
+ declare type ErrorEvent_2 = {
2530
+ type: 'error'
2531
+ name: string
2532
+ description: string
2533
+ data: unknown
2534
+ }
2535
+
2377
2536
  /**
2378
2537
  * @public
2379
2538
  * Listen for events emitted by the editor. Must be used inside `EditorProvider`. Events available include:
@@ -780,6 +780,12 @@ declare const editorMachine: StateMachine<
780
780
  | {
781
781
  type: 'editable'
782
782
  }
783
+ | {
784
+ type: 'error'
785
+ name: string
786
+ description: string
787
+ data: unknown
788
+ }
783
789
  | {
784
790
  type: 'focused'
785
791
  event: FocusEvent_2<HTMLDivElement, Element>
@@ -1204,6 +1210,142 @@ declare const editorMachine: StateMachine<
1204
1210
  never,
1205
1211
  never
1206
1212
  >,
1213
+ ActionFunction<
1214
+ {
1215
+ behaviors: Set<BehaviorConfig>
1216
+ converters: Set<Converter>
1217
+ getLegacySchema: () => PortableTextMemberSchemaTypes
1218
+ keyGenerator: () => string
1219
+ pendingEvents: Array<InternalPatchEvent | MutationEvent>
1220
+ pendingIncomingPatchesEvents: Array<PatchesEvent>
1221
+ schema: EditorSchema
1222
+ initialReadOnly: boolean
1223
+ maxBlocks: number | undefined
1224
+ selection: EditorSelection
1225
+ initialValue: Array<PortableTextBlock> | undefined
1226
+ internalDrag?: {
1227
+ ghost?: HTMLElement
1228
+ origin: Pick<EventPosition, 'selection'>
1229
+ }
1230
+ slateEditor?: PortableTextSlateEditor
1231
+ },
1232
+ {
1233
+ type: 'update selection'
1234
+ selection: EditorSelection
1235
+ },
1236
+ | InternalPatchEvent
1237
+ | MutationEvent
1238
+ | PatchesEvent
1239
+ | {
1240
+ type: 'update readOnly'
1241
+ readOnly: boolean
1242
+ }
1243
+ | {
1244
+ type: 'update maxBlocks'
1245
+ maxBlocks: number | undefined
1246
+ }
1247
+ | {
1248
+ type: 'add behavior'
1249
+ behaviorConfig: BehaviorConfig
1250
+ }
1251
+ | {
1252
+ type: 'remove behavior'
1253
+ behaviorConfig: BehaviorConfig
1254
+ }
1255
+ | {
1256
+ type: 'blur'
1257
+ editor: PortableTextSlateEditor
1258
+ }
1259
+ | {
1260
+ type: 'focus'
1261
+ editor: PortableTextSlateEditor
1262
+ }
1263
+ | {
1264
+ type: 'normalizing'
1265
+ }
1266
+ | {
1267
+ type: 'update selection'
1268
+ selection: EditorSelection
1269
+ }
1270
+ | {
1271
+ type: 'done normalizing'
1272
+ }
1273
+ | {
1274
+ type: 'done syncing value'
1275
+ }
1276
+ | {
1277
+ type: 'syncing value'
1278
+ }
1279
+ | {
1280
+ type: 'behavior event'
1281
+ behaviorEvent: BehaviorEvent
1282
+ editor: PortableTextSlateEditor
1283
+ nativeEvent?: {
1284
+ preventDefault: () => void
1285
+ }
1286
+ }
1287
+ | {
1288
+ type: 'dragstart'
1289
+ origin: Pick<EventPosition, 'selection'>
1290
+ ghost?: HTMLElement
1291
+ }
1292
+ | {
1293
+ type: 'dragend'
1294
+ }
1295
+ | {
1296
+ type: 'drop'
1297
+ },
1298
+ undefined,
1299
+ never,
1300
+ never,
1301
+ never,
1302
+ never,
1303
+ | InternalPatchEvent
1304
+ | MutationEvent
1305
+ | PatchesEvent
1306
+ | {
1307
+ type: 'blurred'
1308
+ event: FocusEvent_2<HTMLDivElement, Element>
1309
+ }
1310
+ | {
1311
+ type: 'done loading'
1312
+ }
1313
+ | {
1314
+ type: 'editable'
1315
+ }
1316
+ | {
1317
+ type: 'error'
1318
+ name: string
1319
+ description: string
1320
+ data: unknown
1321
+ }
1322
+ | {
1323
+ type: 'focused'
1324
+ event: FocusEvent_2<HTMLDivElement, Element>
1325
+ }
1326
+ | {
1327
+ type: 'invalid value'
1328
+ resolution: InvalidValueResolution | null
1329
+ value: Array<PortableTextBlock> | undefined
1330
+ }
1331
+ | {
1332
+ type: 'loading'
1333
+ }
1334
+ | {
1335
+ type: 'read only'
1336
+ }
1337
+ | {
1338
+ type: 'ready'
1339
+ }
1340
+ | {
1341
+ type: 'selection'
1342
+ selection: EditorSelection
1343
+ }
1344
+ | {
1345
+ type: 'value changed'
1346
+ value: Array<PortableTextBlock> | undefined
1347
+ }
1348
+ >,
1207
1349
  ]
1208
1350
  }
1209
1351
  }
@@ -2056,6 +2198,12 @@ declare const editorMachine: StateMachine<
2056
2198
  | {
2057
2199
  type: 'editable'
2058
2200
  }
2201
+ | {
2202
+ type: 'error'
2203
+ name: string
2204
+ description: string
2205
+ data: unknown
2206
+ }
2059
2207
  | {
2060
2208
  type: 'focused'
2061
2209
  event: FocusEvent_2<HTMLDivElement, Element>