-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Create Block] Add support for the example property and add template defaults. #52803
[Create Block] Add support for the example property and add template defaults. #52803
Conversation
Size Change: +21 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
I also included the change of the last version that we forgot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working great 🙂
I recently learned how to update the individual changelog.md files, so I went ahead and added an entry for this one, and also the entry that we forgot for the last PR.
…ackage. (#52801) * Move the example property in block.json. * Add late escaping to the render.php file. * Fix type cho -> echo in render file. * Add doc block to the render.php file. * Remove escaping for get_block_wrapper_attributes * Define an empty example property to trigger the inserter preview. * Move example to top level based on #52803 * Add changelog entry.
|
What?
This PR adds support for the
example
property in block.json to the create-block tool and adds a basicexample: {}
to each template.Why?
The
example
property is used to trigger the block preview in the inserter as well as in the Style Book. This is a point of confusion for developers and by having it supported and in the default templates, it will bring awareness to the property and address issues around why custom block are not appearing in the Style BookTesting Instructions
cd
intopacakagpackages/create-block
node index.js
and follow promptsblock.json
containsexample: {}