Use image block functionality in a custom block


I’d like to display an image that my block creates. Ideally I’d like to allow the user to resize and crop the image, etc., but not allow them to change the image to another one in the media library. It would be great if I could just use the core image block’s functionality, but disable the part that lets the user change the image or upload a different one.

Of course copying the image block’s code is an option, but I want to avoid duplication and benefit from bug fixes and features in future versions of Gutenberg. Ideally I would subclass it or include the image block in my own block. Crucially though I need to disable certain behaviours like the media library. Is this possible?

, , , Sean 1 year 0 Answers 56 views 0

Leave an answer