Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

No ability to add streamfield items within an inline panel without min_num=1 #35

Closed
stuartaccent opened this issue Feb 15, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@stuartaccent
Copy link

stuartaccent commented Feb 15, 2019

Hi guys

I found a bug today, defining:

class MyPageFooItem(Orderable):
    page = ParentalKey(..., related_name='foos')
    content = StreamField([...])

    panels = [
        StreamFieldPanel('content'),
    ]

class MyPage(Page):
    ...
    content_panels = Page.content_panels + [
        InlinePanel('foos', label="Foos"),
    ]

renders no options to add any item from the streamfield within the inline panel. You just get a label Foos:. If you then oddly add min_num=1 to the inline they appear and you can happily add content:

class MyPage(Page):
    ...
    content_panels = Page.content_panels + [
        InlinePanel('foos', label="Foos", min_num=1),
    ]

Im guessing its prob a js thing in that with min_num=1 one will be on the page already.

Also adding a second inline via the button renders no content till you try to save it.

Cheers
Stu

@BertrandBordage BertrandBordage added the bug Something isn't working label Feb 22, 2019
@BertrandBordage
Copy link
Contributor

That’s a tough issue. I didn’t think about the inclusion of streamfields in inlines, I honestly never did that and didn’t even think it was possible!

Fortunately, this should be fixed by the huge rewrite I am currently doing with the guidance of Thibaud Colas here: wagtail-deprecated/react-streamfield#4
It should be fixed because we will no longer initialize StreamField the same way. They were initialized all at once on page load, now they will be initialized in inline scripts, so it should perfectly work with inlines :)

@stuartaccent
Copy link
Author

Superb

@BertrandBordage
Copy link
Contributor

Fixed by wagtail/wagtail@73e01f2, will be in a new version of wagtail-react-streamfield today.

@BertrandBordage
Copy link
Contributor

Released in version 1.2.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants