-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Implements the image-cropper package in the editor. #73277
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
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Size Change: +1.62 kB (+0.06%) Total Size: 2.58 MB
ℹ️ View Unchanged
|
5d4d128 to
567351f
Compare
8772f33 to
51947b4
Compare
f61dc66 to
f44ed00
Compare
|
Flaky tests detected in a2b8598. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/19753199851
|
2ab009a to
5299fc4
Compare
packages/block-editor/src/components/image-editor/use-transform-image.js
Outdated
Show resolved
Hide resolved
8c30e4f to
b5697d5
Compare
474ad31 to
a2b8598
Compare
tellthemachines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes specific to this PR LGTM but not sure why the image-cropper package is still appearing in the diff.
One thing I noticed while testing, which is unrelated to this PR as it also happens on trunk, is that when applying the cropper changes a notification pops up with an "undo" button. Clicking on that undo is irreversible, because it doesn't seem to be in sync with the post "undo" and "redo" buttons. Would be worth fixing separately.
- Added `@wordpress/image-cropper` dependency to package.json and tsconfig.json. - Replaced `react-easy-crop` with the new `ImageCropperComponent` in cropper.js. - Wrapped ImageEditor component with `ImageCropperProvider` for context management. - Updated useTransformImage hook to utilize the new image cropper state management. - Adjusted ZoomDropdown to handle zoom values correctly. This update enhances the image editing capabilities within the block editor by integrating a more robust image cropping solution.
a2b8598 to
a30200e
Compare
|
Thanks for testing! Yep just needed a proper rebase. |
packages/block-editor/src/components/image-editor/use-transform-image.js
Outdated
Show resolved
Hide resolved
tellthemachines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Preserving the set aspect ratio on rotation is a nice improvement.
packages/block-editor/src/components/image-editor/use-transform-image.js
Outdated
Show resolved
Hide resolved
andrewserong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One tiny detail: now that the image cropper package is being imported into the block-editor package, I think this means we'll need to remove the "private": true flag in the image cropper package (based on the discussion in #73633 (comment)):
| "private": true |
andrewserong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change otherwise looks good, and testing well for me, too. Nice work! 🚀
Good spotting! I'll update that in this PR then moige it! |
… access for publishing.
- Included new package entry for @wordpress/image-cropper in the manifest. - Updated markdown source path to point to the package's README.md. This addition enhances the documentation and visibility of the image cropper package within the project.
…ackage' into update/integrate-image-cropper-package
Relies on #72414
What? How?
Implements the image-cropper package in the editor.
Kapture.2025-11-19.at.17.08.44.mp4
Why?
The image cropper component and hooks have been moved to their own package so they can be used across the app, and not just in side the block editor.
Testing
Insert an image block in the editor and crop the image. Make sure to rotate, zoom, and select different aspect ratios.
Save different crops.
There should be no regressions in the way images are cropped in the editor.
There are 2 main differences: