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 27, 2021
1 parent f42fa3a commit 1940c86
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 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
1 change: 1 addition & 0 deletions packages/block-library/src/cover/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"html": false,
"spacing": {
"padding": true,
"margin": true,
"__experimentalDefaultControls": {
"padding": true
}
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 @@ -23,7 +23,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 @@ -79,8 +78,6 @@ const INNER_BLOCKS_TEMPLATE = [
],
];

const { __Visualizer: BoxControlVisualizer } = BoxControl;

function retrieveFastAverageColor() {
if ( ! retrieveFastAverageColor.fastAverageColor ) {
retrieveFastAverageColor.fastAverageColor = new FastAverageColor();
Expand Down Expand Up @@ -319,7 +316,6 @@ function CoverEdit( {
isRepeated,
minHeight,
minHeightUnit,
style: styleAttribute,
url,
alt,
} = attributes;
Expand Down Expand Up @@ -652,10 +648,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 1940c86

Please sign in to comment.