this is my payload.config.ts
editor: lexicalEditor({
features: ({ defaultFeatures }) => [
...defaultFeatures,
HTMLConverterFeature({}),
BlocksFeature({
blocks: [AlertBlock, AlignmentBlock, YoutubeBlock, CodeBlock],
}),
],
}),
Now in my frontend i get this data back
content_html: '<h1>H1</h1><h2>H2</h2><h3>H3</h3><h3>H4</h3><h4>H5</h4><h6>H6</h6><span>unknown node</span><blockquote>QUOTE</blockquote><img src="/media/minecraft.png" alt="minecraft.png" width="500" height="500"/><ul class="bullet"><li value=1>Unordered List x1</li><li value=2>Unordered List x2</li></ul><ol class="number"><li value=1> Ordered List x1</li><li value=2>Ordered List x2</li></ol><ul class="check"><li aria-checked=false class="list-item-checkbox-checked"\n' +
' role="checkbox"\n' +
' tabIndex=-1\n' +
' value=1\n' +
' >\n' +
' {serializedChildren}\n' +
' </li></ul><span>unknown node</span><ul class="check"></ul><span>unknown node</span><span>unknown node</span><span>unknown node</span><p>Paragraph </p><p></p><h1>UL with a code block</h1><span>unknown node</span><h1></h1>'
1)All the unknown nodes are the custom blocks, example for one of them is
import { Block } from "payload/types";
export const YoutubeBlock: Block = {
slug: "Youtube",
interfaceName: "YoutubeBlock",
fields: [
{
name: "link",
type: "text",
required: true,
admin: {
description: "The embed link of the youtube video",
},
},
],
};
So how do i make the unknown nodes.. not unknown and have actual data
- Is there a better way to parse the html, instead of getting a massive html string?