File tree Expand file tree Collapse file tree 4 files changed +6
-59
lines changed
packages/block-library/src/separator Expand file tree Collapse file tree 4 files changed +6
-59
lines changed Original file line number Diff line number Diff line change 88 },
99 "customColor" : {
1010 "type" : " string"
11- },
12- "style" : {
13- "type" : " object"
1411 }
1512 },
1613 "supports" : {
1714 "anchor" : true ,
18- "align" : [" center" ," wide" ," full" ]
15+ "align" : [" center" ," wide" ," full" ],
16+ "spacing" : {
17+ "margin" : [ " top" , " bottom" ]
18+ }
1919 },
2020 "editorStyle" : " wp-block-separator-editor" ,
2121 "style" : " wp-block-separator"
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ function SeparatorEdit( props ) {
3939 'wp-block-separator' ,
4040 'wp-block-separator-wrapper'
4141 ) }
42+ style = { { } }
4243 >
4344 < BoxControlVisualizer
4445 values = { style ?. spacing ?. margin }
Original file line number Diff line number Diff line change @@ -27,8 +27,6 @@ export default function separatorSave( { attributes } ) {
2727 const style = {
2828 backgroundColor : backgroundClass ? undefined : customColor ,
2929 color : colorClass ? undefined : customColor ,
30- marginBottom : attributes . style ?. spacing ?. margin ?. bottom ,
31- marginTop : attributes . style ?. spacing ?. margin ?. top ,
3230 } ;
3331
3432 return < hr { ...useBlockProps . save ( { className, style } ) } /> ;
Original file line number Diff line number Diff line change 33 */
44import { __ } from '@wordpress/i18n' ;
55import { InspectorControls , PanelColorSettings } from '@wordpress/block-editor' ;
6- import {
7- PanelBody ,
8- __experimentalBoxControl as BoxControl ,
9- } from '@wordpress/components' ;
10-
11- /**
12- * Internal dependencies
13- */
14- import { CSS_UNITS } from './shared' ;
15-
16- const SeparatorSettings = ( {
17- color,
18- setColor,
19- attributes : { style } ,
20- setAttributes,
21- } ) => {
22- const updateMargins = ( { top, bottom } ) => {
23- setAttributes ( {
24- style : {
25- ...style ,
26- spacing : {
27- ...style ?. spacing ,
28- margin : { top, bottom } ,
29- } ,
30- } ,
31- } ) ;
32- } ;
33-
34- const onChangeShowVisualizer = ( { top, bottom } ) => {
35- setAttributes ( {
36- style : {
37- ...style ,
38- visualizers : {
39- margin : { top, bottom } ,
40- } ,
41- } ,
42- } ) ;
43- } ;
446
7+ const SeparatorSettings = ( { color, setColor } ) => {
458 return (
469 < InspectorControls >
4710 < PanelColorSettings
@@ -54,21 +17,6 @@ const SeparatorSettings = ( {
5417 } ,
5518 ] }
5619 />
57- < PanelBody title = { __ ( 'Separator settings' ) } >
58- < BoxControl
59- label = { __ ( 'Margin' ) }
60- onChange = { updateMargins }
61- sides = { {
62- top : true ,
63- right : false ,
64- bottom : true ,
65- left : false ,
66- } }
67- units = { CSS_UNITS }
68- values = { style ?. spacing ?. margin || { } }
69- onChangeShowVisualizer = { onChangeShowVisualizer }
70- />
71- </ PanelBody >
7220 </ InspectorControls >
7321 ) ;
7422} ;
You can’t perform that action at this time.
0 commit comments