@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.
@@ -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(schema: EditorSchema, node: Node): node is Element {
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,