Skip to content

Structured rich text element mapping #125

@Simply007

Description

@Simply007

Motivation

Allow Delivery SDK to work with Structured rich text element.

Proposed solution

  • Allow model generators to generate rich text elements differently than just a string.
  • Fill the structured rich text element model while mapping the data (.NET implementation example)

Additional context

SDK has solid support for the Thymeleaf template engine - string-based rendering of the data.
Loading data for "API" endpoints currently require parsing the HTML and create a structure for rich text on the application site.

Sample item with multilevel nested components: https://deliver.kontent.ai/306d7f21-2609-01b0-6e1c-93cbc328a82d/items/rich_text_resolution

Simple pseudocode of the structure

{
  elements: {
    content: [ // rich text element
      {
        headline: { // component/content item
          ..
        },
        section: { // component/content item
          content: [ // rich text element
            {
              headline: { // component/content item
                text: [ // rich text element
                  {
                    text: "inner headline" // text element is an object too
                  }
                ]
              }
            }
          ]
        }
      }
    ]
  }
}

Notes

  • text is also the object for interoperability with components
  • infinite loop - first version
    • log a warning and does not resolve! WITH PROPER ITEM IDENTIFICATION ERROR MESSAGE

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions