Skip to content

Commit

Permalink
Merge pull request #4 from charlie-tango/add-support-for-inline-blocks
Browse files Browse the repository at this point in the history
add support for inline blocks for rich text
  • Loading branch information
fbosch authored Jun 17, 2024
2 parents ccbe8f0 + 050b25f commit f807c35
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/UmbracoRichText.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ export type RichTextElementModel =
};
elements: RichTextElementModel[];
}
| {
tag: "umb-rte-block-inline";
attributes: {
"content-id": string;
};
elements: RichTextElementModel[];
}
| {
tag: keyof React.JSX.IntrinsicElements;
attributes: Record<string, unknown> & { route?: RouteAttributes };
Expand Down Expand Up @@ -164,7 +171,10 @@ function RichTextElement({
if (!children?.length) children = undefined;

// If the tag is a block, skip the normal rendering and render the block
if (element.tag === "umb-rte-block") {
if (
element.tag === "umb-rte-block" ||
element.tag === "umb-rte-block-inline"
) {
const block = blocks?.find(
(block) => block.content?.id === element.attributes["content-id"],
);
Expand Down

0 comments on commit f807c35

Please sign in to comment.