From cb93e9fa28333ff8771b016c9d49845f59bda3a8 Mon Sep 17 00:00:00 2001 From: Jorge Date: Mon, 1 Apr 2019 15:07:33 +0100 Subject: [PATCH] Fix: Cover Block: Remove focal point attributes when they are not needed --- packages/block-library/src/cover/edit.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/cover/edit.js b/packages/block-library/src/cover/edit.js index bdf85c0874a757..d7e51f876156f4 100644 --- a/packages/block-library/src/cover/edit.js +++ b/packages/block-library/src/cover/edit.js @@ -137,9 +137,19 @@ class CoverEdit extends Component { url: media.url, id: media.id, backgroundType: mediaType, + ...( mediaType === VIDEO_BACKGROUND_TYPE ? + { focalPoint: undefined, hasParallax: undefined } : + {} + ), + } ); + }; + + const toggleParallax = () => { + setAttributes( { + hasParallax: ! hasParallax, + ...( ! hasParallax ? { focalPoint: undefined } : {} ), } ); }; - const toggleParallax = () => setAttributes( { hasParallax: ! hasParallax } ); const setDimRatio = ( ratio ) => setAttributes( { dimRatio: ratio } ); const style = {