From cba150ada6f377ac072961f7dd67093385582503 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 29 Apr 2022 17:24:02 +1000 Subject: [PATCH] Try new approach to handling cover borders in editor --- packages/block-library/src/cover/block.json | 1 - packages/block-library/src/cover/edit.js | 129 +++++++++---------- packages/block-library/src/cover/editor.scss | 20 ++- 3 files changed, 73 insertions(+), 77 deletions(-) diff --git a/packages/block-library/src/cover/block.json b/packages/block-library/src/cover/block.json index d42232dd0f277..0450b736b2f75 100644 --- a/packages/block-library/src/cover/block.json +++ b/packages/block-library/src/cover/block.json @@ -92,7 +92,6 @@ "radius": true, "style": true, "width": true, - "__experimentalSkipSerialization": true, "__experimentalDefaultControls": { "color": true, "radius": true, diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index 0ca295ddbb145..2e39a1f186943 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -51,7 +51,6 @@ import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings, __experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl, __experimentalBlockFullHeightAligmentControl as FullHeightAlignmentControl, - __experimentalUseBorderProps as useBorderProps, store as blockEditorStore, } from '@wordpress/block-editor'; import { __ } from '@wordpress/i18n'; @@ -74,7 +73,6 @@ import { isContentPositionCenter, getPositionClassName, } from './shared'; -import cleanEmptyObject from '../utils/clean-empty-object'; extend( [ namesPlugin ] ); @@ -302,6 +300,7 @@ function CoverEdit( { context: { postId, postType }, } ) { const { + align, contentPosition, id, useFeaturedImage, @@ -653,14 +652,6 @@ function CoverEdit( { const ref = useRef(); const blockProps = useBlockProps( { ref } ); - const borderProps = useBorderProps( attributes ); - const borderRadiusStyles = cleanEmptyObject( { - borderTopLeftRadius: borderProps.style.borderTopLeftRadius, - borderTopRightRadius: borderProps.style.borderTopRightRadius, - borderBottomLeftRadius: borderProps.style.borderBottomLeftRadius, - borderBottomRightRadius: borderProps.style.borderBottomRightRadius, - borderRadius: borderProps.style.borderRadius, - } ); // Check for fontSize support before we pass a fontSize attribute to the innerBlocks. const hasFontSizes = !! useSetting( 'typography.fontSizes' )?.length; @@ -745,10 +736,10 @@ function CoverEdit( { <> { controls }