🩹 fix: core/button block style (#3130)
This commit is contained in:
@@ -1,17 +1,7 @@
|
|||||||
import domReady from '@roots/sage/client/dom-ready';
|
|
||||||
import { registerBlockStyle, unregisterBlockStyle } from '@wordpress/blocks';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Editor entrypoint
|
* @see {@link https://bud.js.org/extensions/bud-preset-wordpress/editor-integration/filters}
|
||||||
*/
|
*/
|
||||||
domReady(() => {
|
roots.register.filters('@scripts/filters');
|
||||||
unregisterBlockStyle('core/button', 'outline');
|
|
||||||
|
|
||||||
registerBlockStyle('core/button', {
|
|
||||||
name: 'outline',
|
|
||||||
label: 'Outline',
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see {@link https://webpack.js.org/api/hot-module-replacement/}
|
* @see {@link https://webpack.js.org/api/hot-module-replacement/}
|
||||||
|
|||||||
25
resources/scripts/filters/button.filter.js
Normal file
25
resources/scripts/filters/button.filter.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* @see {@link https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#blocks-registerblocktype}
|
||||||
|
*/
|
||||||
|
export const hook = 'blocks.registerBlockType';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter handle
|
||||||
|
*/
|
||||||
|
export const name = 'sage/button';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter callback
|
||||||
|
*
|
||||||
|
* @param {object} settings
|
||||||
|
* @param {string} name
|
||||||
|
* @returns modified settings
|
||||||
|
*/
|
||||||
|
export function callback(settings, name) {
|
||||||
|
if (name !== 'core/button') return settings;
|
||||||
|
|
||||||
|
return {
|
||||||
|
...settings,
|
||||||
|
styles: [{ label: 'Outline', name: 'outline' }],
|
||||||
|
};
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user