Skip to content

Image Cropper: Deprecate the package in favour of the image editor - #86417

Merged
ramonjd merged 4 commits into
trunkfrom
update/deprecate-image-cropper
Nov 9, 2026
Merged

ramonjd merged 4 commits into
trunkfrom
update/deprecate-image-cropper

Conversation

@ramonjd

@ramonjd ramonjd commented Nov 6, 2026 •

Copy link
Copy Markdown
Member

What?

Follow-up to #86223, part of #86145. Deprecates @wordpress/image-cropper in favour of @wordpress/image-editor. The package implementation remains unchanged.

Why?

@wordpress/image-editor has the canvas, the controller and the save helpers the media editor is built on, so new croppers should start there. Rebuilding the old package on it (#86407) was more than the package warrants: its only consumer in this repository is wp.blockEditor.__experimentalImageEditor, itself deprecated since 7.1 and rendered by no core block. Deprecating in place and removing the package later costs outside consumers one migration instead of two.

How?

  • README: a deprecation banner in the shape @wordpress/nux uses, which also notes that wp.blockEditor.__experimentalImageEditor is deprecated. The package description starts with "Deprecated", as nux's does, so the npm page says so.
  • CHANGELOG entry under Deprecations.
  • The image editor README no longer says the cropper will be rebuilt on it.

Testing Instructions

  1. Check the package description, README and CHANGELOG for the deprecation and replacement.
  2. Open Storybook, "Editor/Image Cropper/ImageCropper", and check that cropping still behaves as before.

Follow-ups

  • Run npm deprecate on the package when this ships.
  • Remove wp.blockEditor.__experimentalImageEditor, then the package.

@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

Preview in WordPress Playground Preview in Storybook

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

📦 Bundle size

Size Change: 0 B

Total Size: 8.61 MB

49e1d50 Run

⚡ Performance

Show the results

Client side metrics exclude the server response time.

front-end-block-theme

Metric fa24151 trunk % Change
timeToFirstByte 36.05 ms +5.96% -3.88% 37.6 ms +7.31% -9.18% -4.12%
largestContentfulPaint 64 ms +6.25% -6.25% 64 ms +12.5% -0% 0%
lcpMinusTtfb 28.9 ms +8.3% -15.4% 27 ms +10.56% -2.96% 7.04%
wpBeforeTemplate 18.56 ms +14.22% -3.39% 19.13 ms +12.28% -5.23% -2.98%
wpTemplate 13.86 ms +3.97% -8.59% 14.02 ms +10.2% -6.56% -1.14%
wpTotal 33 ms +6.21% -4.03% 34.53 ms +7.21% -9.76% -4.43%
wpMemoryUsage 7.72 MB +0% -0% 7.69 MB +0% -0% 0.43%
wpDbQueries 16 +0% -0% 16 +0% -0% 0%

front-end-classic-theme

Metric fa24151 trunk % Change
timeToFirstByte 30.2 ms +6.95% -4.64% 33.35 ms +6.15% -7.05% -9.45%
largestContentfulPaint 68 ms +2.94% -5.88% 72 ms +5.56% -2.78% -5.56%
lcpMinusTtfb 36.25 ms +4.14% -2.21% 39.05 ms +3.33% -2.56% -7.17%
wpBeforeTemplate 16.02 ms +11.17% -0.87% 17.81 ms +12.63% -5.73% -10.05%
wpTemplate 10.77 ms +7.24% -4.09% 11.57 ms +10.03% -4.06% -6.91%
wpTotal 27.37 ms +8.33% -4.09% 30.56 ms +5.89% -7.69% -10.44%
wpMemoryUsage 6.41 MB +0% -0% 6.38 MB +0% -0% 0.53%
wpDbQueries 13 +0% -0% 13 +0% -0% 0%

media-processing

Metric fa24151 trunk % Change
mediaProcessingJpeg 226.56 ms +12.76% -1.33% 232.73 ms +2.61% -1.08% -2.65%
mediaProcessingAvif 3697.88 ms +0.46% -0.3% 3852.32 ms +0.4% -1.14% -4.01%
mediaProcessingJpegToAvif 2589.88 ms +0.61% -0.88% 2663.73 ms +0.41% -0.28% -2.77%

media-upload

Metric fa24151 trunk % Change
jpegUploadProcessing 1417.94 ms +0.82% -1.23% 1416.91 ms +0.64% -1.04% 0.07%
pngUploadProcessing 180.96 ms +7.66% -3.34% 210.06 ms +3.18% -3.58% -13.85%
largeJpegUploadProcessing 1424.15 ms +0.13% -0.68% 1410.35 ms +0.94% -0.67% 0.98%
multipleImageUploadProcessing 1476.1 ms +0.51% -0.58% 1480.4 ms +1.47% -1.07% -0.29%

post-editor

Metric fa24151 trunk % Change
serverResponse 468.76 ms +5.95% -5.31% 492.84 ms +1.66% -8.05% -4.89%
firstPaint 333.14 ms +26.8% -12.52% 328.52 ms +10.89% -7.41% 1.41%
domContentLoaded 888.29 ms +2.99% -1.8% 884.94 ms +1.27% -1.91% 0.38%
loaded 889.52 ms +2.96% -1.81% 886.28 ms +1.24% -1.9% 0.37%
firstContentfulPaint 518.91 ms +5.31% -2.96% 523.08 ms +2.07% -2.98% -0.8%
firstBlock 2243.27 ms +6.16% -1.32% 2236.48 ms +1.56% -0.36% 0.3%
type 18.56 ms +9.32% -10.4% 19.46 ms +9.1% -8.17% -4.62%
typeWithoutInspector 19.85 ms +4.79% -14.36% 20.58 ms +2.77% -12.49% -3.55%
typeWithTopToolbar 25 ms +5.84% -4.6% 24.32 ms +14.27% -14.51% 2.8%
typeContainer 9.08 ms +10.13% -3.63% 8.44 ms +8.29% -3.08% 7.58%
focus 130.42 ms +0.78% -7.45% 111.07 ms +12.57% -5.51% 17.42%
firstFocus 271.4 ms +0% -0% 233.64 ms +0% -0% 16.16%
selectAll 464.08 ms +1.12% -6.83% 413.68 ms +2.28% -1.68% 12.18%
undo 31.19 ms +10.93% -3.78% 29.65 ms +7.49% -7.69% 5.19%
listViewOpen 84.4 ms +9.32% -8.45% 78.88 ms +9.76% -4.34% 7%
inserterOpen 45.47 ms +4.31% -8.97% 43.54 ms +6.57% -12.13% 4.43%
inserterHover 12.51 ms +3.92% -13.19% 11.14 ms +7.9% -9.78% 12.3%
inserterSearch 8.67 ms +10.03% -6.46% 8.82 ms +7.82% -16.1% -1.7%
loadPatterns 699.1 ms +1.61% -4.75% 631.04 ms +6.55% -3.87% 10.79%
wpTotal 458.95 ms +6.07% -5.39% 482.88 ms +1.68% -8.21% -4.96%
wpMemoryUsage 14.78 MB +0% -0% 14.74 MB +0% -0% 0.24%
wpDbQueries 55 +0% -0% 55 +0% -0% 0%

site-editor

Metric fa24151 trunk % Change
serverResponse 317.66 ms +1.87% -8.51% 312.49 ms +3.45% -6.9% 1.65%
firstPaint 284.59 ms +1.53% -20.5% 288.05 ms +6.46% -7.68% -1.2%
domContentLoaded 698.52 ms +1.35% -1.47% 702.87 ms +0.46% -1.84% -0.62%
loaded 699.42 ms +1.36% -1.47% 703.71 ms +0.47% -1.84% -0.61%
firstContentfulPaint 405.71 ms +1.74% -2.71% 400.04 ms +0.85% -1.48% 1.42%
firstBlock 2060.84 ms +0.56% -1.14% 2050.25 ms +2.14% -1.72% 0.52%
type 15.96 ms +4.07% -9.65% 16.09 ms +1.86% -9.45% -0.81%
navigate 92.57 ms +2.53% -5.87% 90.64 ms +14.46% -1.53% 2.13%
loadPatterns 1054.68 ms +18.56% -10.09% 1002.92 ms +5.8% -4.27% 5.16%
loadPages 1045.22 ms +3.38% -1.14% 961.09 ms +6.07% -2.42% 8.75%
wpTotal 309.26 ms +1.94% -8.73% 304.16 ms +3.51% -7.2% 1.68%
wpMemoryUsage 12.79 MB +0% -0% 12.76 MB +0% -0% 0.27%
wpDbQueries 45 +0% -0% 45 +0% -0% 0%

49e1d50 Run

🏁 Flaky tests

Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

Page List converts to Navigation Links with entity bindings in /test/e2e/specs/editor/blocks/navigation.spec.js, passed after 1 failed attempt.
Error: expect(locator).toContainText(expected) failed

Locator: getByRole('region', { name: 'Editor settings' }).getByRole('tabpanel', { name: 'Content' }).getByRole('button', { name: /Link to:/ })
Expected substring: "test-page-1"
Received string:    "Link to:Cat/catPagePublished"
Timeout: 5000ms

Call log:
  - Expect "toContainText" getByRole('region', { name: 'Editor settings' }).getByRole('tabpanel', { name: 'Content' }).getByRole('button', { name: /Link to:/ }) with timeout 5000ms
  - waiting for getByRole('region', { name: 'Editor settings' }).getByRole('tabpanel', { name: 'Content' }).getByRole('button', { name: /Link to:/ })
    14 × locator resolved to <button type="button" aria-expanded="false" aria-haspopup="dialog" class="components-button link-preview-button is-next-40px-default-size is-secondary">…</button>
       - unexpected value "Link to:Cat/catPagePublished"

    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/blocks/navigation.spec.js:1949:31
Undo restores the post selection when another synced entity is loaded (RTC WebSocket) in /test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Object {
    "attributeKey": "content",
    "blockIndex": 0,
    "content": "abcdef",
-   "endOffset": 3,
-   "offset": 3,
+   "endOffset": 6,
+   "offset": 6,
  }

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/collaboration/collaboration-undo-redo.spec.ts:363:5
moves selected text into another paragraph in /test/e2e/specs/editor/various/draggable-blocks.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 2
+ Received  + 2

  Array [
    Object {
      "attributes": Object {
-       "content": "First third",
+       "content": "First second third",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {
-       "content": "Fourth second fifth",
+       "content": "Fourth fifth",
      },
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/draggable-blocks.spec.js:1167:41
should partially select with shift + click in /test/e2e/specs/editor/various/multi-block-selection.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  -  1
+ Received  + 11

  Array [
    Object {
      "attributes": Object {
-       "content": "<strong>1</strong>|2",
+       "content": "<strong>1</strong>[",
+       "dropCap": false,
+     },
+     "innerBlocks": Array [],
+     "name": "core/paragraph",
+   },
+   Object {
+     "attributes": Object {
+       "content": "]2",
+       "dropCap": false,
      },
+     "innerBlocks": Array [],
      "name": "core/paragraph",
    },
  ]

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/multi-block-selection.spec.js:1600:41
should place the caret at the click position when clicking a block that is not selected in /test/e2e/specs/editor/various/writing-flow.spec.js, passed after 1 failed attempt.
Error: expect(received).toMatchObject(expected)

- Expected  - 1
+ Received  + 1

@@ -1,9 +1,9 @@
  Array [
    Object {
      "attributes": Object {
-       "content": "First!",
+       "content": "First",
      },
      "name": "core/paragraph",
    },
    Object {
      "attributes": Object {

Call Log:
- Timeout 5000ms exceeded while waiting on the predicate
    at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/editor/various/writing-flow.spec.js:952:41

49e1d50 Run

@github-actions github-actions Bot added [Package] Image Cropper Related to packages/image-cropper [Package] Image Editor Related to packages/image-editor labels Nov 6, 2026
@ramonjd
ramonjd requested a review from andrewserong November 6, 2026 07:37
@ramonjd
ramonjd marked this pull request as ready for review November 6, 2026 07:38
@ramonjd
ramonjd requested a balanced review from Copilot November 6, 2026 07:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the change deprecating @wordpress/image-cropper in favor of @wordpress/image-editor.

No open issues 🎉

What changed in this PR

Deprecates @wordpress/image-cropper in favour of @wordpress/image-editor, preserving existing cropping behaviour until a future removal.

Changes:

  • Adds a mount-time deprecation notice to ImageCropperProvider.
  • Adds the @wordpress/deprecated dependency and TypeScript references.
  • Updates documentation and the changelog to describe deprecation rather than rebuilding the cropper.
File Description
packages/​image-editor/​README.md Replaces the rebuild plan with the cropper’s deprecation status.
packages/​image-cropper/​tsconfig.json Adds the deprecation package reference for development.
packages/​image-cropper/​tsconfig.build.json Adds the deprecation package reference for builds.
packages/​image-cropper/​src/​provider/​index.tsx Logs a deprecation notice when the provider mounts.
packages/​image-cropper/​README.md Adds migration guidance and future removal notices.
packages/​image-cropper/​package.json Declares the deprecation utility dependency.
packages/​image-cropper/​CHANGELOG.md Records the package deprecation.
package-lock.json Records the added dependency in the lockfile.

Review effort: Balanced

@ramonjd ramonjd added the [Type] Code Quality Issues or PRs that relate to code quality label Nov 6, 2026
Mounting ImageCropperProvider logs a deprecation notice once, naming
@wordpress/image-editor as the replacement. The README says the package
will be removed in a later release and that the one consumer in this
repository, wp.blockEditor.__experimentalImageEditor, is deprecated as
well. Nothing else in the package changes.
Shorten the README banner to the shape @wordpress/nux uses, and start
the package description with "Deprecated" so the npm page and search
results say so.
@ramonjd
ramonjd force-pushed the update/deprecate-image-cropper branch from 530ce58 to 51c8e8b Compare November 8, 2026 23:04
Comment thread packages/image-cropper/CHANGELOG.md Resolved

@andrewserong andrewserong left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looking good to me, and it logs out correctly in storybook:

Image

Smoke-tested that it doesn't log anything out by default the block editor since we're not rendering the __experimentalImageEditor anywhere.

Just left a comment about whether or not we need the runtime deprecation call (not a strong opinion, just a question). One other thought is that (in a follow up) we could remove the Image Cropper story book story altogether now that we're stabilising and consolidating around the Image Editor?

In any case, LGTM

@ramonjd

ramonjd commented Nov 9, 2026 •

Copy link
Copy Markdown
Member Author

Thanks for testing @andrewserong!

Note to self:

Need to deprecate during RC1 before final release. When @wordpress/image-editor is published to npm under latest

npm deprecate '@wordpress/image-cropper@*' 'This package is deprecated. Use @wordpress/image-editor instead.'

Not because we have to (see #84318 (comment)), but because @wordpress/image-editor is not yet on npm!

@ramonjd
ramonjd merged commit 99055cf into trunk Nov 9, 2026
85 checks passed
@ramonjd
ramonjd deleted the update/deprecate-image-cropper branch November 9, 2026 01:11
@github-actions github-actions Bot added this to the Gutenberg 24.5 milestone Nov 9, 2026
@ramonjd

ramonjd commented Nov 25, 2026 •

Copy link
Copy Markdown
Member Author

Need to deprecate during RC1 before final release. When @wordpress/image-editor is published to npm under latest

Update. After chatting with @ciampo I learned that it can’t be safely deprecated until we take away block-editor’s dependency on it. So we have to

  1. Remove wp.blockEditor.__experimentalImageEditor / remove the dependency from the block-editor package. (block-editor is already using the new image editor)
  2. Then mark @wordpress/image-cropper as private.
  3. After the last version is published, run the deprecate command for npm once.

No. 1 might be 2-3 versions out still as it's on the public API, despite having the __experimental prefix.

Vedant-Gandhi pushed a commit to Vedant-Gandhi/gutenberg that referenced this pull request Nov 30, 2026
…ordPress#86417)

Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Image Cropper Related to packages/image-cropper [Package] Image Editor Related to packages/image-editor [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants