@portabletext/editor 1.40.0 → 1.40.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.
@@ -2418,7 +2418,12 @@ const converterJson = {
2418
2418
  blocks: snapshot.context.value,
2419
2419
  selection
2420
2420
  });
2421
- return {
2421
+ return blocks.length === 0 ? {
2422
+ type: "serialization.failure",
2423
+ mimeType: "application/x-portable-text",
2424
+ reason: "No blocks serialized",
2425
+ originEvent: event.originEvent
2426
+ } : {
2422
2427
  type: "serialization.success",
2423
2428
  data: JSON.stringify(blocks),
2424
2429
  mimeType: "application/x-portable-text",
@@ -2527,7 +2532,7 @@ const converterJson = {
2527
2532
  data: util_sliceBlocks.sliceBlocks({
2528
2533
  blocks: snapshot.context.value,
2529
2534
  selection
2530
- }).map((block) => types.isPortableTextTextBlock(block) ? block.children.map((child) => child._type === snapshot.context.schema.span.name ? child.text : `[${snapshot.context.schema.inlineObjects.find((inlineObjectType) => inlineObjectType.name === child._type)?.title ?? "Object"}]`).join("") : `[${snapshot.context.schema.blockObjects.find((blockObjectType) => blockObjectType.name === block._type)?.title ?? "Object"}]`).join(`
2535
+ }).map((block) => types.isPortableTextTextBlock(block) ? block.children.map((child) => child._type === snapshot.context.schema.span.name ? child.text : "").join("") : "").filter((block) => block !== "").join(`
2531
2536
 
2532
2537
  `),
2533
2538
  mimeType: "text/plain",
@@ -5266,12 +5271,9 @@ function createWithEventListeners(editorActor, subscriptions) {
5266
5271
  editorActor.send({
5267
5272
  type: "behavior event",
5268
5273
  behaviorEvent: {
5269
- type: "deserialize",
5274
+ type: "input.*",
5270
5275
  originEvent: {
5271
- type: "input.*",
5272
- originEvent: {
5273
- dataTransfer
5274
- }
5276
+ dataTransfer
5275
5277
  }
5276
5278
  },
5277
5279
  editor