@wordpress/media-editor 0.17.2-next.v.202608281122.0 → 0.18.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.
Files changed (103) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/build/components/media-editor/index.cjs +43 -11
  3. package/build/components/media-editor/index.cjs.map +2 -2
  4. package/build/components/media-editor-canvas/index.cjs +4 -2
  5. package/build/components/media-editor-canvas/index.cjs.map +2 -2
  6. package/build/components/media-editor-crop-panel/index.cjs +4 -2
  7. package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
  8. package/build/components/media-editor-fine-rotation/index.cjs +4 -2
  9. package/build/components/media-editor-fine-rotation/index.cjs.map +2 -2
  10. package/build/components/media-editor-image-controls/index.cjs +17 -4
  11. package/build/components/media-editor-image-controls/index.cjs.map +2 -2
  12. package/build/components/rotation-ruler/index.cjs +1 -0
  13. package/build/components/rotation-ruler/index.cjs.map +2 -2
  14. package/build/components/rotation-ruler/use-ruler-drag.cjs +7 -2
  15. package/build/components/rotation-ruler/use-ruler-drag.cjs.map +2 -2
  16. package/build/image-editor/core/interaction-controller.cjs +3 -0
  17. package/build/image-editor/core/interaction-controller.cjs.map +2 -2
  18. package/build/image-editor/react/components/cropper.cjs +5 -3
  19. package/build/image-editor/react/components/cropper.cjs.map +2 -2
  20. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +12 -5
  21. package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
  22. package/build/image-editor/react/hooks/use-interaction.cjs +31 -0
  23. package/build/image-editor/react/hooks/use-interaction.cjs.map +2 -2
  24. package/build-module/components/media-editor/index.mjs +43 -11
  25. package/build-module/components/media-editor/index.mjs.map +2 -2
  26. package/build-module/components/media-editor-canvas/index.mjs +4 -2
  27. package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
  28. package/build-module/components/media-editor-crop-panel/index.mjs +4 -2
  29. package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
  30. package/build-module/components/media-editor-fine-rotation/index.mjs +4 -2
  31. package/build-module/components/media-editor-fine-rotation/index.mjs.map +2 -2
  32. package/build-module/components/media-editor-image-controls/index.mjs +17 -4
  33. package/build-module/components/media-editor-image-controls/index.mjs.map +2 -2
  34. package/build-module/components/rotation-ruler/index.mjs +1 -0
  35. package/build-module/components/rotation-ruler/index.mjs.map +2 -2
  36. package/build-module/components/rotation-ruler/use-ruler-drag.mjs +7 -2
  37. package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +2 -2
  38. package/build-module/image-editor/core/interaction-controller.mjs +3 -0
  39. package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
  40. package/build-module/image-editor/react/components/cropper.mjs +5 -3
  41. package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
  42. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +12 -5
  43. package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
  44. package/build-module/image-editor/react/hooks/use-interaction.mjs +31 -0
  45. package/build-module/image-editor/react/hooks/use-interaction.mjs.map +2 -2
  46. package/build-style/style-rtl.css +5 -12
  47. package/build-style/style.css +5 -12
  48. package/build-types/components/media-editor/index.d.ts.map +1 -1
  49. package/build-types/components/media-editor-canvas/index.d.ts +7 -1
  50. package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
  51. package/build-types/components/media-editor-crop-panel/index.d.ts +4 -1
  52. package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
  53. package/build-types/components/media-editor-fine-rotation/index.d.ts +7 -1
  54. package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -1
  55. package/build-types/components/media-editor-image-controls/index.d.ts +7 -1
  56. package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
  57. package/build-types/components/rotation-ruler/index.d.ts.map +1 -1
  58. package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -1
  59. package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
  60. package/build-types/image-editor/react/components/cropper.d.ts +7 -0
  61. package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
  62. package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
  63. package/build-types/image-editor/react/hooks/use-interaction.d.ts +5 -0
  64. package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -1
  65. package/global.d.ts +1 -0
  66. package/package.json +23 -22
  67. package/src/components/media-editor/index.tsx +42 -5
  68. package/src/components/media-editor/test/{use-crop-options.tsx → use-crop-options.jsdom.test.tsx} +1 -0
  69. package/src/components/media-editor-canvas/index.tsx +8 -0
  70. package/src/components/media-editor-crop-panel/index.tsx +6 -1
  71. package/src/components/media-editor-crop-panel/test/{index.tsx → index.jsdom.test.tsx} +5 -2
  72. package/src/components/media-editor-fine-rotation/index.tsx +8 -0
  73. package/src/components/media-editor-image-controls/index.tsx +22 -3
  74. package/src/components/media-editor-image-controls/test/{index.tsx → index.jsdom.test.tsx} +37 -0
  75. package/src/components/media-editor-modal/test/build-modifiers.test.ts +24 -14
  76. package/src/components/media-editor-modal/test/{index.tsx → index.jsdom.test.tsx} +65 -35
  77. package/src/components/rotation-ruler/index.tsx +1 -0
  78. package/src/components/rotation-ruler/style.scss +1 -1
  79. package/src/components/rotation-ruler/test/{index.tsx → index.jsdom.test.tsx} +42 -4
  80. package/src/components/rotation-ruler/use-ruler-drag.ts +10 -2
  81. package/src/image-editor/core/export/test/{canvas-renderer.ts → canvas-renderer.jsdom.test.ts} +76 -63
  82. package/src/image-editor/core/interaction-controller.ts +8 -0
  83. package/src/image-editor/core/math/test/sanitize.ts +1 -0
  84. package/src/image-editor/core/test/camera.ts +2 -3
  85. package/src/image-editor/core/test/interaction-controller.ts +50 -40
  86. package/src/image-editor/core/test/preview-export-parity.ts +31 -23
  87. package/src/image-editor/core/test/render-camera-bridge.ts +1 -0
  88. package/src/image-editor/core/test/state.ts +1 -0
  89. package/src/image-editor/core/test/stencil-math.ts +1 -0
  90. package/src/image-editor/core/transforms/test/pipeline.ts +1 -0
  91. package/src/image-editor/react/components/cropper.tsx +12 -1
  92. package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +22 -6
  93. package/src/image-editor/react/components/stencils/test/{rectangle-stencil.tsx → rectangle-stencil.jsdom.test.tsx} +54 -36
  94. package/src/image-editor/react/components/test/{cropper.tsx → cropper.jsdom.test.tsx} +304 -0
  95. package/src/image-editor/react/hooks/test/{use-aria-announcer.ts → use-aria-announcer.jsdom.test.ts} +57 -44
  96. package/src/image-editor/react/hooks/test/{use-cropper-reducer.ts → use-cropper-reducer.jsdom.test.ts} +1 -0
  97. package/src/image-editor/react/hooks/test/{use-interaction.ts → use-interaction.jsdom.test.ts} +17 -16
  98. package/src/image-editor/react/hooks/test/{use-transform-style.ts → use-transform-style.jsdom.test.ts} +1 -0
  99. package/src/image-editor/react/hooks/use-interaction.ts +47 -0
  100. package/src/state/test/{use-media-editor-state.ts → use-media-editor-state.jsdom.test.ts} +1 -0
  101. package/src/store/test/reducer.ts +9 -8
  102. package/tsconfig.build.tsbuildinfo +1 -1
  103. package/tsconfig.json +8 -3
@@ -65,8 +65,7 @@
65
65
  .media-editor-preview--image img {
66
66
  max-width: 100%;
67
67
  max-height: 100%;
68
- -o-object-fit: contain;
69
- object-fit: contain;
68
+ object-fit: contain;
70
69
  width: auto;
71
70
  height: auto;
72
71
  opacity: 0;
@@ -88,8 +87,7 @@
88
87
  .media-editor-preview--video video {
89
88
  max-width: 100%;
90
89
  max-height: 100%;
91
- -o-object-fit: contain;
92
- object-fit: contain;
90
+ object-fit: contain;
93
91
  width: auto;
94
92
  height: auto;
95
93
  }
@@ -135,7 +133,6 @@
135
133
  height: 100%;
136
134
  touch-action: none;
137
135
  -webkit-user-select: none;
138
- -moz-user-select: none;
139
136
  user-select: none;
140
137
  cursor: grab;
141
138
  }
@@ -236,9 +233,7 @@
236
233
  box-shadow: 0 0 0 1px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
237
234
  }
238
235
  .wp-media-editor-image-editor__handle {
239
- -webkit-appearance: none;
240
- -moz-appearance: none;
241
- appearance: none;
236
+ appearance: none;
242
237
  margin: 0;
243
238
  padding: 0;
244
239
  font: inherit;
@@ -442,8 +437,7 @@
442
437
  .media-editor .media-editor__canvas-area video {
443
438
  max-width: 100%;
444
439
  max-height: 100%;
445
- -o-object-fit: contain;
446
- object-fit: contain;
440
+ object-fit: contain;
447
441
  }
448
442
  .media-editor .media-editor__sidebar {
449
443
  display: flex;
@@ -695,7 +689,6 @@
695
689
  color: #1e1e1e;
696
690
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
697
691
  -webkit-user-select: none;
698
- -moz-user-select: none;
699
692
  user-select: none;
700
693
  touch-action: none;
701
694
  cursor: ew-resize;
@@ -719,7 +712,7 @@
719
712
  margin: -1px;
720
713
  padding: 0;
721
714
  border: 0;
722
- clip: rect(0 0 0 0);
715
+ clip-path: inset(50%);
723
716
  overflow: hidden;
724
717
  white-space: nowrap;
725
718
  }
@@ -65,8 +65,7 @@
65
65
  .media-editor-preview--image img {
66
66
  max-width: 100%;
67
67
  max-height: 100%;
68
- -o-object-fit: contain;
69
- object-fit: contain;
68
+ object-fit: contain;
70
69
  width: auto;
71
70
  height: auto;
72
71
  opacity: 0;
@@ -88,8 +87,7 @@
88
87
  .media-editor-preview--video video {
89
88
  max-width: 100%;
90
89
  max-height: 100%;
91
- -o-object-fit: contain;
92
- object-fit: contain;
90
+ object-fit: contain;
93
91
  width: auto;
94
92
  height: auto;
95
93
  }
@@ -135,7 +133,6 @@
135
133
  height: 100%;
136
134
  touch-action: none;
137
135
  -webkit-user-select: none;
138
- -moz-user-select: none;
139
136
  user-select: none;
140
137
  cursor: grab;
141
138
  }
@@ -236,9 +233,7 @@
236
233
  box-shadow: 0 0 0 1px var(--wp-image-editor-focus-color, var(--wp-admin-theme-color, #007cba));
237
234
  }
238
235
  .wp-media-editor-image-editor__handle {
239
- -webkit-appearance: none;
240
- -moz-appearance: none;
241
- appearance: none;
236
+ appearance: none;
242
237
  margin: 0;
243
238
  padding: 0;
244
239
  font: inherit;
@@ -442,8 +437,7 @@
442
437
  .media-editor .media-editor__canvas-area video {
443
438
  max-width: 100%;
444
439
  max-height: 100%;
445
- -o-object-fit: contain;
446
- object-fit: contain;
440
+ object-fit: contain;
447
441
  }
448
442
  .media-editor .media-editor__sidebar {
449
443
  display: flex;
@@ -695,7 +689,6 @@
695
689
  color: #1e1e1e;
696
690
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
697
691
  -webkit-user-select: none;
698
- -moz-user-select: none;
699
692
  user-select: none;
700
693
  touch-action: none;
701
694
  cursor: ew-resize;
@@ -719,7 +712,7 @@
719
712
  margin: -1px;
720
713
  padding: 0;
721
714
  border: 0;
722
- clip: rect(0 0 0 0);
715
+ clip-path: inset(50%);
723
716
  overflow: hidden;
724
717
  white-space: nowrap;
725
718
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor/index.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,IAAI,kBAAkB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AAStD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAG3E,OAAO,EAGN,KAAK,qBAAqB,EAC1B,MAAM,yBAAyB,CAAC;AAGjC,YAAY,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AA0BrE,MAAM,WAAW,qBAAqB;IACrC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;;;OAMG;IACH,MAA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AAoB,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAqHD,MAAM,WAAW,kBAAkB;IAClC;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,iBAAS,aAAa,CAAE,EAAE,eAAuB,EAAE,EAAE,kBAAkB,+BAoDtE;AAED,iBAAS,cAAc,uCAsFtB;AAED,MAAM,WAAW,gBAAgB;IAChC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAC7B;AAED,iBAAS,WAAW,CAAE,EAAE,IAAgB,EAAE,EAAE,gBAAgB,+BAkC3D;AA+bD,wBAAgB,WAAW,CAAE,KAAK,EAAE,gBAAgB,+BAMnD;yBANe,WAAW;;;;;eAeZ,WAAW"}
@@ -5,6 +5,11 @@ export interface MediaEditorCanvasProps {
5
5
  onGestureStart?: () => void;
6
6
  /** Fires when a canvas cropper gesture ends. */
7
7
  onGestureEnd?: () => void;
8
+ /**
9
+ * Disable crop interaction on the canvas. Set while the edit is saving,
10
+ * so a drag cannot change the crop after the request was built.
11
+ */
12
+ disabled?: boolean;
8
13
  }
9
14
  /**
10
15
  * Editing surface for image media in the media editor modal. Pulls
@@ -18,6 +23,7 @@ export interface MediaEditorCanvasProps {
18
23
  * @param props.isPlacementActive
19
24
  * @param props.onGestureStart
20
25
  * @param props.onGestureEnd
26
+ * @param props.disabled
21
27
  */
22
- export default function MediaEditorCanvas({ isPlacementActive, onGestureStart, onGestureEnd, }: MediaEditorCanvasProps): import("react").JSX.Element | null;
28
+ export default function MediaEditorCanvas({ isPlacementActive, onGestureStart, onGestureEnd, disabled, }: MediaEditorCanvasProps): import("react").JSX.Element | null;
23
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACtC,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,iBAAyB,EACzB,cAAc,EACd,YAAY,GACZ,EAAE,sBAAsB,sCAkIxB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-canvas/index.tsx"],"names":[],"mappings":"AASA,MAAM,WAAW,sBAAsB;IACtC,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,gDAAgD;IAChD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAE,EAC1C,iBAAyB,EACzB,cAAc,EACd,YAAY,EACZ,QAAgB,GAChB,EAAE,sBAAsB,sCAmIxB"}
@@ -10,6 +10,8 @@ export interface MediaEditorCropPanelProps {
10
10
  onAspectRatioChange: (value: string) => void;
11
11
  /** Aspect-ratio presets to display in the selector. */
12
12
  aspectRatioOptions: AspectRatioPreset[];
13
+ /** Disable every control in the panel while the edit is saving. */
14
+ disabled?: boolean;
13
15
  }
14
16
  /**
15
17
  * Sidebar panel for crop controls: rotate, flip and zoom above the
@@ -19,6 +21,7 @@ export interface MediaEditorCropPanelProps {
19
21
  * @param props.aspectRatioValue
20
22
  * @param props.onAspectRatioChange
21
23
  * @param props.aspectRatioOptions
24
+ * @param props.disabled
22
25
  */
23
- export default function MediaEditorCropPanel({ aspectRatioValue, onAspectRatioChange, aspectRatioOptions, }: MediaEditorCropPanelProps): import("react").JSX.Element;
26
+ export default function MediaEditorCropPanel({ aspectRatioValue, onAspectRatioChange, aspectRatioOptions, disabled, }: MediaEditorCropPanelProps): import("react").JSX.Element;
24
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,mBAAmB,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IAC/C,uDAAuD;IACvD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,GAClB,EAAE,yBAAyB,+BAyB3B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-crop-panel/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,MAAM,WAAW,yBAAyB;IACzC;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;IACzB,gDAAgD;IAChD,mBAAmB,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IAC/C,uDAAuD;IACvD,kBAAkB,EAAE,iBAAiB,EAAE,CAAC;IACxC,mEAAmE;IACnE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAE,EAC7C,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,QAAgB,GAChB,EAAE,yBAAyB,+BA0B3B"}
@@ -1,6 +1,11 @@
1
1
  export interface MediaEditorFineRotationProps {
2
2
  /** Signal that a placement-oriented control is being adjusted. */
3
3
  onPlacementControlInteraction?: () => void;
4
+ /**
5
+ * Disable the ruler. Set while the edit is saving; `RotationRuler`
6
+ * cancels an in-flight drag when this flips.
7
+ */
8
+ disabled?: boolean;
4
9
  }
5
10
  /**
6
11
  * Fine-rotation slider for the media editor. It renders under the canvas so it
@@ -10,6 +15,7 @@ export interface MediaEditorFineRotationProps {
10
15
  *
11
16
  * @param props
12
17
  * @param props.onPlacementControlInteraction
18
+ * @param props.disabled
13
19
  */
14
- export default function MediaEditorFineRotation({ onPlacementControlInteraction, }: MediaEditorFineRotationProps): import("react").JSX.Element;
20
+ export default function MediaEditorFineRotation({ onPlacementControlInteraction, disabled, }: MediaEditorFineRotationProps): import("react").JSX.Element;
15
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-fine-rotation/index.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,4BAA4B;IAC5C,kEAAkE;IAClE,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3C;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAE,EAChD,6BAA6B,GAC7B,EAAE,4BAA4B,+BA6C9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-fine-rotation/index.tsx"],"names":[],"mappings":"AAMA,MAAM,WAAW,4BAA4B;IAC5C,kEAAkE;IAClE,6BAA6B,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAE,EAChD,6BAA6B,EAC7B,QAAgB,GAChB,EAAE,4BAA4B,+BA8C9B"}
@@ -29,6 +29,11 @@ export interface MediaEditorImageControlsProps {
29
29
  * `DEFAULT_ZOOM_FACTOR` (1.2).
30
30
  */
31
31
  zoomFactor?: number;
32
+ /**
33
+ * Disable every control. Set while the edit is saving, so the crop the
34
+ * request was built from cannot change under it.
35
+ */
36
+ disabled?: boolean;
32
37
  }
33
38
  /**
34
39
  * Image editing controls placed independently per viewport: on wide viewports
@@ -41,6 +46,7 @@ export interface MediaEditorImageControlsProps {
41
46
  * @param props.showAspectRatioControl
42
47
  * @param props.aspectRatioPresets
43
48
  * @param props.zoomFactor
49
+ * @param props.disabled
44
50
  */
45
- export default function MediaEditorImageControls({ withLabels, showAspectRatioControl, aspectRatioPresets, zoomFactor, }: MediaEditorImageControlsProps): import("react").JSX.Element;
51
+ export default function MediaEditorImageControls({ withLabels, showAspectRatioControl, aspectRatioPresets, zoomFactor, disabled, }: MediaEditorImageControlsProps): import("react").JSX.Element;
46
52
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-image-controls/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,mCAAmC,CAAC;AAI3C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,MAAM,WAAW,6BAA6B;IAC7C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,EACjD,UAAkB,EAClB,sBAA8B,EAC9B,kBAAkB,EAClB,UAAgC,GAChC,EAAE,6BAA6B,+BAmL/B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/media-editor-image-controls/index.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,mCAAmC,CAAC;AAI3C;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAEvC,MAAM,WAAW,6BAA6B;IAC7C;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAE,EACjD,UAAkB,EAClB,sBAA8B,EAC9B,kBAAkB,EAClB,UAAgC,EAChC,QAAgB,GAChB,EAAE,6BAA6B,+BA+L/B"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/rotation-ruler/index.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IAClC,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IACpC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAqDD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,KAAK,EAAE,kBAAkB,+BAwK/D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/rotation-ruler/index.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,kBAAkB;IAClC,qBAAqB;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,QAAQ,EAAE,CAAE,KAAK,EAAE,MAAM,KAAM,IAAI,CAAC;IACpC,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oCAAoC;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AAqDD;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,KAAK,EAAE,kBAAkB,+BAyK/D"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-ruler-drag.d.ts","sourceRoot":"","sources":["../../../src/components/rotation-ruler/use-ruler-drag.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM,GACV,MAAM,CAER;AAED;;;;;;GAMG;AACH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EAAE,MAAM,GACV,MAAM,CAER;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAI,MAAM,CAQ5E;AAED;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAI,MAAM,CAE9D;AAED,MAAM,WAAW,mBAAmB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,oEAAoE;IACpE,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IACjC,aAAa,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IACpE,aAAa,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IACpE,WAAW,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;IAClE,eAAe,EAAE,CAAE,KAAK,EAAE,KAAK,CAAC,YAAY,CAAE,WAAW,CAAE,KAAM,IAAI,CAAC;CACtE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAC3B,OAAO,EAAE,mBAAmB,GAC1B,iBAAiB,CAsJnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"interaction-controller.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/interaction-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,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U,GAAI,IAAI,CA0DjC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CACf,CAAC,EAAE,UAAU,EACb,aAAa,EAAE,OAAO,EACtB,GAAG,GAAE,QAAmB,GACtB,IAAI,CA6FN;IAOD,OAAO,CAAC,eAAe,CA2JrB;IAQF,OAAO,CAAC,YAAY;IAkFpB;;;;;;OAMG;IACH,aAAa,CAAE,CAAC,EAAE,aAAa,GAAI,IAAI,CAwHtC;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAWd;CACD"}
1
+ {"version":3,"file":"interaction-controller.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/interaction-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AA6CnE;;GAEG;AACH,MAAM,WAAW,iBAAiB;IACjC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,0DAA0D;IAC1D,MAAM,EAAE,CAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IACzC;;;;OAIG;IACH,OAAO,EAAE,CAAE,IAAI,EAAE,MAAM,KAAM,IAAI,CAAC;IAClC,sDAAsD;IACtD,cAAc,EAAE,CAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,eAAe,KAAM,IAAI,CAAC;IAC/D,iCAAiC;IACjC,YAAY,EAAE,CAAE,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,KAAM,IAAI,CAAC;IAC5C,qCAAqC;IACrC,UAAU,CAAC,EAAE,CAAE,SAAS,EAAE,YAAY,GAAG,UAAU,KAAM,IAAI,CAAC;CAC9D;AAED;;;;;;GAMG;AACH,MAAM,WAAW,4BAA4B;IAC5C,sEAAsE;IACtE,QAAQ,EAAE,MAAM,YAAY,CAAC;IAC7B,6EAA6E;I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4BAA4B,EAEjD;IAED,qEAAqE;IACrE,OAAO,KAAK,OAAO,GAElB;IAED,qEAAqE;IACrE,OAAO,KAAK,OAAO,GAElB;IAED,uEAAuE;IACvE,OAAO,KAAK,SAAS,GAEpB;IAED,0EAA0E;IAC1E,OAAO,KAAK,YAAY,GAEvB;IAED;;;;;OAKG;IACH,OAAO,CAAC,eAAe;IAMvB,2EAA2E;IAC3E,OAAO,KAAK,aAAa,GAExB;IAED;;;;OAIG;IACH,OAAO,CAAC,SAAS;IA0BjB;;;;;;;;;OASG;IACH,iBAAiB,CAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,WAAW,GAAI,IAAI,CAiG1D;IAED;;;;;;;;;OASG;IACH,WAAW,CAAE,CAAC,EAAE,UAAU,GAAI,IAAI,CA0DjC;IAED;;;;;;;;;;;;;OAaG;IACH,gBAAgB,CACf,CAAC,EAAE,UAAU,EACb,aAAa,EAAE,OAAO,EACtB,GAAG,GAAE,QAAmB,GACtB,IAAI,CA6FN;IAOD,OAAO,CAAC,eAAe,CA2JrB;IAQF,OAAO,CAAC,YAAY;IAkFpB;;;;;;OAMG;IACH,aAAa,CAAE,CAAC,EAAE,aAAa,GAAI,IAAI,CAwHtC;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI,CAmBd;CACD"}
@@ -32,6 +32,13 @@ export interface CropperProps {
32
32
  freeformCrop?: boolean;
33
33
  /** Focus the crop area when the cropper mounts. */
34
34
  focusOnMount?: boolean;
35
+ /**
36
+ * Ignore all crop interaction: pointer drags, wheel zoom, keyboard
37
+ * pan/zoom and the stencil's resize handles. Any gesture already in
38
+ * flight is cancelled. Used while the edit is being saved, so the
39
+ * modifiers sent to the server cannot change after the request starts.
40
+ */
41
+ disabled?: boolean;
35
42
  /** Callback fired when the image is loaded. */
36
43
  onImageLoaded?: (size: Size) => void;
37
44
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"cropper.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper.ts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EAAE,MAAM,IAAI,CAAC;IAC1B,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAs+BD,eAAO,MAAM,OAAO,yGAMnB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AAmExE;;GAEG;AACH,KAAK,qBAAqB,GAAG,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAE,EACjC,QAAQ,EACR,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAoB,EACpB,gBAAwB,EACxB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,kBAAkB,GAClB,EAAE,qBAAqB,sCAmevB"}
1
+ {"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AAmExE;;GAEG;AACH,KAAK,qBAAqB,GAAG,YAAY,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAE,EACjC,QAAQ,EACR,aAAa,EACb,SAAS,EACT,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,YAAoB,EACpB,gBAAwB,EACxB,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,kBAAkB,GAClB,EAAE,qBAAqB,sCAmfvB"}
@@ -40,6 +40,11 @@ export interface UseInteractionOptions {
40
40
  onGestureStart?: () => void;
41
41
  /** Fires when a continuous gesture ends (pointer release). */
42
42
  onGestureEnd?: () => void;
43
+ /**
44
+ * Ignore all interaction. Any gesture already in flight is torn down,
45
+ * so a drag started before this flipped cannot keep moving the image.
46
+ */
47
+ disabled?: boolean;
43
48
  }
44
49
  /**
45
50
  * Mouse, touch, and keyboard event handling for pan, zoom,
@@ -1 +1 @@
1
- {"version":3,"file":"use-interaction.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-interaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAEN,KAAK,yBAAyB,EAC9B,MAAM,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,8DAA8D;IAC9D,QAAQ,EAAE;QACT,aAAa,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAM,IAAI,CAAC;QACjD,YAAY,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAM,IAAI,CAAC;QAC9C,SAAS,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,aAAa,KAAM,IAAI,CAAC;KAC9C,CAAC;IACF,yEAAyE;IACzE,aAAa,EAAE,CAAE,CAAC,EAAE,UAAU,KAAM,IAAI,CAAC;IACzC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,iBAAiB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B;AA6BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,yBAAyB,EAClC,aAAa,EAAE,IAAI,EACnB,SAAS,CAAC,EAAE,IAAI,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,oBAAoB,CAmJtB"}
1
+ {"version":3,"file":"use-interaction.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/hooks/use-interaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAEN,KAAK,yBAAyB,EAC9B,MAAM,mCAAmC,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACpC,8DAA8D;IAC9D,QAAQ,EAAE;QACT,aAAa,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,YAAY,KAAM,IAAI,CAAC;QACjD,YAAY,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,UAAU,KAAM,IAAI,CAAC;QAC9C,SAAS,EAAE,CAAE,CAAC,EAAE,KAAK,CAAC,aAAa,KAAM,IAAI,CAAC;KAC9C,CAAC;IACF,yEAAyE;IACzE,aAAa,EAAE,CAAE,CAAC,EAAE,UAAU,KAAM,IAAI,CAAC;IACzC,uDAAuD;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IACnB,wEAAwE;IACxE,iBAAiB,EAAE,OAAO,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qDAAqD;IACrD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qEAAqE;IACrE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACnB;AA6BD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC7B,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,yBAAyB,EAClC,aAAa,EAAE,IAAI,EACnB,SAAS,CAAC,EAAE,IAAI,EAChB,OAAO,CAAC,EAAE,qBAAqB,GAC7B,oBAAoB,CA6LtB"}
package/global.d.ts CHANGED
@@ -3,3 +3,4 @@
3
3
  * like the jest-dom matchers, must be referenced explicitly.
4
4
  */
5
5
  import '@testing-library/jest-dom';
6
+ import '@testing-library/jest-dom/vitest';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/media-editor",
3
- "version": "0.17.2-next.v.202608281122.0",
3
+ "version": "0.18.0",
4
4
  "description": "Media editor components for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -43,33 +43,34 @@
43
43
  "build-module/store/index.mjs"
44
44
  ],
45
45
  "dependencies": {
46
- "@wordpress/a11y": "^4.54.1-next.v.202608281122.0",
47
- "@wordpress/admin-ui": "^2.9.1-next.v.202608281122.0",
48
- "@wordpress/api-fetch": "^7.54.1-next.v.202608281122.0",
49
- "@wordpress/base-styles": "^13.0.1-next.v.202608281122.0",
50
- "@wordpress/components": "^40.1.1-next.v.202608281122.0",
51
- "@wordpress/compose": "^8.7.2-next.v.202608281122.0",
52
- "@wordpress/core-data": "^7.54.2-next.v.202608281122.0",
53
- "@wordpress/data": "^10.54.2-next.v.202608281122.0",
54
- "@wordpress/dataviews": "^18.1.2-next.v.202608281122.0",
55
- "@wordpress/element": "^8.6.2-next.v.202608281122.0",
56
- "@wordpress/i18n": "^6.27.1-next.v.202608281122.0",
57
- "@wordpress/icons": "^15.5.1-next.v.202608281122.0",
58
- "@wordpress/keyboard-shortcuts": "^5.54.1-next.v.202608281122.0",
59
- "@wordpress/keycodes": "^4.54.1-next.v.202608281122.0",
60
- "@wordpress/notices": "^5.54.1-next.v.202608281122.0",
61
- "@wordpress/private-apis": "^1.54.1-next.v.202608281122.0",
62
- "@wordpress/ui": "^0.22.1-next.v.202608281122.0",
46
+ "@wordpress/a11y": "^4.55.0",
47
+ "@wordpress/admin-ui": "^2.10.0",
48
+ "@wordpress/api-fetch": "^7.55.0",
49
+ "@wordpress/base-styles": "^13.1.0",
50
+ "@wordpress/components": "^40.1.0",
51
+ "@wordpress/compose": "^8.8.0",
52
+ "@wordpress/core-data": "^8.0.0",
53
+ "@wordpress/data": "^10.55.0",
54
+ "@wordpress/dataviews": "^19.0.0",
55
+ "@wordpress/element": "^8.7.0",
56
+ "@wordpress/i18n": "^6.28.0",
57
+ "@wordpress/icons": "^16.0.0",
58
+ "@wordpress/keyboard-shortcuts": "^5.55.0",
59
+ "@wordpress/keycodes": "^4.55.0",
60
+ "@wordpress/notices": "^5.55.0",
61
+ "@wordpress/private-apis": "^1.55.0",
62
+ "@wordpress/ui": "^0.22.0",
63
63
  "clsx": "^2.1.1",
64
64
  "gl-matrix": "^3.4.3"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@storybook/react-vite": "^10.5.3",
68
68
  "@testing-library/dom": "^10.4.1",
69
- "@testing-library/jest-dom": "^6.9.1",
70
- "@testing-library/react": "^16.3.2",
69
+ "@testing-library/jest-dom": "^7.0.1",
70
+ "@testing-library/react": "^16.3.3",
71
71
  "@testing-library/user-event": "^14.6.1",
72
- "@types/jest": "^30.0.0"
72
+ "@types/jest": "^30.0.0",
73
+ "vitest": "^5.0.0"
73
74
  },
74
75
  "peerDependencies": {
75
76
  "@types/react": "^18 || ^19",
@@ -83,5 +84,5 @@
83
84
  "publishConfig": {
84
85
  "access": "public"
85
86
  },
86
- "gitHead": "de479d415171765f7b573c81aeec5334ff506a12"
87
+ "gitHead": "485f42ae8a1c58ceea18371a507fd4acfa86fbd8"
87
88
  }
@@ -116,12 +116,15 @@ interface MediaEditorSidebarProps {
116
116
  /** The open panel's id. Always one of `tabs`. */
117
117
  activeTab: string;
118
118
  onSelectTab: ( tab: string ) => void;
119
+ /** Freeze the open panel while the edit is saving. */
120
+ disabled?: boolean;
119
121
  }
120
122
 
121
123
  function MediaEditorSidebar( {
122
124
  tabs,
123
125
  activeTab,
124
126
  onSelectTab,
127
+ disabled = false,
125
128
  }: MediaEditorSidebarProps ) {
126
129
  return (
127
130
  <NavigableRegion
@@ -146,7 +149,11 @@ function MediaEditorSidebar( {
146
149
  <div className="media-editor__tablist">
147
150
  <Tabs.List variant="minimal">
148
151
  { tabs.map( ( tab ) => (
149
- <Tabs.Tab key={ tab.id } value={ tab.id }>
152
+ <Tabs.Tab
153
+ key={ tab.id }
154
+ value={ tab.id }
155
+ disabled={ disabled }
156
+ >
150
157
  { tab.title }
151
158
  </Tabs.Tab>
152
159
  ) ) }
@@ -320,6 +327,9 @@ function HistoryActions() {
320
327
  redoCrop();
321
328
  };
322
329
  const handleReset = () => {
330
+ if ( isUndoRedoDisabled ) {
331
+ return;
332
+ }
323
333
  beginGesture();
324
334
  reset();
325
335
  onReset();
@@ -334,7 +344,7 @@ function HistoryActions() {
334
344
  <Button
335
345
  size="compact"
336
346
  variant="tertiary"
337
- disabled={ ! isDirty }
347
+ disabled={ isUndoRedoDisabled || ! isDirty }
338
348
  accessibleWhenDisabled
339
349
  onClick={ handleReset }
340
350
  >
@@ -600,6 +610,14 @@ function MediaEditorContent( {
600
610
  } );
601
611
 
602
612
  const handleChange = ( updates: Partial< Media > ) => {
613
+ // A save reads the pending edits once and then waits. An edit
614
+ // arriving after that read misses the request, and a crop save
615
+ // then clears the edits for this id, so it would be lost rather
616
+ // than merely late. It would also land on the attachment being
617
+ // replaced, not the new one the modal moves to.
618
+ if ( isSaving ) {
619
+ return;
620
+ }
603
621
  editEntityRecord( 'postType', 'attachment', id, updates );
604
622
  };
605
623
 
@@ -634,7 +652,7 @@ function MediaEditorContent( {
634
652
  ! target.closest( `[${ CROP_CONTROL_ATTR }]` );
635
653
  if ( ! isMetadataField ) {
636
654
  event.preventDefault();
637
- if ( isCropInteractionActive ) {
655
+ if ( isCropInteractionActive || isSaving ) {
638
656
  return;
639
657
  }
640
658
  if ( isRedoShortcut ) {
@@ -677,6 +695,7 @@ function MediaEditorContent( {
677
695
  <MediaEditorImageControls
678
696
  showAspectRatioControl
679
697
  aspectRatioPresets={ aspectRatioPresets }
698
+ disabled={ isSaving }
680
699
  />
681
700
  ) : null;
682
701
 
@@ -694,6 +713,7 @@ function MediaEditorContent( {
694
713
  aspectRatioValue={ aspectRatioValue }
695
714
  onAspectRatioChange={ setAspectRatioValue }
696
715
  aspectRatioOptions={ aspectRatioOptions }
716
+ disabled={ isSaving }
697
717
  />
698
718
  ),
699
719
  },
@@ -709,6 +729,7 @@ function MediaEditorContent( {
709
729
  const ruler = isImage ? (
710
730
  <MediaEditorFineRotation
711
731
  onPlacementControlInteraction={ signalPlacementControlInteraction }
732
+ disabled={ isSaving }
712
733
  />
713
734
  ) : null;
714
735
 
@@ -716,7 +737,18 @@ function MediaEditorContent( {
716
737
  <MediaEditorProvider
717
738
  value={ media ?? undefined }
718
739
  onChange={ handleChange }
719
- settings={ { fields } }
740
+ settings={ {
741
+ // Disable the fields while saving, so the guard in
742
+ // `handleChange` is not silently swallowing typing.
743
+ // `readOnly` would swap the field's layout mid-save;
744
+ // disabled keeps it in place and greys it out.
745
+ fields: isSaving
746
+ ? fields.map( ( field ) => ( {
747
+ ...field,
748
+ isDisabled: true,
749
+ } ) )
750
+ : fields,
751
+ } }
720
752
  >
721
753
  <div className="media-editor">
722
754
  { ! media ? (
@@ -745,6 +777,7 @@ function MediaEditorContent( {
745
777
  handleCanvasGestureStart
746
778
  }
747
779
  onGestureEnd={ handleCanvasGestureEnd }
780
+ disabled={ isSaving }
748
781
  />
749
782
  ) : (
750
783
  <MediaPreview />
@@ -773,6 +806,7 @@ function MediaEditorContent( {
773
806
  : DETAILS_PANEL
774
807
  }
775
808
  onSelectTab={ selectPanel }
809
+ disabled={ isSaving }
776
810
  />
777
811
  ) }
778
812
  </div>
@@ -805,7 +839,10 @@ function MediaEditorContent( {
805
839
  isSaving,
806
840
  hasMedia: !! media,
807
841
  hasChanges,
808
- isUndoRedoDisabled: isCropInteractionActive,
842
+ // Saving freezes the whole edit surface: `save()` reads the
843
+ // modifiers once and then awaits, so anything changed after that
844
+ // would be silently dropped when the save resolves.
845
+ isUndoRedoDisabled: isCropInteractionActive || isSaving,
809
846
  aspectRatioPresets,
810
847
  isWide,
811
848
  activePanel,
@@ -1,3 +1,4 @@
1
+ import { describe, expect, it } from 'vitest';
1
2
  import { fireEvent, render, screen } from '@testing-library/react';
2
3
  import { useCropOptions } from '../use-crop-options';
3
4
  import { ORIGINAL_ASPECT_RATIO } from '../../../image-editor/core/constants';
@@ -14,6 +14,11 @@ export interface MediaEditorCanvasProps {
14
14
  onGestureStart?: () => void;
15
15
  /** Fires when a canvas cropper gesture ends. */
16
16
  onGestureEnd?: () => void;
17
+ /**
18
+ * Disable crop interaction on the canvas. Set while the edit is saving,
19
+ * so a drag cannot change the crop after the request was built.
20
+ */
21
+ disabled?: boolean;
17
22
  }
18
23
 
19
24
  /**
@@ -28,11 +33,13 @@ export interface MediaEditorCanvasProps {
28
33
  * @param props.isPlacementActive
29
34
  * @param props.onGestureStart
30
35
  * @param props.onGestureEnd
36
+ * @param props.disabled
31
37
  */
32
38
  export default function MediaEditorCanvas( {
33
39
  isPlacementActive = false,
34
40
  onGestureStart,
35
41
  onGestureEnd,
42
+ disabled = false,
36
43
  }: MediaEditorCanvasProps ) {
37
44
  const { media } = useMediaEditorContext();
38
45
  const controller = useMediaEditor();
@@ -159,6 +166,7 @@ export default function MediaEditorCanvas( {
159
166
  isPlacementActive={ isPlacementActive }
160
167
  onGestureStart={ handleGestureStart }
161
168
  onGestureEnd={ handleGestureEnd }
169
+ disabled={ disabled }
162
170
  />
163
171
  </div>
164
172
  </div>
@@ -16,6 +16,8 @@ export interface MediaEditorCropPanelProps {
16
16
  onAspectRatioChange: ( value: string ) => void;
17
17
  /** Aspect-ratio presets to display in the selector. */
18
18
  aspectRatioOptions: AspectRatioPreset[];
19
+ /** Disable every control in the panel while the edit is saving. */
20
+ disabled?: boolean;
19
21
  }
20
22
 
21
23
  /**
@@ -26,11 +28,13 @@ export interface MediaEditorCropPanelProps {
26
28
  * @param props.aspectRatioValue
27
29
  * @param props.onAspectRatioChange
28
30
  * @param props.aspectRatioOptions
31
+ * @param props.disabled
29
32
  */
30
33
  export default function MediaEditorCropPanel( {
31
34
  aspectRatioValue,
32
35
  onAspectRatioChange,
33
36
  aspectRatioOptions,
37
+ disabled = false,
34
38
  }: MediaEditorCropPanelProps ) {
35
39
  return (
36
40
  // Tag the whole panel as a crop-control region so the modal's
@@ -44,11 +48,12 @@ export default function MediaEditorCropPanel( {
44
48
  <VisuallyHidden render={ <h2 /> }>
45
49
  { __( 'Crop options' ) }
46
50
  </VisuallyHidden>
47
- <MediaEditorImageControls withLabels />
51
+ <MediaEditorImageControls withLabels disabled={ disabled } />
48
52
  <SelectControl
49
53
  label={ __( 'Aspect ratio' ) }
50
54
  value={ aspectRatioValue }
51
55
  onChange={ onAspectRatioChange }
56
+ disabled={ disabled }
52
57
  options={ aspectRatioOptions.map( ( preset ) => ( {
53
58
  label: preset.label,
54
59
  value: preset.value.toString(),