-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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: Print the block class name in the save
method
#27988
Merged
Conversation
This file contains 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
It bring the old behavior that was implicit in block API version 1. In version 2, the class name for the block is generated only when explicitly using `useBlockProps.save` method call.
gziolo
added
[Tool] Create Block
/packages/create-block
[Type] Bug
An existing feature does not function as intended
labels
Jan 5, 2021
Size Change: 0 B Total Size: 1.29 MB ℹ️ View Unchanged
|
gziolo
added a commit
that referenced
this pull request
Jan 5, 2021
* Create Block: Print the block class name in the `save` method It bring the old behavior that was implicit in block API version 1. In version 2, the class name for the block is generated only when explicitly using `useBlockProps.save` method call. * Docs: Update Create Block changelog
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Tool] Create Block
/packages/create-block
[Type] Bug
An existing feature does not function as intended
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.
Description
It brings the old behavior that was implicit in block API version 1. In version 2, the class name for the block is generated only when explicitly using
useBlockProps.save
method call.How has this been tested?
This part is tricky but it's definitely possible. It has to follow CI job for Gutenberg that verifies
@wordpress/create-block
:gutenberg/bin/test-create-block.sh
Lines 25 to 32 in e389aeb
You need to create two blocks (one with es5 and one with esnext template) with the latest Gutenberg that don't install
@wordpress/scripts
:npx wp-create-block my-block-1 --no-wp-scripts npx wp-create-block my-block-2 --no-wp-scripts cd my-block-1 ../node_modules/.bin/wp-scripts build
Now you need to put both blocks (plugins) in the WordPress plugins directory and verify they are activated. Next step is injecting both blocks in the post and checking it the class name is generated and CSS applied on the front-end.
Types of changes
Bug fix (non-breaking change which fixes an issue).
Checklist: