- Issue created by @drclaw
- Merge request !120Add spacing and color block support for drupal blocks → (Merged) created by drclaw
- First commit to issue fork.
- 🇵🇹Portugal marcofernandes
Hmm.. it's going to need some tweaks in order to run the Layout processor.
- 🇵🇹Portugal marcofernandes
I think we also need to add a wrapper to the block markup (save function) in order to set the css classes and style attributes (useBlockProps) for color and spacing support. This means some adjustments to the processor also in order to render the block markup with that wrapper.
- 🇨🇦Canada drclaw
Oh yeah, HA I got so hyped on getting it to work in the editor I didn't even realize it wasn't working on the front-end of the site 😂
I'll see what I can do!
- Status changed to Needs work
7 months ago 6:28pm 24 April 2024 - Status changed to Needs review
7 months ago 10:04pm 24 April 2024 - 🇨🇦Canada drclaw
Looks like we can just use the StyleEngine you added a few weeks ago to render the block styles on the server-side! 🙌
- 🇵🇹Portugal marcofernandes
Yes, you can go for that approach.
Still, since those blocks don't use useBlockProps.save() on their save() function, classes related to color (ex: has-background-color-white) won't be applied.
Btw, I added some validations to the LayoutProcessor to handle those blocks that don't have any JSON info.Still thinking that instead of getting the block styles (StyleEngine) and alter the block render, it won't be better to add a wrapper to handle useBlockProps.save() and also add the JSON definition so LayoutProcessor can, well, process them. 🤔
- 🇵🇹Portugal marcofernandes
I added a wrapper on the save() function to hold any classes from Gutenberg (color, font size, alignment, etc) and then fetch those classes and add it to the block build array. Applied to both block types.
Probably this is going to change when we implement the remaining processors (color, spacing, etc) but, for now it will do just fine ;)
- Status changed to Fixed
7 months ago 6:30pm 26 April 2024 Automatically closed - issue fixed for 2 weeks with no activity.