contentfully icon indicating copy to clipboard operation
contentfully copied to clipboard

Feature/adding renderRichtext option

Open Shenoudafarouk opened this issue 3 years ago • 0 comments

Added the ability to HTML renderer for the Contentful rich text field type.

you can enable as follows:

const data = await contentfully.getEntries(query,  { renderRichtext: true });

so the old response was look something like this:

{
        "_id": "26sw3opeSNXmhzS9kgpfde",
        "_type": "helloworld",
        "_createdAt": "2022-02-08T15:03:27.611Z",
        "_updatedAt": "2022-02-16T17:07:27.784Z",
        "title": "Hello World",
        "richtext": [
            {
                "nodeType": "paragraph",
                "content": [
                    {
                        "nodeType": "text",
                        "value": "hallo world",
                        "marks": [
                            "italic",
                            "underline"
                        ]
                    }
                ]
            }
        ]
}

after enabling the option It should look something like this:

{
        "_id": "26sw3opeSNXmhzS9kgpfde",
        "_type": "helloworld",
        "_createdAt": "2022-02-08T15:03:27.611Z",
        "_updatedAt": "2022-02-16T17:07:27.784Z",
        "title": "Hello World",
        "richtext": "<p><u><i>hallo world</i></u></p>"
}

Shenoudafarouk avatar Feb 16 '22 17:02 Shenoudafarouk