Jesse Reza Khorasanee
Jesse Reza Khorasanee

Reputation: 3471

Is there a way to generate contentful rich text on a web page?

Contenful has their own rich text format in a json style form:

{
  "nodeType": "document",
  "data": {},
  "content": [
    {
      "nodeType": "paragraph", // Can be paragraphs, images, lists, embedded entries
      "data": {},
      "content": [
        {
          "nodeType": "text",
          "value": "This text is ",
          "data": {},
          "marks": []
        },
        {
          "nodeType": "text",
          "value": "important",
          "data": {},
          "marks": [
            "type": "bold" // Can be bold, underline, italicss
          ]
        }
      ]
    }
  ]
}

Is there any way to generate this type of rich text besides in contenful?

I'd love to use other rich text editors like for example vue-quill-editor

enter image description here

But they generate html as an output, meaning there is no way for me to add the content to a contentful database in a meaningful way.

Interested in ideas on this.

Upvotes: 0

Views: 956

Answers (1)

stefan judis
stefan judis

Reputation: 3879

Contentful DevRel here.👋

If this editor is producing HTML it won't be compatible with Contentful's RichText field type.

If you want to use your own editor inside the Contentful UI you can always use the App Framework to extend the interface. The App Framework allows you to define custom UI in various locations such as an entry's field. If you want to use this HTML-based editor you could create an app using the App Framework and render it in a "long text" field to store your HTML.

But be aware, if you store HTML in Contentful, you're loosing cross-platform content partibility. Contentful is JSON-based to keep the content platform agnosting. If you start storing HTML you might have a hard time reusing your content on platforms that are not able to render HTML (e.g. iOS).

Upvotes: 3

Related Questions