wagtail-deprecated/wagtail-react-streamfield

Blocks concertina'd shut by default

arctangent opened this issue · 3 comments

We would like to be able to control which ones are open and which are closed by default

Yes, this is one of the upcoming features :)

Is it possible to have all open by default in todays version?

Since 1.0.0, released today, the default layout is SIMPLE, a layout closer to the old StreamField where there is no way to collapse blocks. Blocks can still be defined as using the COLLAPSIBLE layout by writing:

class YourBlock(CharBlock):
    def get_layout(self):
        return self.COLLAPSIBLE

That being said, you may want to keep COLLAPSIBLE blocks, but opened by default.

To do that, use this:

class YourBlock(CharBlock):
    def get_layout(self):
        return self.COLLAPSIBLE

    def get_definition(self):
        definition = super().get_definition()
        definition['closed'] = False
        return definition