Iām trying to use Structured Text for a blog post that I am pulling into Nuxt that contains a custom block for Quote. Iāve found some documentation online and tried to follow the example but I am getting an error that says:
Error: The Structured Text document contains a āblockā node, but .blocks is not present!
@roger Thanks for your response, that did help resolve the error.
I am wondering about one other thing related to Structured Text parsing. Is there any way to wrap the plain HTML text inside an element so I can group just the text that exists outside of the custom blocks?
So for example, if my structured text editor looked like this:
Hey @JLernDesign, Iām not quite sure I fully understand your question, sorry. Could you please provide an example of the desired output you want from that (either in HTML, psuedocode, or just something you scribble on a napkin)?
I think what youāre asking for is the raw content of the body text, before it gets processed by our Structured Text renderer componentā¦? If so, it should be in the GraphQL response, probably at page_data.content.value or maybe page_data.content?
If you could please let me know your desired output in more detail, and also provide a link to the record in question, I can try to make a more specific example for you? But otherwise I hope the above helps a bit?
I was hoping I could create new blocks that would form before and after the quote block if there is a quote block inserted. I think I can achieve this with the structured-text-to-html converter and just split the string around the quote block.
I am also wondering if just using Modular blocks to build out the page would be more effective than using Structured Text. I just love how seamless the structured text experience is so I wanted to make that work.
Hey @JLernDesign, if you can send me the link to the frontend code and the project in question, I can take a deeper look. Normally, you should be able to keep the structured text as the root component, and each of its child nodes (whether a DatoCMS block or a standard HTML thing like a blockquote) should be customizable through the node/block rendering overrides. For examples, you should be able to assign a custom classname (or even inline style override) to make the blockquote look how you want it. If you can send me a link to the code, I can make a quick example for you? (Feel free to DM me here or email us at support@datocms.com mentioning this thread).
The structured text is like a tree, and each child node or block is like a branch with its own sub-branches and leaf nodes. You can customize the display of each child without having them ārip them off and put them on another treeā, so to speak.
You shouldnāt have to reinvent the wheel by parsing out the HTML and then rebuilding it into componentsā¦ the structured text component itself should be pretty customizable and extensible, and Iād be glad to try to help you find an easier way to make that quote line up, if youād like