I wanna add custom classes to gutenberg wrapper.
But I wanna be flexible and use the classes from inspectorinput.
How can I do? Block filters don't work a that cause you can just use a special class.
wp-block-[plugin_name]-[block-name]
. You can access that using this.props.className
.(Create separate file for this and pass into edit method inside registerBlockType for better structuring else you can write this whole code)
class Testing extends Component {
constructor() {
this.state = {
customClasses: null
}
}
render() {
<InspectorControls>
<TextControl
label="Custom CSS Classes"
value={ this.state.customClasses }
onChange={ ( content ) => setState( { customClasses: content } ) }
/>
</InspectorControls>
}
}