- 🇵🇹Portugal marcofernandes
To make sure your scripts runs after Gutenberg is initialized, add a dependency to gutenberg/edit-node to your library.
I have tried to disable the core styles for the Button component in the editor and add my own default classes.
I implemented the following JS code:
wp.domReady( () => {
wp.blocks.unregisterBlockStyle(
'core/button',
[ 'default', 'outline', 'squared', 'fill' ]
);
wp.blocks.registerBlockStyle(
'core/button',
[
{
name: 'primary',
label: 'Primary one',
isDefault: true,
},
]
);
} );
This gives weird results because the unregisterBlockStyle function is found but it doesn't do anything. The registerBlockStyle function works fine and the new style is added.
Running the same unregisterBlockStyle JS code in browser console removes the buttons correctly.
Closed: works as designed
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
To make sure your scripts runs after Gutenberg is initialized, add a dependency to gutenberg/edit-node to your library.