Replies: 5 comments 2 replies
-
@uroybd thanks for raising this. There are likely ways to do something similar already in Wagtail. I think it might be good to point you towards our Stimulus RFC 78 which offers some of the building blocks that come already with Wagtail. Namely the ability to dynamically attach some JS to rendered form parts in Wagtail. When using plain html (as used by Panels), StreamField will use that provided HTML without issue, so the tricky part is conveniently attaching JS to that HTML when it gets added to the DOM, Stimulus bridges this gap with a lightweight data attributes convention in html and a simple JS class approach. Additionally, there is activate work in place to make some approaches documented and more capabilities supported in this area. See
Additionally, there is also Telepath which may provide some ways to achieve your goals in the StreamField case. |
Beta Was this translation helpful? Give feedback.
-
To add to this - looking at the screenshot, I see one of the use cases is to have settings. There's a discussion around block settings specifically at #7739 (comment) |
Beta Was this translation helpful? Give feedback.
-
Converting to a discussion @uroybd - I think this is useful for others to chime in but i do not think this can be really resolved with a single fix or enhancement. It's likely a mix of seeing what documented/upcoming solutions will be available and maybe some gaps can lead to some more focused enhancement requests. |
Beta Was this translation helpful? Give feedback.
-
Actually, the example with the tabs is just a demo. The main point is about giving the same amount of control in block level that is currently available in field level for admin interface using the same type of abstraction. This, I believe will be very good from a DX perspective. |
Beta Was this translation helpful? Give feedback.
-
@lb- can you elaborate on why you don’t think this can be solved with a single enhancement? From my perspective it seems like supporting the "panels" API we have at the page level or for snippets would make a lot of sense for CMS users and site implementers. Now what the implementation looks like / how much work that is – I don’t know. The use case that we see a lot is "settings", which really could just be having collapsible sections within the block (so for example |
Beta Was this translation helpful? Give feedback.
-
Currently, we can use
FieldPanel
,MultiFieldPanel
, andFieldRowPanel
to create very efficient editing workflow. However,StreamField
blocks cannot take advantage of those. This, I think, is very important for Stream blocks since they are being heavily used as freeform page body editors.Very recently, I've solved this problem by some custom blocks which can be considered as proof of concept of what can be done. here's the full code:
blocks.py
tabbed_struct.js
And here's an usecase
It renders an UI like this 🖼️
Beta Was this translation helpful? Give feedback.
All reactions