[Create Block] Add support for the example property and add template defaults.#52803
Merged
ryanwelcher merged 3 commits intotrunkfrom Jul 22, 2023
Merged
Conversation
ryanwelcher
added a commit
that referenced
this pull request
Jul 20, 2023
|
Size Change: +21 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
I also included the change of the last version that we forgot.
luisherranz
approved these changes
Jul 21, 2023
Member
luisherranz
left a comment
There was a problem hiding this comment.
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.
ryanwelcher
added a commit
that referenced
this pull request
Jul 24, 2023
…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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
This PR adds support for the
exampleproperty in block.json to the create-block tool and adds a basicexample: {}to each template.Why?
The
exampleproperty 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
cdintopacakagpackages/create-blocknode index.jsand follow promptsblock.jsoncontainsexample: {}