keystatic icon indicating copy to clipboard operation
keystatic copied to clipboard

Bug: nested component blocks

Open florian-lefebvre opened this issue 2 years ago • 6 comments

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

florian-lefebvre avatar Aug 25 '23 08:08 florian-lefebvre

@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.

JedWatson avatar Aug 26 '23 08:08 JedWatson

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

florian-lefebvre avatar Aug 26 '23 08:08 florian-lefebvre

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

JedWatson avatar Aug 28 '23 09:08 JedWatson

@JedWatson can i help in any way?

florian-lefebvre avatar Sep 04 '23 14:09 florian-lefebvre

@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!

JedWatson avatar Sep 04 '23 16:09 JedWatson

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

florian-lefebvre avatar Sep 05 '23 09:09 florian-lefebvre