-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Allow developers to reuse default blocks in their blocks #2995
Description
I'm coding new custom blocks. For every custom block, I have to copy paste whole files of code to get the same functionality you already have in the default blocks. It's very confusing and goes against "do not repeat yourself" principle we try to stick to.
Issue:
For example, if I need to create a new custom block "Recipe" with the next structure:
- Image (a dish image)
- Heading (recipe name)
- Text block (description)
- List (ingredients)
- Button (call to action)
I will have to copy/paste the code from 5 already coded default blocks. What even worse: I will have to monitor official blocks for further improvements/changes in the future and update my block accordingly.
Please, allow 3-rd party developers to easily reuse already coded default blocks in their blocks.
Something like <Freeform /> <Image /> <Button /> <Heading /> <Paragraph /> will make our lives much easier.
Benefits:
- Good for the end users: they don't have to learn custom variations of the same content types like an image, button, etc..
- Good for 3-rd party developers: easy to create complex blocks
- Good for Gutenberg developers: less code from 3-rd party developers means fewer issues/errors for the whole product
- Good for the project: standardization, consistent design, and usage patterns
It's better to do this now, not after release as many 3-rd party developers with have to create custom blocks for their plugins before Gutenberg merged into WP.
I see no reason why it can't be good for everyone.