@wordpress/media-editor 0.7.0 → 0.8.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/build/components/media-editor-canvas/index.cjs +54 -0
- package/build/components/media-editor-canvas/index.cjs.map +7 -0
- package/build/components/media-editor-crop-panel/index.cjs +116 -0
- package/build/components/media-editor-crop-panel/index.cjs.map +7 -0
- package/build/components/media-editor-modal/build-modifiers.cjs +91 -0
- package/build/components/media-editor-modal/build-modifiers.cjs.map +7 -0
- package/build/components/media-editor-modal/index.cjs +497 -0
- package/build/components/media-editor-modal/index.cjs.map +7 -0
- package/build/components/media-editor-toolbar/index.cjs +146 -0
- package/build/components/media-editor-toolbar/index.cjs.map +7 -0
- package/build/components/media-preview/index.cjs +1 -1
- package/build/components/media-preview/index.cjs.map +2 -2
- package/build/image-editor/core/camera.cjs +194 -0
- package/build/image-editor/core/camera.cjs.map +7 -0
- package/build/image-editor/core/constants.cjs +81 -0
- package/build/image-editor/core/constants.cjs.map +7 -0
- package/build/image-editor/core/containment.cjs +245 -0
- package/build/image-editor/core/containment.cjs.map +7 -0
- package/build/image-editor/core/export/canvas-renderer.cjs +151 -0
- package/build/image-editor/core/export/canvas-renderer.cjs.map +7 -0
- package/build/image-editor/core/index.cjs +50 -0
- package/build/image-editor/core/index.cjs.map +7 -0
- package/build/image-editor/core/interaction-controller.cjs +608 -0
- package/build/image-editor/core/interaction-controller.cjs.map +7 -0
- package/build/image-editor/core/math/rotation.cjs +41 -0
- package/build/image-editor/core/math/rotation.cjs.map +7 -0
- package/build/image-editor/core/source-region.cjs +95 -0
- package/build/image-editor/core/source-region.cjs.map +7 -0
- package/build/image-editor/core/state.cjs +269 -0
- package/build/image-editor/core/state.cjs.map +7 -0
- package/build/image-editor/core/stencil-math.cjs +197 -0
- package/build/image-editor/core/stencil-math.cjs.map +7 -0
- package/build/image-editor/core/transform-style.cjs +46 -0
- package/build/image-editor/core/transform-style.cjs.map +7 -0
- package/build/image-editor/core/transforms/pipeline.cjs +43 -0
- package/build/image-editor/core/transforms/pipeline.cjs.map +7 -0
- package/build/image-editor/core/types.cjs +19 -0
- package/build/image-editor/core/types.cjs.map +7 -0
- package/build/image-editor/index.cjs +57 -0
- package/build/image-editor/index.cjs.map +7 -0
- package/build/image-editor/react/components/cropper-provider.cjs +50 -0
- package/build/image-editor/react/components/cropper-provider.cjs.map +7 -0
- package/build/image-editor/react/components/cropper.cjs +365 -0
- package/build/image-editor/react/components/cropper.cjs.map +7 -0
- package/build/image-editor/react/components/index.cjs +36 -0
- package/build/image-editor/react/components/index.cjs.map +7 -0
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +58 -0
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +7 -0
- package/build/image-editor/react/components/overlays/grid-overlay.cjs +91 -0
- package/build/image-editor/react/components/overlays/grid-overlay.cjs.map +7 -0
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +351 -0
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +7 -0
- package/build/image-editor/react/hooks/index.cjs +31 -0
- package/build/image-editor/react/hooks/index.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +68 -0
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-cropper-state.cjs +158 -0
- package/build/image-editor/react/hooks/use-cropper-state.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-interaction.cjs +161 -0
- package/build/image-editor/react/hooks/use-interaction.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-transform-style.cjs +38 -0
- package/build/image-editor/react/hooks/use-transform-style.cjs.map +7 -0
- package/build/index.cjs +5 -2
- package/build/index.cjs.map +2 -2
- package/build/lock-unlock.cjs +37 -0
- package/build/lock-unlock.cjs.map +7 -0
- package/build/private-apis.cjs +38 -0
- package/build/private-apis.cjs.map +7 -0
- package/build/store/actions.cjs +45 -0
- package/build/store/actions.cjs.map +7 -0
- package/build/store/constants.cjs +31 -0
- package/build/store/constants.cjs.map +7 -0
- package/build/store/index.cjs +51 -0
- package/build/store/index.cjs.map +7 -0
- package/build/store/reducer.cjs +51 -0
- package/build/store/reducer.cjs.map +7 -0
- package/build/store/selectors.cjs +43 -0
- package/build/store/selectors.cjs.map +7 -0
- package/build-module/components/media-editor-canvas/index.mjs +33 -0
- package/build-module/components/media-editor-canvas/index.mjs.map +7 -0
- package/build-module/components/media-editor-crop-panel/index.mjs +100 -0
- package/build-module/components/media-editor-crop-panel/index.mjs.map +7 -0
- package/build-module/components/media-editor-modal/build-modifiers.mjs +66 -0
- package/build-module/components/media-editor-modal/build-modifiers.mjs.map +7 -0
- package/build-module/components/media-editor-modal/index.mjs +483 -0
- package/build-module/components/media-editor-modal/index.mjs.map +7 -0
- package/build-module/components/media-editor-toolbar/index.mjs +130 -0
- package/build-module/components/media-editor-toolbar/index.mjs.map +7 -0
- package/build-module/components/media-preview/index.mjs +1 -1
- package/build-module/components/media-preview/index.mjs.map +2 -2
- package/build-module/image-editor/core/camera.mjs +163 -0
- package/build-module/image-editor/core/camera.mjs.map +7 -0
- package/build-module/image-editor/core/constants.mjs +51 -0
- package/build-module/image-editor/core/constants.mjs.map +7 -0
- package/build-module/image-editor/core/containment.mjs +218 -0
- package/build-module/image-editor/core/containment.mjs.map +7 -0
- package/build-module/image-editor/core/export/canvas-renderer.mjs +120 -0
- package/build-module/image-editor/core/export/canvas-renderer.mjs.map +7 -0
- package/build-module/image-editor/core/index.mjs +24 -0
- package/build-module/image-editor/core/index.mjs.map +7 -0
- package/build-module/image-editor/core/interaction-controller.mjs +583 -0
- package/build-module/image-editor/core/interaction-controller.mjs.map +7 -0
- package/build-module/image-editor/core/math/rotation.mjs +15 -0
- package/build-module/image-editor/core/math/rotation.mjs.map +7 -0
- package/build-module/image-editor/core/source-region.mjs +69 -0
- package/build-module/image-editor/core/source-region.mjs.map +7 -0
- package/build-module/image-editor/core/state.mjs +242 -0
- package/build-module/image-editor/core/state.mjs.map +7 -0
- package/build-module/image-editor/core/stencil-math.mjs +169 -0
- package/build-module/image-editor/core/stencil-math.mjs.map +7 -0
- package/build-module/image-editor/core/transform-style.mjs +21 -0
- package/build-module/image-editor/core/transform-style.mjs.map +7 -0
- package/build-module/image-editor/core/transforms/pipeline.mjs +17 -0
- package/build-module/image-editor/core/transforms/pipeline.mjs.map +7 -0
- package/build-module/image-editor/core/types.mjs +1 -0
- package/build-module/image-editor/core/types.mjs.map +7 -0
- package/build-module/image-editor/index.mjs +30 -0
- package/build-module/image-editor/index.mjs.map +7 -0
- package/build-module/image-editor/react/components/cropper-provider.mjs +26 -0
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +7 -0
- package/build-module/image-editor/react/components/cropper.mjs +337 -0
- package/build-module/image-editor/react/components/cropper.mjs.map +7 -0
- package/build-module/image-editor/react/components/index.mjs +9 -0
- package/build-module/image-editor/react/components/index.mjs.map +7 -0
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +33 -0
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +7 -0
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs +66 -0
- package/build-module/image-editor/react/components/overlays/grid-overlay.mjs.map +7 -0
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +330 -0
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/index.mjs +6 -0
- package/build-module/image-editor/react/hooks/index.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +43 -0
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs +137 -0
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-interaction.mjs +138 -0
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-transform-style.mjs +13 -0
- package/build-module/image-editor/react/hooks/use-transform-style.mjs.map +7 -0
- package/build-module/index.mjs +3 -1
- package/build-module/index.mjs.map +2 -2
- package/build-module/lock-unlock.mjs +11 -0
- package/build-module/lock-unlock.mjs.map +7 -0
- package/build-module/private-apis.mjs +13 -0
- package/build-module/private-apis.mjs.map +7 -0
- package/build-module/store/actions.mjs +19 -0
- package/build-module/store/actions.mjs.map +7 -0
- package/build-module/store/constants.mjs +6 -0
- package/build-module/store/constants.mjs.map +7 -0
- package/build-module/store/index.mjs +16 -0
- package/build-module/store/index.mjs.map +7 -0
- package/build-module/store/reducer.mjs +26 -0
- package/build-module/store/reducer.mjs.map +7 -0
- package/build-module/store/selectors.mjs +16 -0
- package/build-module/store/selectors.mjs.map +7 -0
- package/build-style/style-rtl.css +315 -0
- package/build-style/style.css +315 -0
- package/build-types/components/media-editor-canvas/index.d.ts +22 -0
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -0
- package/build-types/components/media-editor-crop-panel/index.d.ts +45 -0
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -0
- package/build-types/components/media-editor-modal/build-modifiers.d.ts +83 -0
- package/build-types/components/media-editor-modal/build-modifiers.d.ts.map +1 -0
- package/build-types/components/media-editor-modal/index.d.ts +20 -0
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -0
- package/build-types/components/media-editor-toolbar/index.d.ts +21 -0
- package/build-types/components/media-editor-toolbar/index.d.ts.map +1 -0
- package/build-types/components/media-preview/index.d.ts.map +1 -1
- package/build-types/image-editor/core/camera.d.ts +107 -0
- package/build-types/image-editor/core/camera.d.ts.map +1 -0
- package/build-types/image-editor/core/constants.d.ts +46 -0
- package/build-types/image-editor/core/constants.d.ts.map +1 -0
- package/build-types/image-editor/core/containment.d.ts +61 -0
- package/build-types/image-editor/core/containment.d.ts.map +1 -0
- package/build-types/image-editor/core/export/canvas-renderer.d.ts +106 -0
- package/build-types/image-editor/core/export/canvas-renderer.d.ts.map +1 -0
- package/build-types/image-editor/core/index.d.ts +8 -0
- package/build-types/image-editor/core/index.d.ts.map +1 -0
- package/build-types/image-editor/core/interaction-controller.d.ts +178 -0
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -0
- package/build-types/image-editor/core/math/rotation.d.ts +18 -0
- package/build-types/image-editor/core/math/rotation.d.ts.map +1 -0
- package/build-types/image-editor/core/source-region.d.ts +75 -0
- package/build-types/image-editor/core/source-region.d.ts.map +1 -0
- package/build-types/image-editor/core/state.d.ts +42 -0
- package/build-types/image-editor/core/state.d.ts.map +1 -0
- package/build-types/image-editor/core/stencil-math.d.ts +79 -0
- package/build-types/image-editor/core/stencil-math.d.ts.map +1 -0
- package/build-types/image-editor/core/transform-style.d.ts +23 -0
- package/build-types/image-editor/core/transform-style.d.ts.map +1 -0
- package/build-types/image-editor/core/transforms/pipeline.d.ts +27 -0
- package/build-types/image-editor/core/transforms/pipeline.d.ts.map +1 -0
- package/build-types/image-editor/core/types.d.ts +211 -0
- package/build-types/image-editor/core/types.d.ts.map +1 -0
- package/build-types/image-editor/index.d.ts +16 -0
- package/build-types/image-editor/index.d.ts.map +1 -0
- package/build-types/image-editor/react/components/cropper-provider.d.ts +37 -0
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -0
- package/build-types/image-editor/react/components/cropper.d.ts +59 -0
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -0
- package/build-types/image-editor/react/components/index.d.ts +4 -0
- package/build-types/image-editor/react/components/index.d.ts.map +1 -0
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +30 -0
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -0
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +30 -0
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +1 -0
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +32 -0
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/index.d.ts +3 -0
- package/build-types/image-editor/react/hooks/index.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts +16 -0
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +68 -0
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +60 -0
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts +16 -0
- package/build-types/image-editor/react/hooks/use-transform-style.d.ts.map +1 -0
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts +16 -0
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -0
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/private-apis.d.ts +2 -0
- package/build-types/private-apis.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +27 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +2 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/index.d.ts +4 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +23 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +8 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/package.json +21 -8
- package/src/components/media-editor-canvas/index.tsx +56 -0
- package/src/components/media-editor-canvas/style.scss +9 -0
- package/src/components/media-editor-crop-panel/index.tsx +143 -0
- package/src/components/media-editor-modal/build-modifiers.ts +164 -0
- package/src/components/media-editor-modal/index.tsx +639 -0
- package/src/components/media-editor-modal/style.scss +139 -0
- package/src/components/media-editor-modal/test/build-modifiers.test.ts +343 -0
- package/src/components/media-editor-toolbar/index.tsx +150 -0
- package/src/components/media-editor-toolbar/style.scss +21 -0
- package/src/components/media-preview/index.tsx +2 -1
- package/src/image-editor/README.md +162 -0
- package/src/image-editor/core/camera.ts +352 -0
- package/src/image-editor/core/constants.ts +93 -0
- package/src/image-editor/core/containment.ts +435 -0
- package/src/image-editor/core/export/canvas-renderer.ts +253 -0
- package/src/image-editor/core/export/test/canvas-renderer.ts +813 -0
- package/src/image-editor/core/index.ts +35 -0
- package/src/image-editor/core/interaction-controller.ts +889 -0
- package/src/image-editor/core/math/rotation.ts +26 -0
- package/src/image-editor/core/source-region.ts +166 -0
- package/src/image-editor/core/state.ts +428 -0
- package/src/image-editor/core/stencil-math.ts +330 -0
- package/src/image-editor/core/test/camera.ts +593 -0
- package/src/image-editor/core/test/interaction-controller.ts +996 -0
- package/src/image-editor/core/test/preview-export-parity.ts +242 -0
- package/src/image-editor/core/test/render-camera-bridge.ts +348 -0
- package/src/image-editor/core/test/state.ts +762 -0
- package/src/image-editor/core/test/stencil-math.ts +321 -0
- package/src/image-editor/core/transform-style.ts +44 -0
- package/src/image-editor/core/transforms/pipeline.ts +43 -0
- package/src/image-editor/core/transforms/test/pipeline.ts +269 -0
- package/src/image-editor/core/types.ts +177 -0
- package/src/image-editor/docs/architecture.md +96 -0
- package/src/image-editor/docs/recipes.md +720 -0
- package/src/image-editor/docs/roadmap.md +66 -0
- package/src/image-editor/index.ts +43 -0
- package/src/image-editor/react/components/cropper-provider.tsx +73 -0
- package/src/image-editor/react/components/cropper.scss +195 -0
- package/src/image-editor/react/components/cropper.tsx +534 -0
- package/src/image-editor/react/components/index.ts +3 -0
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +57 -0
- package/src/image-editor/react/components/overlays/grid-overlay.tsx +80 -0
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +513 -0
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.tsx +265 -0
- package/src/image-editor/react/components/test/cropper.tsx +140 -0
- package/src/image-editor/react/hooks/index.ts +2 -0
- package/src/image-editor/react/hooks/test/use-cropper-state.ts +913 -0
- package/src/image-editor/react/hooks/test/use-interaction.ts +218 -0
- package/src/image-editor/react/hooks/test/use-transform-style.ts +146 -0
- package/src/image-editor/react/hooks/use-aria-announcer.ts +64 -0
- package/src/image-editor/react/hooks/use-cropper-state.ts +238 -0
- package/src/image-editor/react/hooks/use-interaction.ts +223 -0
- package/src/image-editor/react/hooks/use-transform-style.ts +30 -0
- package/src/image-editor/stories/rectangle-crop.story.tsx +1085 -0
- package/src/image-editor/stories/style.css +94 -0
- package/src/image-editor/style.scss +1 -0
- package/src/index.ts +3 -0
- package/src/lock-unlock.ts +10 -0
- package/src/private-apis.ts +12 -0
- package/src/store/actions.ts +33 -0
- package/src/store/constants.ts +1 -0
- package/src/store/index.ts +20 -0
- package/src/store/reducer.ts +48 -0
- package/src/store/selectors.ts +16 -0
- package/src/store/test/reducer.ts +57 -0
- package/src/style.scss +4 -0
- package/tsconfig.json +10 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
// packages/media-editor/src/components/media-editor-modal/index.tsx
|
|
2
|
+
import apiFetch from "@wordpress/api-fetch";
|
|
3
|
+
import {
|
|
4
|
+
Button,
|
|
5
|
+
Flex,
|
|
6
|
+
Modal,
|
|
7
|
+
Spinner,
|
|
8
|
+
__experimentalConfirmDialog as ConfirmDialog,
|
|
9
|
+
privateApis as componentsPrivateApis
|
|
10
|
+
} from "@wordpress/components";
|
|
11
|
+
import { Stack } from "@wordpress/ui";
|
|
12
|
+
import { useDispatch, useRegistry, useSelect } from "@wordpress/data";
|
|
13
|
+
import { store as coreStore } from "@wordpress/core-data";
|
|
14
|
+
import {
|
|
15
|
+
createPortal,
|
|
16
|
+
useCallback,
|
|
17
|
+
useContext,
|
|
18
|
+
useEffect,
|
|
19
|
+
useMemo,
|
|
20
|
+
useRef,
|
|
21
|
+
useState
|
|
22
|
+
} from "@wordpress/element";
|
|
23
|
+
import { __, sprintf } from "@wordpress/i18n";
|
|
24
|
+
import { close, drawerRight } from "@wordpress/icons";
|
|
25
|
+
import { SnackbarNotices, store as noticesStore } from "@wordpress/notices";
|
|
26
|
+
import {
|
|
27
|
+
ComplementaryArea,
|
|
28
|
+
InterfaceSkeleton,
|
|
29
|
+
PinnedItems
|
|
30
|
+
} from "@wordpress/interface";
|
|
31
|
+
import { MediaEditorProvider } from "../media-editor-provider/index.mjs";
|
|
32
|
+
import MediaPreview from "../media-preview/index.mjs";
|
|
33
|
+
import MediaEditorCanvas from "../media-editor-canvas/index.mjs";
|
|
34
|
+
import MediaEditorToolbar from "../media-editor-toolbar/index.mjs";
|
|
35
|
+
import MediaEditorCropPanel, {
|
|
36
|
+
resolveAspectRatio
|
|
37
|
+
} from "../media-editor-crop-panel/index.mjs";
|
|
38
|
+
import MediaForm from "../media-form/index.mjs";
|
|
39
|
+
import { store as mediaEditorStore } from "../../store/index.mjs";
|
|
40
|
+
import { unlock } from "../../lock-unlock.mjs";
|
|
41
|
+
import { getMediaTypeFromMimeType } from "../../utils/index.mjs";
|
|
42
|
+
import { CropperProvider, useCropper } from "../../image-editor/index.mjs";
|
|
43
|
+
import { buildModifiers } from "./build-modifiers.mjs";
|
|
44
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
45
|
+
var METADATA_EDIT_KEYS = [
|
|
46
|
+
"title",
|
|
47
|
+
"caption",
|
|
48
|
+
"description",
|
|
49
|
+
"alt_text",
|
|
50
|
+
"post"
|
|
51
|
+
];
|
|
52
|
+
var NOTICES_CONTEXT = "media-editor";
|
|
53
|
+
var PLACEMENT_CONTROL_IDLE_MS = 300;
|
|
54
|
+
var { Tabs } = unlock(componentsPrivateApis);
|
|
55
|
+
function MediaEditorModalSidebar({ tabs }) {
|
|
56
|
+
const tabsContextValue = useContext(Tabs.Context);
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
ComplementaryArea,
|
|
59
|
+
{
|
|
60
|
+
scope: "media-editor",
|
|
61
|
+
identifier: "media-editor/details",
|
|
62
|
+
title: __("Details"),
|
|
63
|
+
icon: drawerRight,
|
|
64
|
+
isActiveByDefault: true,
|
|
65
|
+
className: "media-editor-modal__sidebar",
|
|
66
|
+
panelClassName: "media-editor-modal__sidebar-panel",
|
|
67
|
+
headerClassName: "media-editor-modal__sidebar-header",
|
|
68
|
+
header: /* @__PURE__ */ jsx(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ jsx(Tabs.TabList, { children: tabs.map((tab) => /* @__PURE__ */ jsx(Tabs.Tab, { tabId: tab.id, children: tab.title }, tab.id)) }) }),
|
|
69
|
+
children: /* @__PURE__ */ jsx(Tabs.Context.Provider, { value: tabsContextValue, children: tabs.map((tab) => /* @__PURE__ */ jsx(
|
|
70
|
+
Tabs.TabPanel,
|
|
71
|
+
{
|
|
72
|
+
tabId: tab.id,
|
|
73
|
+
focusable: false,
|
|
74
|
+
children: tab.panel
|
|
75
|
+
},
|
|
76
|
+
tab.id
|
|
77
|
+
)) })
|
|
78
|
+
}
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
function HeaderActions({
|
|
82
|
+
isSaving,
|
|
83
|
+
hasMedia,
|
|
84
|
+
hasChanges,
|
|
85
|
+
onCancel,
|
|
86
|
+
onSave
|
|
87
|
+
}) {
|
|
88
|
+
const saveDisabled = isSaving || !hasMedia || !hasChanges;
|
|
89
|
+
return /* @__PURE__ */ jsxs(
|
|
90
|
+
Flex,
|
|
91
|
+
{
|
|
92
|
+
className: "media-editor-modal__header-actions",
|
|
93
|
+
justify: "flex-end",
|
|
94
|
+
expanded: false,
|
|
95
|
+
gap: 2,
|
|
96
|
+
children: [
|
|
97
|
+
/* @__PURE__ */ jsx(PinnedItems.Slot, { scope: "media-editor" }),
|
|
98
|
+
/* @__PURE__ */ jsx(
|
|
99
|
+
Button,
|
|
100
|
+
{
|
|
101
|
+
size: "compact",
|
|
102
|
+
variant: "tertiary",
|
|
103
|
+
onClick: onCancel,
|
|
104
|
+
disabled: isSaving,
|
|
105
|
+
accessibleWhenDisabled: true,
|
|
106
|
+
children: __("Cancel")
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ jsx(
|
|
110
|
+
Button,
|
|
111
|
+
{
|
|
112
|
+
size: "compact",
|
|
113
|
+
variant: "primary",
|
|
114
|
+
onClick: onSave,
|
|
115
|
+
isBusy: isSaving,
|
|
116
|
+
disabled: saveDisabled,
|
|
117
|
+
accessibleWhenDisabled: true,
|
|
118
|
+
children: __("Save")
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsx(
|
|
122
|
+
Button,
|
|
123
|
+
{
|
|
124
|
+
size: "compact",
|
|
125
|
+
icon: close,
|
|
126
|
+
label: __("Close"),
|
|
127
|
+
onClick: onCancel,
|
|
128
|
+
disabled: isSaving,
|
|
129
|
+
accessibleWhenDisabled: true
|
|
130
|
+
}
|
|
131
|
+
)
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
);
|
|
135
|
+
}
|
|
136
|
+
function MediaEditorModalContent({
|
|
137
|
+
fields,
|
|
138
|
+
id,
|
|
139
|
+
media,
|
|
140
|
+
hasEdits,
|
|
141
|
+
aspectRatioPresets,
|
|
142
|
+
onUpdate
|
|
143
|
+
}) {
|
|
144
|
+
const cropper = useCropper();
|
|
145
|
+
const hasChanges = cropper.isDirty || hasEdits;
|
|
146
|
+
const registry = useRegistry();
|
|
147
|
+
const {
|
|
148
|
+
clearEntityRecordEdits,
|
|
149
|
+
editEntityRecord,
|
|
150
|
+
receiveEntityRecords,
|
|
151
|
+
saveEditedEntityRecord
|
|
152
|
+
} = useDispatch(coreStore);
|
|
153
|
+
const { closeMediaEditorModal } = useDispatch(mediaEditorStore);
|
|
154
|
+
const { createErrorNotice, removeAllNotices } = useDispatch(noticesStore);
|
|
155
|
+
const [isSaving, setIsSaving] = useState(false);
|
|
156
|
+
const [isDiscardDialogOpen, setIsDiscardDialogOpen] = useState(false);
|
|
157
|
+
const [isPlacementActive, setIsPlacementActive] = useState(false);
|
|
158
|
+
const placementControlTimerRef = useRef();
|
|
159
|
+
const [aspectRatioValue, setAspectRatioValue] = useState("0");
|
|
160
|
+
const [freeformCrop, setFreeformCrop] = useState(true);
|
|
161
|
+
const signalPlacementControlInteraction = useCallback(() => {
|
|
162
|
+
setIsPlacementActive(true);
|
|
163
|
+
clearTimeout(placementControlTimerRef.current);
|
|
164
|
+
placementControlTimerRef.current = setTimeout(() => {
|
|
165
|
+
setIsPlacementActive(false);
|
|
166
|
+
}, PLACEMENT_CONTROL_IDLE_MS);
|
|
167
|
+
}, []);
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
return () => {
|
|
170
|
+
clearTimeout(placementControlTimerRef.current);
|
|
171
|
+
};
|
|
172
|
+
}, []);
|
|
173
|
+
useEffect(() => {
|
|
174
|
+
setAspectRatioValue("0");
|
|
175
|
+
setFreeformCrop(true);
|
|
176
|
+
}, [id]);
|
|
177
|
+
const mediaType = getMediaTypeFromMimeType(media?.mime_type).type;
|
|
178
|
+
const isImage = !!media && mediaType === "image";
|
|
179
|
+
const imageAspectRatio = useMemo(() => {
|
|
180
|
+
if (!isImage) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
const naturalWidth = Number(media?.media_details?.width);
|
|
184
|
+
const naturalHeight = Number(media?.media_details?.height);
|
|
185
|
+
if (Number.isFinite(naturalWidth) && Number.isFinite(naturalHeight) && naturalHeight > 0) {
|
|
186
|
+
return naturalWidth / naturalHeight;
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}, [isImage, media]);
|
|
190
|
+
const tabs = useMemo(() => {
|
|
191
|
+
const detailsTab = {
|
|
192
|
+
id: "details",
|
|
193
|
+
title: __("Details"),
|
|
194
|
+
panel: /* @__PURE__ */ jsx(
|
|
195
|
+
Stack,
|
|
196
|
+
{
|
|
197
|
+
className: "media-editor-modal__panel",
|
|
198
|
+
direction: "column",
|
|
199
|
+
gap: "lg",
|
|
200
|
+
children: /* @__PURE__ */ jsx(MediaForm, {})
|
|
201
|
+
}
|
|
202
|
+
)
|
|
203
|
+
};
|
|
204
|
+
if (!isImage) {
|
|
205
|
+
return [detailsTab];
|
|
206
|
+
}
|
|
207
|
+
return [
|
|
208
|
+
{
|
|
209
|
+
id: "crop",
|
|
210
|
+
title: __("Crop"),
|
|
211
|
+
panel: /* @__PURE__ */ jsx(
|
|
212
|
+
Stack,
|
|
213
|
+
{
|
|
214
|
+
className: "media-editor-modal__panel",
|
|
215
|
+
direction: "column",
|
|
216
|
+
gap: "lg",
|
|
217
|
+
children: /* @__PURE__ */ jsx(
|
|
218
|
+
MediaEditorCropPanel,
|
|
219
|
+
{
|
|
220
|
+
aspectRatioValue,
|
|
221
|
+
onAspectRatioChange: setAspectRatioValue,
|
|
222
|
+
freeformCrop,
|
|
223
|
+
onFreeformChange: setFreeformCrop,
|
|
224
|
+
onPlacementControlInteraction: signalPlacementControlInteraction,
|
|
225
|
+
aspectRatioPresets
|
|
226
|
+
}
|
|
227
|
+
)
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
},
|
|
231
|
+
detailsTab
|
|
232
|
+
];
|
|
233
|
+
}, [
|
|
234
|
+
isImage,
|
|
235
|
+
aspectRatioValue,
|
|
236
|
+
freeformCrop,
|
|
237
|
+
aspectRatioPresets,
|
|
238
|
+
signalPlacementControlInteraction
|
|
239
|
+
]);
|
|
240
|
+
const handleChange = (updates) => {
|
|
241
|
+
editEntityRecord("postType", "attachment", id, updates);
|
|
242
|
+
};
|
|
243
|
+
const discardAndClose = () => {
|
|
244
|
+
removeAllNotices("snackbar", NOTICES_CONTEXT);
|
|
245
|
+
clearEntityRecordEdits("postType", "attachment", id);
|
|
246
|
+
closeMediaEditorModal();
|
|
247
|
+
};
|
|
248
|
+
const handleRequestClose = () => {
|
|
249
|
+
if (isSaving) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (hasChanges) {
|
|
253
|
+
setIsDiscardDialogOpen(true);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
discardAndClose();
|
|
257
|
+
};
|
|
258
|
+
const handleSave = async () => {
|
|
259
|
+
removeAllNotices("snackbar", NOTICES_CONTEXT);
|
|
260
|
+
setIsSaving(true);
|
|
261
|
+
try {
|
|
262
|
+
let saved;
|
|
263
|
+
const modifiers = cropper.isDirty && cropper.state.image ? buildModifiers(cropper.state, {
|
|
264
|
+
width: cropper.state.image.naturalWidth,
|
|
265
|
+
height: cropper.state.image.naturalHeight
|
|
266
|
+
}) : [];
|
|
267
|
+
if (modifiers.length > 0) {
|
|
268
|
+
const pendingEdits = registry.select(coreStore).getEntityRecordNonTransientEdits(
|
|
269
|
+
"postType",
|
|
270
|
+
"attachment",
|
|
271
|
+
id
|
|
272
|
+
);
|
|
273
|
+
const metadataEdits = {};
|
|
274
|
+
for (const key of METADATA_EDIT_KEYS) {
|
|
275
|
+
if (pendingEdits && key in pendingEdits) {
|
|
276
|
+
metadataEdits[key] = pendingEdits[key];
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
saved = await apiFetch({
|
|
280
|
+
path: `/wp/v2/media/${id}/edit`,
|
|
281
|
+
method: "POST",
|
|
282
|
+
data: {
|
|
283
|
+
src: media?.source_url,
|
|
284
|
+
modifiers,
|
|
285
|
+
...metadataEdits
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
if (saved) {
|
|
289
|
+
receiveEntityRecords(
|
|
290
|
+
"postType",
|
|
291
|
+
"attachment",
|
|
292
|
+
saved,
|
|
293
|
+
void 0,
|
|
294
|
+
true
|
|
295
|
+
);
|
|
296
|
+
}
|
|
297
|
+
} else {
|
|
298
|
+
saved = await saveEditedEntityRecord(
|
|
299
|
+
"postType",
|
|
300
|
+
"attachment",
|
|
301
|
+
id
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
const next = saved ?? media;
|
|
305
|
+
if (next && next.id !== id) {
|
|
306
|
+
clearEntityRecordEdits("postType", "attachment", id);
|
|
307
|
+
}
|
|
308
|
+
if (next && next.id && onUpdate) {
|
|
309
|
+
onUpdate({ id: next.id, url: next.source_url });
|
|
310
|
+
}
|
|
311
|
+
closeMediaEditorModal();
|
|
312
|
+
} catch (error) {
|
|
313
|
+
const message = error instanceof Error ? error.message : error?.message ?? __("An unknown error occurred.");
|
|
314
|
+
createErrorNotice(
|
|
315
|
+
sprintf(
|
|
316
|
+
/* translators: %s: Error message. */
|
|
317
|
+
__("Could not save image. %s"),
|
|
318
|
+
message
|
|
319
|
+
),
|
|
320
|
+
{ type: "snackbar", context: NOTICES_CONTEXT }
|
|
321
|
+
);
|
|
322
|
+
} finally {
|
|
323
|
+
setIsSaving(false);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
return /* @__PURE__ */ jsxs(
|
|
327
|
+
Modal,
|
|
328
|
+
{
|
|
329
|
+
className: "media-editor-modal",
|
|
330
|
+
title: __("Edit media"),
|
|
331
|
+
size: "fill",
|
|
332
|
+
isDismissible: false,
|
|
333
|
+
shouldCloseOnClickOutside: !hasChanges && !isSaving,
|
|
334
|
+
onKeyDown: (event) => {
|
|
335
|
+
if (event.code !== "Escape" && event.key !== "Escape") {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
if (isSaving) {
|
|
339
|
+
event.preventDefault();
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (hasChanges) {
|
|
343
|
+
event.preventDefault();
|
|
344
|
+
setIsDiscardDialogOpen(true);
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
onRequestClose: handleRequestClose,
|
|
348
|
+
headerActions: /* @__PURE__ */ jsx(
|
|
349
|
+
HeaderActions,
|
|
350
|
+
{
|
|
351
|
+
isSaving,
|
|
352
|
+
hasMedia: !!media,
|
|
353
|
+
hasChanges,
|
|
354
|
+
onCancel: handleRequestClose,
|
|
355
|
+
onSave: handleSave
|
|
356
|
+
}
|
|
357
|
+
),
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ jsxs(
|
|
360
|
+
MediaEditorProvider,
|
|
361
|
+
{
|
|
362
|
+
value: media ?? void 0,
|
|
363
|
+
onChange: handleChange,
|
|
364
|
+
settings: { fields },
|
|
365
|
+
children: [
|
|
366
|
+
!media ? /* @__PURE__ */ jsx("div", { className: "media-editor-modal__loading", children: /* @__PURE__ */ jsx(Spinner, {}) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
367
|
+
/* @__PURE__ */ jsx(Tabs, { children: /* @__PURE__ */ jsx(MediaEditorModalSidebar, { tabs }) }),
|
|
368
|
+
/* @__PURE__ */ jsx(
|
|
369
|
+
InterfaceSkeleton,
|
|
370
|
+
{
|
|
371
|
+
className: "media-editor-modal__skeleton",
|
|
372
|
+
content: /* @__PURE__ */ jsx("div", { className: "media-editor-modal__canvas", children: isImage ? /* @__PURE__ */ jsx(
|
|
373
|
+
MediaEditorCanvas,
|
|
374
|
+
{
|
|
375
|
+
aspectRatio: resolveAspectRatio(
|
|
376
|
+
aspectRatioValue,
|
|
377
|
+
imageAspectRatio
|
|
378
|
+
),
|
|
379
|
+
freeformCrop,
|
|
380
|
+
isPlacementActive
|
|
381
|
+
}
|
|
382
|
+
) : /* @__PURE__ */ jsx(MediaPreview, {}) }),
|
|
383
|
+
footer: isImage ? /* @__PURE__ */ jsx(
|
|
384
|
+
MediaEditorToolbar,
|
|
385
|
+
{
|
|
386
|
+
onReset: () => {
|
|
387
|
+
setAspectRatioValue("0");
|
|
388
|
+
setFreeformCrop(true);
|
|
389
|
+
},
|
|
390
|
+
onPlacementControlInteraction: signalPlacementControlInteraction
|
|
391
|
+
}
|
|
392
|
+
) : void 0,
|
|
393
|
+
sidebar: /* @__PURE__ */ jsx(ComplementaryArea.Slot, { scope: "media-editor" })
|
|
394
|
+
}
|
|
395
|
+
)
|
|
396
|
+
] }),
|
|
397
|
+
/* @__PURE__ */ jsx(
|
|
398
|
+
ConfirmDialog,
|
|
399
|
+
{
|
|
400
|
+
isOpen: isDiscardDialogOpen,
|
|
401
|
+
confirmButtonText: __("Discard"),
|
|
402
|
+
cancelButtonText: __("Keep editing"),
|
|
403
|
+
onCancel: () => setIsDiscardDialogOpen(false),
|
|
404
|
+
onConfirm: () => {
|
|
405
|
+
setIsDiscardDialogOpen(false);
|
|
406
|
+
discardAndClose();
|
|
407
|
+
},
|
|
408
|
+
children: __(
|
|
409
|
+
"Are you sure you want to discard your unsaved changes?"
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
)
|
|
413
|
+
]
|
|
414
|
+
}
|
|
415
|
+
),
|
|
416
|
+
createPortal(
|
|
417
|
+
/* @__PURE__ */ jsx(
|
|
418
|
+
SnackbarNotices,
|
|
419
|
+
{
|
|
420
|
+
className: "media-editor-modal__snackbar",
|
|
421
|
+
context: NOTICES_CONTEXT
|
|
422
|
+
}
|
|
423
|
+
),
|
|
424
|
+
document.body
|
|
425
|
+
)
|
|
426
|
+
]
|
|
427
|
+
}
|
|
428
|
+
);
|
|
429
|
+
}
|
|
430
|
+
function MediaEditorModal({
|
|
431
|
+
fields = [],
|
|
432
|
+
aspectRatioPresets
|
|
433
|
+
}) {
|
|
434
|
+
const { isModalOpen, id, onUpdate } = useSelect((select) => {
|
|
435
|
+
const { isOpen, getId, getOnUpdate } = select(mediaEditorStore);
|
|
436
|
+
return {
|
|
437
|
+
isModalOpen: isOpen(),
|
|
438
|
+
id: getId(),
|
|
439
|
+
onUpdate: getOnUpdate()
|
|
440
|
+
};
|
|
441
|
+
}, []);
|
|
442
|
+
const { media, hasEdits } = useSelect(
|
|
443
|
+
(select) => {
|
|
444
|
+
if (!id) {
|
|
445
|
+
return { media: null, hasEdits: false };
|
|
446
|
+
}
|
|
447
|
+
const { getEditedEntityRecord, hasEditsForEntityRecord } = select(coreStore);
|
|
448
|
+
return {
|
|
449
|
+
media: getEditedEntityRecord(
|
|
450
|
+
"postType",
|
|
451
|
+
"attachment",
|
|
452
|
+
id
|
|
453
|
+
),
|
|
454
|
+
hasEdits: hasEditsForEntityRecord(
|
|
455
|
+
"postType",
|
|
456
|
+
"attachment",
|
|
457
|
+
id
|
|
458
|
+
)
|
|
459
|
+
};
|
|
460
|
+
},
|
|
461
|
+
[id]
|
|
462
|
+
);
|
|
463
|
+
if (!isModalOpen || !id) {
|
|
464
|
+
return null;
|
|
465
|
+
}
|
|
466
|
+
return /* @__PURE__ */ jsx(CropperProvider, { children: /* @__PURE__ */ jsx(
|
|
467
|
+
MediaEditorModalContent,
|
|
468
|
+
{
|
|
469
|
+
fields,
|
|
470
|
+
id,
|
|
471
|
+
media,
|
|
472
|
+
hasEdits,
|
|
473
|
+
aspectRatioPresets,
|
|
474
|
+
onUpdate
|
|
475
|
+
}
|
|
476
|
+
) }, id);
|
|
477
|
+
}
|
|
478
|
+
var media_editor_modal_default = MediaEditorModal;
|
|
479
|
+
export {
|
|
480
|
+
MediaEditorModal,
|
|
481
|
+
media_editor_modal_default as default
|
|
482
|
+
};
|
|
483
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/media-editor-modal/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport {\n\tButton,\n\tFlex,\n\tModal,\n\tSpinner,\n\t__experimentalConfirmDialog as ConfirmDialog,\n\tprivateApis as componentsPrivateApis,\n} from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { useDispatch, useRegistry, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tcreatePortal,\n\tuseCallback,\n\tuseContext,\n\tuseEffect,\n\tuseMemo,\n\tuseRef,\n\tuseState,\n} from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { close, drawerRight } from '@wordpress/icons';\nimport { SnackbarNotices, store as noticesStore } from '@wordpress/notices';\nimport type { Field } from '@wordpress/dataviews';\nimport {\n\tComplementaryArea,\n\tInterfaceSkeleton,\n\tPinnedItems,\n\t// No type declarations available for @wordpress/interface.\n\t// @ts-expect-error\n} from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport { MediaEditorProvider } from '../media-editor-provider';\nimport type { Media } from '../media-editor-provider';\nimport MediaPreview from '../media-preview';\nimport MediaEditorCanvas from '../media-editor-canvas';\nimport MediaEditorToolbar from '../media-editor-toolbar';\nimport MediaEditorCropPanel, {\n\tresolveAspectRatio,\n} from '../media-editor-crop-panel';\nimport MediaForm from '../media-form';\nimport { store as mediaEditorStore } from '../../store';\nimport type { MediaEditorModalUpdate } from '../../store/actions';\nimport { unlock } from '../../lock-unlock';\nimport { getMediaTypeFromMimeType } from '../../utils';\nimport { CropperProvider, useCropper } from '../../image-editor';\nimport type { AspectRatioPreset } from '../../image-editor/core/constants';\nimport { buildModifiers } from './build-modifiers';\n\n// Details-tab edits the modal bundles into a transformed `/edit` request.\n// Matches Core's `WP_REST_Attachments_Controller::get_edit_media_item_args`\n// \u2014 that endpoint's arg schema explicitly whitelists only these fields\n// (title / caption / description / alt_text / post), so forwarding any\n// others would fail REST validation with `rest_invalid_param`. Staged\n// edits to fields outside this list are not forwarded; a follow-up could\n// persist them via a separate `saveEditedEntityRecord` call.\nconst METADATA_EDIT_KEYS = [\n\t'title',\n\t'caption',\n\t'description',\n\t'alt_text',\n\t'post',\n] as const;\n\n// Scope save-failure snackbars to this modal so they don't leak into the\n// host editor's notices tray (and vice versa).\nconst NOTICES_CONTEXT = 'media-editor';\nconst PLACEMENT_CONTROL_IDLE_MS = 300;\n\nconst { Tabs } = unlock( componentsPrivateApis );\n\ninterface MediaEditorModalProps {\n\t/**\n\t * Attachment fields to render in the Details tab.\n\t *\n\t * Passed from the editor layer (which owns the `usePostFields` hook),\n\t * since `@wordpress/media-editor` cannot depend on `@wordpress/editor`.\n\t */\n\tfields?: Field< Media >[];\n\t/**\n\t * Fixed aspect-ratio presets for image cropping. Free and Original are\n\t * always provided by the modal.\n\t */\n\taspectRatioPresets?: AspectRatioPreset[];\n}\n\ninterface ModalTab {\n\tid: string;\n\ttitle: string;\n\tpanel: JSX.Element;\n}\n\n// Renders the `ComplementaryArea` with a tab list in its header, mirroring\n// the post editor's pattern in\n// `packages/editor/src/components/sidebar/index.js`. The `header` prop\n// replaces `ComplementaryArea`'s default `<h2>{ title }</h2>` row \u2014 `title`\n// is still passed so it can label the pinned toolbar button. Tabs context\n// must be re-provided on both sides of the Slot/Fill because the Fill\n// doesn't preserve the Tabs React context across to the Slot.\nfunction MediaEditorModalSidebar( { tabs }: { tabs: ModalTab[] } ) {\n\tconst tabsContextValue = useContext( Tabs.Context );\n\treturn (\n\t\t<ComplementaryArea\n\t\t\tscope=\"media-editor\"\n\t\t\tidentifier=\"media-editor/details\"\n\t\t\ttitle={ __( 'Details' ) }\n\t\t\ticon={ drawerRight }\n\t\t\tisActiveByDefault\n\t\t\tclassName=\"media-editor-modal__sidebar\"\n\t\t\tpanelClassName=\"media-editor-modal__sidebar-panel\"\n\t\t\theaderClassName=\"media-editor-modal__sidebar-header\"\n\t\t\theader={\n\t\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t\t<Tabs.TabList>\n\t\t\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t\t\t<Tabs.Tab key={ tab.id } tabId={ tab.id }>\n\t\t\t\t\t\t\t\t{ tab.title }\n\t\t\t\t\t\t\t</Tabs.Tab>\n\t\t\t\t\t\t) ) }\n\t\t\t\t\t</Tabs.TabList>\n\t\t\t\t</Tabs.Context.Provider>\n\t\t\t}\n\t\t>\n\t\t\t<Tabs.Context.Provider value={ tabsContextValue }>\n\t\t\t\t{ tabs.map( ( tab ) => (\n\t\t\t\t\t<Tabs.TabPanel\n\t\t\t\t\t\tkey={ tab.id }\n\t\t\t\t\t\ttabId={ tab.id }\n\t\t\t\t\t\tfocusable={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ tab.panel }\n\t\t\t\t\t</Tabs.TabPanel>\n\t\t\t\t) ) }\n\t\t\t</Tabs.Context.Provider>\n\t\t</ComplementaryArea>\n\t);\n}\n\ninterface HeaderActionsProps {\n\tisSaving: boolean;\n\thasMedia: boolean;\n\thasChanges: boolean;\n\tonCancel: () => void;\n\tonSave: () => void;\n}\n\nfunction HeaderActions( {\n\tisSaving,\n\thasMedia,\n\thasChanges,\n\tonCancel,\n\tonSave,\n}: HeaderActionsProps ) {\n\tconst saveDisabled = isSaving || ! hasMedia || ! hasChanges;\n\treturn (\n\t\t<Flex\n\t\t\tclassName=\"media-editor-modal__header-actions\"\n\t\t\tjustify=\"flex-end\"\n\t\t\texpanded={ false }\n\t\t\tgap={ 2 }\n\t\t>\n\t\t\t<PinnedItems.Slot scope=\"media-editor\" />\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"tertiary\"\n\t\t\t\tonClick={ onCancel }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t>\n\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ onSave }\n\t\t\t\tisBusy={ isSaving }\n\t\t\t\tdisabled={ saveDisabled }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t>\n\t\t\t\t{ __( 'Save' ) }\n\t\t\t</Button>\n\t\t\t<Button\n\t\t\t\tsize=\"compact\"\n\t\t\t\ticon={ close }\n\t\t\t\tlabel={ __( 'Close' ) }\n\t\t\t\tonClick={ onCancel }\n\t\t\t\tdisabled={ isSaving }\n\t\t\t\taccessibleWhenDisabled\n\t\t\t/>\n\t\t</Flex>\n\t);\n}\n\ninterface MediaEditorModalContentProps {\n\tfields: Field< Media >[];\n\tid: number;\n\tmedia: Media | null;\n\thasEdits: boolean;\n\taspectRatioPresets?: AspectRatioPreset[];\n\tonUpdate: ( ( updated: MediaEditorModalUpdate ) => void ) | null;\n}\n\n// Inner component rendered inside `CropperProvider` so it can read\n// `isDirty` from the cropper. The outer `MediaEditorModal` keeps the\n// store reads and provider tree above this.\nfunction MediaEditorModalContent( {\n\tfields,\n\tid,\n\tmedia,\n\thasEdits,\n\taspectRatioPresets,\n\tonUpdate,\n}: MediaEditorModalContentProps ) {\n\tconst cropper = useCropper();\n\tconst hasChanges = cropper.isDirty || hasEdits;\n\n\tconst registry = useRegistry();\n\tconst {\n\t\tclearEntityRecordEdits,\n\t\teditEntityRecord,\n\t\treceiveEntityRecords,\n\t\tsaveEditedEntityRecord,\n\t} = useDispatch( coreStore );\n\tconst { closeMediaEditorModal } = useDispatch( mediaEditorStore );\n\tconst { createErrorNotice, removeAllNotices } = useDispatch( noticesStore );\n\n\tconst [ isSaving, setIsSaving ] = useState( false );\n\tconst [ isDiscardDialogOpen, setIsDiscardDialogOpen ] = useState( false );\n\tconst [ isPlacementActive, setIsPlacementActive ] = useState( false );\n\tconst placementControlTimerRef =\n\t\tuseRef< ReturnType< typeof setTimeout > >();\n\n\tconst [ aspectRatioValue, setAspectRatioValue ] = useState( '0' );\n\tconst [ freeformCrop, setFreeformCrop ] = useState( true );\n\n\tconst signalPlacementControlInteraction = useCallback( () => {\n\t\tsetIsPlacementActive( true );\n\t\tclearTimeout( placementControlTimerRef.current );\n\t\tplacementControlTimerRef.current = setTimeout( () => {\n\t\t\tsetIsPlacementActive( false );\n\t\t}, PLACEMENT_CONTROL_IDLE_MS );\n\t}, [] );\n\n\tuseEffect( () => {\n\t\treturn () => {\n\t\t\tclearTimeout( placementControlTimerRef.current );\n\t\t};\n\t}, [] );\n\n\t// Reset aspect-ratio / freeform state when the media changes, so the\n\t// next image starts from the defaults.\n\tuseEffect( () => {\n\t\tsetAspectRatioValue( '0' );\n\t\tsetFreeformCrop( true );\n\t}, [ id ] );\n\n\tconst mediaType = getMediaTypeFromMimeType( media?.mime_type ).type;\n\tconst isImage = !! media && mediaType === 'image';\n\n\tconst imageAspectRatio = useMemo( () => {\n\t\tif ( ! isImage ) {\n\t\t\treturn null;\n\t\t}\n\t\tconst naturalWidth = Number( media?.media_details?.width );\n\t\tconst naturalHeight = Number( media?.media_details?.height );\n\t\tif (\n\t\t\tNumber.isFinite( naturalWidth ) &&\n\t\t\tNumber.isFinite( naturalHeight ) &&\n\t\t\tnaturalHeight > 0\n\t\t) {\n\t\t\treturn naturalWidth / naturalHeight;\n\t\t}\n\t\treturn null;\n\t}, [ isImage, media ] );\n\n\tconst tabs = useMemo< ModalTab[] >( () => {\n\t\tconst detailsTab: ModalTab = {\n\t\t\tid: 'details',\n\t\t\ttitle: __( 'Details' ),\n\t\t\tpanel: (\n\t\t\t\t<Stack\n\t\t\t\t\tclassName=\"media-editor-modal__panel\"\n\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\tgap=\"lg\"\n\t\t\t\t>\n\t\t\t\t\t<MediaForm />\n\t\t\t\t</Stack>\n\t\t\t),\n\t\t};\n\t\tif ( ! isImage ) {\n\t\t\treturn [ detailsTab ];\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\tid: 'crop',\n\t\t\t\ttitle: __( 'Crop' ),\n\t\t\t\tpanel: (\n\t\t\t\t\t<Stack\n\t\t\t\t\t\tclassName=\"media-editor-modal__panel\"\n\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\tgap=\"lg\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<MediaEditorCropPanel\n\t\t\t\t\t\t\taspectRatioValue={ aspectRatioValue }\n\t\t\t\t\t\t\tonAspectRatioChange={ setAspectRatioValue }\n\t\t\t\t\t\t\tfreeformCrop={ freeformCrop }\n\t\t\t\t\t\t\tonFreeformChange={ setFreeformCrop }\n\t\t\t\t\t\t\tonPlacementControlInteraction={\n\t\t\t\t\t\t\t\tsignalPlacementControlInteraction\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\taspectRatioPresets={ aspectRatioPresets }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Stack>\n\t\t\t\t),\n\t\t\t},\n\t\t\tdetailsTab,\n\t\t];\n\t}, [\n\t\tisImage,\n\t\taspectRatioValue,\n\t\tfreeformCrop,\n\t\taspectRatioPresets,\n\t\tsignalPlacementControlInteraction,\n\t] );\n\n\tconst handleChange = ( updates: Partial< Media > ) => {\n\t\teditEntityRecord( 'postType', 'attachment', id, updates );\n\t};\n\n\tconst discardAndClose = () => {\n\t\tremoveAllNotices( 'snackbar', NOTICES_CONTEXT );\n\t\tclearEntityRecordEdits( 'postType', 'attachment', id );\n\t\tcloseMediaEditorModal();\n\t};\n\n\tconst handleRequestClose = () => {\n\t\t// Disallow closing while a save is in flight so the in-progress\n\t\t// request can settle without the modal unmounting under it.\n\t\tif ( isSaving ) {\n\t\t\treturn;\n\t\t}\n\t\tif ( hasChanges ) {\n\t\t\tsetIsDiscardDialogOpen( true );\n\t\t\treturn;\n\t\t}\n\t\tdiscardAndClose();\n\t};\n\n\tconst handleSave = async () => {\n\t\t// Clear any prior failure snackbar so a successful retry doesn't\n\t\t// leave a stale \"Could not save image\" hovering.\n\t\tremoveAllNotices( 'snackbar', NOTICES_CONTEXT );\n\t\tsetIsSaving( true );\n\t\ttry {\n\t\t\tlet saved: Media | null | undefined;\n\n\t\t\tconst modifiers =\n\t\t\t\tcropper.isDirty && cropper.state.image\n\t\t\t\t\t? buildModifiers( cropper.state, {\n\t\t\t\t\t\t\twidth: cropper.state.image.naturalWidth,\n\t\t\t\t\t\t\theight: cropper.state.image.naturalHeight,\n\t\t\t\t\t } )\n\t\t\t\t\t: [];\n\n\t\t\tif ( modifiers.length > 0 ) {\n\t\t\t\t// Bundle staged Details-tab edits into the same /edit\n\t\t\t\t// request. Transformed saves duplicate the attachment,\n\t\t\t\t// and the prior core-data edits were staged against the\n\t\t\t\t// old id \u2014 if we don't forward them here they'd be\n\t\t\t\t// silently lost. Core's `edit_media_item` honors these\n\t\t\t\t// keys via `prepare_item_for_database` and `alt_text`.\n\t\t\t\tconst pendingEdits = registry\n\t\t\t\t\t.select( coreStore )\n\t\t\t\t\t.getEntityRecordNonTransientEdits(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tid\n\t\t\t\t\t) as Record< string, unknown > | undefined;\n\t\t\t\tconst metadataEdits: Record< string, unknown > = {};\n\t\t\t\tfor ( const key of METADATA_EDIT_KEYS ) {\n\t\t\t\t\tif ( pendingEdits && key in pendingEdits ) {\n\t\t\t\t\t\tmetadataEdits[ key ] = pendingEdits[ key ];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsaved = ( await apiFetch( {\n\t\t\t\t\tpath: `/wp/v2/media/${ id }/edit`,\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\tsrc: media?.source_url,\n\t\t\t\t\t\tmodifiers,\n\t\t\t\t\t\t...metadataEdits,\n\t\t\t\t\t},\n\t\t\t\t} ) ) as Media;\n\n\t\t\t\tif ( saved ) {\n\t\t\t\t\t// Put the newly-created attachment into the core-data\n\t\t\t\t\t// cache so downstream consumers see it without an\n\t\t\t\t\t// extra fetch round-trip.\n\t\t\t\t\treceiveEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\tsaved,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsaved = ( await saveEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tid\n\t\t\t\t) ) as Media | undefined;\n\t\t\t}\n\n\t\t\tconst next = ( saved ?? media ) as Media | null;\n\n\t\t\t// A transformed save creates a new attachment; clear staged\n\t\t\t// edits on the old record so it doesn't appear dirty in the\n\t\t\t// Media Library afterwards.\n\t\t\tif ( next && next.id !== id ) {\n\t\t\t\tclearEntityRecordEdits( 'postType', 'attachment', id );\n\t\t\t}\n\n\t\t\tif ( next && next.id && onUpdate ) {\n\t\t\t\t// Normalize to the public callback shape \u2014 see\n\t\t\t\t// `MediaEditorModalUpdate` in `../../store/actions.ts`.\n\t\t\t\tonUpdate( { id: next.id, url: next.source_url } );\n\t\t\t}\n\t\t\tcloseMediaEditorModal();\n\t\t} catch ( error ) {\n\t\t\tconst message =\n\t\t\t\terror instanceof Error\n\t\t\t\t\t? error.message\n\t\t\t\t\t: ( error as { message?: string } )?.message ??\n\t\t\t\t\t __( 'An unknown error occurred.' );\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: Error message. */\n\t\t\t\t\t__( 'Could not save image. %s' ),\n\t\t\t\t\tmessage\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', context: NOTICES_CONTEXT }\n\t\t\t);\n\t\t} finally {\n\t\t\tsetIsSaving( false );\n\t\t}\n\t};\n\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"media-editor-modal\"\n\t\t\ttitle={ __( 'Edit media' ) }\n\t\t\tsize=\"fill\"\n\t\t\tisDismissible={ false }\n\t\t\tshouldCloseOnClickOutside={ ! hasChanges && ! isSaving }\n\t\t\tonKeyDown={ ( event ) => {\n\t\t\t\tif ( event.code !== 'Escape' && event.key !== 'Escape' ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// While saving, swallow ESC so the in-progress request\n\t\t\t\t// can settle without the modal closing under it.\n\t\t\t\tif ( isSaving ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// When there are pending changes, intercept ESC and\n\t\t\t\t// open the confirm dialog ourselves. `preventDefault`\n\t\t\t\t// short-circuits Modal's own ESC-to-close handler on\n\t\t\t\t// the overlay so the modal doesn't animate out before\n\t\t\t\t// the dialog appears.\n\t\t\t\tif ( hasChanges ) {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tsetIsDiscardDialogOpen( true );\n\t\t\t\t}\n\t\t\t} }\n\t\t\tonRequestClose={ handleRequestClose }\n\t\t\theaderActions={\n\t\t\t\t<HeaderActions\n\t\t\t\t\tisSaving={ isSaving }\n\t\t\t\t\thasMedia={ !! media }\n\t\t\t\t\thasChanges={ hasChanges }\n\t\t\t\t\tonCancel={ handleRequestClose }\n\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t/>\n\t\t\t}\n\t\t>\n\t\t\t<MediaEditorProvider\n\t\t\t\tvalue={ media ?? undefined }\n\t\t\t\tonChange={ handleChange }\n\t\t\t\tsettings={ { fields } }\n\t\t\t>\n\t\t\t\t{ ! media ? (\n\t\t\t\t\t<div className=\"media-editor-modal__loading\">\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tabs>\n\t\t\t\t\t\t\t<MediaEditorModalSidebar tabs={ tabs } />\n\t\t\t\t\t\t</Tabs>\n\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\tclassName=\"media-editor-modal__skeleton\"\n\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t<div className=\"media-editor-modal__canvas\">\n\t\t\t\t\t\t\t\t\t{ isImage ? (\n\t\t\t\t\t\t\t\t\t\t<MediaEditorCanvas\n\t\t\t\t\t\t\t\t\t\t\taspectRatio={ resolveAspectRatio(\n\t\t\t\t\t\t\t\t\t\t\t\taspectRatioValue,\n\t\t\t\t\t\t\t\t\t\t\t\timageAspectRatio\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tfreeformCrop={ freeformCrop }\n\t\t\t\t\t\t\t\t\t\t\tisPlacementActive={\n\t\t\t\t\t\t\t\t\t\t\t\tisPlacementActive\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t<MediaPreview />\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\tisImage ? (\n\t\t\t\t\t\t\t\t\t<MediaEditorToolbar\n\t\t\t\t\t\t\t\t\t\tonReset={ () => {\n\t\t\t\t\t\t\t\t\t\t\tsetAspectRatioValue( '0' );\n\t\t\t\t\t\t\t\t\t\t\tsetFreeformCrop( true );\n\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\tonPlacementControlInteraction={\n\t\t\t\t\t\t\t\t\t\t\tsignalPlacementControlInteraction\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t) : undefined\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"media-editor\" />\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t\t{ /* Rendered inside the parent Modal so it's tracked as\n\t\t\t\t\t a nested dismisser. As a top-level sibling it would,\n\t\t\t\t\t on mount, request the parent Modal close. */ }\n\t\t\t\t<ConfirmDialog\n\t\t\t\t\tisOpen={ isDiscardDialogOpen }\n\t\t\t\t\tconfirmButtonText={ __( 'Discard' ) }\n\t\t\t\t\tcancelButtonText={ __( 'Keep editing' ) }\n\t\t\t\t\tonCancel={ () => setIsDiscardDialogOpen( false ) }\n\t\t\t\t\tonConfirm={ () => {\n\t\t\t\t\t\tsetIsDiscardDialogOpen( false );\n\t\t\t\t\t\tdiscardAndClose();\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Are you sure you want to discard your unsaved changes?'\n\t\t\t\t\t) }\n\t\t\t\t</ConfirmDialog>\n\t\t\t</MediaEditorProvider>\n\t\t\t{ createPortal(\n\t\t\t\t<SnackbarNotices\n\t\t\t\t\tclassName=\"media-editor-modal__snackbar\"\n\t\t\t\t\tcontext={ NOTICES_CONTEXT }\n\t\t\t\t/>,\n\t\t\t\tdocument.body\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nexport function MediaEditorModal( {\n\tfields = [],\n\taspectRatioPresets,\n}: MediaEditorModalProps ) {\n\tconst { isModalOpen, id, onUpdate } = useSelect( ( select ) => {\n\t\tconst { isOpen, getId, getOnUpdate } = select( mediaEditorStore );\n\t\treturn {\n\t\t\tisModalOpen: isOpen(),\n\t\t\tid: getId(),\n\t\t\tonUpdate: getOnUpdate(),\n\t\t};\n\t}, [] );\n\n\tconst { media, hasEdits } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! id ) {\n\t\t\t\treturn { media: null, hasEdits: false };\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\treturn {\n\t\t\t\tmedia: getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tid\n\t\t\t\t) as Media,\n\t\t\t\thasEdits: hasEditsForEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'attachment',\n\t\t\t\t\tid\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ id ]\n\t);\n\n\tif ( ! isModalOpen || ! id ) {\n\t\treturn null;\n\t}\n\n\t// `CropperProvider` is always mounted while the modal is open \u2014 it's\n\t// just a `useReducer` with no side effects \u2014 so the inner component\n\t// can read `isDirty` for images without forking on media type. The\n\t// `key` remounts the provider when the edited attachment changes,\n\t// discarding the previous cropper state. Keying on `id` (rather than\n\t// `media?.id`) avoids a remount when `media` resolves from `null` to\n\t// the loaded record on open \u2014 that flip would otherwise re-run the\n\t// modal's entry animation and cause a visible flicker.\n\treturn (\n\t\t<CropperProvider key={ id }>\n\t\t\t<MediaEditorModalContent\n\t\t\t\tfields={ fields }\n\t\t\t\tid={ id }\n\t\t\t\tmedia={ media }\n\t\t\t\thasEdits={ hasEdits }\n\t\t\t\taspectRatioPresets={ aspectRatioP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EAAE,OAAO,MAAM,UAAU,MAAM;AAAA,MACvC;AACA,YAAM,EAAE,uBAAuB,wBAAwB,IACtD,OAAQ,SAAU;AACnB,aAAO;AAAA,QACN,OAAO;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,QACA,UAAU;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,IACA,CAAE,EAAG;AAAA,EACN;AAEA,MAAK,CAAE,eAAe,CAAE,IAAK;AAC5B,WAAO;AAAA,EACR;AAUA,SACC,oBAAC,mBACA;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,EACD,KARsB,EASvB;AAEF;AAEA,IAAO,6BAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// packages/media-editor/src/components/media-editor-toolbar/index.tsx
|
|
2
|
+
import { Button, RangeControl } from "@wordpress/components";
|
|
3
|
+
import { Stack } from "@wordpress/ui";
|
|
4
|
+
import { __ } from "@wordpress/i18n";
|
|
5
|
+
import {
|
|
6
|
+
rotateLeft,
|
|
7
|
+
rotateRight,
|
|
8
|
+
flipHorizontal,
|
|
9
|
+
flipVertical
|
|
10
|
+
} from "@wordpress/icons";
|
|
11
|
+
import { useCropper } from "../../image-editor/index.mjs";
|
|
12
|
+
import { MAX_ROTATION_OFFSET } from "../../image-editor/core/constants.mjs";
|
|
13
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
function MediaEditorToolbar({
|
|
15
|
+
onReset,
|
|
16
|
+
onPlacementControlInteraction
|
|
17
|
+
}) {
|
|
18
|
+
const { state, setRotation, setFlip, snapRotate90, reset, isDirty } = useCropper();
|
|
19
|
+
const handleReset = () => {
|
|
20
|
+
reset();
|
|
21
|
+
onReset?.();
|
|
22
|
+
};
|
|
23
|
+
const baseAngle = Math.round(state.rotation / 90) * 90;
|
|
24
|
+
const singleFlip = state.flip.horizontal !== state.flip.vertical;
|
|
25
|
+
const visualDir = singleFlip ? -1 : 1;
|
|
26
|
+
const fineOffset = (state.rotation - baseAngle) * visualDir;
|
|
27
|
+
const handleRotationSlider = (value) => {
|
|
28
|
+
if (value === void 0) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const EPS = 0.01;
|
|
32
|
+
const clamped = Math.max(
|
|
33
|
+
-MAX_ROTATION_OFFSET + EPS,
|
|
34
|
+
Math.min(MAX_ROTATION_OFFSET - EPS, value)
|
|
35
|
+
);
|
|
36
|
+
onPlacementControlInteraction?.();
|
|
37
|
+
setRotation(baseAngle + clamped * visualDir);
|
|
38
|
+
};
|
|
39
|
+
return /* @__PURE__ */ jsxs(
|
|
40
|
+
Stack,
|
|
41
|
+
{
|
|
42
|
+
className: "media-editor-toolbar",
|
|
43
|
+
direction: "row",
|
|
44
|
+
align: "center",
|
|
45
|
+
justify: "center",
|
|
46
|
+
gap: "sm",
|
|
47
|
+
wrap: "wrap",
|
|
48
|
+
children: [
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
Button,
|
|
51
|
+
{
|
|
52
|
+
size: "compact",
|
|
53
|
+
icon: rotateLeft,
|
|
54
|
+
label: __("Rotate 90\xB0 counter-clockwise"),
|
|
55
|
+
showTooltip: true,
|
|
56
|
+
onClick: () => snapRotate90(-1)
|
|
57
|
+
}
|
|
58
|
+
),
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
Button,
|
|
61
|
+
{
|
|
62
|
+
size: "compact",
|
|
63
|
+
icon: rotateRight,
|
|
64
|
+
label: __("Rotate 90\xB0 clockwise"),
|
|
65
|
+
showTooltip: true,
|
|
66
|
+
onClick: () => snapRotate90(1)
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ jsx(
|
|
70
|
+
Button,
|
|
71
|
+
{
|
|
72
|
+
size: "compact",
|
|
73
|
+
icon: flipHorizontal,
|
|
74
|
+
label: __("Flip horizontal"),
|
|
75
|
+
showTooltip: true,
|
|
76
|
+
isPressed: state.flip.horizontal,
|
|
77
|
+
onClick: () => setFlip({
|
|
78
|
+
horizontal: !state.flip.horizontal,
|
|
79
|
+
vertical: state.flip.vertical
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
/* @__PURE__ */ jsx(
|
|
84
|
+
Button,
|
|
85
|
+
{
|
|
86
|
+
size: "compact",
|
|
87
|
+
icon: flipVertical,
|
|
88
|
+
label: __("Flip vertical"),
|
|
89
|
+
showTooltip: true,
|
|
90
|
+
isPressed: state.flip.vertical,
|
|
91
|
+
onClick: () => setFlip({
|
|
92
|
+
horizontal: state.flip.horizontal,
|
|
93
|
+
vertical: !state.flip.vertical
|
|
94
|
+
})
|
|
95
|
+
}
|
|
96
|
+
),
|
|
97
|
+
/* @__PURE__ */ jsx("div", { className: "media-editor-toolbar__rotation-slider", children: /* @__PURE__ */ jsx(
|
|
98
|
+
RangeControl,
|
|
99
|
+
{
|
|
100
|
+
__next40pxDefaultSize: true,
|
|
101
|
+
__nextHasNoMarginBottom: true,
|
|
102
|
+
label: __("Fine rotation"),
|
|
103
|
+
hideLabelFromVision: true,
|
|
104
|
+
min: -MAX_ROTATION_OFFSET,
|
|
105
|
+
max: MAX_ROTATION_OFFSET,
|
|
106
|
+
step: 0.5,
|
|
107
|
+
value: fineOffset,
|
|
108
|
+
onChange: handleRotationSlider,
|
|
109
|
+
showTooltip: false
|
|
110
|
+
}
|
|
111
|
+
) }),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
Button,
|
|
114
|
+
{
|
|
115
|
+
size: "compact",
|
|
116
|
+
variant: "tertiary",
|
|
117
|
+
disabled: !isDirty,
|
|
118
|
+
accessibleWhenDisabled: true,
|
|
119
|
+
onClick: handleReset,
|
|
120
|
+
children: __("Reset")
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
export {
|
|
128
|
+
MediaEditorToolbar as default
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=index.mjs.map
|