Pricing Blog

Infinite Component Repeat for Rich Text

  • nocodeprocode-1392728267819319306

    NoCode ProCode

    2 days ago

    I'm trying to build a rich text content paragraph for my application and I have implemented re-repeating of components (inspired by @Andreas Møller's JSON viewer) but I'm stuck when it goes beyond a component repeating another one - the moment it goes 3 layers deep my implementation fails.

    I would appreciate some tips and assistance with this - as I do need a SSR rich paragraph element that can hold multiple styles and I'm 95% there but this is the last thing holding me back.

    Please see my project / branch here: https://editor.nordcraft.com/projects/crimson_boba_fett_satisfactory_bear/branches/start/components/HomePage?canvas-width=800&rightpanel=style&selection=nodes.root&canvas-height=800

    Thanks for your help 🙏
  • lucasg-1392737215205081228

    Lucas G

    2 days ago

    The recursive component in the CMS guide may help: https://docs.nordcraft.com/guides/datocms
  • dato-block
  • It outputs clean HTML, no divception or anything 👍
  • nocodeprocode-1392744723931725984

    NoCode ProCode

    2 days ago

    Thanks @Lucas G - so I would have to adjust my backend to provide child nodes, I saw contentful do that, and every major CMS is doing that - thanks for the insight, I really appreciate that.
  • nocodeprocode-1392746127391985704

    NoCode ProCode

    2 days ago

    How would you solve the need to render a strong in a em in a a tag? @Lucas G so the html stays schematic?
  • nocodeprocode-1392746574781747231

    NoCode ProCode

    2 days ago

    ChatGPT had the answer
  • {
    "type": "paragraph",
    "children": [
    {
    "type": "bold",
    "children": [
    {
    "type": "italic",
    "children": [
    {
    "type": "underline",
    "children": [
    { "text": "styled text" }
    ]
    }
    ]
    }
    ]
    }
    ]
    }
  • This makes more sense - there is a clear child tree for the nested rendering now.
  • Thanks for your help!
  • andreasmoller-1392752391669158000

    Andreas Møller

    2 days ago

    👍
    ❤️1