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

Image Block: Enable crop action when image has a link #61470

Merged
merged 1 commit into from
May 8, 2024
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
20 changes: 13 additions & 7 deletions packages/block-library/src/image/editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,19 @@ figure.wp-block-image:not(.wp-block) {
width: 100%;
overflow: hidden;

// This removes the border from the img within the image cropper so it
// can be applied to the cropper itself. This then allows the image to be
// cropped within the visual border providing more accurate editing and
// smoother UX.
.reactEasyCrop_Container .reactEasyCrop_Image {
border: none;
border-radius: 0; // Prevent's theme.json radius bleeding into cropper.
.reactEasyCrop_Container {
// The linked Image block has `pointer-events: none` applied. Override it
// here to enable the crop action.
pointer-events: auto;

// This removes the border from the img within the image cropper so it
// can be applied to the cropper itself. This then allows the image to be
// cropped within the visual border providing more accurate editing and
// smoother UX.
.reactEasyCrop_Image {
border: none;
border-radius: 0; // Prevent's theme.json radius bleeding into cropper.
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/image/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const ImageWrapper = ( { href, children } ) => {
// When the Image block is linked,
// it's wrapped with a disabled <a /> tag.
// Restore cursor style so it doesn't appear 'clickable'
// Safari needs the display property.
// and remove pointer events. Safari needs the display property.
pointerEvents: 'none',
cursor: 'default',
display: 'inline',
} }
Expand Down
Loading