Skip to content

How to render Headless CMS Richtext Custom Lexical Node  #4380

@bschulz87

Description

@bschulz87

Hello,

i've followed the documentation on how to extend the Lexical Editor and cannot figure out how make the CMS render saved custom nodes. Inserting, saving and publishing works and i also get the the Node as Lexical State from the GraphQL API. After a refresh the nodes content are fetched from graphql but are missing the Richtext Editor.

I'm aware of the lexical-converter mentioned in https://www.webiny.com/docs/core-development-concepts/extending-and-customizing/lexical-tools#custom-nodes but i cannot find an example on how to implement it for the LexicalEditorConfig.

Version of Webiny is v5.40.5

App.tsx

    return (
        <Admin>
            <Cognito />
            <Extensions />
            <LexicalEditorConfig>
                <Plugin name={"insertColumns"} element={<InsertColumnsPlugin />} />
                <ToolbarAction name={"insertColumns"} element={<InsertColumnsAction />} />
                <Node name={"layoutContainer"} node={LayoutContainerNode} />
                <Node name={"layoutItem"} node={LayoutItemNode} />
            </LexicalEditorConfig>
        </Admin>
    );
};

Content from the /manage CmsEntriesGetPage request the CMS does on page detail:

	"children": [
		{
			"children": [
				{
					"detail": 0,
					"format": 0,
					"mode": "normal",
					"style": "",
					"text": "Paragraph",
					"type": "text",
					"version": 1
				}
			],
			"direction": "ltr",
			"format": "",
			"indent": 0,
			"type": "paragraph-element",
			"version": 1,
			"textFormat": 0,
			"styles": [
				{
					"styleId": "paragraph1",
					"type": "typography"
				}
			]
		},
		{
			"children": [
				{
					"children": [
						{
							"children": [
								{
									"detail": 0,
									"format": 0,
									"mode": "normal",
									"style": "",
									"text": "left",
									"type": "text",
									"version": 1
								}
							],
							"direction": "ltr",
							"format": "",
							"indent": 0,
							"type": "paragraph-element",
							"version": 1,
							"textFormat": 0,
							"styles": [
								{
									"styleId": "paragraph1",
									"type": "typography"
								}
							]
						}
					],
					"direction": "ltr",
					"format": "",
					"indent": 0,
					"type": "layout-item",
					"version": 1
				},
				{
					"children": [
						{
							"children": [
								{
									"detail": 0,
									"format": 0,
									"mode": "normal",
									"style": "",
									"text": "right",
									"type": "text",
									"version": 1
								}
							],
							"direction": "ltr",
							"format": "",
							"indent": 0,
							"type": "paragraph-element",
							"version": 1,
							"textFormat": 0,
							"styles": [
								{
									"styleId": "paragraph1",
									"type": "typography"
								}
							]
						}
					],
					"direction": "ltr",
					"format": "",
					"indent": 0,
					"type": "layout-item",
					"version": 1
				}
			],
			"direction": "ltr",
			"format": "",
			"indent": 0,
			"type": "layout-container",
			"version": 1,
			"templateColumns": "1fr 3fr"
		},
		{
			"children": [],
			"direction": null,
			"format": "",
			"indent": 0,
			"type": "paragraph-element",
			"version": 1,
			"textFormat": 0,
			"styles": [
				{
					"styleId": "paragraph1",
					"type": "typography"
				}
			]
		}
	]
}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions