Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cover: Explicitly set isUserOverlayColor to false when media is updated #65105

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/block-library/src/cover/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,9 @@ const v12 = {
supports: v12BlockSupports,
isEligible( attributes ) {
return (
attributes.customOverlayColor !== undefined ||
attributes.overlayColor !== undefined
( attributes.customOverlayColor !== undefined ||
attributes.overlayColor !== undefined ) &&
attributes.isUserOverlayColor === undefined
);
},
migrate( attributes ) {
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/cover/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ function CoverEdit( {
averageBackgroundColor
);
__unstableMarkNextChangeAsNotPersistent();
setAttributes( { isDark: newIsDark } );
setAttributes( {
isDark: newIsDark,
isUserOverlayColor: isUserOverlayColor || false,
} );
} )();
// Disable reason: Update the block only when the featured image changes.
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down Expand Up @@ -201,6 +204,7 @@ function CoverEdit( {
useFeaturedImage: undefined,
dimRatio: newDimRatio,
isDark: newIsDark,
isUserOverlayColor: isUserOverlayColor || false,
} );
};

Expand Down
Loading