-
Notifications
You must be signed in to change notification settings - Fork 0
v1: Remove style panel on Image core block #3
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
Conversation
This reverts commit 0e4fc39.
|
The PR has been updated to keep the |
braican
left a comment
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.
Want to get your take @ALJ: I know that default and rounded are the defaults that ship with core, but it seems somewhat fragile to hardcode these styles here. WordPress could potentially rename or add additional styles that would then render this code obsolete.
To truly kill the core styles, it may make sense to pull the styles right from the block object:
wp.blocks
.getBlockType('core/image')
.styles.forEach(({ name }) => wp.blocks.unregisterBlockStyle('core/image', name));We could also extend this to more easily extend to other block types as well:
// Add whatever blocks we wanted to zero out here...
['core/image', 'core/quote', 'core/separator', 'core/table'].forEach(blockName => {
wp.blocks
.getBlockType(blockName)
.styles.forEach(({ name: styleName }) => unregisterBlockStyle('core/image', styleName));
});Since the plugin code runs before the theme's, this would still allow the theme to add their own block styles with either wp.blocks.registerBlockStyle or the server-side register_block_style().
|
@braican Yes! I think that's a way better path to go down! Specifically the second example where all core styles (except on ['core/button', 'core/image', 'core/quote', 'core/separator', 'core/table'].forEach(blockName => {
wp.blocks
.getBlockType(blockName)
.styles.forEach(({ name: styleName }) => unregisterBlockStyle(blockName, styleName));
});Want me to bake that in to this PR? |
|
@ALJ yeah let's do it in this PR. |
|
@braican I adjusted the PR to the array loop way of doing things, BUT/AND I also added a final commit for your consideration: 3255662 It makes this whole core block style situation configurable in WSK 'enable_block_styles' => array(
'button',
),Then, theme designers can either enable support for other core block styles, if desired, by adding more config array lines. Or, they can remove the default-on |
|
@ALJ looks great. I just moved everything into the same |
Changes
This removes the WordPress-provided style panels on
core/buttonandcore/imageblocks. This works towards the goal of removing opinionated defaults and unneeded editor options.Edited to add: This image is old; the core/button block still has its styles.
