@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.
- package/lib/_chunks-cjs/editor-provider.cjs +9 -7
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/selector.is-overlapping-selection.cjs +3 -2
- package/lib/_chunks-cjs/selector.is-overlapping-selection.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/_chunks-es/selector.is-overlapping-selection.js +3 -2
- package/lib/_chunks-es/selector.is-overlapping-selection.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 +2 -2
- 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
- package/src/selectors/selector.get-selected-spans.test.ts +33 -0
- package/src/selectors/selector.get-selected-spans.ts +7 -1
- package/src/selectors/selector.is-active-decorator.test.ts +100 -27
|
@@ -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 :
|
|
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: "
|
|
5274
|
+
type: "input.*",
|
|
5270
5275
|
originEvent: {
|
|
5271
|
-
|
|
5272
|
-
originEvent: {
|
|
5273
|
-
dataTransfer
|
|
5274
|
-
}
|
|
5276
|
+
dataTransfer
|
|
5275
5277
|
}
|
|
5276
5278
|
},
|
|
5277
5279
|
editor
|