Skip to content

Commit

Permalink
- Activating margin block support for the cover block at the block le…
Browse files Browse the repository at this point in the history
…vel.

- Activating margin block support in experimental-default-theme.json so that it's turned on in development by default.
- Removing BoxControlVisualizer for padding to avoid incongruity, that is, that it's on for padding and not for margin
- To add a BoxControlVisualizer for margin we would have to introduce a wrapper around the entire block in edit.js for margin to display properly.
  • Loading branch information
ramonjd committed Aug 11, 2021
1 parent 5a610d4 commit dedc0f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
6 changes: 6 additions & 0 deletions lib/theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,12 @@
"customRadius": true
}
},
"core/cover": {
"spacing": {
"customMargin": true,
"customPadding": true
}
},
"core/pullquote": {
"border": {
"customColor": true,
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
"align": true,
"html": false,
"spacing": {
"padding": true
"padding": true,
"margin": true
},
"color": {
"__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
Expand Down
8 changes: 0 additions & 8 deletions packages/block-library/src/cover/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
ToggleControl,
withNotices,
__experimentalUseCustomUnits as useCustomUnits,
__experimentalBoxControl as BoxControl,
} from '@wordpress/components';
import { compose, withInstanceId, useInstanceId } from '@wordpress/compose';
import {
Expand Down Expand Up @@ -77,8 +76,6 @@ const INNER_BLOCKS_TEMPLATE = [
],
];

const { __Visualizer: BoxControlVisualizer } = BoxControl;

function retrieveFastAverageColor() {
if ( ! retrieveFastAverageColor.fastAverageColor ) {
retrieveFastAverageColor.fastAverageColor = new FastAverageColor();
Expand Down Expand Up @@ -317,7 +314,6 @@ function CoverEdit( {
isRepeated,
minHeight,
minHeightUnit,
style: styleAttribute,
url,
} = attributes;
const {
Expand Down Expand Up @@ -628,10 +624,6 @@ function CoverEdit( {
style={ { ...style, ...blockProps.style } }
data-url={ url }
>
<BoxControlVisualizer
values={ styleAttribute?.spacing?.padding }
showValues={ styleAttribute?.visualizers?.padding }
/>
<ResizableCover
className="block-library-cover__resize-container"
onResizeStart={ () => {
Expand Down

0 comments on commit dedc0f5

Please sign in to comment.