Skip to content

Commit

Permalink
Fix media type check in the onSelectMedia hook
Browse files Browse the repository at this point in the history
  • Loading branch information
WunderBart committed Oct 9, 2023
1 parent 4ce1636 commit 659ba57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/block-library/src/cover/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,12 @@ function CoverEdit( {

const onSelectMedia = async ( newMedia ) => {
const mediaAttributes = attributesFromMedia( newMedia );
const isImage = [ newMedia?.type, newMedia?.media_type ].includes(
IMAGE_BACKGROUND_TYPE
);

const averageBackgroundColor = await getMediaColor(
newMedia?.type === IMAGE_BACKGROUND_TYPE ? newMedia?.url : undefined
isImage ? newMedia?.url : undefined
);

let newOverlayColor = overlayColor.color;
Expand Down

0 comments on commit 659ba57

Please sign in to comment.