You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This component automatically renders all nodes except for `inline_item`, `item_link`and `block` using a set of default rules, but you might want to customize those. For example:
262
+
This component automatically renders all nodes (except for `inline_item`, `item_link`, `block`and `inline_block`) using a set of default rules, but you might want to customize those. For example:
234
263
235
264
For example:
236
265
@@ -309,17 +338,18 @@ import SyntaxHighlight from 'components/SyntaxHighlight';
309
338
/>;
310
339
```
311
340
312
-
Note: if you override the rules for `inline_item`, `item_link`or `block` nodes, then the `renderInlineRecord`, `renderLinkToRecord`and `renderBlock` props won't be considered!
341
+
Note: if you override the rules for `inline_item`, `item_link`, `block`or `inline_block` nodes, then the `renderInlineRecord`, `renderLinkToRecord`, `renderBlock`and `renderInlineBlock` props won't be considered!
| data |`StructuredTextGraphQlResponse \| DastNode`|:white_check_mark:| The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from DatoCMS ||
319
-
| renderInlineRecord |`({ record }) => ReactElement \| null`| Only required if document contains `inlineItem` nodes | Convert an `inlineItem` DAST node into React |`[]`|
320
-
| renderLinkToRecord |`({ record, children }) => ReactElement \| null`| Only required if document contains `itemLink` nodes | Convert an `itemLink` DAST node into React |`null`|
321
-
| renderBlock |`({ record }) => ReactElement \| null`| Only required if document contains `block` nodes | Convert a `block` DAST node into React |`null`|
322
-
| metaTransformer |`({ node, meta }) => Object \| null`|:x:| Transform `link` and `itemLink` meta property into HTML props |[See function](https://github.com/datocms/structured-text/blob/main/packages/generic-html-renderer/src/index.ts#L61)|
323
-
| customNodeRules |`Array<RenderRule>`|:x:| Customize how nodes are converted in JSX (use `renderNodeRule()` to generate rules) |`null`|
324
-
| customMarkRules |`Array<RenderMarkRule>`|:x:| Customize how marks are converted in JSX (use `renderMarkRule()` to generate rules) |`null`|
325
-
| renderText |`(text: string, key: string) => ReactElement \| string \| null`|:x:| Convert a simple string text into React |`(text) => text`|
| data |`StructuredTextGraphQlResponse \| DastNode`|:white_check_mark:| The actual [field value](https://www.datocms.com/docs/structured-text/dast) you get from DatoCMS ||
348
+
| renderInlineRecord |`({ record }) => ReactElement \| null`| Only required if document contains `inline_item` nodes | Convert an `inlineItem` DAST node into React |`[]`|
349
+
| renderLinkToRecord |`({ record, children }) => ReactElement \| null`| Only required if document contains `item_link` nodes | Convert an `itemLink` DAST node into React |`null`|
350
+
| renderBlock |`({ record }) => ReactElement \| null`| Only required if document contains `block` nodes | Convert a `block` DAST node into React |`null`|
351
+
| renderInlineBlock |`({ record }) => ReactElement \| null`| Only required if document contains `inline_block` nodes | Convert a `block` DAST node into React |`null`|
352
+
| metaTransformer |`({ node, meta }) => Object \| null`|:x:| Transform `link` and `itemLink` meta property into HTML props |[See function](https://github.com/datocms/structured-text/blob/main/packages/generic-html-renderer/src/index.ts#L61)|
353
+
| customNodeRules |`Array<RenderRule>`|:x:| Customize how nodes are converted in JSX (use `renderNodeRule()` to generate rules) |`null`|
354
+
| customMarkRules |`Array<RenderMarkRule>`|:x:| Customize how marks are converted in JSX (use `renderMarkRule()` to generate rules) |`null`|
355
+
| renderText |`(text: string, key: string) => ReactElement \| string \| null`|:x:| Convert a simple string text into React |`(text) => text`|
@@ -246,18 +262,18 @@ export function StructuredText<
246
262
);
247
263
}
248
264
249
-
if(!(isStructuredText(data)&&data.blocks)){
265
+
if(!(isStructuredText(data)&&data.inlineBlocks)){
250
266
thrownewRenderError(
251
-
`The document contains an 'inlineBlock' node, but the passed data prop is not a Structured Text GraphQL response, or data.blocks is not present!`,
267
+
`The document contains an 'inlineBlock' node, but the passed data prop is not a Structured Text GraphQL response, or data.inlineBlocks is not present!`,
0 commit comments