Hi, how can I achieve nested lists in lexical? Currently when I write the following into a richText field (first image), it gets rendered as the following on the frontend (second image).
The serializer being used is taken from the website template for payload v3. Any guidance is appreciated :)
😅
yeah im not that great with css
this is the relevant parse section on the list type nodes
ill use the TreeViewFeature
and see how it's being stored by lexical
what is your ''@/modules/core/ui/link'' component btw?
just want to know what the textDecoration bit means
or can i just remove that Link tag and just have {childrenText}
nah i don't think that's the issue
its more like this being the issue:
<ol>
<li>Item 1</li>
<li>Item 3</li>
<li>Item 5</li>
<li>
<ul>
<li>Sublist item</li>
</ul>
</li>
</ol>
the nested list is treated like that, so it gets rendered weird
but it should actually be like
<ol>
<li>Item 1</li>
<li>Item 3</li>
<li>
Item 5
<ul>
<li>Sublist item</li>
</ul>
</li>
</ol>
you see the problem right
an extra list item gets created
but the sublist should actually be part of the previous list item
ok i loaded the treeviewfeature
is this an issue with lexical itself ?
the treeview explains the problem clearly btw ^^
yeah seems like an issue on lexical :(
so do I just have to import the css/scss file containing these styles into the serializer tsx file?
like what im inferring is, that the classnames will be added to the components, but those classnames don't have a definition yet
so by adding the css file, it'll pickup what styles to apply to those classes
I can see that there are some classnames on lexical for this
but unsure of how to put Alessio's suggestion into practise
do you know how i can solve this?
because the node doesn't have any styles stored
so i need to figure out what styles to apply to it
ok do i just put this into a scss file?
and import that file
sorry for the dumb questions 😅
thank you so much, that worked
try mine:
https://github.com/tyteen4a03/payload-lexical-renderer-examplebut I suspect it might just be a css issue
internal component (it's just park ui)
CSS text-decoration, you can kill it
that looks correct
I'm not sure how lexical is supposed to handle this so I'll ping
@360823574644129795you just need some css, see
https://payloadcms.com/docs/beta/lexical/converters#cssthis CSS fixed it for me:
li:has(ul),
li:has(ol) {
list-style-type: none;
}
yes 🙂
Star
Discord
online
Get dedicated engineering support directly from the Payload team.