-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Continuation of Block Style Variations #7551
Comments
This reminds me a lot of the classes feature in Oxygen Builder: I think this is a great idea! 👍 Side note: I recommend checking out Oxygen Builder. I found out about it recently and was very impressed. It does pretty much everything, with the only downside being that its proprietary software. Interestingly, it uses a builder system that is actually a bit similar to Gutenberg in that it is more "block"-based, and it has no strict section→row→column→module system like nearly every other page builder; you can have columns, but it allows you to build stuff using a CSS flex-based system which works really well and is a lot cleaner than the deep levels of nested |
Those two parts are the steps I consider the most crucial for now out of the list. Many themes provide elements in different variations, there may be different separators, quotes, or especially buttons, where you often have a distinction between a regular (secondary) button and a primary button, just like WordPress itself has in the admin. Having this map to Gutenberg in a simple way by registering a block style is an easy-to-implement solution for the theme developer. In terms of implementation, I can see it either being handled via theme support (as in This was previously discussed in #5360 (comment) (theme support) and #5360 (comment) (extra functions), some input around that to consider as well. |
I just installed 3.2.0. Is it correct that the block styles/settings have been taken out of the block itself? What's the main reason for it? From a design/accessibility perspective, this is an odd choice. For instance, for people with tunnel vision, the proximity of related actions is very important. Now when you select a block at the bottom of your screen, you won't see what happens at the top left. |
What do you mean with out of the block itself? |
@boemedia Might you have the "Fix toolbar to Top" option active by mistake? Make sure it's not checked here: If that's checked, it would show the toolbar at the top of the screen, away from the block, as you described: If un-checked, the block controls should still be visible with the block itself: |
Thanks, @chrisvanpatten , I must be blondish... Totally forgot about that option being there. I must have been playing around with it with a previous update. |
@mtias I just checked the block variation implementation. I think it is great but I think it should not force the user to use a special kind of class system. Many people use BEM or other CSS styling methods to keep the CSS clean. The current implementation forces the user to use the class |
To @pascalknecht's point, CSS classes aren't always used as style selectors. Common to target classes in JS for functionality -- |
Supporting what @pascalknecht said, I think the current system is too opinionated, and doesn't play nice with existing CSS frameworks, e.g. Bootstrap or UIKit. These already have customized button styles and whatnot that you just can't use with the block editor as it is (please let me know if I'm wrong!) without, e.g. rolling your own buttons. What about being able to directly register custom class names for each style?
|
Hi @mtias, |
I really like the idea of defaulting to globally-registered styles — it would allow a site creator to easily set up some "pre-sets" that their content creators can leverage later on. |
@jorgefilipecosta site wide, depending on permissions. |
+1 |
A lot of improvements have been achieved for the block style variations. What's remaining here? Should we close this one? |
I don't know if allowing a custom class name has been added, but it'd make sense to support it, even if discouraged, for multiple reasons. |
It has not, there's an issue for it - #11763 |
Transferring #31360 to here as advised. What problem does this address?Makes adding custom classes more user friendly for styling options that may not fit into the other options offered by Gutenberg already. What is your proposed solution?Allow user to select from available classes that the theme offers along with adding custom. Similar to how EditorsKit plugin does it by using a token field. Having the theme provide (via JSON and/or PHP) a list of classes (with labels) and possibly by group could make this very easy. Utility classes for padding, margin, maximum widths, etc could take advantage of this. A label could be used with the underlying value being the class itself. |
This is another issue that probably needs to be transferred to here: #42297 |
Once #7362 lands, we'll have the ability to register new block variations (based on classes) with automated previews. With this foundation there are further ideas of how this functionality could be extended.
Register New Styles
Themes / Plugins should be able to easily register new variations from the client or server.
Unregister Existing Styles
Themes / Plugins should be able to unregister existing block style variations for a specific block. (A plugin may also want to disable style variations entirely across all blocks.)
Change the Default
A Plugin / Theme might want to make a specific variation the default one for that block type.
User Defaults
A user might want to make a specific variation the default whenever they insert a new block of the type.
Custom User Styles
A user might be able to write a custom class (in the "Advanced" block tab) and register it as a block variation.
Concept:
Package Customizations as Classes
A user should be able to modify the aspect of a block (padding, font-size, etc) and save this not as inline styles but as a specific class to be reused. These don't necessarily have to become "style variations" but should be selectable in the advanced -> class input.
Show Style Variations in Class Selector
Style variations should also probably be exposed in the class selector.
The text was updated successfully, but these errors were encountered: