thoughtis / cata-blocks

Block Editor components for use with the Cata theme.
GNU General Public License v3.0
1 stars 0 forks source link

Using styles requires passing className to useBlockProps.save() #132

Closed douglas-johnson closed 6 months ago

douglas-johnson commented 6 months ago

We want to use block styles on the table of contents block. Currently, registered styles work in the editor but are not saved or output in the rendered content.

The problem is resolved if we updated the block's save function to include ...useBlockProps.save({ className: attributes.className })

douglas-johnson commented 6 months ago

I was wrong about what fixes this. Styles are considered custom class names, so the block.json just needs to allow customClassName.