Custom Gutenberg-Block esnext pass variables

The problem in your “edit” file is that your Edit() function in there is unpacking/destructuring the props, hence props is no longer defined or what you expected it to be. So you should do function Edit( props ) and not function Edit({className, props}) — and it should be noted that className is in that props, … Read more

Conditional save return on Gutenberg Block

You should define your btntype attribute as type boolean and set its default to false (maybe better rename it to download then ;). And change it to true when the user selects the download option. If you want to conditionally add the download attribute in your save functions’ JSX use this syntax: <a href={ btnurl … Read more

UnitControl – Block has encountered an error

The problem in your code is that UnitControl is not actually defined anywhere: If you look at the example in the documentation, the UnitControl is defined as follows: import { __experimentalUnitControl as UnitControl } from ‘@wordpress/components’; I.e. It uses the __experimentalUnitControl component in wp.components and not wp.blockEditor, and secondly, it imports the component as UnitControl. … Read more

Gutenberg richtext block vaildation failed

The problem in your block is due to the selector value of your emailPlaceholder attribute — you set the value to span.kathyContactFormEmail, but there’s actually no span element with that class in your save() function (or the markup/HTML of the element returned by the function). What you have though, is an input with kathyContactFormEmail as … Read more