@wordpress/media-editor 0.11.0 → 0.11.2-next.v.202606191442.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 +16 -0
- package/build/components/media-editor/index.cjs +41 -51
- package/build/components/media-editor/index.cjs.map +3 -3
- package/build/components/media-editor/use-crop-options.cjs.map +1 -1
- package/build/components/media-editor-canvas/index.cjs +63 -15
- package/build/components/media-editor-canvas/index.cjs.map +3 -3
- package/build/components/media-editor-crop-panel/index.cjs +15 -45
- package/build/components/media-editor-crop-panel/index.cjs.map +3 -3
- package/build/components/media-editor-fine-rotation/index.cjs.map +2 -2
- package/build/components/media-editor-image-controls/index.cjs +230 -0
- package/build/components/media-editor-image-controls/index.cjs.map +7 -0
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +4 -4
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +2 -2
- package/build/components/media-editor-modal/build-modifiers.cjs.map +1 -1
- package/build/components/media-form/index.cjs +12 -23
- package/build/components/media-form/index.cjs.map +3 -3
- package/build/components/rotation-ruler/index.cjs +1 -1
- package/build/components/rotation-ruler/index.cjs.map +1 -1
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +1 -1
- package/build/image-editor/core/camera.cjs +13 -0
- package/build/image-editor/core/camera.cjs.map +2 -2
- package/build/image-editor/core/constants.cjs +15 -3
- package/build/image-editor/core/constants.cjs.map +2 -2
- package/build/image-editor/core/containment.cjs.map +1 -1
- package/build/image-editor/core/crop-rect.cjs.map +1 -1
- package/build/image-editor/core/export/canvas-renderer.cjs.map +1 -1
- package/build/image-editor/core/interaction-controller.cjs +9 -7
- package/build/image-editor/core/interaction-controller.cjs.map +2 -2
- package/build/image-editor/core/math/sanitize.cjs.map +1 -1
- package/build/image-editor/core/setter-helpers.cjs.map +1 -1
- package/build/image-editor/core/source-region.cjs +111 -2
- package/build/image-editor/core/source-region.cjs.map +2 -2
- package/build/image-editor/core/state.cjs.map +1 -1
- package/build/image-editor/core/stencil-math.cjs +14 -6
- package/build/image-editor/core/stencil-math.cjs.map +2 -2
- package/build/image-editor/core/transform-style.cjs.map +1 -1
- package/build/image-editor/core/types.cjs.map +1 -1
- package/build/image-editor/react/components/cropper.cjs +231 -49
- package/build/image-editor/react/components/cropper.cjs.map +2 -2
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +1 -1
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +1 -0
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +2 -2
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +65 -19
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +1 -1
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs +1 -1
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-interaction.cjs.map +1 -1
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +1 -1
- package/build/index.cjs.map +1 -1
- package/build/state/types.cjs.map +1 -1
- package/build/state/use-media-editor-state.cjs +1 -1
- package/build/state/use-media-editor-state.cjs.map +2 -2
- package/build-module/components/media-editor/index.mjs +41 -51
- package/build-module/components/media-editor/index.mjs.map +2 -2
- package/build-module/components/media-editor/use-crop-options.mjs.map +1 -1
- package/build-module/components/media-editor-canvas/index.mjs +55 -17
- package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
- package/build-module/components/media-editor-crop-panel/index.mjs +8 -51
- package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +2 -2
- package/build-module/components/media-editor-image-controls/index.mjs +221 -0
- package/build-module/components/media-editor-image-controls/index.mjs.map +7 -0
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +4 -4
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +2 -2
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +1 -1
- package/build-module/components/media-form/index.mjs +12 -13
- package/build-module/components/media-form/index.mjs.map +2 -2
- package/build-module/components/rotation-ruler/index.mjs +1 -1
- package/build-module/components/rotation-ruler/index.mjs.map +1 -1
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +1 -1
- package/build-module/image-editor/core/camera.mjs +12 -0
- package/build-module/image-editor/core/camera.mjs.map +2 -2
- package/build-module/image-editor/core/constants.mjs +10 -2
- package/build-module/image-editor/core/constants.mjs.map +2 -2
- package/build-module/image-editor/core/containment.mjs.map +1 -1
- package/build-module/image-editor/core/crop-rect.mjs.map +1 -1
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +1 -1
- package/build-module/image-editor/core/interaction-controller.mjs +9 -7
- package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
- package/build-module/image-editor/core/math/sanitize.mjs.map +1 -1
- package/build-module/image-editor/core/setter-helpers.mjs.map +1 -1
- package/build-module/image-editor/core/source-region.mjs +108 -1
- package/build-module/image-editor/core/source-region.mjs.map +2 -2
- package/build-module/image-editor/core/state.mjs.map +1 -1
- package/build-module/image-editor/core/stencil-math.mjs +12 -5
- package/build-module/image-editor/core/stencil-math.mjs.map +2 -2
- package/build-module/image-editor/core/transform-style.mjs.map +1 -1
- package/build-module/image-editor/react/components/cropper.mjs +242 -52
- package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +1 -1
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +1 -0
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +2 -2
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +65 -19
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +1 -1
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +1 -1
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +1 -1
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +1 -1
- package/build-module/index.mjs.map +1 -1
- package/build-module/state/types.mjs.map +1 -1
- package/build-module/state/use-media-editor-state.mjs +1 -1
- package/build-module/state/use-media-editor-state.mjs.map +2 -2
- package/build-style/style-rtl.css +179 -47
- package/build-style/style.css +179 -46
- package/build-types/components/media-editor/index.d.ts +6 -7
- package/build-types/components/media-editor/index.d.ts.map +1 -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 +11 -6
- 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 +4 -3
- 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 +46 -0
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -0
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/image-editor/core/camera.d.ts +25 -1
- package/build-types/image-editor/core/camera.d.ts.map +1 -1
- package/build-types/image-editor/core/constants.d.ts +30 -1
- package/build-types/image-editor/core/constants.d.ts.map +1 -1
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
- package/build-types/image-editor/core/source-region.d.ts +23 -1
- package/build-types/image-editor/core/source-region.d.ts.map +1 -1
- package/build-types/image-editor/core/stencil-math.d.ts +22 -4
- package/build-types/image-editor/core/stencil-math.d.ts.map +1 -1
- package/build-types/image-editor/core/types.d.ts +14 -0
- package/build-types/image-editor/core/types.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +17 -14
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
- package/package.json +30 -20
- package/src/components/media-editor/index.tsx +69 -77
- package/src/components/media-editor/style.scss +136 -4
- package/src/components/media-editor-canvas/index.tsx +82 -13
- package/src/components/media-editor-canvas/style.scss +41 -0
- package/src/components/media-editor-crop-panel/index.tsx +16 -62
- package/src/components/media-editor-crop-panel/test/index.tsx +25 -41
- package/src/components/media-editor-fine-rotation/index.tsx +4 -3
- package/src/components/media-editor-image-controls/index.tsx +262 -0
- package/src/components/media-editor-image-controls/style.scss +48 -0
- package/src/components/media-editor-image-controls/test/index.tsx +150 -0
- package/src/components/media-editor-modal/style.scss +32 -42
- package/src/components/media-form/index.tsx +17 -21
- package/src/components/media-form/style.scss +6 -0
- package/src/components/rotation-ruler/style.scss +10 -3
- package/src/image-editor/core/camera.ts +60 -1
- package/src/image-editor/core/constants.ts +34 -1
- package/src/image-editor/core/interaction-controller.ts +25 -11
- package/src/image-editor/core/source-region.ts +202 -1
- package/src/image-editor/core/stencil-math.ts +42 -10
- package/src/image-editor/core/test/camera.ts +272 -1
- package/src/image-editor/core/test/interaction-controller.ts +100 -0
- package/src/image-editor/core/test/stencil-math.ts +153 -0
- package/src/image-editor/core/types.ts +17 -0
- package/src/image-editor/react/components/cropper.scss +28 -17
- package/src/image-editor/react/components/cropper.tsx +362 -62
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +1 -0
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +101 -32
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.tsx +169 -17
- package/src/image-editor/react/components/test/cropper.tsx +689 -6
- package/src/style.scss +2 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/media-editor-transform-controls/index.cjs +0 -84
- package/build/components/media-editor-transform-controls/index.cjs.map +0 -7
- package/build/components/media-form/sidebar-datetime-view.cjs +0 -53
- package/build/components/media-form/sidebar-datetime-view.cjs.map +0 -7
- package/build-module/components/media-editor-transform-controls/index.mjs +0 -68
- package/build-module/components/media-editor-transform-controls/index.mjs.map +0 -7
- package/build-module/components/media-form/sidebar-datetime-view.mjs +0 -32
- package/build-module/components/media-form/sidebar-datetime-view.mjs.map +0 -7
- package/build-types/components/media-editor-transform-controls/index.d.ts +0 -8
- package/build-types/components/media-editor-transform-controls/index.d.ts.map +0 -1
- package/build-types/components/media-form/sidebar-datetime-view.d.ts +0 -10
- package/build-types/components/media-form/sidebar-datetime-view.d.ts.map +0 -1
- package/src/components/media-editor-transform-controls/index.tsx +0 -70
- package/src/components/media-editor-transform-controls/style.scss +0 -8
- package/src/components/media-form/sidebar-datetime-view.tsx +0 -47
- package/src/components/media-form/test/sidebar-datetime-view.test.tsx +0 -96
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal dependencies
|
|
3
3
|
*/
|
|
4
|
-
import type { CropperState, Size } from './types';
|
|
4
|
+
import type { CropperState, HandlePosition, NormalizedRect, Size } from './types';
|
|
5
5
|
/**
|
|
6
6
|
* The selected image region in source-pixel coordinates.
|
|
7
7
|
*/
|
|
@@ -43,6 +43,28 @@ export interface SourceRegion {
|
|
|
43
43
|
* @return The selected region in source pixels plus rotation/flip metadata.
|
|
44
44
|
*/
|
|
45
45
|
export declare function getSourceRegion(state: CropperState, imageSize: Size): SourceRegion;
|
|
46
|
+
/**
|
|
47
|
+
* Snap a crop rect so the selected source-region edges land on whole pixels.
|
|
48
|
+
*
|
|
49
|
+
* This is a display-time affordance for visible pixel grids; it does not alter
|
|
50
|
+
* pan/zoom/rotation. Callers decide when snapping is appropriate.
|
|
51
|
+
*
|
|
52
|
+
* @param state The current cropper state.
|
|
53
|
+
* @param imageSize The natural dimensions of the source image.
|
|
54
|
+
* @param cropRect The candidate crop rect from resize math.
|
|
55
|
+
* @param handle The active resize handle. Only edges moved by the handle snap.
|
|
56
|
+
* @return A crop rect whose selected source-region edges are whole pixels.
|
|
57
|
+
*/
|
|
58
|
+
export declare function snapCropRectToSourcePixels(state: CropperState, imageSize: Size, cropRect: NormalizedRect, handle: HandlePosition): NormalizedRect;
|
|
59
|
+
/**
|
|
60
|
+
* Snap all source-region edges for a crop rect to the nearest whole pixels.
|
|
61
|
+
*
|
|
62
|
+
* @param state The current cropper state.
|
|
63
|
+
* @param imageSize The natural dimensions of the source image.
|
|
64
|
+
* @param cropRect The crop rect to align to the source-pixel grid.
|
|
65
|
+
* @return A crop rect whose source-region edges are whole pixels.
|
|
66
|
+
*/
|
|
67
|
+
export declare function snapCropRectToSourcePixelGrid(state: CropperState, imageSize: Size, cropRect: NormalizedRect): NormalizedRect;
|
|
46
68
|
/**
|
|
47
69
|
* The selected crop region expressed as percentages of the source image.
|
|
48
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source-region.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/source-region.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"source-region.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/source-region.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,OAAO,KAAK,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,IAAI,EACJ,MAAM,SAAS,CAAC;AAKjB;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,iCAAiC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,iCAAiC;IACjC,CAAC,EAAE,MAAM,CAAC;IACV,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,IAAI,EAAE;QAAE,UAAU,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IACjD,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,YAAY,CA0Ed;AAgGD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACzC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,EACf,QAAQ,EAAE,cAAc,EACxB,MAAM,EAAE,cAAc,GACpB,cAAc,CAYhB;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAC5C,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,EACf,QAAQ,EAAE,cAAc,GACtB,cAAc,CAOhB;AAmDD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IACnC,kEAAkE;IAClE,CAAC,EAAE,MAAM,CAAC;IACV,mEAAmE;IACnE,CAAC,EAAE,MAAM,CAAC;IACV,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACrC,KAAK,EAAE,YAAY,EACnB,SAAS,EAAE,IAAI,GACb,mBAAmB,CAWrB"}
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
1
|
import type { HandlePosition, NormalizedRect, Size } from './types';
|
|
5
2
|
export type { HandlePosition };
|
|
3
|
+
/** Axis whose resize distance controls the locked-ratio size projection. */
|
|
4
|
+
export type ResizeDriverAxis = 'width' | 'height';
|
|
5
|
+
/**
|
|
6
|
+
* Resolve the minimum crop dimension, in source-image pixels, for the current
|
|
7
|
+
* display scale.
|
|
8
|
+
*
|
|
9
|
+
* Two floors compete: a fixed source-pixel floor (`MIN_CROP_PIXELS`) that
|
|
10
|
+
* avoids sub-pixel crops, and an on-screen floor (`MIN_CROP_SCREEN_PX`) that
|
|
11
|
+
* keeps the crop large enough to grab. The on-screen floor converted to source
|
|
12
|
+
* pixels is `MIN_CROP_SCREEN_PX / displayScale`; the binding constraint is the
|
|
13
|
+
* larger of the two. When the image is shown small (small `displayScale`) the
|
|
14
|
+
* on-screen floor dominates; once it is shown large enough the source-pixel
|
|
15
|
+
* floor takes over.
|
|
16
|
+
*
|
|
17
|
+
* @param displayScale CSS pixels rendered per source pixel
|
|
18
|
+
* (fit scale × zoom × view scale).
|
|
19
|
+
* @return Minimum crop dimension in source-image pixels.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getMinCropPixels(displayScale: number): number;
|
|
6
22
|
/**
|
|
7
23
|
* Default minimum crop rect dimension in normalized space, used when no
|
|
8
24
|
* explicit per-axis minimum is supplied (e.g. before the source image
|
|
@@ -60,9 +76,11 @@ export declare function computeFreeResizeRect(drag: ResizeDragState, clientX: nu
|
|
|
60
76
|
* @param bounds The allowed crop area bounds.
|
|
61
77
|
* @param normalizedRatio The locked aspect ratio (width / height in normalized space).
|
|
62
78
|
* @param minCropSize Minimum crop rect dimension in normalized space, per axis.
|
|
79
|
+
* @param driverAxis Optional explicit driver axis. Used for keyboard
|
|
80
|
+
* resize, where one arrow axis should determine the step.
|
|
63
81
|
* @return The new crop rect in normalized coordinates.
|
|
64
82
|
*/
|
|
65
|
-
export declare function computeLockedResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds, normalizedRatio: number, minCropSize?: Size): NormalizedRect;
|
|
83
|
+
export declare function computeLockedResizeRect(drag: ResizeDragState, clientX: number, clientY: number, imageSize: Size, bounds: CropBounds, normalizedRatio: number, minCropSize?: Size, driverAxis?: ResizeDriverAxis): NormalizedRect;
|
|
66
84
|
/**
|
|
67
85
|
* Compute the new crop rect for a resize that temporarily locks the
|
|
68
86
|
* aspect ratio to `drag.startRect`'s ratio (e.g. while Shift is held).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stencil-math.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/stencil-math.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stencil-math.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/stencil-math.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAA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I,EAAE,eAAe,EACrB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,IAAI,EACf,MAAM,EAAE,UAAU,EAClB,WAAW,GAAE,IAA4B,GACvC,cAAc,CA0GhB"}
|
|
@@ -234,6 +234,8 @@ export interface StencilProps {
|
|
|
234
234
|
aspectRatio?: number;
|
|
235
235
|
/** Whether the crop handles are shown for freeform resizing. */
|
|
236
236
|
freeformCrop?: boolean;
|
|
237
|
+
/** Whether resize handles should ignore pointer and keyboard input. */
|
|
238
|
+
isResizeDisabled?: boolean;
|
|
237
239
|
/** CSS transition string for settle animation. */
|
|
238
240
|
stencilTransition?: string;
|
|
239
241
|
/** Maximum crop rect bounds based on current zoom/rotation. */
|
|
@@ -251,5 +253,17 @@ export interface StencilProps {
|
|
|
251
253
|
* the source image dimensions. Omit to use the stencil's default.
|
|
252
254
|
*/
|
|
253
255
|
minCropSize?: Size;
|
|
256
|
+
/**
|
|
257
|
+
* Optional post-processor for freeform resize output. Hosts use this for
|
|
258
|
+
* display-gated behavior such as snapping visible pixel grids to source
|
|
259
|
+
* pixel boundaries.
|
|
260
|
+
*/
|
|
261
|
+
snapCropRect?: (rect: NormalizedRect, handle: HandlePosition) => NormalizedRect;
|
|
262
|
+
/**
|
|
263
|
+
* Optional keyboard resize step in normalized space, per axis. Hosts use
|
|
264
|
+
* this when keyboard resize should follow the rendered image scale instead
|
|
265
|
+
* of the default percentage-based step.
|
|
266
|
+
*/
|
|
267
|
+
keyboardResizeStep?: Size;
|
|
254
268
|
}
|
|
255
269
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/image-editor/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,MAAM,GAAG,KAAK,CAAC;AAE3B;;GAE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cAAc,KAAM,IAAI,CAAC;IAC/C;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,CAAE,MAAM,CAAC,EAAE,cAAc,KAAM,IAAI,CAAC;IACpD,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,mEAAmE;IACnE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kDAAkD;IAClD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,UAAU,CAAC,EAAE;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACb,CAAC;IACF,wDAAwD;IACxD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CACd,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,cAAc,KAClB,cAAc,CAAC;IACpB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,IAAI,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cropper.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAmBH;;GAEG;AACH,OAAO,KAAK,EACX,YAAY,EAEZ,YAAY,EACZ,IAAI,EAEJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"cropper.d.ts","sourceRoot":"","sources":["../../../../src/image-editor/react/components/cropper.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAmBH;;GAEG;AACH,OA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
|
1
|
-
{"version":3,"file":"dimming-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/overlays/dimming-overlay.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;GAEG;AACH,UAAU,mBAAmB;IAC5B,oDAAoD;IACpD,QAAQ,EAAE,cAAc,CAAC;IACzB,kDAAkD;IAClD,aAAa,EAAE,IAAI,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,IAAI,CAAC;IAChB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,cAAc,CAAE,EAC/B,QAAQ,EACR,aAAa,EACb,SAAS,EACT,UAAU,EACV,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"dimming-overlay.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/overlays/dimming-overlay.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAEhE;;GAEG;AACH,UAAU,mBAAmB;IAC5B,oDAAoD;IACpD,QAAQ,EAAE,cAAc,CAAC;IACzB,kDAAkD;IAClD,aAAa,EAAE,IAAI,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,IAAI,CAAC;IAChB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,wBAAgB,cAAc,CAAE,EAC/B,QAAQ,EACR,aAAa,EACb,SAAS,EACT,UAAU,EACV,EAAE,mBAAmB,sCA+BrB"}
|
|
@@ -13,21 +13,24 @@ type RectangleStencilProps = StencilProps;
|
|
|
13
13
|
* crop pass through to the container for image panning. The crop
|
|
14
14
|
* auto-centers after resize via SETTLE_CROP.
|
|
15
15
|
*
|
|
16
|
-
* @param props
|
|
17
|
-
* @param props.cropRect
|
|
18
|
-
* @param props.containerSize
|
|
19
|
-
* @param props.imageSize
|
|
20
|
-
* @param props.onCropChange
|
|
21
|
-
* @param props.onResizeStart
|
|
22
|
-
* @param props.onResizeEnd
|
|
23
|
-
* @param props.aspectRatio
|
|
24
|
-
* @param props.freeformCrop
|
|
25
|
-
* @param props.
|
|
26
|
-
* @param props.
|
|
27
|
-
* @param props.
|
|
28
|
-
* @param props.
|
|
16
|
+
* @param props Component props implementing StencilProps.
|
|
17
|
+
* @param props.cropRect The crop rectangle in normalized coordinates.
|
|
18
|
+
* @param props.containerSize The container element dimensions in pixels.
|
|
19
|
+
* @param props.imageSize The rendered image dimensions in pixels.
|
|
20
|
+
* @param props.onCropChange Callback fired when the crop rect changes.
|
|
21
|
+
* @param props.onResizeStart Callback fired when a resize drag starts.
|
|
22
|
+
* @param props.onResizeEnd Callback fired when a resize drag ends (mouseup).
|
|
23
|
+
* @param props.aspectRatio Optional fixed aspect ratio (width / height).
|
|
24
|
+
* @param props.freeformCrop Whether resize handles are shown.
|
|
25
|
+
* @param props.isResizeDisabled Whether resize handles should ignore pointer and keyboard input.
|
|
26
|
+
* @param props.stencilTransition CSS transition string for settle animation.
|
|
27
|
+
* @param props.cropBounds Maximum crop rect bounds from camera (zoom/rotation-aware).
|
|
28
|
+
* @param props.onEscape Called when Escape is pressed on a resize handle.
|
|
29
|
+
* @param props.minCropSize Minimum crop rect dimension in normalized space, per axis.
|
|
30
|
+
* @param props.snapCropRect Optional post-processor for freeform resize output.
|
|
31
|
+
* @param props.keyboardResizeStep Optional keyboard resize step in normalized space, per axis.
|
|
29
32
|
* @return The rectangle stencil element.
|
|
30
33
|
*/
|
|
31
|
-
export declare function RectangleStencil({ cropRect, containerSize, imageSize, onCropChange, onResizeStart, onResizeEnd, aspectRatio, freeformCrop, stencilTransition, cropBounds, onEscape, minCropSize }: RectangleStencilProps): import("react").JSX.Element | null;
|
|
34
|
+
export declare function RectangleStencil({ cropRect, containerSize, imageSize, onCropChange, onResizeStart, onResizeEnd, aspectRatio, freeformCrop, isResizeDisabled, stencilTransition, cropBounds, onEscape, minCropSize, snapCropRect, keyboardResizeStep }: RectangleStencilProps): import("react").JSX.Element | null;
|
|
32
35
|
export {};
|
|
33
36
|
//# sourceMappingURL=rectangle-stencil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,OAAO,KAAK,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"rectangle-stencil.d.ts","sourceRoot":"","sources":["../../../../../src/image-editor/react/components/stencils/rectangle-stencil.tsx"],"names":[],"mappings":"AAYA;;GAEG;AACH,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,EAClB,EAAE,qBAAqB,sCAmevB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/media-editor",
|
|
3
|
-
"version": "0.11.0",
|
|
3
|
+
"version": "0.11.2-next.v.202606191442.0+17fe7db8a",
|
|
4
4
|
"description": "Media editor components for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"./package.json": "./package.json"
|
|
36
36
|
},
|
|
37
|
-
"react-native": "src/index",
|
|
38
37
|
"types": "build-types",
|
|
39
38
|
"sideEffects": [
|
|
40
39
|
"build-style/**",
|
|
@@ -44,31 +43,42 @@
|
|
|
44
43
|
"build-module/store/index.mjs"
|
|
45
44
|
],
|
|
46
45
|
"dependencies": {
|
|
47
|
-
"@wordpress/api-fetch": "^7.48.0",
|
|
48
|
-
"@wordpress/base-styles": "^
|
|
49
|
-
"@wordpress/components": "^35.
|
|
50
|
-
"@wordpress/compose": "^8.1.0",
|
|
51
|
-
"@wordpress/core-data": "^7.48.0",
|
|
52
|
-
"@wordpress/data": "^10.48.0",
|
|
53
|
-
"@wordpress/dataviews": "^
|
|
54
|
-
"@wordpress/date": "^5.48.0",
|
|
55
|
-
"@wordpress/element": "^8.0.0",
|
|
56
|
-
"@wordpress/i18n": "^6.21.0",
|
|
57
|
-
"@wordpress/icons": "^
|
|
58
|
-
"@wordpress/interface": "^9.33.0",
|
|
59
|
-
"@wordpress/keyboard-shortcuts": "^5.48.0",
|
|
60
|
-
"@wordpress/keycodes": "^4.48.0",
|
|
61
|
-
"@wordpress/notices": "^5.48.0",
|
|
62
|
-
"@wordpress/private-apis": "^1.48.0",
|
|
63
|
-
"@wordpress/ui": "^0.
|
|
46
|
+
"@wordpress/api-fetch": "^7.48.2-next.v.202606191442.0+17fe7db8a",
|
|
47
|
+
"@wordpress/base-styles": "^10.0.2-next.v.202606191442.0+17fe7db8a",
|
|
48
|
+
"@wordpress/components": "^35.1.1-next.v.202606191442.0+17fe7db8a",
|
|
49
|
+
"@wordpress/compose": "^8.1.2-next.v.202606191442.0+17fe7db8a",
|
|
50
|
+
"@wordpress/core-data": "^7.48.2-next.v.202606191442.0+17fe7db8a",
|
|
51
|
+
"@wordpress/data": "^10.48.2-next.v.202606191442.0+17fe7db8a",
|
|
52
|
+
"@wordpress/dataviews": "^17.0.1-next.v.202606191442.0+17fe7db8a",
|
|
53
|
+
"@wordpress/date": "^5.48.2-next.v.202606191442.0+17fe7db8a",
|
|
54
|
+
"@wordpress/element": "^8.0.2-next.v.202606191442.0+17fe7db8a",
|
|
55
|
+
"@wordpress/i18n": "^6.21.2-next.v.202606191442.0+17fe7db8a",
|
|
56
|
+
"@wordpress/icons": "^14.0.2-next.v.202606191442.0+17fe7db8a",
|
|
57
|
+
"@wordpress/interface": "^9.33.2-next.v.202606191442.0+17fe7db8a",
|
|
58
|
+
"@wordpress/keyboard-shortcuts": "^5.48.2-next.v.202606191442.0+17fe7db8a",
|
|
59
|
+
"@wordpress/keycodes": "^4.48.2-next.v.202606191442.0+17fe7db8a",
|
|
60
|
+
"@wordpress/notices": "^5.48.2-next.v.202606191442.0+17fe7db8a",
|
|
61
|
+
"@wordpress/private-apis": "^1.48.2-next.v.202606191442.0+17fe7db8a",
|
|
62
|
+
"@wordpress/ui": "^0.16.1-next.v.202606191442.0+17fe7db8a",
|
|
64
63
|
"clsx": "^2.1.1",
|
|
65
64
|
"gl-matrix": "^3.4.3"
|
|
66
65
|
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@testing-library/dom": "^10.4.1",
|
|
68
|
+
"@testing-library/react": "^16.3.2",
|
|
69
|
+
"@testing-library/user-event": "^14.6.1"
|
|
70
|
+
},
|
|
67
71
|
"peerDependencies": {
|
|
72
|
+
"@types/react": "^18.3.27",
|
|
68
73
|
"react": "^18.0.0"
|
|
69
74
|
},
|
|
75
|
+
"peerDependenciesMeta": {
|
|
76
|
+
"@types/react": {
|
|
77
|
+
"optional": true
|
|
78
|
+
}
|
|
79
|
+
},
|
|
70
80
|
"publishConfig": {
|
|
71
81
|
"access": "public"
|
|
72
82
|
},
|
|
73
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "1b6a19222df5a88f161880b5789efb3171d8f425"
|
|
74
84
|
}
|
|
@@ -47,7 +47,7 @@ import type { Media } from '../media-editor-provider';
|
|
|
47
47
|
import MediaPreview from '../media-preview';
|
|
48
48
|
import MediaEditorCanvas from '../media-editor-canvas';
|
|
49
49
|
import MediaEditorFineRotation from '../media-editor-fine-rotation';
|
|
50
|
-
import
|
|
50
|
+
import MediaEditorImageControls from '../media-editor-image-controls';
|
|
51
51
|
import MediaEditorCropPanel from '../media-editor-crop-panel';
|
|
52
52
|
import MediaForm from '../media-form';
|
|
53
53
|
import { unlock } from '../../lock-unlock';
|
|
@@ -86,15 +86,14 @@ export interface MediaEditorFrameProps {
|
|
|
86
86
|
footerActions: ReactNode;
|
|
87
87
|
/**
|
|
88
88
|
* Footer layout selector. Frames apply this to the footer container
|
|
89
|
-
* as a modifier class.
|
|
89
|
+
* as a modifier class. Tracks the sidebar-collapse breakpoint (`medium`).
|
|
90
90
|
*
|
|
91
|
-
* - `wide` —
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* Cancel/Save.
|
|
91
|
+
* - `wide` — sidebar is a column; footer is a single row of History |
|
|
92
|
+
* Cancel/Save (transform controls live in the Crop panel).
|
|
93
|
+
* - `narrow` — sidebar collapsed; transform controls sit above a
|
|
94
|
+
* History | Cancel/Save row.
|
|
96
95
|
*/
|
|
97
|
-
footerLayout: 'wide' | '
|
|
96
|
+
footerLayout: 'wide' | 'narrow';
|
|
98
97
|
onRequestClose: () => void;
|
|
99
98
|
onKeyDown: ( event: ReactKeyboardEvent< HTMLElement > ) => void;
|
|
100
99
|
shouldCloseOnClickOutside: boolean;
|
|
@@ -128,6 +127,7 @@ function MediaEditorSidebar( { tabs }: { tabs: EditorTab[] } ) {
|
|
|
128
127
|
className="media-editor__sidebar"
|
|
129
128
|
panelClassName="media-editor__sidebar-panel"
|
|
130
129
|
headerClassName="media-editor__sidebar-header"
|
|
130
|
+
closeLabel={ __( 'Close media panel' ) }
|
|
131
131
|
header={
|
|
132
132
|
<Tabs.Context.Provider value={ tabsContextValue }>
|
|
133
133
|
<Tabs.TabList>
|
|
@@ -247,6 +247,15 @@ function HistoryActions( {
|
|
|
247
247
|
expanded={ false }
|
|
248
248
|
gap={ 2 }
|
|
249
249
|
>
|
|
250
|
+
<Button
|
|
251
|
+
size="compact"
|
|
252
|
+
variant="tertiary"
|
|
253
|
+
disabled={ ! isDirty }
|
|
254
|
+
accessibleWhenDisabled
|
|
255
|
+
onClick={ handleReset }
|
|
256
|
+
>
|
|
257
|
+
{ __( 'Reset' ) }
|
|
258
|
+
</Button>
|
|
250
259
|
<Button
|
|
251
260
|
size="compact"
|
|
252
261
|
icon={ undo }
|
|
@@ -271,15 +280,6 @@ function HistoryActions( {
|
|
|
271
280
|
accessibleWhenDisabled
|
|
272
281
|
onClick={ handleRedo }
|
|
273
282
|
/>
|
|
274
|
-
<Button
|
|
275
|
-
size="compact"
|
|
276
|
-
variant="tertiary"
|
|
277
|
-
disabled={ ! isDirty }
|
|
278
|
-
accessibleWhenDisabled
|
|
279
|
-
onClick={ handleReset }
|
|
280
|
-
>
|
|
281
|
-
{ __( 'Reset' ) }
|
|
282
|
-
</Button>
|
|
283
283
|
</Flex>
|
|
284
284
|
);
|
|
285
285
|
}
|
|
@@ -343,19 +343,15 @@ function MediaEditorContent( {
|
|
|
343
343
|
shouldCloseOnEsc = false,
|
|
344
344
|
}: MediaEditorProps ) {
|
|
345
345
|
const cropper = useMediaEditor();
|
|
346
|
-
//
|
|
347
|
-
//
|
|
348
|
-
//
|
|
349
|
-
//
|
|
350
|
-
//
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
footerLayout = 'wide';
|
|
356
|
-
} else if ( isMediumViewport ) {
|
|
357
|
-
footerLayout = 'medium';
|
|
358
|
-
}
|
|
346
|
+
// The sidebar is a side column from the `small` breakpoint up and collapses
|
|
347
|
+
// to an overlay below it — mirroring InterfaceSkeleton's behaviour, shifted
|
|
348
|
+
// from `medium` to `small` (see the matching CSS overrides in style.scss).
|
|
349
|
+
// Track that single breakpoint: in "panel mode" (≥ small) the
|
|
350
|
+
// rotate/flip/zoom controls live in the Crop panel and the footer is just
|
|
351
|
+
// History + Cancel/Save; below it the controls drop into the footer. (The
|
|
352
|
+
// fine-rotation ruler always sits under the canvas.)
|
|
353
|
+
const isPanelLayout = useViewportMatch( 'small' );
|
|
354
|
+
const footerLayout: 'wide' | 'narrow' = isPanelLayout ? 'wide' : 'narrow';
|
|
359
355
|
|
|
360
356
|
const { media, hasEdits } = useSelect(
|
|
361
357
|
( select ) => {
|
|
@@ -489,10 +485,8 @@ function MediaEditorContent( {
|
|
|
489
485
|
<MediaEditorCropPanel
|
|
490
486
|
aspectRatioValue={ aspectRatioValue }
|
|
491
487
|
onAspectRatioChange={ setAspectRatioValue }
|
|
492
|
-
onPlacementControlInteraction={
|
|
493
|
-
signalPlacementControlInteraction
|
|
494
|
-
}
|
|
495
488
|
aspectRatioOptions={ aspectRatioOptions }
|
|
489
|
+
showTransformControls={ isPanelLayout }
|
|
496
490
|
/>
|
|
497
491
|
</Stack>
|
|
498
492
|
),
|
|
@@ -504,7 +498,7 @@ function MediaEditorContent( {
|
|
|
504
498
|
aspectRatioValue,
|
|
505
499
|
setAspectRatioValue,
|
|
506
500
|
aspectRatioOptions,
|
|
507
|
-
|
|
501
|
+
isPanelLayout,
|
|
508
502
|
] );
|
|
509
503
|
|
|
510
504
|
const handleChange = ( updates: Partial< Media > ) => {
|
|
@@ -575,6 +569,12 @@ function MediaEditorContent( {
|
|
|
575
569
|
/>
|
|
576
570
|
);
|
|
577
571
|
|
|
572
|
+
const ruler = isImage ? (
|
|
573
|
+
<MediaEditorFineRotation
|
|
574
|
+
onPlacementControlInteraction={ signalPlacementControlInteraction }
|
|
575
|
+
/>
|
|
576
|
+
) : null;
|
|
577
|
+
|
|
578
578
|
const children = (
|
|
579
579
|
<MediaEditorProvider
|
|
580
580
|
value={ media ?? undefined }
|
|
@@ -600,22 +600,29 @@ function MediaEditorContent( {
|
|
|
600
600
|
sidebar: __( 'Media details' ),
|
|
601
601
|
} }
|
|
602
602
|
content={
|
|
603
|
-
<div className="media-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
isPlacementActive
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
603
|
+
<div className="media-editor__content">
|
|
604
|
+
<div className="media-editor__canvas-area">
|
|
605
|
+
{ isImage ? (
|
|
606
|
+
<MediaEditorCanvas
|
|
607
|
+
focusOnMount
|
|
608
|
+
isPlacementActive={
|
|
609
|
+
isPlacementActive
|
|
610
|
+
}
|
|
611
|
+
onGestureStart={
|
|
612
|
+
handleCanvasGestureStart
|
|
613
|
+
}
|
|
614
|
+
onGestureEnd={
|
|
615
|
+
handleCanvasGestureEnd
|
|
616
|
+
}
|
|
617
|
+
/>
|
|
618
|
+
) : (
|
|
619
|
+
<MediaPreview />
|
|
620
|
+
) }
|
|
621
|
+
</div>
|
|
622
|
+
{ isImage && (
|
|
623
|
+
<div className="media-editor__canvas-toolbar">
|
|
624
|
+
{ ruler }
|
|
625
|
+
</div>
|
|
619
626
|
) }
|
|
620
627
|
</div>
|
|
621
628
|
}
|
|
@@ -652,12 +659,12 @@ function MediaEditorContent( {
|
|
|
652
659
|
onReset={ resetCropOptions }
|
|
653
660
|
/>
|
|
654
661
|
) : null;
|
|
655
|
-
const
|
|
656
|
-
<
|
|
657
|
-
|
|
662
|
+
const imageControls = isImage ? (
|
|
663
|
+
<MediaEditorImageControls
|
|
664
|
+
showAspectRatioControl
|
|
665
|
+
aspectRatioPresets={ aspectRatioPresets }
|
|
658
666
|
/>
|
|
659
667
|
) : null;
|
|
660
|
-
const transform = isImage ? <MediaEditorTransformControls /> : null;
|
|
661
668
|
const actions = (
|
|
662
669
|
<FooterActions
|
|
663
670
|
isSaving={ isSaving }
|
|
@@ -668,40 +675,25 @@ function MediaEditorContent( {
|
|
|
668
675
|
/>
|
|
669
676
|
);
|
|
670
677
|
|
|
671
|
-
//
|
|
672
|
-
//
|
|
673
|
-
//
|
|
674
|
-
//
|
|
678
|
+
// The fine-rotation ruler always lives under the canvas (in
|
|
679
|
+
// `media-editor__content`), never the footer, so it stays constrained to
|
|
680
|
+
// the canvas column at every viewport. One JSX tree per layout; DOM order
|
|
681
|
+
// matches visual order.
|
|
675
682
|
let footerActions: ReactNode;
|
|
676
683
|
if ( footerLayout === 'wide' ) {
|
|
684
|
+
// Sidebar is a column: image controls live in the Crop panel, so
|
|
685
|
+
// the footer is just History + Cancel/Save.
|
|
677
686
|
footerActions = (
|
|
678
687
|
<>
|
|
679
688
|
{ history }
|
|
680
|
-
{ isImage && (
|
|
681
|
-
<div className="media-editor-modal__footer-toolbar">
|
|
682
|
-
{ ruler }
|
|
683
|
-
{ transform }
|
|
684
|
-
</div>
|
|
685
|
-
) }
|
|
686
689
|
{ actions }
|
|
687
690
|
</>
|
|
688
691
|
);
|
|
689
|
-
} else if ( footerLayout === 'medium' ) {
|
|
690
|
-
footerActions = (
|
|
691
|
-
<>
|
|
692
|
-
{ ruler }
|
|
693
|
-
<div className="media-editor-modal__footer-row">
|
|
694
|
-
{ history }
|
|
695
|
-
{ transform }
|
|
696
|
-
{ actions }
|
|
697
|
-
</div>
|
|
698
|
-
</>
|
|
699
|
-
);
|
|
700
692
|
} else {
|
|
693
|
+
// Sidebar collapsed: the image controls drop into the footer.
|
|
701
694
|
footerActions = (
|
|
702
695
|
<>
|
|
703
|
-
{
|
|
704
|
-
{ transform }
|
|
696
|
+
{ imageControls }
|
|
705
697
|
<div className="media-editor-modal__footer-row">
|
|
706
698
|
{ history }
|
|
707
699
|
{ actions }
|