@wordpress/media-editor 0.18.1-next.v.202609171837.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.19.0 (2026-09-23)
6
+
7
+ ### Bug Fixes
8
+
9
+ - Stop mirroring the crop canvas in RTL. The camera and the resize maths address it in physical pixels, so a mirrored sheet left the handle drawn at the top right resizing the left edge, and pinned the image to the stage edge instead of centring it ([#83304](https://github.com/WordPress/gutenberg/pull/83304)).
10
+ - `RotationRuler`: keep the numerals reading left to right in RTL, matching a strip that already keeps negative degrees on the left ([#83304](https://github.com/WordPress/gutenberg/pull/83304)).
11
+
5
12
  ## 0.18.0 (2026-09-10)
6
13
 
7
14
  ### Internal
@@ -125,7 +125,6 @@
125
125
  word-break: break-all;
126
126
  margin-top: 8px;
127
127
  }
128
-
129
128
  .wp-media-editor-image-editor {
130
129
  position: relative;
131
130
  overflow: hidden;
@@ -155,7 +154,7 @@
155
154
  .wp-media-editor-image-editor__image {
156
155
  position: absolute;
157
156
  top: 0;
158
- right: 0;
157
+ left: 0;
159
158
  will-change: transform;
160
159
  transform-origin: center center;
161
160
  }
@@ -199,7 +198,7 @@
199
198
  background: rgba(255, 255, 255, 0.4);
200
199
  }
201
200
  .wp-media-editor-image-editor__grid-line--horizontal {
202
- right: 0;
201
+ left: 0;
203
202
  width: 100%;
204
203
  height: 1px;
205
204
  }
@@ -260,59 +259,58 @@
260
259
  content: "";
261
260
  position: absolute;
262
261
  top: 50%;
263
- right: 50%;
262
+ left: 50%;
264
263
  width: 44px;
265
264
  height: 44px;
266
- transform: translate(50%, -50%);
265
+ transform: translate(-50%, -50%);
267
266
  }
268
267
  .wp-media-editor-image-editor__handle {
269
268
  /* Offset by half the handle width (12px / 2 = 6px) to center on crop edge */
270
269
  }
271
270
  .wp-media-editor-image-editor__handle--n {
272
271
  top: -6px;
273
- right: 50%;
274
- margin-right: -6px;
272
+ left: 50%;
273
+ margin-left: -6px;
275
274
  cursor: ns-resize;
276
275
  }
277
276
  .wp-media-editor-image-editor__handle--s {
278
277
  bottom: -6px;
279
- right: 50%;
280
- margin-right: -6px;
278
+ left: 50%;
279
+ margin-left: -6px;
281
280
  cursor: ns-resize;
282
281
  }
283
282
  .wp-media-editor-image-editor__handle--e {
284
283
  top: 50%;
285
- left: -6px;
284
+ right: -6px;
286
285
  margin-top: -6px;
287
286
  cursor: ew-resize;
288
287
  }
289
288
  .wp-media-editor-image-editor__handle--w {
290
289
  top: 50%;
291
- right: -6px;
290
+ left: -6px;
292
291
  margin-top: -6px;
293
292
  cursor: ew-resize;
294
293
  }
295
294
  .wp-media-editor-image-editor__handle--nw {
296
295
  top: -6px;
297
- right: -6px;
298
- cursor: nesw-resize;
296
+ left: -6px;
297
+ cursor: nwse-resize;
299
298
  }
300
299
  .wp-media-editor-image-editor__handle--ne {
301
300
  top: -6px;
302
- left: -6px;
303
- cursor: nwse-resize;
301
+ right: -6px;
302
+ cursor: nesw-resize;
304
303
  }
305
304
  .wp-media-editor-image-editor__handle--sw {
306
305
  bottom: -6px;
307
- right: -6px;
308
- cursor: nwse-resize;
306
+ left: -6px;
307
+ cursor: nesw-resize;
309
308
  }
310
309
  .wp-media-editor-image-editor__handle--se {
311
310
  bottom: -6px;
312
- left: -6px;
313
- cursor: nesw-resize;
311
+ right: -6px;
312
+ cursor: nwse-resize;
314
313
  }
315
-
316
314
  /**
317
315
  * Breakpoints & Media Queries
318
316
  */
@@ -692,6 +690,7 @@
692
690
  user-select: none;
693
691
  touch-action: none;
694
692
  cursor: ew-resize;
693
+ direction: ltr;
695
694
  container-type: inline-size;
696
695
  }
697
696
  .rotation-ruler[data-disabled] {
@@ -797,13 +796,13 @@
797
796
  .rotation-ruler__active-label-sign {
798
797
  position: absolute;
799
798
  top: 0;
800
- left: 100%;
799
+ right: 100%;
801
800
  }
802
801
 
803
802
  .rotation-ruler__active-label-unit {
804
803
  position: absolute;
805
804
  top: 0;
806
- right: 100%;
805
+ left: 100%;
807
806
  }
808
807
 
809
808
  @container (max-width: 220px) {
@@ -126,6 +126,7 @@
126
126
  margin-top: 8px;
127
127
  }
128
128
 
129
+ /*!rtl:begin:ignore*/
129
130
  .wp-media-editor-image-editor {
130
131
  position: relative;
131
132
  overflow: hidden;
@@ -313,6 +314,7 @@
313
314
  cursor: nwse-resize;
314
315
  }
315
316
 
317
+ /*!rtl:end:ignore*/
316
318
  /**
317
319
  * Breakpoints & Media Queries
318
320
  */
@@ -692,6 +694,8 @@
692
694
  user-select: none;
693
695
  touch-action: none;
694
696
  cursor: ew-resize;
697
+ /*rtl:ignore*/
698
+ direction: ltr;
695
699
  container-type: inline-size;
696
700
  }
697
701
  .rotation-ruler[data-disabled] {
@@ -798,12 +802,14 @@
798
802
  .rotation-ruler__active-label-sign {
799
803
  position: absolute;
800
804
  top: 0;
805
+ /*rtl:ignore*/
801
806
  right: 100%;
802
807
  }
803
808
 
804
809
  .rotation-ruler__active-label-unit {
805
810
  position: absolute;
806
811
  top: 0;
812
+ /*rtl:ignore*/
807
813
  left: 100%;
808
814
  }
809
815
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/media-editor",
3
- "version": "0.18.1-next.v.202609171837.0",
3
+ "version": "0.19.0",
4
4
  "description": "Media editor components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -21,8 +21,7 @@
21
21
  "url": "https://github.com/WordPress/gutenberg/issues"
22
22
  },
23
23
  "engines": {
24
- "node": ">=18.12.0",
25
- "npm": ">=8.19.2"
24
+ "node": ">=18.12.0"
26
25
  },
27
26
  "main": "build/index.cjs",
28
27
  "module": "build-module/index.mjs",
@@ -43,29 +42,29 @@
43
42
  "build-module/store/index.mjs"
44
43
  ],
45
44
  "dependencies": {
46
- "@wordpress/a11y": "^4.55.1-next.v.202609171837.0",
47
- "@wordpress/admin-ui": "^2.10.1-next.v.202609171837.0",
48
- "@wordpress/api-fetch": "^7.55.1-next.v.202609171837.0",
49
- "@wordpress/base-styles": "^13.2.1-next.v.202609171837.0",
50
- "@wordpress/components": "^41.0.1-next.v.202609171837.0",
51
- "@wordpress/compose": "^8.8.2-next.v.202609171837.0",
52
- "@wordpress/core-data": "^8.0.2-next.v.202609171837.0",
53
- "@wordpress/data": "^10.56.1-next.v.202609171837.0",
54
- "@wordpress/dataviews": "^19.0.2-next.v.202609171837.0",
55
- "@wordpress/element": "^8.7.1-next.v.202609171837.0",
56
- "@wordpress/i18n": "^6.28.1-next.v.202609171837.0",
57
- "@wordpress/icons": "^17.0.1-next.v.202609171837.0",
58
- "@wordpress/keyboard-shortcuts": "^5.56.1-next.v.202609171837.0",
59
- "@wordpress/keycodes": "^4.56.1-next.v.202609171837.0",
60
- "@wordpress/notices": "^5.55.1-next.v.202609171837.0",
61
- "@wordpress/private-apis": "^1.55.1-next.v.202609171837.0",
62
- "@wordpress/ui": "^0.23.1-next.v.202609171837.0",
45
+ "@wordpress/a11y": "^4.56.0",
46
+ "@wordpress/admin-ui": "^2.11.0",
47
+ "@wordpress/api-fetch": "^7.56.0",
48
+ "@wordpress/base-styles": "^13.2.0",
49
+ "@wordpress/components": "^41.0.0",
50
+ "@wordpress/compose": "^8.9.0",
51
+ "@wordpress/core-data": "^8.1.0",
52
+ "@wordpress/data": "^10.56.0",
53
+ "@wordpress/dataviews": "^19.1.0",
54
+ "@wordpress/element": "^8.8.0",
55
+ "@wordpress/i18n": "^6.29.0",
56
+ "@wordpress/icons": "^17.0.0",
57
+ "@wordpress/keyboard-shortcuts": "^5.56.0",
58
+ "@wordpress/keycodes": "^4.56.0",
59
+ "@wordpress/notices": "^5.56.0",
60
+ "@wordpress/private-apis": "^1.56.0",
61
+ "@wordpress/ui": "^0.23.0",
63
62
  "clsx": "^2.1.1",
64
63
  "gl-matrix": "^3.4.3"
65
64
  },
66
65
  "devDependencies": {
67
66
  "@storybook/react-vite": "^10.5.3",
68
- "@testing-library/dom": "^10.4.1",
67
+ "@testing-library/dom": "^10.4.2",
69
68
  "@testing-library/jest-dom": "^7.0.1",
70
69
  "@testing-library/react": "^16.3.3",
71
70
  "@testing-library/user-event": "^14.6.1",
@@ -84,5 +83,5 @@
84
83
  "publishConfig": {
85
84
  "access": "public"
86
85
  },
87
- "gitHead": "7fc9f6676debc888d2f071d17cb71837040d4b48"
86
+ "gitHead": "56d8058eda6e30c4cc8bfc37818fa6ed972f7dc2"
88
87
  }
@@ -2,10 +2,10 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import { useState } from '@wordpress/element';
3
3
  import { __ } from '@wordpress/i18n';
4
4
  import RotationRuler from '../index';
5
- import '../style.scss';
6
5
 
7
6
  const meta: Meta< typeof RotationRuler > = {
8
- title: 'MediaEditor/RotationRuler',
7
+ id: 'mediaeditor-rotationruler',
8
+ title: 'Editor/Media Editor/RotationRuler',
9
9
  component: RotationRuler,
10
10
  args: {
11
11
  label: __( 'Fine rotation' ),
@@ -22,6 +22,11 @@ $rotation-ruler-accent: var(--wp-admin-theme-color, #3858e9);
22
22
  user-select: none;
23
23
  touch-action: none;
24
24
  cursor: ew-resize;
25
+ // A number line, not prose: `__ticks` keeps negatives on the left in
26
+ // every locale, so the numerals must read that way too. Inherited `rtl`
27
+ // sends each tick label through bidi and `-45°` comes out `45°-`.
28
+ /*rtl:ignore*/
29
+ direction: ltr;
25
30
  // Always declare the container so the inline-size query below can
26
31
  // match. Cheap; only affects layout if a child uses cqw/cqh.
27
32
  container-type: inline-size;
@@ -162,9 +167,12 @@ $rotation-ruler-accent: var(--wp-admin-theme-color, #3858e9);
162
167
  // Sign sits flush to the left of the number (mirror of the unit).
163
168
  // Rendered only for negative values, and removed from flow so the
164
169
  // leading `-` does not nudge the digits off the marker line.
170
+ // Both spans are out of flow, so bidi never reorders them: their sides are
171
+ // whatever `left`/`right` say. Mirrored, the label reads `°45-`.
165
172
  .rotation-ruler__active-label-sign {
166
173
  position: absolute;
167
174
  top: 0;
175
+ /*rtl:ignore*/
168
176
  right: 100%;
169
177
  }
170
178
 
@@ -173,6 +181,7 @@ $rotation-ruler-accent: var(--wp-admin-theme-color, #3858e9);
173
181
  .rotation-ruler__active-label-unit {
174
182
  position: absolute;
175
183
  top: 0;
184
+ /*rtl:ignore*/
176
185
  left: 100%;
177
186
  }
178
187
 
@@ -6,6 +6,11 @@
6
6
  // reach isn't clipped by the root.
7
7
  $handle-touch-target-size: 44px;
8
8
 
9
+ // Geometry, not text direction: the camera and `stencil-math.ts` address
10
+ // this canvas in physical pixels, and JS sets the image's `left` inline.
11
+ // Mirrored, `nw` would resize the right edge and the image would pin to the
12
+ // stage edge. ResizableBox ignores its own handle offsets for the same reason.
13
+ /*!rtl:begin:ignore*/
9
14
  .wp-media-editor-image-editor {
10
15
  position: relative;
11
16
  overflow: hidden;
@@ -251,3 +256,4 @@ $handle-touch-target-size: 44px;
251
256
  }
252
257
 
253
258
  }
259
+ /*!rtl:end:ignore*/
@@ -40,7 +40,7 @@ import {
40
40
  getVisibleBounds,
41
41
  } from '../core/camera';
42
42
  import { getSourceRegion } from '../core/source-region';
43
- import './style.css';
43
+ import styles from './style.module.css';
44
44
 
45
45
  const SAMPLE_IMAGE = 'image-editor-demo.jpeg';
46
46
 
@@ -118,7 +118,8 @@ function resolveAspectRatio(
118
118
  }
119
119
 
120
120
  const meta: Meta< typeof Cropper > = {
121
- title: 'MediaEditor/ImageEditor',
121
+ id: 'mediaeditor-imageeditor',
122
+ title: 'Editor/Media Editor/ImageEditor',
122
123
  component: Cropper,
123
124
  tags: [ 'status-experimental' ],
124
125
  };
@@ -135,7 +136,7 @@ const DefaultComponent = () => {
135
136
 
136
137
  return (
137
138
  <div>
138
- <div className="image-editor-story__container">
139
+ <div className={ styles.container }>
139
140
  <Cropper
140
141
  src={ SAMPLE_IMAGE }
141
142
  controller={ controller }
@@ -320,9 +321,9 @@ const WithControlsComponent = () => {
320
321
  type="file"
321
322
  accept="image/*"
322
323
  onChange={ handleFileChange }
323
- className="image-editor-story__hidden-file"
324
+ className={ styles[ 'hidden-file' ] }
324
325
  />
325
- <div className="image-editor-story__toolbar">
326
+ <div className={ styles.toolbar }>
326
327
  <Flex align="center" gap={ 2 } wrap>
327
328
  <FlexItem>
328
329
  <Button
@@ -440,7 +441,7 @@ const WithControlsComponent = () => {
440
441
  </Button>
441
442
  </FlexItem>
442
443
  </Flex>
443
- <div className="image-editor-story__sliders">
444
+ <div className={ styles.sliders }>
444
445
  <RangeControl
445
446
  label="Fine rotation"
446
447
  min={ -MAX_ROTATION_OFFSET }
@@ -460,7 +461,7 @@ const WithControlsComponent = () => {
460
461
  </div>
461
462
  </div>
462
463
 
463
- <div className="image-editor-story__resizable">
464
+ <div className={ styles.resizable }>
464
465
  <Cropper
465
466
  src={ src }
466
467
  controller={ controller }
@@ -491,7 +492,7 @@ const WithControlsComponent = () => {
491
492
 
492
493
  <div style={ { marginTop: 16 } }>
493
494
  <strong>Current State:</strong>
494
- <pre className="image-editor-story__state">
495
+ <pre className={ styles.state }>
495
496
  { JSON.stringify(
496
497
  {
497
498
  rotation: state.rotation,
@@ -737,9 +738,9 @@ const DebugComponent = () => {
737
738
  type="file"
738
739
  accept="image/*"
739
740
  onChange={ handleFileChange }
740
- className="image-editor-story__hidden-file"
741
+ className={ styles[ 'hidden-file' ] }
741
742
  />
742
- <div className="image-editor-story__toolbar">
743
+ <div className={ styles.toolbar }>
743
744
  <Flex align="center" gap={ 2 } wrap>
744
745
  <FlexItem>
745
746
  <Button
@@ -858,7 +859,7 @@ const DebugComponent = () => {
858
859
  </Button>
859
860
  </FlexItem>
860
861
  </Flex>
861
- <div className="image-editor-story__sliders">
862
+ <div className={ styles.sliders }>
862
863
  <RangeControl
863
864
  label="Fine rotation"
864
865
  min={ -MAX_ROTATION_OFFSET }
@@ -885,7 +886,7 @@ const DebugComponent = () => {
885
886
  ref={ containerRef }
886
887
  style={ { flex: '1 1 60%', minWidth: 0 } }
887
888
  >
888
- <div className="image-editor-story__container">
889
+ <div className={ styles.container }>
889
890
  <Cropper
890
891
  src={ src }
891
892
  controller={ controller }
@@ -907,10 +908,10 @@ const DebugComponent = () => {
907
908
  maxHeight: 500,
908
909
  } }
909
910
  >
910
- <div className="image-editor-story__export-preview">
911
+ <div className={ styles[ 'export-preview' ] }>
911
912
  { previewSrc ? (
912
913
  <img
913
- className="image-editor-story__export-image"
914
+ className={ styles[ 'export-image' ] }
914
915
  src={ previewSrc }
915
916
  alt="Crop preview"
916
917
  />
@@ -1,4 +1,4 @@
1
- .image-editor-story__container {
1
+ .container {
2
2
  width: 100%;
3
3
  max-width: 600px;
4
4
  aspect-ratio: 3 / 2;
@@ -6,7 +6,7 @@
6
6
  position: relative;
7
7
  }
8
8
 
9
- .image-editor-story__resizable {
9
+ .resizable {
10
10
  width: 600px;
11
11
  height: 400px;
12
12
  max-width: 100%;
@@ -18,7 +18,7 @@
18
18
  position: relative;
19
19
  }
20
20
 
21
- .image-editor-story__toolbar {
21
+ .toolbar {
22
22
  display: flex;
23
23
  flex-direction: column;
24
24
  gap: 12px;
@@ -29,25 +29,18 @@
29
29
  background: #fafafa;
30
30
  }
31
31
 
32
- .image-editor-story__sliders {
32
+ .sliders {
33
33
  display: grid;
34
34
  grid-template-columns: 1fr 1fr;
35
35
  gap: 16px;
36
36
  padding: 0 4px;
37
37
  }
38
38
 
39
- .image-editor-story__hidden-file {
39
+ .hidden-file {
40
40
  display: none;
41
41
  }
42
42
 
43
- .image-editor-story__json {
44
- width: 100%;
45
- min-height: 80px;
46
- font-family: monospace;
47
- font-size: 12px;
48
- }
49
-
50
- .image-editor-story__state {
43
+ .state {
51
44
  font-family: monospace;
52
45
  font-size: 11px;
53
46
  background: #f5f5f5;
@@ -58,34 +51,12 @@
58
51
  overflow: auto;
59
52
  }
60
53
 
61
- .image-editor-story__vertex-count {
62
- font-variant-numeric: tabular-nums;
63
- min-width: 120px;
64
- }
65
-
66
- .image-editor-story__instructions {
67
- background: #f9f9f9;
68
- border: 1px solid #e0e0e0;
69
- border-radius: 4px;
70
- padding: 12px;
71
- font-size: 13px;
72
- line-height: 1.5;
73
- }
74
-
75
- .image-editor-story__instructions p {
76
- margin: 0 0 4px;
77
- }
78
-
79
- .image-editor-story__instructions p:last-child {
80
- margin-bottom: 0;
81
- }
82
-
83
- .image-editor-story__export-preview {
54
+ .export-preview {
84
55
  margin-bottom: 16px;
85
56
  max-width: 200px;
86
57
  }
87
58
 
88
- .image-editor-story__export-image {
59
+ .export-image {
89
60
  display: block;
90
61
  max-width: 100%;
91
62
  border: 1px solid #ccc;