Closed imanpalsingh closed 1 year ago
Hi @imanpalsingh ! We currently do not support RichText fields. We'd be interested in having a design discussion with you to figure out how best to do that! Would you be interested in contributing?
Hi @gburgett ! I'm not a ruby expert but I would love to contribute.
Great! I would love to work on this with you. There's a couple things we should do to get started:
Can you download a sample of the Content Type in your space that contains the rich text field? We'll need a JSON file containing the Content Type definition and Editor Interface. The easiest thing to do would be to just attach your contentful-schema.json
to this issue.
Can you also download a JSON file of an Entry in your contentful space that has a Rich Text field in it? The easiest thing to do would be to use curl
to query the Contentful Content Delivery API and write the output to a JSON file. We should use the "include" parameter as well, to make sure we are getting the entries that are referenced by your rich text field.
Something like this:
curl -H "Authorization: Bearer $CONTENTFUL_ACCESS_TOKEN" https://cdn.contentful.com/spaces/$CONTENTFUL_SPACE_ID/entries?sys.id=$ENTRY_ID&include=1 > entry_with_rich_text.json
Those JSON files will form the basis of a test fixture so that we can write a unit test for supporting Rich Text in general.
I'm copying these here for reference: https://www.contentful.com/developers/docs/concepts/rich-text/
https://github.com/contentful/contentful.rb/blob/master/lib/contentful/coercions.rb
So it looks like the Contentful ruby gem just returns a hash for a Rich Text field. But they automatically resolve links. Interesting.
We should probably do the same thing to start with, and later on we can add some better functionality.
Looks great! I've got some stuff that I've already been working on, I'll push it up as a PR in a minute. We can then talk about how to proceed from there.
Fixed in v1.2.0
Rails : 5.2.0 Ruby: 2.7.5
Config
On running rails server
rails s
I get this errorI have a content model named
Page
which has a field namedbody
of typeRich Text