-
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
Docs: clarify isDefault usage for registerBlockStyles() #11478
Conversation
Hi @ajitbohra, thanks for the PR. In the future, feel free to assign more folks than just @chrisvanpatten and I to review documentation PRs. It's probably best to assign the review to gutenberg-core, so that a wider group of people can see the review request 😄 |
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.
I can't tell from the issue if there is a bug here or not; in the issue it seems like @dgwyer is saying this should work. So I don't think removing the docs is the right approach.
I think it makes sense to have the The issue is that |
Yeah, that makes sense to me too.
|
I think people are confusing "isDefault" as the default style variation applied when you insert the block (concept we don't have at the moment). That's not what the current "isDefault" refer to. The current "isDefault" is used to give a name to the style variation that doesn't add any custom className. (The no-style style variation). |
@tofumatt noted agree with you on that @youknowriad yes currently it's confusing if I am not wrong its kind of fallback style in case of missing style variation? Instead of removing we need copy update for the |
@youknowriad I think I'm more confused now than when I started. Here's what I found after more testing. It appears that when Also, even if a style variation is selected in the block UI on insertion no CSS class is actually applied to the block wrapper element until a style variation option is manually clicked. This feels counter intuitive to me. I'd expect the style variation CSS class to be applied whenever one is selected, either on block insertion or manual selection. This isn't currently the case. And allowing |
@dgwyer yes, at the moment |
@ajitbohra can you clarify the intent of
|
@gziolo PR updated to clarify the usage of |
@youknowriad - is it correct now? |
@@ -17,7 +17,7 @@ wp.blocks.registerBlockStyle( 'core/quote', { | |||
|
|||
The example above registers a block style variation named `fancy-quote` to the `core/quote` block. When the user selects this block style variation from the styles selector, an `is-style-fancy-quote` className will be added to the block's wrapper. | |||
|
|||
By adding `isDefault: true`, you can make registered style variation to be active by default when a block is inserted. | |||
By adding `isDefault: true` you can make the registered style variation to be used as a fallback if no style in `registerBlockType()` has been set as the default. |
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.
Maybe something like?
By adding
isDefault: true
you can mark the registered style variation as the one that is active without any custom className.
(Or something in that vein, it's hard to explain :P)
Co-Authored-By: ajitbohra <ajit@lubus.in>
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.
Haha, so @ajitbohra couldn't approve. Let me do it on his behalf as I authored the last version. Thanks for good teamwork on this one 💯
* Docs: Remove isDefault from registerBlockStyle * Docs: clarify isDefault usage for registerBlockStyles() * Clarify isDefault Co-Authored-By: ajitbohra <ajit@lubus.in>
* Docs: Remove isDefault from registerBlockStyle * Docs: clarify isDefault usage for registerBlockStyles() * Clarify isDefault Co-Authored-By: ajitbohra <ajit@lubus.in>
RemovesisDefault
info forregisterBlockStyle()
from handbook.Clarify isDefault usage for registerBlockStyles()
Reference #11451