Restrict settings of Gutenberg editor #49493
Labels
[Feature] Block Style Variations
Issues or PRs that are related to the style variations for blocks
[Feature] Design Tools
Tools that impact the appearance of blocks both to expand the number of tools and improve the experi
[Type] Enhancement
A suggestion for improvement.
[Type] Question
Questions about the design or development of the editor.
There are many ways of restricting the settings of the Gutenberg editor, but they all seem to be quite hacky.
In my special case, I want to remove the button's settings in Gutenberg. Therefore I use a javascript file.
wp.blocks.unregisterBlockStyle('core/button', 'fill'); wp.blocks.unregisterBlockStyle('core/button', 'outline');
Afterward, I register a new block inside a PHP file.
register_block_style( 'core/button', array( 'name' => 'primary-button', 'label' => __('Primary Button', 'textdomain'), 'is_default' => true, 'inline_style' => '.is-style-primary-button { color: blue !important; }', ) );
At least I use the Theme.json file to remove leftover settings I don't want to use.
"styles": { "elements": { "button": { "color": { "background": "#17a2b8", "text": "#ffffff", "custom": false }, "border": { "radius": false, "color": false, "style": false, "width": false }, "typography": { "fontSizes": [], "fontFamilies": [] } } } },
Is that the way of removing settings and styles? I used three different files... It feels not that good.
The text was updated successfully, but these errors were encountered: