Hello everyone,
I am a product manager at Contentful, responsible for the Authoring experience, and I would like to share a new feature we’re working on with everyone here.
It is a new field type, called Structured Text (for now), that enables a rich text editor in an entry. It allows a content author to format text in a visual way (WYSIWYG) and also embed linked entries as well.
What can you do with it
As a content editor the available actions are:
- Applying the following formatting:
- Bold
- Underline
- Italics
- Heading 1
- Heading 2
- Embedding an entry
Future features
In the next months we plan to support more functionality such as:
- Linking to entries
- Linking to assets
- Apply validation to the types of linked entries
- Add more formatting options
- And more
As always, this is our initial plan, but the actual deliverables might end up being different.
What does this look like for a developer?
Some of you might already be wondering how these rich text objects, like linked entries, might look like in the response.
As a developer what you receive in the CDA, CMA, CPA is a JSON object describing a tree of nodes where leafs may have a set of marks. These nodes can range from block ones like paragraphs and headings, to inline like hyperlinks.
Here’s also an example response:
"..."
"fields": {
"structuredContent": {
"nodeType": "document",
"content": [
{
"nodeType": "paragraph",
"nodeClass": "block",
"content": [
{
"nodeClass": "text",
"nodeType": "text",
"value": "This text is bold",
"marks": [
{
"type": "bold"
}
]
},
{
"nodeClass": "text",
"nodeType": "text",
"value": " but this doesn't have any formatting. "
},
{
"nodeClass": "text",
"nodeType": "text",
"value": "But if we ask you to "
},
{
"nodeType": "hyperlink",
"nodeClass": "inline",
"data": {
"url": "https://prosemirror.net/docs/guide/#doc",
"title": "This page explains the inline schema well"
},
"content": [
{
"nodeClass": "text",
"nodeType": "text",
"value": "click here"
}
]
},
{
"nodeClass": "text",
"nodeType": "text",
"value": ", you will see that it's actually a quite simple concept."
}
]
},
{
"nodeType": "paragraph",
"nodeClass": "block",
"content": [
{
"nodeClass": "text",
"nodeType": "text",
"value": "Another cool thing is that you can insert an entry between paragraphs like the following: "
}
]
},
{
"nodeType": "embedded-entry-block",
"nodeClass": "block",
"data": {
"target": {
"type": "Link",
"linkType": "Entry",
"id": "4JJ21pcEI0QSsea20g6K6K"
}
}
},
{
"nodeType": "paragraph",
"nodeClass": "block",
"content": [
{
"nodeClass": "text",
"nodeType": "text",
"value": "Cool, right?"
}
]
}
]
}
}
"..."
How to use this feature
As this is a closed Alpha program I will need your Space/Org ID (whichever you want to enable this feature in) and an email to just send you instructions.
You can give me this information:
- Either in this thread
- Or in a personal message here
- Or via an email to spiros@contentful.com
- Or via our Slack Community thread #alpha-structured-text
Thank you and I’m looking forward to you using this feature and giving us your feedback!