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 😄 |
|
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? |
| 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.
Maybe something like?
By adding
isDefault: trueyou 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>
gziolo
left a comment
There was a problem hiding this comment.
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>
RemovesisDefaultinfo forregisterBlockStyle()from handbook.Clarify isDefault usage for registerBlockStyles()
Reference #11451