@portabletext/editor 1.49.13 → 1.50.0
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/index.cjs +7 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +7 -1
- package/lib/index.d.ts +7 -1
- package/lib/index.js +7 -1
- package/lib/index.js.map +1 -1
- package/lib/selectors/index.cjs +95 -1
- package/lib/selectors/index.cjs.map +1 -1
- package/lib/selectors/index.d.cts +25 -0
- package/lib/selectors/index.d.ts +25 -0
- package/lib/selectors/index.js +97 -3
- package/lib/selectors/index.js.map +1 -1
- package/package.json +1 -1
- package/src/editor/__tests__/PortableTextEditor.test.tsx +1 -0
- package/src/editor/components/render-text-block.tsx +15 -0
- package/src/selectors/index.ts +1 -0
- package/src/selectors/selector.get-list-state.test.ts +202 -0
- package/src/selectors/selector.get-list-state.ts +175 -0
- package/src/types/editor.ts +2 -1
- package/src/types/paths.ts +1 -0
package/lib/index.d.cts
CHANGED
|
@@ -417,6 +417,12 @@ export declare type BlockOffset = {
|
|
|
417
417
|
offset: number
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
+
declare type BlockPath = [
|
|
421
|
+
{
|
|
422
|
+
_key: string
|
|
423
|
+
},
|
|
424
|
+
]
|
|
425
|
+
|
|
420
426
|
/** @beta */
|
|
421
427
|
export declare interface BlockRenderProps {
|
|
422
428
|
children: ReactElement<any>
|
|
@@ -424,7 +430,7 @@ export declare interface BlockRenderProps {
|
|
|
424
430
|
focused: boolean
|
|
425
431
|
level?: number
|
|
426
432
|
listItem?: string
|
|
427
|
-
path:
|
|
433
|
+
path: BlockPath
|
|
428
434
|
selected: boolean
|
|
429
435
|
style?: string
|
|
430
436
|
schemaType: ObjectSchemaType
|
package/lib/index.d.ts
CHANGED
|
@@ -417,6 +417,12 @@ export declare type BlockOffset = {
|
|
|
417
417
|
offset: number
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
+
declare type BlockPath = [
|
|
421
|
+
{
|
|
422
|
+
_key: string
|
|
423
|
+
},
|
|
424
|
+
]
|
|
425
|
+
|
|
420
426
|
/** @beta */
|
|
421
427
|
export declare interface BlockRenderProps {
|
|
422
428
|
children: ReactElement<any>
|
|
@@ -424,7 +430,7 @@ export declare interface BlockRenderProps {
|
|
|
424
430
|
focused: boolean
|
|
425
431
|
level?: number
|
|
426
432
|
listItem?: string
|
|
427
|
-
path:
|
|
433
|
+
path: BlockPath
|
|
428
434
|
selected: boolean
|
|
429
435
|
style?: string
|
|
430
436
|
schemaType: ObjectSchemaType
|
package/lib/index.js
CHANGED
|
@@ -978,7 +978,13 @@ function RenderTextBlock(props) {
|
|
|
978
978
|
schemaType: legacyListItemSchemaType
|
|
979
979
|
}) : console.error(`Unable to find Schema type for text block list item ${props.textBlock.listItem}`);
|
|
980
980
|
}
|
|
981
|
-
return /* @__PURE__ */ jsxs("div", { ...props.attributes, className: ["pt-block", "pt-text-block", ...props.textBlock.style ? [`pt-text-block-style-${props.textBlock.style}`] : [], ...props.textBlock.listItem ? ["pt-list-item", `pt-list-item-${props.textBlock.listItem}`, `pt-list-item-level-${props.textBlock.level ?? 1}`] : []].join(" "), spellCheck: props.spellCheck, "data-block-key": props.textBlock._key, "data-block-name": props.textBlock._type, "data-block-type": "text",
|
|
981
|
+
return /* @__PURE__ */ jsxs("div", { ...props.attributes, className: ["pt-block", "pt-text-block", ...props.textBlock.style ? [`pt-text-block-style-${props.textBlock.style}`] : [], ...props.textBlock.listItem ? ["pt-list-item", `pt-list-item-${props.textBlock.listItem}`, `pt-list-item-level-${props.textBlock.level ?? 1}`] : []].join(" "), spellCheck: props.spellCheck, "data-block-key": props.textBlock._key, "data-block-name": props.textBlock._type, "data-block-type": "text", ...props.textBlock.listItem !== void 0 ? {
|
|
982
|
+
"data-list-item": props.textBlock.listItem
|
|
983
|
+
} : {}, ...props.textBlock.level !== void 0 ? {
|
|
984
|
+
"data-level": props.textBlock.level
|
|
985
|
+
} : {}, ...props.textBlock.style !== void 0 ? {
|
|
986
|
+
"data-style": props.textBlock.style
|
|
987
|
+
} : {}, children: [
|
|
982
988
|
dragPositionBlock === "start" ? /* @__PURE__ */ jsx(DropIndicator, {}) : null,
|
|
983
989
|
/* @__PURE__ */ jsx("div", { ref: blockRef, children: props.renderBlock ? props.renderBlock({
|
|
984
990
|
children,
|