@wordpress/media-editor 0.15.0 → 0.17.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 +18 -0
- package/build/components/media-editor/index.cjs +115 -119
- package/build/components/media-editor/index.cjs.map +3 -3
- package/build/components/media-editor/use-crop-options.cjs.map +2 -2
- package/build/components/media-editor/use-save-media-editor.cjs.map +2 -2
- package/build/components/media-editor-canvas/index.cjs +0 -2
- package/build/components/media-editor-canvas/index.cjs.map +2 -2
- package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
- package/build/components/media-editor-fine-rotation/index.cjs.map +2 -2
- package/build/components/media-editor-image-controls/index.cjs.map +2 -2
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +2 -2
- package/build/components/media-editor-modal/build-modifiers.cjs.map +2 -2
- package/build/components/media-editor-modal/index.cjs +31 -15
- package/build/components/media-editor-modal/index.cjs.map +3 -3
- package/build/components/media-editor-provider/index.cjs.map +2 -2
- package/build/components/media-form/index.cjs.map +2 -2
- package/build/components/media-preview/index.cjs.map +2 -2
- package/build/components/rotation-ruler/index.cjs.map +2 -2
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +2 -2
- package/build/hooks/use-crop-gesture-handlers.cjs.map +2 -2
- package/build/image-editor/core/camera.cjs.map +2 -2
- package/build/image-editor/core/constants.cjs.map +2 -2
- package/build/image-editor/core/containment.cjs.map +2 -2
- package/build/image-editor/core/crop-rect.cjs.map +2 -2
- package/build/image-editor/core/export/canvas-renderer.cjs.map +2 -2
- package/build/image-editor/core/interaction-controller.cjs.map +2 -2
- package/build/image-editor/core/math/sanitize.cjs.map +2 -2
- package/build/image-editor/core/setter-helpers.cjs.map +2 -2
- package/build/image-editor/core/source-region.cjs.map +2 -2
- package/build/image-editor/core/state.cjs.map +2 -2
- package/build/image-editor/core/stencil-math.cjs.map +2 -2
- package/build/image-editor/core/transform-style.cjs.map +2 -2
- package/build/image-editor/core/transforms/pipeline.cjs.map +2 -2
- package/build/image-editor/core/viewport-state.cjs.map +2 -2
- package/build/image-editor/react/components/cropper-provider.cjs.map +2 -2
- package/build/image-editor/react/components/cropper.cjs.map +2 -2
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +2 -2
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +2 -2
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +2 -2
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
- package/build/image-editor/react/components/viewport-provider.cjs.map +2 -2
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-interaction.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +2 -2
- package/build/lock-unlock.cjs.map +2 -2
- package/build/private-apis.cjs.map +2 -2
- package/build/state/composite-reducer.cjs.map +2 -2
- package/build/state/media-editor-state-provider.cjs.map +2 -2
- package/build/state/types.cjs.map +2 -2
- package/build/state/use-media-editor-state.cjs.map +2 -2
- package/build/store/index.cjs.map +2 -2
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/media-editor/index.mjs +117 -120
- package/build-module/components/media-editor/index.mjs.map +2 -2
- package/build-module/components/media-editor/use-crop-options.mjs.map +2 -2
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +2 -2
- package/build-module/components/media-editor-canvas/index.mjs +0 -2
- package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
- 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.map +2 -2
- 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 +2 -2
- package/build-module/components/media-editor-modal/index.mjs +31 -15
- package/build-module/components/media-editor-modal/index.mjs.map +2 -2
- package/build-module/components/media-editor-provider/index.mjs.map +2 -2
- package/build-module/components/media-form/index.mjs.map +2 -2
- package/build-module/components/media-preview/index.mjs.map +2 -2
- package/build-module/components/rotation-ruler/index.mjs.map +2 -2
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +2 -2
- package/build-module/hooks/use-crop-gesture-handlers.mjs.map +2 -2
- package/build-module/image-editor/core/camera.mjs.map +2 -2
- package/build-module/image-editor/core/constants.mjs.map +2 -2
- package/build-module/image-editor/core/containment.mjs.map +2 -2
- package/build-module/image-editor/core/crop-rect.mjs.map +2 -2
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +2 -2
- package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
- package/build-module/image-editor/core/math/sanitize.mjs.map +2 -2
- package/build-module/image-editor/core/setter-helpers.mjs.map +2 -2
- package/build-module/image-editor/core/source-region.mjs.map +2 -2
- package/build-module/image-editor/core/state.mjs.map +2 -2
- package/build-module/image-editor/core/stencil-math.mjs.map +2 -2
- package/build-module/image-editor/core/transform-style.mjs.map +2 -2
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +2 -2
- package/build-module/image-editor/core/viewport-state.mjs.map +2 -2
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +2 -2
- package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +2 -2
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +2 -2
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +2 -2
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +2 -2
- 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 +2 -2
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +2 -2
- package/build-module/lock-unlock.mjs.map +2 -2
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/state/composite-reducer.mjs.map +2 -2
- package/build-module/state/media-editor-state-provider.mjs.map +2 -2
- package/build-module/state/types.mjs.map +2 -2
- package/build-module/state/use-media-editor-state.mjs.map +2 -2
- package/build-module/store/index.mjs.map +2 -2
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/style-rtl.css +6 -6
- package/build-style/style.css +6 -6
- package/build-types/components/media-editor/index.d.ts +46 -11
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -1
- package/build-types/components/media-editor/use-save-media-editor.d.ts +0 -3
- package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -1
- package/build-types/components/media-editor-canvas/index.d.ts +1 -4
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -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.map +1 -1
- package/build-types/components/media-editor-image-controls/index.d.ts.map +1 -1
- package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +0 -3
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-provider/index.d.ts.map +1 -1
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/media-preview/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/hooks/use-crop-gesture-handlers.d.ts.map +1 -1
- package/build-types/image-editor/core/camera.d.ts +0 -3
- package/build-types/image-editor/core/camera.d.ts.map +1 -1
- package/build-types/image-editor/core/constants.d.ts +0 -3
- package/build-types/image-editor/core/constants.d.ts.map +1 -1
- package/build-types/image-editor/core/containment.d.ts +0 -3
- package/build-types/image-editor/core/containment.d.ts.map +1 -1
- package/build-types/image-editor/core/crop-rect.d.ts +0 -3
- package/build-types/image-editor/core/crop-rect.d.ts.map +1 -1
- package/build-types/image-editor/core/export/canvas-renderer.d.ts +0 -3
- package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +1 -1
- package/build-types/image-editor/core/interaction-controller.d.ts +0 -3
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
- package/build-types/image-editor/core/math/sanitize.d.ts +0 -3
- package/build-types/image-editor/core/math/sanitize.d.ts.map +1 -1
- package/build-types/image-editor/core/setter-helpers.d.ts +0 -3
- package/build-types/image-editor/core/setter-helpers.d.ts.map +1 -1
- package/build-types/image-editor/core/source-region.d.ts +0 -3
- package/build-types/image-editor/core/source-region.d.ts.map +1 -1
- package/build-types/image-editor/core/state.d.ts +0 -3
- package/build-types/image-editor/core/state.d.ts.map +1 -1
- package/build-types/image-editor/core/stencil-math.d.ts.map +1 -1
- package/build-types/image-editor/core/transform-style.d.ts +0 -3
- package/build-types/image-editor/core/transform-style.d.ts.map +1 -1
- package/build-types/image-editor/core/transforms/pipeline.d.ts +0 -3
- package/build-types/image-editor/core/transforms/pipeline.d.ts.map +1 -1
- package/build-types/image-editor/core/viewport-state.d.ts +0 -3
- package/build-types/image-editor/core/viewport-state.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +0 -3
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts +0 -6
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts +0 -3
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +1 -1
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +0 -3
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -1
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +0 -3
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +1 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +0 -3
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
- package/build-types/image-editor/react/components/viewport-provider.d.ts +0 -3
- package/build-types/image-editor/react/components/viewport-provider.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +0 -3
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +0 -3
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts +0 -3
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +0 -3
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts +0 -3
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +0 -3
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/state/composite-reducer.d.ts +0 -3
- package/build-types/state/composite-reducer.d.ts.map +1 -1
- package/build-types/state/media-editor-state-provider.d.ts +0 -3
- package/build-types/state/media-editor-state-provider.d.ts.map +1 -1
- package/build-types/state/types.d.ts +0 -3
- package/build-types/state/types.d.ts.map +1 -1
- package/build-types/state/use-media-editor-state.d.ts +0 -3
- package/build-types/state/use-media-editor-state.d.ts.map +1 -1
- package/build-types/store/index.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +0 -3
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +0 -3
- package/build-types/store/selectors.d.ts.map +1 -1
- package/global.d.ts +5 -0
- package/package.json +24 -22
- package/src/components/media-editor/index.tsx +233 -194
- package/src/components/media-editor/style.scss +6 -3
- package/src/components/media-editor/test/use-crop-options.tsx +0 -7
- package/src/components/media-editor/use-crop-options.ts +0 -7
- package/src/components/media-editor/use-save-media-editor.ts +0 -7
- package/src/components/media-editor-canvas/index.tsx +5 -20
- package/src/components/media-editor-crop-panel/index.tsx +0 -7
- package/src/components/media-editor-crop-panel/test/index.tsx +0 -7
- package/src/components/media-editor-fine-rotation/index.tsx +0 -7
- package/src/components/media-editor-image-controls/index.tsx +0 -7
- package/src/components/media-editor-image-controls/test/index.tsx +0 -7
- package/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +0 -3
- package/src/components/media-editor-modal/build-modifiers.ts +0 -3
- package/src/components/media-editor-modal/index.tsx +43 -19
- package/src/components/media-editor-modal/style.scss +8 -4
- package/src/components/media-editor-modal/test/build-modifiers.test.ts +0 -8
- package/src/components/media-editor-modal/test/index.tsx +0 -11
- package/src/components/media-editor-provider/index.tsx +0 -3
- package/src/components/media-form/index.tsx +0 -7
- package/src/components/media-preview/index.tsx +0 -7
- package/src/components/rotation-ruler/index.tsx +0 -11
- package/src/components/rotation-ruler/stories/index.story.tsx +0 -11
- package/src/components/rotation-ruler/test/index.tsx +0 -7
- package/src/components/rotation-ruler/use-ruler-drag.ts +0 -3
- package/src/hooks/use-crop-gesture-handlers.ts +0 -7
- package/src/image-editor/core/camera.ts +0 -7
- package/src/image-editor/core/constants.ts +0 -7
- package/src/image-editor/core/containment.ts +0 -7
- package/src/image-editor/core/crop-rect.ts +0 -3
- package/src/image-editor/core/export/canvas-renderer.ts +0 -3
- package/src/image-editor/core/export/test/canvas-renderer.ts +0 -3
- package/src/image-editor/core/interaction-controller.ts +0 -3
- package/src/image-editor/core/math/sanitize.ts +0 -3
- package/src/image-editor/core/math/test/sanitize.ts +0 -3
- package/src/image-editor/core/setter-helpers.ts +0 -3
- package/src/image-editor/core/source-region.ts +0 -7
- package/src/image-editor/core/state.ts +0 -3
- package/src/image-editor/core/stencil-math.ts +0 -3
- package/src/image-editor/core/test/interaction-controller.ts +0 -3
- package/src/image-editor/core/test/preview-export-parity.ts +0 -1
- package/src/image-editor/core/test/stencil-math.ts +0 -3
- package/src/image-editor/core/transform-style.ts +0 -3
- package/src/image-editor/core/transforms/pipeline.ts +0 -3
- package/src/image-editor/core/transforms/test/pipeline.ts +0 -3
- package/src/image-editor/core/viewport-state.ts +0 -3
- package/src/image-editor/react/components/cropper-provider.tsx +0 -7
- package/src/image-editor/react/components/cropper.tsx +0 -12
- package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +0 -7
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +0 -3
- package/src/image-editor/react/components/overlays/grid-overlay.tsx +0 -3
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +0 -7
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.tsx +0 -7
- package/src/image-editor/react/components/test/cropper.tsx +0 -7
- package/src/image-editor/react/components/viewport-provider.tsx +0 -7
- package/src/image-editor/react/hooks/build-cropper-setters.ts +0 -3
- package/src/image-editor/react/hooks/test/use-aria-announcer.ts +0 -11
- package/src/image-editor/react/hooks/test/use-cropper-reducer.ts +0 -7
- package/src/image-editor/react/hooks/test/use-interaction.ts +0 -7
- package/src/image-editor/react/hooks/test/use-transform-style.ts +0 -7
- package/src/image-editor/react/hooks/use-aria-announcer.ts +0 -7
- package/src/image-editor/react/hooks/use-cropper-reducer.ts +0 -7
- package/src/image-editor/react/hooks/use-interaction.ts +0 -7
- package/src/image-editor/react/hooks/use-transform-style.ts +0 -7
- package/src/image-editor/react/hooks/use-viewport-state.ts +0 -7
- package/src/image-editor/stories/rectangle-crop.story.tsx +15 -11
- package/src/lock-unlock.ts +0 -3
- package/src/private-apis.ts +0 -3
- package/src/state/composite-reducer.ts +0 -3
- package/src/state/media-editor-state-provider.tsx +0 -7
- package/src/state/test/use-media-editor-state.ts +0 -7
- package/src/state/types.ts +0 -3
- package/src/state/use-media-editor-state.ts +0 -7
- package/src/store/index.ts +0 -7
- package/src/store/reducer.ts +0 -3
- package/src/store/selectors.ts +0 -3
- package/src/store/test/reducer.ts +0 -3
- package/tsconfig.build.json +26 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/tsconfig.json +22 -15
- package/build-types/components/media-editor-toolbar/index.d.ts +0 -24
- package/build-types/components/media-editor-toolbar/index.d.ts.map +0 -1
- package/build-types/components/media-editor-transform-controls/index.d.ts +0 -21
- 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/build-types/components/rotation-ruler/stories/index.story.d.ts +0 -14
- package/build-types/components/rotation-ruler/stories/index.story.d.ts.map +0 -1
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +0 -108
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +0 -1
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts +0 -16
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +0 -1
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import {
|
|
5
2
|
Button,
|
|
6
|
-
Flex,
|
|
7
3
|
Spinner,
|
|
8
4
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
9
5
|
} from '@wordpress/components';
|
|
@@ -12,8 +8,10 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
12
8
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
13
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
10
|
import {
|
|
11
|
+
createContext,
|
|
15
12
|
createPortal,
|
|
16
13
|
useCallback,
|
|
14
|
+
useContext,
|
|
17
15
|
useEffect,
|
|
18
16
|
useMemo,
|
|
19
17
|
useRef,
|
|
@@ -32,14 +30,9 @@ import {
|
|
|
32
30
|
ComplementaryArea,
|
|
33
31
|
InterfaceSkeleton,
|
|
34
32
|
PinnedItems,
|
|
35
|
-
//
|
|
36
|
-
// @ts-expect-error
|
|
33
|
+
// @ts-expect-error `@wordpress/interface` is not typed yet.
|
|
37
34
|
} from '@wordpress/interface';
|
|
38
35
|
import type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from 'react';
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Internal dependencies
|
|
42
|
-
*/
|
|
43
36
|
import { MediaEditorProvider } from '../media-editor-provider';
|
|
44
37
|
import type { Media } from '../media-editor-provider';
|
|
45
38
|
import MediaPreview from '../media-preview';
|
|
@@ -77,18 +70,14 @@ interface EditorTab {
|
|
|
77
70
|
|
|
78
71
|
export interface MediaEditorFrameProps {
|
|
79
72
|
children: ReactNode;
|
|
80
|
-
headerActions: ReactNode;
|
|
81
|
-
footerActions: ReactNode;
|
|
82
73
|
/**
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* Cancel/Save (transform controls live in the Crop panel).
|
|
88
|
-
* - `narrow` — sidebar collapsed; transform controls sit above a
|
|
89
|
-
* History | Cancel/Save row.
|
|
74
|
+
* Whether the media being edited is an image. The history and transform
|
|
75
|
+
* clusters render nothing for other media types, so a frame uses this to
|
|
76
|
+
* decide whether the container it would put them in is worth rendering at
|
|
77
|
+
* all.
|
|
90
78
|
*/
|
|
91
|
-
|
|
79
|
+
isImage: boolean;
|
|
80
|
+
layout: 'wide' | 'narrow';
|
|
92
81
|
onRequestClose: () => void;
|
|
93
82
|
onKeyDown: ( event: ReactKeyboardEvent< HTMLElement > ) => void;
|
|
94
83
|
shouldCloseOnClickOutside: boolean;
|
|
@@ -106,18 +95,37 @@ export interface MediaEditorProps {
|
|
|
106
95
|
renderFrame: ( props: MediaEditorFrameProps ) => JSX.Element;
|
|
107
96
|
noticesClassName?: string;
|
|
108
97
|
noticesPortalElement?: Element | null;
|
|
109
|
-
showCloseButton?: boolean;
|
|
110
98
|
shouldCloseOnEsc?: boolean;
|
|
99
|
+
/**
|
|
100
|
+
* The `@wordpress/interface` scope for the details sidebar and its pinned
|
|
101
|
+
* items. Frames should pass a distinct scope so that sidebar visibility —
|
|
102
|
+
* which is persisted per scope to user meta — is remembered separately for
|
|
103
|
+
* each surface. The modal is a transient surface where a collapsed sidebar
|
|
104
|
+
* is a reasonable choice; the full-screen route is one where the sidebar is
|
|
105
|
+
* the primary metadata surface and should open by default. Sharing a scope
|
|
106
|
+
* would let a choice made in one decide the other's starting state.
|
|
107
|
+
*
|
|
108
|
+
* @default 'media-editor'
|
|
109
|
+
*/
|
|
110
|
+
scope?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface MediaEditorSidebarProps {
|
|
114
|
+
tabs: EditorTab[];
|
|
115
|
+
activeTabId?: string;
|
|
116
|
+
onTabChange: ( tabId: string ) => void;
|
|
117
|
+
scope: string;
|
|
111
118
|
}
|
|
112
119
|
|
|
113
|
-
function MediaEditorSidebar( {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
120
|
+
function MediaEditorSidebar( {
|
|
121
|
+
tabs,
|
|
122
|
+
activeTabId,
|
|
123
|
+
onTabChange,
|
|
124
|
+
scope,
|
|
125
|
+
}: MediaEditorSidebarProps ) {
|
|
118
126
|
return (
|
|
119
127
|
<ComplementaryArea
|
|
120
|
-
scope=
|
|
128
|
+
scope={ scope }
|
|
121
129
|
identifier="media-editor/details"
|
|
122
130
|
title={ __( 'Details' ) }
|
|
123
131
|
icon={ drawerRight }
|
|
@@ -126,6 +134,16 @@ function MediaEditorSidebar( { tabs }: { tabs: EditorTab[] } ) {
|
|
|
126
134
|
panelClassName="media-editor__sidebar-panel"
|
|
127
135
|
headerClassName="media-editor__sidebar-header"
|
|
128
136
|
closeLabel={ __( 'Close media panel' ) }
|
|
137
|
+
// Makes `Tabs.Root` the container, so the tab list passed as
|
|
138
|
+
// `header` and the panels below share a subtree across the fill.
|
|
139
|
+
render={
|
|
140
|
+
<Tabs.Root
|
|
141
|
+
value={ activeTabId }
|
|
142
|
+
onValueChange={ ( value ) =>
|
|
143
|
+
onTabChange( value as string )
|
|
144
|
+
}
|
|
145
|
+
/>
|
|
146
|
+
}
|
|
129
147
|
header={
|
|
130
148
|
<Tabs.List variant="minimal">
|
|
131
149
|
{ tabs.map( ( tab ) => (
|
|
@@ -145,26 +163,64 @@ function MediaEditorSidebar( { tabs }: { tabs: EditorTab[] } ) {
|
|
|
145
163
|
);
|
|
146
164
|
}
|
|
147
165
|
|
|
148
|
-
|
|
149
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Everything the frame's action clusters need from the editor. Supplied by
|
|
168
|
+
* context rather than by props so the clusters can be module-level components:
|
|
169
|
+
* a component created during a render has a new identity on every pass, which
|
|
170
|
+
* remounts its subtree and drops focus mid-interaction.
|
|
171
|
+
*/
|
|
172
|
+
interface MediaEditorFrameContextValue {
|
|
150
173
|
isImage: boolean;
|
|
151
|
-
|
|
174
|
+
isSaving: boolean;
|
|
175
|
+
hasMedia: boolean;
|
|
176
|
+
hasChanges: boolean;
|
|
177
|
+
isUndoRedoDisabled: boolean;
|
|
178
|
+
scope: string;
|
|
179
|
+
aspectRatioPresets?: AspectRatioPreset[];
|
|
152
180
|
onCancel: () => void;
|
|
181
|
+
onSave: () => void;
|
|
182
|
+
onReset: () => void;
|
|
153
183
|
}
|
|
154
184
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
185
|
+
const MediaEditorFrameContext =
|
|
186
|
+
createContext< MediaEditorFrameContextValue | null >( null );
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Hook to access the media editor's frame context.
|
|
190
|
+
*
|
|
191
|
+
* Must be used within a MediaEditor component.
|
|
192
|
+
*
|
|
193
|
+
* @return MediaEditorFrameContextValue the action clusters render from.
|
|
194
|
+
*/
|
|
195
|
+
function useMediaEditorFrameContext(): MediaEditorFrameContextValue {
|
|
196
|
+
const context = useContext( MediaEditorFrameContext );
|
|
197
|
+
if ( ! context ) {
|
|
198
|
+
throw new Error(
|
|
199
|
+
'useMediaEditorFrameContext must be used within MediaEditor'
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
return context;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface HeaderActionsProps {
|
|
206
|
+
/**
|
|
207
|
+
* Whether to include a Close button. Frames with a dismissal affordance of
|
|
208
|
+
* their own — a route's breadcrumbs, say — leave it out.
|
|
209
|
+
*
|
|
210
|
+
* @default false
|
|
211
|
+
*/
|
|
212
|
+
showCloseButton?: boolean;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function HeaderActions( { showCloseButton = false }: HeaderActionsProps ) {
|
|
216
|
+
const { isImage, isSaving, onCancel, scope } = useMediaEditorFrameContext();
|
|
161
217
|
const [ isShortcutsModalOpen, setIsShortcutsModalOpen ] = useState( false );
|
|
162
218
|
return (
|
|
163
|
-
<
|
|
219
|
+
<Stack
|
|
164
220
|
className="media-editor__header-actions"
|
|
165
221
|
justify="flex-end"
|
|
166
|
-
|
|
167
|
-
gap=
|
|
222
|
+
align="center"
|
|
223
|
+
gap="sm"
|
|
168
224
|
>
|
|
169
225
|
{ isImage && (
|
|
170
226
|
<Button
|
|
@@ -174,7 +230,7 @@ function HeaderActions( {
|
|
|
174
230
|
onClick={ () => setIsShortcutsModalOpen( true ) }
|
|
175
231
|
/>
|
|
176
232
|
) }
|
|
177
|
-
<PinnedItems.Slot scope=
|
|
233
|
+
<PinnedItems.Slot scope={ scope } />
|
|
178
234
|
{ showCloseButton && (
|
|
179
235
|
<Button
|
|
180
236
|
size="compact"
|
|
@@ -190,19 +246,13 @@ function HeaderActions( {
|
|
|
190
246
|
onClose={ () => setIsShortcutsModalOpen( false ) }
|
|
191
247
|
/>
|
|
192
248
|
) }
|
|
193
|
-
</
|
|
249
|
+
</Stack>
|
|
194
250
|
);
|
|
195
251
|
}
|
|
196
252
|
|
|
197
|
-
|
|
198
|
-
isUndoRedoDisabled
|
|
199
|
-
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
function HistoryActions( {
|
|
203
|
-
isUndoRedoDisabled = false,
|
|
204
|
-
onReset,
|
|
205
|
-
}: HistoryActionsProps ) {
|
|
253
|
+
function HistoryActions() {
|
|
254
|
+
const { isImage, isUndoRedoDisabled, onReset } =
|
|
255
|
+
useMediaEditorFrameContext();
|
|
206
256
|
const {
|
|
207
257
|
reset,
|
|
208
258
|
isDirty,
|
|
@@ -213,6 +263,11 @@ function HistoryActions( {
|
|
|
213
263
|
beginGesture,
|
|
214
264
|
endGesture,
|
|
215
265
|
} = useMediaEditor();
|
|
266
|
+
// Non-image media has no edit history. Checked after the hooks above so
|
|
267
|
+
// the hook order stays stable across renders.
|
|
268
|
+
if ( ! isImage ) {
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
216
271
|
const handleUndo = () => {
|
|
217
272
|
if ( isUndoRedoDisabled ) {
|
|
218
273
|
return;
|
|
@@ -232,10 +287,10 @@ function HistoryActions( {
|
|
|
232
287
|
endGesture();
|
|
233
288
|
};
|
|
234
289
|
return (
|
|
235
|
-
<
|
|
290
|
+
<Stack
|
|
236
291
|
className="media-editor__history-actions"
|
|
237
|
-
|
|
238
|
-
gap=
|
|
292
|
+
align="center"
|
|
293
|
+
gap="sm"
|
|
239
294
|
>
|
|
240
295
|
<Button
|
|
241
296
|
size="compact"
|
|
@@ -270,35 +325,34 @@ function HistoryActions( {
|
|
|
270
325
|
accessibleWhenDisabled
|
|
271
326
|
onClick={ handleRedo }
|
|
272
327
|
/>
|
|
273
|
-
</
|
|
328
|
+
</Stack>
|
|
274
329
|
);
|
|
275
330
|
}
|
|
276
331
|
|
|
277
|
-
interface
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
332
|
+
export interface SaveActionsProps {
|
|
333
|
+
/**
|
|
334
|
+
* Button height. Footers take the 40px default; frames placing these in a
|
|
335
|
+
* page header pass `compact` to match the header's other controls.
|
|
336
|
+
*
|
|
337
|
+
* @default 'default'
|
|
338
|
+
*/
|
|
339
|
+
size?: 'default' | 'compact';
|
|
283
340
|
}
|
|
284
341
|
|
|
285
|
-
function
|
|
286
|
-
isSaving,
|
|
287
|
-
|
|
288
|
-
hasChanges,
|
|
289
|
-
onCancel,
|
|
290
|
-
onSave,
|
|
291
|
-
}: FooterActionsProps ) {
|
|
342
|
+
function SaveActions( { size = 'default' }: SaveActionsProps ) {
|
|
343
|
+
const { isSaving, hasMedia, hasChanges, onCancel, onSave } =
|
|
344
|
+
useMediaEditorFrameContext();
|
|
292
345
|
const saveDisabled = isSaving || ! hasMedia || ! hasChanges;
|
|
293
346
|
return (
|
|
294
|
-
<
|
|
295
|
-
className="media-
|
|
347
|
+
<Stack
|
|
348
|
+
className="media-editor__save-actions"
|
|
296
349
|
justify="flex-end"
|
|
297
|
-
|
|
298
|
-
gap=
|
|
350
|
+
align="center"
|
|
351
|
+
gap="sm"
|
|
299
352
|
>
|
|
300
353
|
<Button
|
|
301
354
|
__next40pxDefaultSize
|
|
355
|
+
size={ size }
|
|
302
356
|
variant="tertiary"
|
|
303
357
|
onClick={ onCancel }
|
|
304
358
|
disabled={ isSaving }
|
|
@@ -308,6 +362,7 @@ function FooterActions( {
|
|
|
308
362
|
</Button>
|
|
309
363
|
<Button
|
|
310
364
|
__next40pxDefaultSize
|
|
365
|
+
size={ size }
|
|
311
366
|
variant="primary"
|
|
312
367
|
onClick={ onSave }
|
|
313
368
|
isBusy={ isSaving }
|
|
@@ -316,7 +371,23 @@ function FooterActions( {
|
|
|
316
371
|
>
|
|
317
372
|
{ __( 'Save' ) }
|
|
318
373
|
</Button>
|
|
319
|
-
</
|
|
374
|
+
</Stack>
|
|
375
|
+
);
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function ImageControls() {
|
|
379
|
+
const { isImage, aspectRatioPresets } = useMediaEditorFrameContext();
|
|
380
|
+
// Non-image media has nothing to transform. Placement is the frame's call:
|
|
381
|
+
// render this only in the `narrow` layout, since above that breakpoint the
|
|
382
|
+
// Crop panel holds these controls already.
|
|
383
|
+
if ( ! isImage ) {
|
|
384
|
+
return null;
|
|
385
|
+
}
|
|
386
|
+
return (
|
|
387
|
+
<MediaEditorImageControls
|
|
388
|
+
showAspectRatioControl
|
|
389
|
+
aspectRatioPresets={ aspectRatioPresets }
|
|
390
|
+
/>
|
|
320
391
|
);
|
|
321
392
|
}
|
|
322
393
|
|
|
@@ -329,19 +400,19 @@ function MediaEditorContent( {
|
|
|
329
400
|
renderFrame,
|
|
330
401
|
noticesClassName = 'media-editor__snackbar',
|
|
331
402
|
noticesPortalElement,
|
|
332
|
-
showCloseButton = false,
|
|
333
403
|
shouldCloseOnEsc = false,
|
|
404
|
+
scope = 'media-editor',
|
|
334
405
|
}: MediaEditorProps ) {
|
|
335
406
|
const cropper = useMediaEditor();
|
|
336
407
|
// The sidebar is a side column from the `small` breakpoint up and collapses
|
|
337
408
|
// to an overlay below it — mirroring InterfaceSkeleton's behaviour, shifted
|
|
338
409
|
// from `medium` to `small` (see the matching CSS overrides in style.scss).
|
|
339
410
|
// Track that single breakpoint: in "panel mode" (≥ small) the
|
|
340
|
-
// rotate/flip/zoom controls live in the Crop panel
|
|
341
|
-
//
|
|
342
|
-
//
|
|
411
|
+
// rotate/flip/zoom controls live in the Crop panel; below it they have no
|
|
412
|
+
// panel to live in and the frame places them instead. (The fine-rotation
|
|
413
|
+
// ruler always sits under the canvas.)
|
|
343
414
|
const isPanelLayout = useViewportMatch( 'small' );
|
|
344
|
-
const
|
|
415
|
+
const layout: 'wide' | 'narrow' = isPanelLayout ? 'wide' : 'narrow';
|
|
345
416
|
|
|
346
417
|
const { media, hasEdits } = useSelect(
|
|
347
418
|
( select ) => {
|
|
@@ -578,62 +649,60 @@ function MediaEditorContent( {
|
|
|
578
649
|
onChange={ handleChange }
|
|
579
650
|
settings={ { fields } }
|
|
580
651
|
>
|
|
581
|
-
|
|
582
|
-
|
|
652
|
+
<div className="media-editor">
|
|
653
|
+
{ ! media ? (
|
|
583
654
|
<div className="media-editor__loading">
|
|
584
655
|
<Spinner />
|
|
585
656
|
</div>
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
657
|
+
) : (
|
|
658
|
+
<>
|
|
659
|
+
<MediaEditorSidebar
|
|
660
|
+
tabs={ tabs }
|
|
661
|
+
activeTabId={ activeTabId }
|
|
662
|
+
onTabChange={ setSelectedTabId }
|
|
663
|
+
scope={ scope }
|
|
664
|
+
/>
|
|
665
|
+
<InterfaceSkeleton
|
|
666
|
+
className="media-editor__skeleton"
|
|
667
|
+
labels={ {
|
|
668
|
+
body: isImage
|
|
669
|
+
? __( 'Image editor' )
|
|
670
|
+
: __( 'Media preview' ),
|
|
671
|
+
sidebar: __( 'Media details' ),
|
|
672
|
+
} }
|
|
673
|
+
content={
|
|
674
|
+
<div className="media-editor__content">
|
|
675
|
+
<div className="media-editor__canvas-area">
|
|
676
|
+
{ isImage ? (
|
|
677
|
+
<MediaEditorCanvas
|
|
678
|
+
isPlacementActive={
|
|
679
|
+
isPlacementActive
|
|
680
|
+
}
|
|
681
|
+
onGestureStart={
|
|
682
|
+
handleCanvasGestureStart
|
|
683
|
+
}
|
|
684
|
+
onGestureEnd={
|
|
685
|
+
handleCanvasGestureEnd
|
|
686
|
+
}
|
|
687
|
+
/>
|
|
688
|
+
) : (
|
|
689
|
+
<MediaPreview />
|
|
690
|
+
) }
|
|
691
|
+
</div>
|
|
692
|
+
{ isImage && (
|
|
693
|
+
<div className="media-editor__canvas-toolbar">
|
|
694
|
+
{ ruler }
|
|
695
|
+
</div>
|
|
622
696
|
) }
|
|
623
697
|
</div>
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
<ComplementaryArea.Slot scope="media-editor" />
|
|
633
|
-
}
|
|
634
|
-
/>
|
|
635
|
-
</Tabs.Root>
|
|
636
|
-
) }
|
|
698
|
+
}
|
|
699
|
+
sidebar={
|
|
700
|
+
<ComplementaryArea.Slot scope={ scope } />
|
|
701
|
+
}
|
|
702
|
+
/>
|
|
703
|
+
</>
|
|
704
|
+
) }
|
|
705
|
+
</div>
|
|
637
706
|
<ConfirmDialog
|
|
638
707
|
isOpen={ isDiscardDialogOpen }
|
|
639
708
|
confirmButtonText={ __( 'Discard' ) }
|
|
@@ -654,74 +723,36 @@ function MediaEditorContent( {
|
|
|
654
723
|
</MediaEditorProvider>
|
|
655
724
|
);
|
|
656
725
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
/>
|
|
662
|
-
) : null;
|
|
663
|
-
const imageControls = isImage ? (
|
|
664
|
-
<MediaEditorImageControls
|
|
665
|
-
showAspectRatioControl
|
|
666
|
-
aspectRatioPresets={ aspectRatioPresets }
|
|
667
|
-
/>
|
|
668
|
-
) : null;
|
|
669
|
-
const actions = (
|
|
670
|
-
<FooterActions
|
|
671
|
-
isSaving={ isSaving }
|
|
672
|
-
hasMedia={ !! media }
|
|
673
|
-
hasChanges={ hasChanges }
|
|
674
|
-
onCancel={ handleRequestClose }
|
|
675
|
-
onSave={ saveMediaEditor }
|
|
676
|
-
/>
|
|
677
|
-
);
|
|
678
|
-
|
|
679
|
-
// The fine-rotation ruler always lives under the canvas (in
|
|
680
|
-
// `media-editor__content`), never the footer, so it stays constrained to
|
|
681
|
-
// the canvas column at every viewport. One JSX tree per layout; DOM order
|
|
682
|
-
// matches visual order.
|
|
683
|
-
let footerActions: ReactNode;
|
|
684
|
-
if ( footerLayout === 'wide' ) {
|
|
685
|
-
// Sidebar is a column: image controls live in the Crop panel, so
|
|
686
|
-
// the footer is just History + Cancel/Save.
|
|
687
|
-
footerActions = (
|
|
688
|
-
<>
|
|
689
|
-
{ history }
|
|
690
|
-
{ actions }
|
|
691
|
-
</>
|
|
692
|
-
);
|
|
693
|
-
} else {
|
|
694
|
-
// Sidebar collapsed: the image controls drop into the footer.
|
|
695
|
-
footerActions = (
|
|
696
|
-
<>
|
|
697
|
-
{ imageControls }
|
|
698
|
-
<div className="media-editor-modal__footer-row">
|
|
699
|
-
{ history }
|
|
700
|
-
{ actions }
|
|
701
|
-
</div>
|
|
702
|
-
</>
|
|
703
|
-
);
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
return renderFrame( {
|
|
707
|
-
children,
|
|
708
|
-
headerActions: (
|
|
709
|
-
<HeaderActions
|
|
710
|
-
isSaving={ isSaving }
|
|
711
|
-
isImage={ isImage }
|
|
712
|
-
showCloseButton={ showCloseButton }
|
|
713
|
-
onCancel={ handleRequestClose }
|
|
714
|
-
/>
|
|
715
|
-
),
|
|
716
|
-
footerActions,
|
|
717
|
-
footerLayout,
|
|
718
|
-
onRequestClose: handleRequestClose,
|
|
719
|
-
onKeyDown: handleKeyDown,
|
|
720
|
-
shouldCloseOnClickOutside: ! hasChanges && ! isSaving,
|
|
726
|
+
// Rebuilt each render, like the elements it replaces: consumers re-render
|
|
727
|
+
// as they always did, but the cluster component types stay stable.
|
|
728
|
+
const contextValue: MediaEditorFrameContextValue = {
|
|
729
|
+
isImage,
|
|
721
730
|
isSaving,
|
|
722
|
-
hasChanges,
|
|
723
731
|
hasMedia: !! media,
|
|
724
|
-
|
|
732
|
+
hasChanges,
|
|
733
|
+
isUndoRedoDisabled: isCropInteractionActive,
|
|
734
|
+
scope,
|
|
735
|
+
aspectRatioPresets,
|
|
736
|
+
onCancel: handleRequestClose,
|
|
737
|
+
onSave: saveMediaEditor,
|
|
738
|
+
onReset: resetCropOptions,
|
|
739
|
+
};
|
|
740
|
+
|
|
741
|
+
return (
|
|
742
|
+
<MediaEditorFrameContext.Provider value={ contextValue }>
|
|
743
|
+
{ renderFrame( {
|
|
744
|
+
children,
|
|
745
|
+
isImage,
|
|
746
|
+
layout,
|
|
747
|
+
onRequestClose: handleRequestClose,
|
|
748
|
+
onKeyDown: handleKeyDown,
|
|
749
|
+
shouldCloseOnClickOutside: ! hasChanges && ! isSaving,
|
|
750
|
+
isSaving,
|
|
751
|
+
hasChanges,
|
|
752
|
+
hasMedia: !! media,
|
|
753
|
+
} ) }
|
|
754
|
+
</MediaEditorFrameContext.Provider>
|
|
755
|
+
);
|
|
725
756
|
}
|
|
726
757
|
|
|
727
758
|
export function MediaEditor( props: MediaEditorProps ) {
|
|
@@ -732,4 +763,12 @@ export function MediaEditor( props: MediaEditorProps ) {
|
|
|
732
763
|
);
|
|
733
764
|
}
|
|
734
765
|
|
|
766
|
+
// Attached to `MediaEditor` so frames import and arrange them, the way
|
|
767
|
+
// `DataViewsPicker` exposes its own sub-components. They read what they need
|
|
768
|
+
// from context, so a frame only chooses where they go and how they look.
|
|
769
|
+
MediaEditor.HeaderActions = HeaderActions;
|
|
770
|
+
MediaEditor.HistoryActions = HistoryActions;
|
|
771
|
+
MediaEditor.SaveActions = SaveActions;
|
|
772
|
+
MediaEditor.ImageControls = ImageControls;
|
|
773
|
+
|
|
735
774
|
export default MediaEditor;
|
|
@@ -102,10 +102,13 @@
|
|
|
102
102
|
.media-editor__sidebar {
|
|
103
103
|
@include reset;
|
|
104
104
|
|
|
105
|
-
//
|
|
106
|
-
// slider
|
|
105
|
+
// Equal inline gutter so focus rings (outline + offset) and the zoom
|
|
106
|
+
// slider thumb at its minimum sit inside the sidebar without shifting
|
|
107
|
+
// the panel toward one edge. The complementary area uses overflow: auto
|
|
108
|
+
// and the skeleton sidebar overflow: hidden, so a 1px-only left inset
|
|
109
|
+
// still clips the 2px focus outline.
|
|
107
110
|
@include break-small() {
|
|
108
|
-
padding-
|
|
111
|
+
padding-inline: $grid-unit-10;
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { useCropOptions } from '../use-crop-options';
|
|
10
3
|
import { ORIGINAL_ASPECT_RATIO } from '../../../image-editor/core/constants';
|
|
11
4
|
import { MediaEditorStateProvider } from '../../../state';
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { useMemo } from '@wordpress/element';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { DEFAULT_ASPECT_RATIOS } from '../../image-editor/core/constants';
|
|
10
3
|
import type { AspectRatioPreset } from '../../image-editor/core/constants';
|
|
11
4
|
import { useMediaEditor, resolveAspectRatio } from '../../state';
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import apiFetch from '@wordpress/api-fetch';
|
|
5
2
|
import { useDispatch, useRegistry } from '@wordpress/data';
|
|
6
3
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
4
|
import { useCallback, useState } from '@wordpress/element';
|
|
8
5
|
import { __, sprintf } from '@wordpress/i18n';
|
|
9
6
|
import { store as noticesStore } from '@wordpress/notices';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
7
|
import type { Media } from '../media-editor-provider';
|
|
15
8
|
import type { MediaEditorController } from '../../state';
|
|
16
9
|
import {
|