@portabletext/editor 1.49.0 → 1.49.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 +22 -11
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs +2 -1
- package/lib/_chunks-cjs/util.merge-text-blocks.cjs.map +1 -1
- package/lib/_chunks-cjs/util.slice-blocks.cjs +26 -8
- package/lib/_chunks-cjs/util.slice-blocks.cjs.map +1 -1
- package/lib/_chunks-es/editor-provider.js +22 -11
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/_chunks-es/util.merge-text-blocks.js +2 -1
- package/lib/_chunks-es/util.merge-text-blocks.js.map +1 -1
- package/lib/_chunks-es/util.slice-blocks.js +26 -8
- package/lib/_chunks-es/util.slice-blocks.js.map +1 -1
- package/lib/index.cjs +155 -158
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +160 -163
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
- package/src/behaviors/behavior.abstract.split.ts +2 -2
- package/src/converters/converter.portable-text.ts +1 -0
- package/src/converters/converter.text-html.ts +1 -0
- package/src/converters/converter.text-plain.ts +1 -0
- package/src/editor/Editable.tsx +20 -48
- package/src/editor/__tests__/PortableTextEditor.test.tsx +3 -3
- package/src/editor/__tests__/RangeDecorations.test.tsx +2 -2
- package/src/editor/components/render-block-object.tsx +0 -1
- package/src/editor/components/render-element.tsx +3 -3
- package/src/editor/components/render-inline-object.tsx +9 -12
- package/src/editor/components/render-leaf.tsx +64 -0
- package/src/editor/components/render-span.tsx +260 -0
- package/src/editor/components/render-text-block.tsx +0 -1
- package/src/editor/components/render-text.tsx +18 -0
- package/src/internal-utils/parse-blocks.test.ts +20 -20
- package/src/internal-utils/parse-blocks.ts +57 -20
- package/src/operations/behavior.operation.annotation.add.ts +1 -1
- package/src/operations/behavior.operation.block.set.ts +1 -1
- package/src/operations/behavior.operation.block.unset.ts +2 -2
- package/src/operations/behavior.operation.insert-inline-object.ts +1 -1
- package/src/operations/behavior.operation.insert.block.ts +1 -1
- package/src/selectors/selector.get-trimmed-selection.test.ts +1 -0
- package/src/utils/util.merge-text-blocks.ts +1 -1
- package/src/editor/components/Leaf.tsx +0 -336
|
@@ -2244,7 +2244,8 @@ const converterJson = {
|
|
|
2244
2244
|
* If we are dragging internally then we would like to keep the
|
|
2245
2245
|
* dropped portable text as is.
|
|
2246
2246
|
*/
|
|
2247
|
-
refreshKeys: !snapshot.beta.hasTag?.("dragging internally")
|
|
2247
|
+
refreshKeys: !snapshot.beta.hasTag?.("dragging internally"),
|
|
2248
|
+
validateFields: !1
|
|
2248
2249
|
}
|
|
2249
2250
|
});
|
|
2250
2251
|
return parsedBlock ? [parsedBlock] : [];
|
|
@@ -2313,7 +2314,8 @@ function createConverterTextHtml(legacySchema) {
|
|
|
2313
2314
|
context: snapshot.context,
|
|
2314
2315
|
block,
|
|
2315
2316
|
options: {
|
|
2316
|
-
refreshKeys: !1
|
|
2317
|
+
refreshKeys: !1,
|
|
2318
|
+
validateFields: !0
|
|
2317
2319
|
}
|
|
2318
2320
|
});
|
|
2319
2321
|
return parsedBlock ? [parsedBlock] : [];
|
|
@@ -2369,7 +2371,8 @@ function createConverterTextPlain(legacySchema) {
|
|
|
2369
2371
|
context: snapshot.context,
|
|
2370
2372
|
block,
|
|
2371
2373
|
options: {
|
|
2372
|
-
refreshKeys: !1
|
|
2374
|
+
refreshKeys: !1,
|
|
2375
|
+
validateFields: !0
|
|
2373
2376
|
}
|
|
2374
2377
|
});
|
|
2375
2378
|
return parsedBlock ? [parsedBlock] : [];
|
|
@@ -3331,7 +3334,8 @@ const addAnnotationOperationImplementation = ({
|
|
|
3331
3334
|
},
|
|
3332
3335
|
context,
|
|
3333
3336
|
options: {
|
|
3334
|
-
refreshKeys: !1
|
|
3337
|
+
refreshKeys: !1,
|
|
3338
|
+
validateFields: !0
|
|
3335
3339
|
}
|
|
3336
3340
|
});
|
|
3337
3341
|
if (!parsedAnnotation)
|
|
@@ -3529,7 +3533,8 @@ const blockSetOperationImplementation = ({
|
|
|
3529
3533
|
...filteredProps
|
|
3530
3534
|
},
|
|
3531
3535
|
options: {
|
|
3532
|
-
refreshKeys: !1
|
|
3536
|
+
refreshKeys: !1,
|
|
3537
|
+
validateFields: !0
|
|
3533
3538
|
}
|
|
3534
3539
|
});
|
|
3535
3540
|
if (!updatedBlock)
|
|
@@ -3571,7 +3576,8 @@ const blockSetOperationImplementation = ({
|
|
|
3571
3576
|
context,
|
|
3572
3577
|
block: omit__default.default(parsedBlock, propsToRemove),
|
|
3573
3578
|
options: {
|
|
3574
|
-
refreshKeys: !1
|
|
3579
|
+
refreshKeys: !1,
|
|
3580
|
+
validateFields: !0
|
|
3575
3581
|
}
|
|
3576
3582
|
});
|
|
3577
3583
|
if (!updatedTextBlock)
|
|
@@ -3588,7 +3594,8 @@ const blockSetOperationImplementation = ({
|
|
|
3588
3594
|
context,
|
|
3589
3595
|
block: omit__default.default(parsedBlock, operation.props.filter((prop) => prop !== "_type")),
|
|
3590
3596
|
options: {
|
|
3591
|
-
refreshKeys: !1
|
|
3597
|
+
refreshKeys: !1,
|
|
3598
|
+
validateFields: !0
|
|
3592
3599
|
}
|
|
3593
3600
|
});
|
|
3594
3601
|
if (!updatedBlockObject)
|
|
@@ -3793,7 +3800,8 @@ const blockSetOperationImplementation = ({
|
|
|
3793
3800
|
...operation.inlineObject.value ?? {}
|
|
3794
3801
|
},
|
|
3795
3802
|
options: {
|
|
3796
|
-
refreshKeys: !1
|
|
3803
|
+
refreshKeys: !1,
|
|
3804
|
+
validateFields: !0
|
|
3797
3805
|
}
|
|
3798
3806
|
});
|
|
3799
3807
|
if (!parsedInlineObject)
|
|
@@ -3859,7 +3867,8 @@ const blockSetOperationImplementation = ({
|
|
|
3859
3867
|
block: operation.block,
|
|
3860
3868
|
context,
|
|
3861
3869
|
options: {
|
|
3862
|
-
refreshKeys: !1
|
|
3870
|
+
refreshKeys: !1,
|
|
3871
|
+
validateFields: !0
|
|
3863
3872
|
}
|
|
3864
3873
|
});
|
|
3865
3874
|
if (!parsedBlock)
|
|
@@ -6931,7 +6940,8 @@ const arrowDownOnLonelyBlockObject = behaviors_index.defineBehavior({
|
|
|
6931
6940
|
}).at(0),
|
|
6932
6941
|
context: snapshot.context,
|
|
6933
6942
|
options: {
|
|
6934
|
-
refreshKeys: !0
|
|
6943
|
+
refreshKeys: !0,
|
|
6944
|
+
validateFields: !0
|
|
6935
6945
|
}
|
|
6936
6946
|
});
|
|
6937
6947
|
return !newTextBlock || !util_sliceBlocks.isTextBlock(snapshot.context, newTextBlock) ? !1 : {
|
|
@@ -6959,7 +6969,8 @@ const arrowDownOnLonelyBlockObject = behaviors_index.defineBehavior({
|
|
|
6959
6969
|
},
|
|
6960
6970
|
context: snapshot.context,
|
|
6961
6971
|
options: {
|
|
6962
|
-
refreshKeys: !0
|
|
6972
|
+
refreshKeys: !0,
|
|
6973
|
+
validateFields: !0
|
|
6963
6974
|
}
|
|
6964
6975
|
});
|
|
6965
6976
|
return newTextBlock ? {
|