@portabletext/editor 1.40.0 → 1.40.1
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/editor-provider.cjs +9 -7
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +9 -7
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/index.cjs +2 -2
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/converters/converter.portable-text.ts +9 -0
- package/src/converters/converter.text-plain.test.ts +5 -5
- package/src/converters/converter.text-plain.ts +12 -19
- package/src/editor/components/Element.tsx +2 -7
- package/src/editor/plugins/create-with-event-listeners.ts +2 -5
|
@@ -2443,7 +2443,12 @@ const converterJson = {
|
|
|
2443
2443
|
blocks: snapshot.context.value,
|
|
2444
2444
|
selection
|
|
2445
2445
|
});
|
|
2446
|
-
return {
|
|
2446
|
+
return blocks.length === 0 ? {
|
|
2447
|
+
type: "serialization.failure",
|
|
2448
|
+
mimeType: "application/x-portable-text",
|
|
2449
|
+
reason: "No blocks serialized",
|
|
2450
|
+
originEvent: event.originEvent
|
|
2451
|
+
} : {
|
|
2447
2452
|
type: "serialization.success",
|
|
2448
2453
|
data: JSON.stringify(blocks),
|
|
2449
2454
|
mimeType: "application/x-portable-text",
|
|
@@ -2552,7 +2557,7 @@ const converterJson = {
|
|
|
2552
2557
|
data: sliceBlocks({
|
|
2553
2558
|
blocks: snapshot.context.value,
|
|
2554
2559
|
selection
|
|
2555
|
-
}).map((block) => isPortableTextTextBlock(block) ? block.children.map((child) => child._type === snapshot.context.schema.span.name ? child.text :
|
|
2560
|
+
}).map((block) => isPortableTextTextBlock(block) ? block.children.map((child) => child._type === snapshot.context.schema.span.name ? child.text : "").join("") : "").filter((block) => block !== "").join(`
|
|
2556
2561
|
|
|
2557
2562
|
`),
|
|
2558
2563
|
mimeType: "text/plain",
|
|
@@ -5291,12 +5296,9 @@ function createWithEventListeners(editorActor, subscriptions) {
|
|
|
5291
5296
|
editorActor.send({
|
|
5292
5297
|
type: "behavior event",
|
|
5293
5298
|
behaviorEvent: {
|
|
5294
|
-
type: "
|
|
5299
|
+
type: "input.*",
|
|
5295
5300
|
originEvent: {
|
|
5296
|
-
|
|
5297
|
-
originEvent: {
|
|
5298
|
-
dataTransfer
|
|
5299
|
-
}
|
|
5301
|
+
dataTransfer
|
|
5300
5302
|
}
|
|
5301
5303
|
},
|
|
5302
5304
|
editor
|