@wordpress/media-editor 0.17.2-next.v.202609031004.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.
- package/CHANGELOG.md +1 -1
- package/build/components/media-editor/index.cjs +43 -11
- package/build/components/media-editor/index.cjs.map +2 -2
- package/build/components/media-editor-canvas/index.cjs +4 -2
- package/build/components/media-editor-canvas/index.cjs.map +2 -2
- package/build/components/media-editor-crop-panel/index.cjs +4 -2
- package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
- package/build/components/media-editor-fine-rotation/index.cjs +4 -2
- package/build/components/media-editor-fine-rotation/index.cjs.map +2 -2
- package/build/components/media-editor-image-controls/index.cjs +17 -4
- package/build/components/media-editor-image-controls/index.cjs.map +2 -2
- package/build/components/rotation-ruler/index.cjs +1 -0
- package/build/components/rotation-ruler/index.cjs.map +2 -2
- package/build/components/rotation-ruler/use-ruler-drag.cjs +7 -2
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +2 -2
- package/build/image-editor/core/interaction-controller.cjs +3 -0
- package/build/image-editor/core/interaction-controller.cjs.map +2 -2
- package/build/image-editor/react/components/cropper.cjs +5 -3
- package/build/image-editor/react/components/cropper.cjs.map +2 -2
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +12 -5
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-interaction.cjs +31 -0
- package/build/image-editor/react/hooks/use-interaction.cjs.map +2 -2
- package/build-module/components/media-editor/index.mjs +43 -11
- package/build-module/components/media-editor/index.mjs.map +2 -2
- package/build-module/components/media-editor-canvas/index.mjs +4 -2
- package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
- package/build-module/components/media-editor-crop-panel/index.mjs +4 -2
- package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
- package/build-module/components/media-editor-fine-rotation/index.mjs +4 -2
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +2 -2
- package/build-module/components/media-editor-image-controls/index.mjs +17 -4
- package/build-module/components/media-editor-image-controls/index.mjs.map +2 -2
- package/build-module/components/rotation-ruler/index.mjs +1 -0
- package/build-module/components/rotation-ruler/index.mjs.map +2 -2
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs +7 -2
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +2 -2
- package/build-module/image-editor/core/interaction-controller.mjs +3 -0
- package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
- package/build-module/image-editor/react/components/cropper.mjs +5 -3
- package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +12 -5
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-interaction.mjs +31 -0
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +2 -2
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor-canvas/index.d.ts +7 -1
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +4 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-fine-rotation/index.d.ts +7 -1
- package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts +7 -1
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
- package/build-types/components/rotation-ruler/index.d.ts.map +1 -1
- package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -1
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts +7 -0
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +5 -0
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -1
- package/global.d.ts +1 -0
- package/package.json +22 -22
- package/src/components/media-editor/index.tsx +42 -5
- package/src/components/media-editor/test/use-crop-options.jsdom.test.tsx +1 -0
- package/src/components/media-editor-canvas/index.tsx +8 -0
- package/src/components/media-editor-crop-panel/index.tsx +6 -1
- package/src/components/media-editor-crop-panel/test/index.jsdom.test.tsx +5 -2
- package/src/components/media-editor-fine-rotation/index.tsx +8 -0
- package/src/components/media-editor-image-controls/index.tsx +22 -3
- package/src/components/media-editor-image-controls/test/index.jsdom.test.tsx +37 -0
- package/src/components/media-editor-modal/test/index.jsdom.test.tsx +65 -35
- package/src/components/rotation-ruler/index.tsx +1 -0
- package/src/components/rotation-ruler/test/index.jsdom.test.tsx +42 -4
- package/src/components/rotation-ruler/use-ruler-drag.ts +10 -2
- package/src/image-editor/core/export/test/canvas-renderer.jsdom.test.ts +76 -63
- package/src/image-editor/core/interaction-controller.ts +8 -0
- package/src/image-editor/react/components/cropper.tsx +12 -1
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +22 -6
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.jsdom.test.tsx +54 -36
- package/src/image-editor/react/components/test/cropper.jsdom.test.tsx +304 -0
- package/src/image-editor/react/hooks/test/use-aria-announcer.jsdom.test.ts +57 -44
- package/src/image-editor/react/hooks/test/use-cropper-reducer.jsdom.test.ts +1 -0
- package/src/image-editor/react/hooks/test/use-interaction.jsdom.test.ts +17 -16
- package/src/image-editor/react/hooks/test/use-transform-style.jsdom.test.ts +1 -0
- package/src/image-editor/react/hooks/use-interaction.ts +47 -0
- package/src/state/test/use-media-editor-state.jsdom.test.ts +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +6 -1
|
@@ -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;
|
|
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;
|
|
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;
|
|
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;
|
|
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,+
|
|
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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AM,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,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,E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AS,CAA8C;IAE/D,wCAAwC;IACxC,OAAO,CAAC,iBAAiB,CAA8C;IAEvE,mDAAmD;IACnD,OAAO,CAAC,kBAAkB,CAAS;IAEnC,wCAAwC;IACxC,OAAO,CAAC,KAAK,CAAK;IAElB,YAAa,OAAO,EAAE,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,
|
|
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;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AG,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.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACX,YAAY,EAEZ,YAAY,EACZ,IAAI,EAEJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AA2CtE;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,UAAU,EAAE,iBAAiB,CAAC;IAC9B,yEAAyE;IACzE,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAE,YAAY,CAAE,CAAC;IAC9C,yEAAyE;IACzE,QAAQ,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IACnC,wEAAwE;IACxE,iBAAiB,CAAC,EAA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nC,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,mDAAmD;IACnD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+CAA+C;IAC/C,aAAa,CAAC,EAAE,CAAE,IAAI,EAAE,IAAI,KAAM,IAAI,CAAC;IACvC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,CAAE,KAAK,EAAE,YAAY,KAAM,IAAI,CAAC;IAChD,oFAAoF;IACpF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,uEAAuE;IACvE,YAAY,CAAC,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,
|
|
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;
|
|
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,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-
"version": "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,34 +43,34 @@
|
|
|
43
43
|
"build-module/store/index.mjs"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@wordpress/a11y": "^4.
|
|
47
|
-
"@wordpress/admin-ui": "^2.
|
|
48
|
-
"@wordpress/api-fetch": "^7.
|
|
49
|
-
"@wordpress/base-styles": "^13.1.
|
|
50
|
-
"@wordpress/components": "^40.1.
|
|
51
|
-
"@wordpress/compose": "^8.
|
|
52
|
-
"@wordpress/core-data": "^8.0.
|
|
53
|
-
"@wordpress/data": "^10.
|
|
54
|
-
"@wordpress/dataviews": "^19.0.
|
|
55
|
-
"@wordpress/element": "^8.
|
|
56
|
-
"@wordpress/i18n": "^6.
|
|
57
|
-
"@wordpress/icons": "^16.0.
|
|
58
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
59
|
-
"@wordpress/keycodes": "^4.
|
|
60
|
-
"@wordpress/notices": "^5.
|
|
61
|
-
"@wordpress/private-apis": "^1.
|
|
62
|
-
"@wordpress/ui": "^0.22.
|
|
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": "^
|
|
70
|
-
"@testing-library/react": "^16.3.
|
|
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
72
|
"@types/jest": "^30.0.0",
|
|
73
|
-
"vitest": "^
|
|
73
|
+
"vitest": "^5.0.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
76
|
"@types/react": "^18 || ^19",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "485f42ae8a1c58ceea18371a507fd4acfa86fbd8"
|
|
88
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
|
|
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={ {
|
|
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
|
-
|
|
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,
|
|
@@ -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(),
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it, vi, type Mock } from 'vitest';
|
|
1
2
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
2
3
|
import MediaEditorCropPanel from '..';
|
|
3
4
|
import type { MediaEditorCropPanelProps } from '..';
|
|
4
5
|
import { MediaEditorStateProvider } from '../../../state';
|
|
5
6
|
import type { CropperState } from '../../../image-editor';
|
|
6
7
|
|
|
8
|
+
globalThis.wpVitest.mockMatchMedia();
|
|
9
|
+
|
|
7
10
|
function setupCropPanel(
|
|
8
11
|
overrides: Partial< MediaEditorCropPanelProps > = {},
|
|
9
12
|
initialCropperState?: Partial< CropperState >
|
|
10
13
|
) {
|
|
11
14
|
const props: MediaEditorCropPanelProps = {
|
|
12
15
|
aspectRatioValue: '1',
|
|
13
|
-
onAspectRatioChange:
|
|
16
|
+
onAspectRatioChange: vi.fn(),
|
|
14
17
|
aspectRatioOptions: [
|
|
15
18
|
{ label: 'Free', value: 0 },
|
|
16
19
|
{ label: 'Original', value: -1 },
|
|
@@ -40,7 +43,7 @@ describe( 'MediaEditorCropPanel', () => {
|
|
|
40
43
|
|
|
41
44
|
expect( controls.onAspectRatioChange ).toHaveBeenCalled();
|
|
42
45
|
expect(
|
|
43
|
-
( controls.onAspectRatioChange as
|
|
46
|
+
( controls.onAspectRatioChange as Mock ).mock.calls[ 0 ][ 0 ]
|
|
44
47
|
).toBe( '0' );
|
|
45
48
|
} );
|
|
46
49
|
|
|
@@ -7,6 +7,11 @@ import RotationRuler from '../rotation-ruler';
|
|
|
7
7
|
export interface MediaEditorFineRotationProps {
|
|
8
8
|
/** Signal that a placement-oriented control is being adjusted. */
|
|
9
9
|
onPlacementControlInteraction?: () => void;
|
|
10
|
+
/**
|
|
11
|
+
* Disable the ruler. Set while the edit is saving; `RotationRuler`
|
|
12
|
+
* cancels an in-flight drag when this flips.
|
|
13
|
+
*/
|
|
14
|
+
disabled?: boolean;
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
/**
|
|
@@ -17,9 +22,11 @@ export interface MediaEditorFineRotationProps {
|
|
|
17
22
|
*
|
|
18
23
|
* @param props
|
|
19
24
|
* @param props.onPlacementControlInteraction
|
|
25
|
+
* @param props.disabled
|
|
20
26
|
*/
|
|
21
27
|
export default function MediaEditorFineRotation( {
|
|
22
28
|
onPlacementControlInteraction,
|
|
29
|
+
disabled = false,
|
|
23
30
|
}: MediaEditorFineRotationProps ) {
|
|
24
31
|
const { state, setRotation } = useMediaEditor();
|
|
25
32
|
// `commitOnKeyUp: false` lets rapid arrow-key adjustments coalesce
|
|
@@ -62,6 +69,7 @@ export default function MediaEditorFineRotation( {
|
|
|
62
69
|
max={ MAX_ROTATION_OFFSET }
|
|
63
70
|
value={ fineOffset }
|
|
64
71
|
onChange={ handleRotationSlider }
|
|
72
|
+
disabled={ disabled }
|
|
65
73
|
/>
|
|
66
74
|
</div>
|
|
67
75
|
);
|
|
@@ -54,6 +54,11 @@ export interface MediaEditorImageControlsProps {
|
|
|
54
54
|
* `DEFAULT_ZOOM_FACTOR` (1.2).
|
|
55
55
|
*/
|
|
56
56
|
zoomFactor?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Disable every control. Set while the edit is saving, so the crop the
|
|
59
|
+
* request was built from cannot change under it.
|
|
60
|
+
*/
|
|
61
|
+
disabled?: boolean;
|
|
57
62
|
}
|
|
58
63
|
|
|
59
64
|
/**
|
|
@@ -67,12 +72,14 @@ export interface MediaEditorImageControlsProps {
|
|
|
67
72
|
* @param props.showAspectRatioControl
|
|
68
73
|
* @param props.aspectRatioPresets
|
|
69
74
|
* @param props.zoomFactor
|
|
75
|
+
* @param props.disabled
|
|
70
76
|
*/
|
|
71
77
|
export default function MediaEditorImageControls( {
|
|
72
78
|
withLabels = false,
|
|
73
79
|
showAspectRatioControl = false,
|
|
74
80
|
aspectRatioPresets,
|
|
75
81
|
zoomFactor = DEFAULT_ZOOM_FACTOR,
|
|
82
|
+
disabled = false,
|
|
76
83
|
}: MediaEditorImageControlsProps ) {
|
|
77
84
|
const { state, setFlip, snapRotate90, setZoom } = useMediaEditor();
|
|
78
85
|
const { aspectRatioValue, setAspectRatioValue, aspectRatioOptions } =
|
|
@@ -92,6 +99,8 @@ export default function MediaEditorImageControls( {
|
|
|
92
99
|
icon={ rotateLeft }
|
|
93
100
|
label={ __( 'Rotate 90° counter-clockwise' ) }
|
|
94
101
|
showTooltip
|
|
102
|
+
disabled={ disabled }
|
|
103
|
+
accessibleWhenDisabled
|
|
95
104
|
onClick={ () => snapRotate90( -1 ) }
|
|
96
105
|
/>
|
|
97
106
|
<Button
|
|
@@ -99,6 +108,8 @@ export default function MediaEditorImageControls( {
|
|
|
99
108
|
icon={ rotateRight }
|
|
100
109
|
label={ __( 'Rotate 90° clockwise' ) }
|
|
101
110
|
showTooltip
|
|
111
|
+
disabled={ disabled }
|
|
112
|
+
accessibleWhenDisabled
|
|
102
113
|
onClick={ () => snapRotate90( 1 ) }
|
|
103
114
|
/>
|
|
104
115
|
</>
|
|
@@ -112,6 +123,8 @@ export default function MediaEditorImageControls( {
|
|
|
112
123
|
label={ __( 'Flip horizontal' ) }
|
|
113
124
|
showTooltip
|
|
114
125
|
isPressed={ state.flip.horizontal }
|
|
126
|
+
disabled={ disabled }
|
|
127
|
+
accessibleWhenDisabled
|
|
115
128
|
onClick={ () =>
|
|
116
129
|
setFlip( {
|
|
117
130
|
horizontal: ! state.flip.horizontal,
|
|
@@ -125,6 +138,8 @@ export default function MediaEditorImageControls( {
|
|
|
125
138
|
label={ __( 'Flip vertical' ) }
|
|
126
139
|
showTooltip
|
|
127
140
|
isPressed={ state.flip.vertical }
|
|
141
|
+
disabled={ disabled }
|
|
142
|
+
accessibleWhenDisabled
|
|
128
143
|
onClick={ () =>
|
|
129
144
|
setFlip( {
|
|
130
145
|
horizontal: state.flip.horizontal,
|
|
@@ -142,7 +157,7 @@ export default function MediaEditorImageControls( {
|
|
|
142
157
|
icon={ plus }
|
|
143
158
|
label={ __( 'Zoom in' ) }
|
|
144
159
|
showTooltip
|
|
145
|
-
disabled={ state.zoom >= MAX_ZOOM }
|
|
160
|
+
disabled={ disabled || state.zoom >= MAX_ZOOM }
|
|
146
161
|
accessibleWhenDisabled
|
|
147
162
|
onClick={ () => zoomByFactor( zoomFactor ) }
|
|
148
163
|
/>
|
|
@@ -151,7 +166,7 @@ export default function MediaEditorImageControls( {
|
|
|
151
166
|
icon={ lineSolid }
|
|
152
167
|
label={ __( 'Zoom out' ) }
|
|
153
168
|
showTooltip
|
|
154
|
-
disabled={ state.zoom <= minZoom }
|
|
169
|
+
disabled={ disabled || state.zoom <= minZoom }
|
|
155
170
|
accessibleWhenDisabled
|
|
156
171
|
onClick={ () => zoomByFactor( 1 / zoomFactor ) }
|
|
157
172
|
/>
|
|
@@ -163,7 +178,7 @@ export default function MediaEditorImageControls( {
|
|
|
163
178
|
icon={ aspectRatioIcon }
|
|
164
179
|
label={ __( 'Aspect ratio' ) }
|
|
165
180
|
popoverProps={ { placement: 'top' } }
|
|
166
|
-
toggleProps={ { size: 'compact' } }
|
|
181
|
+
toggleProps={ { size: 'compact', disabled } }
|
|
167
182
|
>
|
|
168
183
|
{ ( { onClose } ) => (
|
|
169
184
|
<MenuGroup label={ __( 'Aspect ratio' ) }>
|
|
@@ -176,7 +191,11 @@ export default function MediaEditorImageControls( {
|
|
|
176
191
|
role="menuitemradio"
|
|
177
192
|
isSelected={ isSelected }
|
|
178
193
|
icon={ isSelected ? check : undefined }
|
|
194
|
+
disabled={ disabled }
|
|
179
195
|
onClick={ () => {
|
|
196
|
+
if ( disabled ) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
180
199
|
setAspectRatioValue( value );
|
|
181
200
|
onClose();
|
|
182
201
|
} }
|