Thinkmill / keystatic

First class CMS experience, TypeScript API, Markdown & YAML/JSON based, no DB
https://keystatic.com
MIT License
1.14k stars 76 forks source link

Bug: nested component blocks #594

Open florian-lefebvre opened 1 year ago

florian-lefebvre commented 1 year ago

I have a custom button component block that needs to be in a table cell. In the markdoc file, it works fine

{% table %}
- Platform
- Type
- Price
- Link
---
- Legis Music
- One-time payment
- From $49/lifetime
- {% button text="Here" href="/licenses" /%}
{% /table %}

But in keystatic, it doesn't show in the cell and can't be done at all image

JedWatson commented 1 year ago

@emmatown may be able to comment on this with more details

I know that, currently, nested component blocks aren't possible, and that limitation is something we're working to resolve with the new Markdoc field we're building (which switches out Slate for Prosemirror, long story) but also that's a little while off because there's a lot to do to really achieve our vision for how it should work.

Having said that, I thought we had support for using custom component blocks inside the tags that we have built-in support for (specifically they do work inside layout tags) so having them work inside of tables should be possible, and we can look into it.

florian-lefebvre commented 1 year ago

Definitely interested in nesting blocks inside markdoc nodes (like table). Nesting blocks into blocks is not a blocker for me rn

JedWatson commented 1 year ago

It looks like we should be able to do something about this, will get back to you soon to confirm

florian-lefebvre commented 1 year ago

@JedWatson can i help in any way?

JedWatson commented 1 year ago

@florian-lefebvre we haven't had a chance to try it yet, but in theory we'd need to change the allowed tableCellChildren here to allow component-block nodes here: https://github.com/Thinkmill/keystatic/blob/6b9c653c33e8ea491f63d404464a42d7626db91f/packages/keystatic/DocumentEditor/editor.tsx#L99

It may cause some other side effects (the editor is tricky) but if you want to take a look and see how it goes for you, let us know!

florian-lefebvre commented 1 year ago

Thanks for pointing me to the right part of the codebase! I'll see if I can do anything