@portabletext/editor 1.41.1 → 1.41.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/behavior.core.cjs.map +1 -1
- package/lib/_chunks-cjs/editor-provider.cjs +19 -5
- package/lib/_chunks-cjs/editor-provider.cjs.map +1 -1
- package/lib/_chunks-es/behavior.core.js.map +1 -1
- package/lib/_chunks-es/editor-provider.js +19 -5
- package/lib/_chunks-es/editor-provider.js.map +1 -1
- package/lib/behaviors/index.d.cts +3093 -3071
- package/lib/behaviors/index.d.ts +3093 -3071
- package/lib/index.d.cts +2795 -2772
- package/lib/index.d.ts +2795 -2772
- package/lib/plugins/index.d.cts +2795 -2772
- package/lib/plugins/index.d.ts +2795 -2772
- package/lib/selectors/index.d.cts +2782 -2759
- package/lib/selectors/index.d.ts +2782 -2759
- package/lib/utils/index.d.cts +2782 -2759
- package/lib/utils/index.d.ts +2782 -2759
- package/package.json +1 -1
- package/src/behaviors/behavior.types.ts +151 -108
- package/src/editor/create-editor.ts +2 -2
- package/src/editor/editor-machine.ts +16 -6
- package/src/internal-utils/slate-utils.ts +7 -3
|
@@ -79,7 +79,7 @@ export function getNodeBlock({
|
|
|
79
79
|
return undefined
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
if (isBlockElement(schema, node)) {
|
|
82
|
+
if (isBlockElement({editor, schema}, node)) {
|
|
83
83
|
return elementToBlock({schema, element: node})
|
|
84
84
|
}
|
|
85
85
|
|
|
@@ -88,7 +88,7 @@ export function getNodeBlock({
|
|
|
88
88
|
mode: 'highest',
|
|
89
89
|
at: [],
|
|
90
90
|
match: (n) =>
|
|
91
|
-
isBlockElement(schema, n) &&
|
|
91
|
+
isBlockElement({editor, schema}, n) &&
|
|
92
92
|
n.children.some((child) => child._key === node._key),
|
|
93
93
|
}),
|
|
94
94
|
)
|
|
@@ -113,9 +113,13 @@ function elementToBlock({
|
|
|
113
113
|
return fromSlateValue([element], schema.block.name)?.at(0)
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
function isBlockElement(
|
|
116
|
+
function isBlockElement(
|
|
117
|
+
{editor, schema}: {editor: PortableTextSlateEditor; schema: EditorSchema},
|
|
118
|
+
node: Node,
|
|
119
|
+
): node is Element {
|
|
117
120
|
return (
|
|
118
121
|
Element.isElement(node) &&
|
|
122
|
+
!editor.isInline(node) &&
|
|
119
123
|
(schema.block.name === node._type ||
|
|
120
124
|
schema.blockObjects.some(
|
|
121
125
|
(blockObject) => blockObject.name === node._type,
|