Skip to content

Commit 27a63ec

Browse files
authored
🩹 fix: core/button block style (#3130)
1 parent 505c310 commit 27a63ec

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

resources/scripts/editor.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
1-
import domReady from '@roots/sage/client/dom-ready';
2-
import { registerBlockStyle, unregisterBlockStyle } from '@wordpress/blocks';
3-
41
/**
5-
* Editor entrypoint
2+
* @see {@link https://bud.js.org/extensions/bud-preset-wordpress/editor-integration/filters}
63
*/
7-
domReady(() => {
8-
unregisterBlockStyle('core/button', 'outline');
9-
10-
registerBlockStyle('core/button', {
11-
name: 'outline',
12-
label: 'Outline',
13-
});
14-
});
4+
roots.register.filters('@scripts/filters');
155

166
/**
177
* @see {@link https://webpack.js.org/api/hot-module-replacement/}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* @see {@link https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/#blocks-registerblocktype}
3+
*/
4+
export const hook = 'blocks.registerBlockType';
5+
6+
/**
7+
* Filter handle
8+
*/
9+
export const name = 'sage/button';
10+
11+
/**
12+
* Filter callback
13+
*
14+
* @param {object} settings
15+
* @param {string} name
16+
* @returns modified settings
17+
*/
18+
export function callback(settings, name) {
19+
if (name !== 'core/button') return settings;
20+
21+
return {
22+
...settings,
23+
styles: [{ label: 'Outline', name: 'outline' }],
24+
};
25+
}

0 commit comments

Comments
 (0)