@wordpress/media-editor 0.9.0 → 0.10.1
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/index.cjs +212 -170
- package/build/components/media-editor/index.cjs.map +3 -3
- package/build/components/media-editor/use-crop-options.cjs +63 -0
- package/build/components/media-editor/use-crop-options.cjs.map +7 -0
- package/build/components/media-editor/use-save-media-editor.cjs +185 -0
- package/build/components/media-editor/use-save-media-editor.cjs.map +7 -0
- package/build/components/media-editor-canvas/index.cjs +33 -12
- package/build/components/media-editor-canvas/index.cjs.map +2 -2
- package/build/components/media-editor-crop-panel/index.cjs +70 -84
- package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
- package/build/components/media-editor-fine-rotation/index.cjs +81 -0
- package/build/components/media-editor-fine-rotation/index.cjs.map +7 -0
- package/build/components/media-editor-modal/index.cjs +63 -16
- package/build/components/media-editor-modal/index.cjs.map +3 -3
- package/build/components/media-editor-transform-controls/index.cjs +84 -0
- package/build/components/media-editor-transform-controls/index.cjs.map +7 -0
- package/build/components/media-form/index.cjs +19 -1
- package/build/components/media-form/index.cjs.map +3 -3
- package/build/components/media-form/sidebar-datetime-view.cjs +53 -0
- package/build/components/media-form/sidebar-datetime-view.cjs.map +7 -0
- package/build/components/rotation-ruler/index.cjs +8 -2
- package/build/components/rotation-ruler/index.cjs.map +2 -2
- package/build/hooks/use-crop-gesture-handlers.cjs +41 -4
- package/build/hooks/use-crop-gesture-handlers.cjs.map +2 -2
- package/build/image-editor/core/camera.cjs +29 -11
- package/build/image-editor/core/camera.cjs.map +2 -2
- package/build/image-editor/core/constants.cjs +6 -0
- package/build/image-editor/core/constants.cjs.map +2 -2
- package/build/image-editor/core/containment.cjs +71 -34
- package/build/image-editor/core/containment.cjs.map +2 -2
- package/build/image-editor/core/crop-rect.cjs +48 -0
- package/build/image-editor/core/crop-rect.cjs.map +7 -0
- package/build/image-editor/core/index.cjs +12 -0
- package/build/image-editor/core/index.cjs.map +2 -2
- package/build/image-editor/core/interaction-controller.cjs.map +2 -2
- package/build/image-editor/core/math/sanitize.cjs +92 -0
- package/build/image-editor/core/math/sanitize.cjs.map +7 -0
- package/build/image-editor/core/setter-helpers.cjs +64 -0
- package/build/image-editor/core/setter-helpers.cjs.map +7 -0
- package/build/image-editor/core/source-region.cjs +16 -14
- package/build/image-editor/core/source-region.cjs.map +2 -2
- package/build/image-editor/core/state.cjs +20 -10
- package/build/image-editor/core/state.cjs.map +2 -2
- package/build/image-editor/core/stencil-math.cjs +31 -20
- package/build/image-editor/core/stencil-math.cjs.map +2 -2
- package/build/image-editor/core/transform-style.cjs +12 -6
- package/build/image-editor/core/transform-style.cjs.map +2 -2
- package/build/image-editor/core/types.cjs.map +1 -1
- package/build/image-editor/index.cjs +12 -2
- package/build/image-editor/index.cjs.map +2 -2
- package/build/image-editor/react/components/cropper-provider.cjs +2 -2
- package/build/image-editor/react/components/cropper-provider.cjs.map +2 -2
- package/build/image-editor/react/components/cropper.cjs +120 -47
- package/build/image-editor/react/components/cropper.cjs.map +2 -2
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs +172 -0
- package/build/image-editor/react/components/overlays/dimensions-overlay.cjs.map +7 -0
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +19 -9
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
- package/build/image-editor/react/hooks/build-cropper-setters.cjs +71 -0
- package/build/image-editor/react/hooks/build-cropper-setters.cjs.map +7 -0
- package/build/image-editor/react/hooks/index.cjs +6 -3
- package/build/image-editor/react/hooks/index.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs +113 -0
- package/build/image-editor/react/hooks/use-cropper-reducer.cjs.map +7 -0
- package/build/state/composite-reducer.cjs +103 -0
- package/build/state/composite-reducer.cjs.map +7 -0
- package/build/state/index.cjs +48 -0
- package/build/state/index.cjs.map +7 -0
- package/build/state/media-editor-state-provider.cjs +58 -0
- package/build/state/media-editor-state-provider.cjs.map +7 -0
- package/build/state/types.cjs +33 -0
- package/build/state/types.cjs.map +7 -0
- package/build/state/use-media-editor-state.cjs +287 -0
- package/build/state/use-media-editor-state.cjs.map +7 -0
- package/build/store/actions.cjs +4 -2
- package/build/store/actions.cjs.map +2 -2
- package/build/store/reducer.cjs +5 -3
- package/build/store/reducer.cjs.map +2 -2
- package/build/store/selectors.cjs +5 -0
- package/build/store/selectors.cjs.map +2 -2
- package/build-module/components/media-editor/index.mjs +224 -177
- package/build-module/components/media-editor/index.mjs.map +2 -2
- package/build-module/components/media-editor/use-crop-options.mjs +37 -0
- package/build-module/components/media-editor/use-crop-options.mjs.map +7 -0
- package/build-module/components/media-editor/use-save-media-editor.mjs +151 -0
- package/build-module/components/media-editor/use-save-media-editor.mjs.map +7 -0
- package/build-module/components/media-editor-canvas/index.mjs +34 -13
- package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
- package/build-module/components/media-editor-crop-panel/index.mjs +73 -89
- package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
- package/build-module/components/media-editor-fine-rotation/index.mjs +50 -0
- package/build-module/components/media-editor-fine-rotation/index.mjs.map +7 -0
- package/build-module/components/media-editor-modal/index.mjs +64 -17
- package/build-module/components/media-editor-modal/index.mjs.map +2 -2
- package/build-module/components/media-editor-transform-controls/index.mjs +68 -0
- package/build-module/components/media-editor-transform-controls/index.mjs.map +7 -0
- package/build-module/components/media-form/index.mjs +9 -1
- package/build-module/components/media-form/index.mjs.map +2 -2
- package/build-module/components/media-form/sidebar-datetime-view.mjs +32 -0
- package/build-module/components/media-form/sidebar-datetime-view.mjs.map +7 -0
- package/build-module/components/rotation-ruler/index.mjs +8 -2
- package/build-module/components/rotation-ruler/index.mjs.map +2 -2
- package/build-module/hooks/use-crop-gesture-handlers.mjs +41 -4
- package/build-module/hooks/use-crop-gesture-handlers.mjs.map +2 -2
- package/build-module/image-editor/core/camera.mjs +34 -11
- package/build-module/image-editor/core/camera.mjs.map +2 -2
- package/build-module/image-editor/core/constants.mjs +4 -0
- package/build-module/image-editor/core/constants.mjs.map +2 -2
- package/build-module/image-editor/core/containment.mjs +75 -34
- package/build-module/image-editor/core/containment.mjs.map +2 -2
- package/build-module/image-editor/core/crop-rect.mjs +23 -0
- package/build-module/image-editor/core/crop-rect.mjs.map +7 -0
- package/build-module/image-editor/core/index.mjs +12 -0
- package/build-module/image-editor/core/index.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 +63 -0
- package/build-module/image-editor/core/math/sanitize.mjs.map +7 -0
- package/build-module/image-editor/core/setter-helpers.mjs +39 -0
- package/build-module/image-editor/core/setter-helpers.mjs.map +7 -0
- package/build-module/image-editor/core/source-region.mjs +16 -14
- package/build-module/image-editor/core/source-region.mjs.map +2 -2
- package/build-module/image-editor/core/state.mjs +25 -11
- package/build-module/image-editor/core/state.mjs.map +2 -2
- package/build-module/image-editor/core/stencil-math.mjs +30 -19
- package/build-module/image-editor/core/stencil-math.mjs.map +2 -2
- package/build-module/image-editor/core/transform-style.mjs +12 -6
- package/build-module/image-editor/core/transform-style.mjs.map +2 -2
- package/build-module/image-editor/index.mjs +11 -2
- package/build-module/image-editor/index.mjs.map +2 -2
- package/build-module/image-editor/react/components/cropper-provider.mjs +3 -3
- package/build-module/image-editor/react/components/cropper-provider.mjs.map +2 -2
- package/build-module/image-editor/react/components/cropper.mjs +121 -48
- package/build-module/image-editor/react/components/cropper.mjs.map +2 -2
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs +147 -0
- package/build-module/image-editor/react/components/overlays/dimensions-overlay.mjs.map +7 -0
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +19 -9
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs +46 -0
- package/build-module/image-editor/react/hooks/build-cropper-setters.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/index.mjs +4 -2
- package/build-module/image-editor/react/hooks/index.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs +100 -0
- package/build-module/image-editor/react/hooks/use-cropper-reducer.mjs.map +7 -0
- package/build-module/state/composite-reducer.mjs +82 -0
- package/build-module/state/composite-reducer.mjs.map +7 -0
- package/build-module/state/index.mjs +26 -0
- package/build-module/state/index.mjs.map +7 -0
- package/build-module/state/media-editor-state-provider.mjs +34 -0
- package/build-module/state/media-editor-state-provider.mjs.map +7 -0
- package/build-module/state/types.mjs +8 -0
- package/build-module/state/types.mjs.map +7 -0
- package/build-module/state/use-media-editor-state.mjs +278 -0
- package/build-module/state/use-media-editor-state.mjs.map +7 -0
- package/build-module/store/actions.mjs +4 -2
- package/build-module/store/actions.mjs.map +2 -2
- package/build-module/store/reducer.mjs +5 -3
- package/build-module/store/reducer.mjs.map +2 -2
- package/build-module/store/selectors.mjs +4 -0
- package/build-module/store/selectors.mjs.map +2 -2
- package/build-style/style-rtl.css +97 -44
- package/build-style/style.css +97 -44
- package/build-types/components/media-editor/index.d.ts +14 -5
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor/use-crop-options.d.ts +35 -0
- package/build-types/components/media-editor/use-crop-options.d.ts.map +1 -0
- package/build-types/components/media-editor/use-save-media-editor.d.ts +29 -0
- package/build-types/components/media-editor/use-save-media-editor.d.ts.map +1 -0
- package/build-types/components/media-editor-canvas/index.d.ts +5 -10
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +6 -25
- 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 +14 -0
- package/build-types/components/media-editor-fine-rotation/index.d.ts.map +1 -0
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-transform-controls/index.d.ts +8 -0
- package/build-types/components/media-editor-transform-controls/index.d.ts.map +1 -0
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/media-form/sidebar-datetime-view.d.ts +10 -0
- package/build-types/components/media-form/sidebar-datetime-view.d.ts.map +1 -0
- package/build-types/components/rotation-ruler/index.d.ts.map +1 -1
- package/build-types/hooks/use-crop-gesture-handlers.d.ts +13 -14
- package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -1
- package/build-types/image-editor/core/camera.d.ts.map +1 -1
- package/build-types/image-editor/core/constants.d.ts +18 -0
- package/build-types/image-editor/core/constants.d.ts.map +1 -1
- package/build-types/image-editor/core/containment.d.ts +10 -0
- package/build-types/image-editor/core/containment.d.ts.map +1 -1
- package/build-types/image-editor/core/crop-rect.d.ts +19 -0
- package/build-types/image-editor/core/crop-rect.d.ts.map +1 -0
- package/build-types/image-editor/core/index.d.ts +3 -1
- package/build-types/image-editor/core/index.d.ts.map +1 -1
- package/build-types/image-editor/core/interaction-controller.d.ts +5 -1
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
- package/build-types/image-editor/core/math/sanitize.d.ts +70 -0
- package/build-types/image-editor/core/math/sanitize.d.ts.map +1 -0
- package/build-types/image-editor/core/setter-helpers.d.ts +24 -0
- package/build-types/image-editor/core/setter-helpers.d.ts.map +1 -0
- package/build-types/image-editor/core/source-region.d.ts.map +1 -1
- package/build-types/image-editor/core/state.d.ts +12 -0
- package/build-types/image-editor/core/state.d.ts.map +1 -1
- package/build-types/image-editor/core/stencil-math.d.ts +23 -18
- package/build-types/image-editor/core/stencil-math.d.ts.map +1 -1
- package/build-types/image-editor/core/transform-style.d.ts.map +1 -1
- package/build-types/image-editor/core/types.d.ts +23 -4
- package/build-types/image-editor/core/types.d.ts.map +1 -1
- package/build-types/image-editor/index.d.ts +4 -4
- package/build-types/image-editor/index.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts +11 -7
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts +6 -4
- 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 +36 -0
- package/build-types/image-editor/react/components/overlays/dimensions-overlay.d.ts.map +1 -0
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +2 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts +47 -0
- package/build-types/image-editor/react/hooks/build-cropper-setters.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/index.d.ts +4 -2
- package/build-types/image-editor/react/hooks/index.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts +58 -0
- package/build-types/image-editor/react/hooks/use-cropper-reducer.d.ts.map +1 -0
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -1
- package/build-types/state/composite-reducer.d.ts +39 -0
- package/build-types/state/composite-reducer.d.ts.map +1 -0
- package/build-types/state/index.d.ts +7 -0
- package/build-types/state/index.d.ts.map +1 -0
- package/build-types/state/media-editor-state-provider.d.ts +34 -0
- package/build-types/state/media-editor-state-provider.d.ts.map +1 -0
- package/build-types/state/types.d.ts +96 -0
- package/build-types/state/types.d.ts.map +1 -0
- package/build-types/state/use-media-editor-state.d.ts +101 -0
- package/build-types/state/use-media-editor-state.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +3 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/reducer.d.ts +3 -0
- package/build-types/store/reducer.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +1 -0
- package/build-types/store/selectors.d.ts.map +1 -1
- package/package.json +19 -16
- package/src/components/media-editor/index.tsx +262 -229
- package/src/components/media-editor/style.scss +0 -9
- package/src/components/media-editor/test/use-crop-options.tsx +110 -0
- package/src/components/media-editor/use-crop-options.ts +79 -0
- package/src/components/media-editor/use-save-media-editor.ts +214 -0
- package/src/components/media-editor-canvas/index.tsx +57 -25
- package/src/components/media-editor-crop-panel/index.tsx +53 -87
- package/src/components/media-editor-crop-panel/test/index.tsx +46 -53
- package/src/components/media-editor-fine-rotation/index.tsx +74 -0
- package/src/components/media-editor-modal/index.tsx +70 -16
- package/src/components/media-editor-modal/style.scss +80 -0
- package/src/components/media-editor-modal/test/build-modifiers.test.ts +14 -0
- package/src/components/media-editor-modal/test/index.tsx +146 -0
- package/src/components/media-editor-transform-controls/index.tsx +70 -0
- package/src/components/media-editor-transform-controls/style.scss +8 -0
- package/src/components/media-form/index.tsx +15 -1
- package/src/components/media-form/sidebar-datetime-view.tsx +47 -0
- package/src/components/media-form/test/sidebar-datetime-view.test.tsx +96 -0
- package/src/components/rotation-ruler/README.md +11 -25
- package/src/components/rotation-ruler/index.tsx +17 -2
- package/src/components/rotation-ruler/style.scss +49 -13
- package/src/hooks/use-crop-gesture-handlers.ts +64 -17
- package/src/image-editor/README.md +28 -129
- package/src/image-editor/core/camera.ts +51 -26
- package/src/image-editor/core/constants.ts +19 -0
- package/src/image-editor/core/containment.ts +102 -49
- package/src/image-editor/core/crop-rect.ts +45 -0
- package/src/image-editor/core/index.ts +16 -4
- package/src/image-editor/core/interaction-controller.ts +5 -1
- package/src/image-editor/core/math/sanitize.ts +158 -0
- package/src/image-editor/core/math/test/sanitize.ts +244 -0
- package/src/image-editor/core/setter-helpers.ts +66 -0
- package/src/image-editor/core/source-region.ts +21 -14
- package/src/image-editor/core/state.ts +67 -15
- package/src/image-editor/core/stencil-math.ts +55 -35
- package/src/image-editor/core/test/camera.ts +367 -1
- package/src/image-editor/core/test/state.ts +101 -8
- package/src/image-editor/core/test/stencil-math.ts +193 -0
- package/src/image-editor/core/transform-style.ts +21 -6
- package/src/image-editor/core/types.ts +24 -4
- package/src/image-editor/docs/architecture.md +48 -89
- package/src/image-editor/docs/recipes.md +123 -659
- package/src/image-editor/index.ts +12 -3
- package/src/image-editor/react/components/cropper-provider.tsx +16 -12
- package/src/image-editor/react/components/cropper.scss +23 -4
- package/src/image-editor/react/components/cropper.tsx +194 -89
- package/src/image-editor/react/components/overlays/dimensions-overlay.tsx +269 -0
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +19 -8
- package/src/image-editor/react/components/test/cropper.tsx +55 -13
- package/src/image-editor/react/hooks/build-cropper-setters.ts +105 -0
- package/src/image-editor/react/hooks/index.ts +4 -2
- package/src/image-editor/react/hooks/test/{use-cropper-state.ts → use-cropper-reducer.ts} +142 -286
- package/src/image-editor/react/hooks/use-cropper-reducer.ts +204 -0
- package/src/image-editor/stories/rectangle-crop.story.tsx +7 -17
- package/src/state/composite-reducer.ts +137 -0
- package/src/state/index.ts +20 -0
- package/src/state/media-editor-state-provider.tsx +70 -0
- package/src/state/test/use-media-editor-state.ts +330 -0
- package/src/state/types.ts +101 -0
- package/src/state/use-media-editor-state.ts +472 -0
- package/src/store/actions.ts +3 -0
- package/src/store/reducer.ts +6 -1
- package/src/store/selectors.ts +4 -0
- package/src/store/test/reducer.ts +9 -0
- package/src/style.scss +1 -1
- package/tsconfig.json +3 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/components/media-editor-toolbar/index.cjs +0 -214
- package/build/components/media-editor-toolbar/index.cjs.map +0 -7
- package/build/image-editor/react/hooks/use-cropper-state.cjs +0 -277
- package/build/image-editor/react/hooks/use-cropper-state.cjs.map +0 -7
- package/build-module/components/media-editor-toolbar/index.mjs +0 -190
- package/build-module/components/media-editor-toolbar/index.mjs.map +0 -7
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs +0 -262
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +0 -7
- 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/image-editor/react/hooks/use-cropper-state.d.ts +0 -97
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +0 -1
- package/src/components/media-editor-toolbar/index.tsx +0 -209
- package/src/components/media-editor-toolbar/style.scss +0 -49
- package/src/image-editor/docs/roadmap.md +0 -66
- package/src/image-editor/react/hooks/use-cropper-state.ts +0 -457
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// packages/media-editor/src/components/media-editor/index.tsx
|
|
2
|
-
import apiFetch from "@wordpress/api-fetch";
|
|
3
2
|
import {
|
|
4
3
|
Button,
|
|
5
4
|
Flex,
|
|
@@ -8,7 +7,8 @@ import {
|
|
|
8
7
|
privateApis as componentsPrivateApis
|
|
9
8
|
} from "@wordpress/components";
|
|
10
9
|
import { Stack } from "@wordpress/ui";
|
|
11
|
-
import {
|
|
10
|
+
import { useViewportMatch } from "@wordpress/compose";
|
|
11
|
+
import { useDispatch, useSelect } from "@wordpress/data";
|
|
12
12
|
import { store as coreStore } from "@wordpress/core-data";
|
|
13
13
|
import {
|
|
14
14
|
createPortal,
|
|
@@ -19,9 +19,13 @@ import {
|
|
|
19
19
|
useRef,
|
|
20
20
|
useState
|
|
21
21
|
} from "@wordpress/element";
|
|
22
|
-
import { __
|
|
23
|
-
import { close, drawerRight, keyboard } from "@wordpress/icons";
|
|
24
|
-
import {
|
|
22
|
+
import { __ } from "@wordpress/i18n";
|
|
23
|
+
import { close, drawerRight, keyboard, redo, undo } from "@wordpress/icons";
|
|
24
|
+
import {
|
|
25
|
+
displayShortcut,
|
|
26
|
+
isAppleOS,
|
|
27
|
+
isKeyboardEvent
|
|
28
|
+
} from "@wordpress/keycodes";
|
|
25
29
|
import { SnackbarNotices, store as noticesStore } from "@wordpress/notices";
|
|
26
30
|
import {
|
|
27
31
|
ComplementaryArea,
|
|
@@ -31,27 +35,22 @@ import {
|
|
|
31
35
|
import { MediaEditorProvider } from "../media-editor-provider/index.mjs";
|
|
32
36
|
import MediaPreview from "../media-preview/index.mjs";
|
|
33
37
|
import MediaEditorCanvas from "../media-editor-canvas/index.mjs";
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
|
|
37
|
-
} from "../media-editor-crop-panel/index.mjs";
|
|
38
|
+
import MediaEditorFineRotation from "../media-editor-fine-rotation/index.mjs";
|
|
39
|
+
import MediaEditorTransformControls from "../media-editor-transform-controls/index.mjs";
|
|
40
|
+
import MediaEditorCropPanel from "../media-editor-crop-panel/index.mjs";
|
|
38
41
|
import MediaForm from "../media-form/index.mjs";
|
|
39
42
|
import { unlock } from "../../lock-unlock.mjs";
|
|
40
43
|
import { getMediaTypeFromMimeType } from "../../utils/index.mjs";
|
|
41
|
-
import {
|
|
44
|
+
import { MediaEditorStateProvider, useMediaEditor } from "../../state/index.mjs";
|
|
42
45
|
import { CROP_CONTROL_ATTR } from "../../hooks/use-crop-gesture-handlers.mjs";
|
|
43
|
-
import { buildModifiers } from "../media-editor-modal/build-modifiers.mjs";
|
|
44
46
|
import MediaEditorKeyboardShortcutsModal from "../media-editor-keyboard-shortcuts-modal/index.mjs";
|
|
47
|
+
import {
|
|
48
|
+
MEDIA_EDITOR_NOTICES_CONTEXT,
|
|
49
|
+
useSaveMediaEditor
|
|
50
|
+
} from "./use-save-media-editor.mjs";
|
|
51
|
+
import { useCropOptions } from "./use-crop-options.mjs";
|
|
45
52
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
46
|
-
var METADATA_EDIT_KEYS = [
|
|
47
|
-
"title",
|
|
48
|
-
"caption",
|
|
49
|
-
"description",
|
|
50
|
-
"alt_text",
|
|
51
|
-
"post"
|
|
52
|
-
];
|
|
53
53
|
var ATTACHMENT_EMBED_QUERY = { _embed: "author,wp:attached-to" };
|
|
54
|
-
var NOTICES_CONTEXT = "media-editor";
|
|
55
54
|
var PLACEMENT_CONTROL_IDLE_MS = 300;
|
|
56
55
|
var { Tabs } = unlock(componentsPrivateApis);
|
|
57
56
|
function MediaEditorSidebar({ tabs }) {
|
|
@@ -82,14 +81,10 @@ function MediaEditorSidebar({ tabs }) {
|
|
|
82
81
|
}
|
|
83
82
|
function HeaderActions({
|
|
84
83
|
isSaving,
|
|
85
|
-
hasMedia,
|
|
86
|
-
hasChanges,
|
|
87
84
|
isImage,
|
|
88
85
|
showCloseButton = false,
|
|
89
|
-
onCancel
|
|
90
|
-
onSave
|
|
86
|
+
onCancel
|
|
91
87
|
}) {
|
|
92
|
-
const saveDisabled = isSaving || !hasMedia || !hasChanges;
|
|
93
88
|
const [isShortcutsModalOpen, setIsShortcutsModalOpen] = useState(false);
|
|
94
89
|
return /* @__PURE__ */ jsxs(
|
|
95
90
|
Flex,
|
|
@@ -109,44 +104,144 @@ function HeaderActions({
|
|
|
109
104
|
}
|
|
110
105
|
),
|
|
111
106
|
/* @__PURE__ */ jsx(PinnedItems.Slot, { scope: "media-editor" }),
|
|
112
|
-
/* @__PURE__ */ jsx(
|
|
107
|
+
showCloseButton && /* @__PURE__ */ jsx(
|
|
113
108
|
Button,
|
|
114
109
|
{
|
|
115
110
|
size: "compact",
|
|
116
|
-
|
|
111
|
+
icon: close,
|
|
112
|
+
label: __("Close"),
|
|
117
113
|
onClick: onCancel,
|
|
118
114
|
disabled: isSaving,
|
|
115
|
+
accessibleWhenDisabled: true
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
isShortcutsModalOpen && /* @__PURE__ */ jsx(
|
|
119
|
+
MediaEditorKeyboardShortcutsModal,
|
|
120
|
+
{
|
|
121
|
+
onClose: () => setIsShortcutsModalOpen(false)
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
function HistoryActions({
|
|
129
|
+
isUndoRedoDisabled = false,
|
|
130
|
+
onReset
|
|
131
|
+
}) {
|
|
132
|
+
const {
|
|
133
|
+
reset,
|
|
134
|
+
isDirty,
|
|
135
|
+
hasUndo,
|
|
136
|
+
hasRedo,
|
|
137
|
+
undo: undoCrop,
|
|
138
|
+
redo: redoCrop,
|
|
139
|
+
beginGesture,
|
|
140
|
+
endGesture
|
|
141
|
+
} = useMediaEditor();
|
|
142
|
+
const handleUndo = () => {
|
|
143
|
+
if (isUndoRedoDisabled) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
undoCrop();
|
|
147
|
+
};
|
|
148
|
+
const handleRedo = () => {
|
|
149
|
+
if (isUndoRedoDisabled) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
redoCrop();
|
|
153
|
+
};
|
|
154
|
+
const handleReset = () => {
|
|
155
|
+
beginGesture();
|
|
156
|
+
reset();
|
|
157
|
+
onReset();
|
|
158
|
+
endGesture();
|
|
159
|
+
};
|
|
160
|
+
return /* @__PURE__ */ jsxs(
|
|
161
|
+
Flex,
|
|
162
|
+
{
|
|
163
|
+
className: "media-editor__history-actions",
|
|
164
|
+
expanded: false,
|
|
165
|
+
gap: 2,
|
|
166
|
+
children: [
|
|
167
|
+
/* @__PURE__ */ jsx(
|
|
168
|
+
Button,
|
|
169
|
+
{
|
|
170
|
+
size: "compact",
|
|
171
|
+
icon: undo,
|
|
172
|
+
label: __("Undo"),
|
|
173
|
+
showTooltip: true,
|
|
174
|
+
shortcut: displayShortcut.primary("z"),
|
|
175
|
+
disabled: isUndoRedoDisabled || !hasUndo,
|
|
119
176
|
accessibleWhenDisabled: true,
|
|
120
|
-
|
|
177
|
+
onClick: handleUndo
|
|
121
178
|
}
|
|
122
179
|
),
|
|
123
180
|
/* @__PURE__ */ jsx(
|
|
124
181
|
Button,
|
|
125
182
|
{
|
|
126
183
|
size: "compact",
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
184
|
+
icon: redo,
|
|
185
|
+
label: __("Redo"),
|
|
186
|
+
showTooltip: true,
|
|
187
|
+
shortcut: isAppleOS() ? displayShortcut.primaryShift("z") : displayShortcut.primary("y"),
|
|
188
|
+
disabled: isUndoRedoDisabled || !hasRedo,
|
|
131
189
|
accessibleWhenDisabled: true,
|
|
132
|
-
|
|
190
|
+
onClick: handleRedo
|
|
133
191
|
}
|
|
134
192
|
),
|
|
135
|
-
|
|
193
|
+
/* @__PURE__ */ jsx(
|
|
136
194
|
Button,
|
|
137
195
|
{
|
|
138
196
|
size: "compact",
|
|
139
|
-
|
|
140
|
-
|
|
197
|
+
variant: "tertiary",
|
|
198
|
+
disabled: !isDirty,
|
|
199
|
+
accessibleWhenDisabled: true,
|
|
200
|
+
onClick: handleReset,
|
|
201
|
+
children: __("Reset")
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
function FooterActions({
|
|
209
|
+
isSaving,
|
|
210
|
+
hasMedia,
|
|
211
|
+
hasChanges,
|
|
212
|
+
onCancel,
|
|
213
|
+
onSave
|
|
214
|
+
}) {
|
|
215
|
+
const saveDisabled = isSaving || !hasMedia || !hasChanges;
|
|
216
|
+
return /* @__PURE__ */ jsxs(
|
|
217
|
+
Flex,
|
|
218
|
+
{
|
|
219
|
+
className: "media-editor__footer-actions",
|
|
220
|
+
justify: "flex-end",
|
|
221
|
+
expanded: false,
|
|
222
|
+
gap: 2,
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsx(
|
|
225
|
+
Button,
|
|
226
|
+
{
|
|
227
|
+
__next40pxDefaultSize: true,
|
|
228
|
+
variant: "tertiary",
|
|
141
229
|
onClick: onCancel,
|
|
142
230
|
disabled: isSaving,
|
|
143
|
-
accessibleWhenDisabled: true
|
|
231
|
+
accessibleWhenDisabled: true,
|
|
232
|
+
children: __("Cancel")
|
|
144
233
|
}
|
|
145
234
|
),
|
|
146
|
-
|
|
147
|
-
|
|
235
|
+
/* @__PURE__ */ jsx(
|
|
236
|
+
Button,
|
|
148
237
|
{
|
|
149
|
-
|
|
238
|
+
__next40pxDefaultSize: true,
|
|
239
|
+
variant: "primary",
|
|
240
|
+
onClick: onSave,
|
|
241
|
+
isBusy: isSaving,
|
|
242
|
+
disabled: saveDisabled,
|
|
243
|
+
accessibleWhenDisabled: true,
|
|
244
|
+
children: __("Save")
|
|
150
245
|
}
|
|
151
246
|
)
|
|
152
247
|
]
|
|
@@ -165,7 +260,15 @@ function MediaEditorContent({
|
|
|
165
260
|
showCloseButton = false,
|
|
166
261
|
shouldCloseOnEsc = false
|
|
167
262
|
}) {
|
|
168
|
-
const cropper =
|
|
263
|
+
const cropper = useMediaEditor();
|
|
264
|
+
const isWideViewport = useViewportMatch("xlarge");
|
|
265
|
+
const isMediumViewport = useViewportMatch("medium");
|
|
266
|
+
let footerLayout = "narrow";
|
|
267
|
+
if (isWideViewport) {
|
|
268
|
+
footerLayout = "wide";
|
|
269
|
+
} else if (isMediumViewport) {
|
|
270
|
+
footerLayout = "medium";
|
|
271
|
+
}
|
|
169
272
|
const { media, hasEdits } = useSelect(
|
|
170
273
|
(select) => {
|
|
171
274
|
const {
|
|
@@ -194,23 +297,13 @@ function MediaEditorContent({
|
|
|
194
297
|
},
|
|
195
298
|
[id]
|
|
196
299
|
);
|
|
197
|
-
const hasChanges = cropper.
|
|
198
|
-
const
|
|
199
|
-
const {
|
|
200
|
-
clearEntityRecordEdits,
|
|
201
|
-
editEntityRecord,
|
|
202
|
-
invalidateResolution,
|
|
203
|
-
receiveEntityRecords,
|
|
204
|
-
saveEditedEntityRecord
|
|
205
|
-
} = useDispatch(coreStore);
|
|
206
|
-
const { createErrorNotice, removeAllNotices } = useDispatch(noticesStore);
|
|
207
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
300
|
+
const hasChanges = cropper.isCropperDirty || hasEdits;
|
|
301
|
+
const { clearEntityRecordEdits, editEntityRecord, invalidateResolution } = useDispatch(coreStore);
|
|
302
|
+
const { removeAllNotices } = useDispatch(noticesStore);
|
|
208
303
|
const [isDiscardDialogOpen, setIsDiscardDialogOpen] = useState(false);
|
|
209
304
|
const [isPlacementActive, setIsPlacementActive] = useState(false);
|
|
210
305
|
const [isCanvasGestureActive, setIsCanvasGestureActive] = useState(false);
|
|
211
306
|
const placementControlTimerRef = useRef();
|
|
212
|
-
const [aspectRatioValue, setAspectRatioValue] = useState("0");
|
|
213
|
-
const [freeformCrop, setFreeformCrop] = useState(true);
|
|
214
307
|
const signalPlacementControlInteraction = useCallback(() => {
|
|
215
308
|
setIsPlacementActive(true);
|
|
216
309
|
clearTimeout(placementControlTimerRef.current);
|
|
@@ -231,8 +324,6 @@ function MediaEditorContent({
|
|
|
231
324
|
};
|
|
232
325
|
}, []);
|
|
233
326
|
useEffect(() => {
|
|
234
|
-
setAspectRatioValue("0");
|
|
235
|
-
setFreeformCrop(true);
|
|
236
327
|
setIsPlacementActive(false);
|
|
237
328
|
setIsCanvasGestureActive(false);
|
|
238
329
|
}, [id]);
|
|
@@ -246,17 +337,21 @@ function MediaEditorContent({
|
|
|
246
337
|
}, [id, invalidateResolution]);
|
|
247
338
|
const mediaType = getMediaTypeFromMimeType(media?.mime_type).type;
|
|
248
339
|
const isImage = !!media && mediaType === "image";
|
|
249
|
-
const
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
340
|
+
const {
|
|
341
|
+
aspectRatioValue,
|
|
342
|
+
setAspectRatioValue,
|
|
343
|
+
aspectRatioOptions,
|
|
344
|
+
resetCropOptions
|
|
345
|
+
} = useCropOptions({
|
|
346
|
+
aspectRatioPresets
|
|
347
|
+
});
|
|
348
|
+
const { isSaving, save: saveMediaEditor } = useSaveMediaEditor({
|
|
349
|
+
cropper,
|
|
350
|
+
id,
|
|
351
|
+
isImage,
|
|
352
|
+
media,
|
|
353
|
+
onSaved
|
|
354
|
+
});
|
|
260
355
|
const tabs = useMemo(() => {
|
|
261
356
|
const detailsTab = {
|
|
262
357
|
id: "details",
|
|
@@ -289,10 +384,8 @@ function MediaEditorContent({
|
|
|
289
384
|
{
|
|
290
385
|
aspectRatioValue,
|
|
291
386
|
onAspectRatioChange: setAspectRatioValue,
|
|
292
|
-
freeformCrop,
|
|
293
|
-
onFreeformChange: setFreeformCrop,
|
|
294
387
|
onPlacementControlInteraction: signalPlacementControlInteraction,
|
|
295
|
-
|
|
388
|
+
aspectRatioOptions
|
|
296
389
|
}
|
|
297
390
|
)
|
|
298
391
|
}
|
|
@@ -303,15 +396,15 @@ function MediaEditorContent({
|
|
|
303
396
|
}, [
|
|
304
397
|
isImage,
|
|
305
398
|
aspectRatioValue,
|
|
306
|
-
|
|
307
|
-
|
|
399
|
+
setAspectRatioValue,
|
|
400
|
+
aspectRatioOptions,
|
|
308
401
|
signalPlacementControlInteraction
|
|
309
402
|
]);
|
|
310
403
|
const handleChange = (updates) => {
|
|
311
404
|
editEntityRecord("postType", "attachment", id, updates);
|
|
312
405
|
};
|
|
313
406
|
const discardAndClose = () => {
|
|
314
|
-
removeAllNotices("snackbar",
|
|
407
|
+
removeAllNotices("snackbar", MEDIA_EDITOR_NOTICES_CONTEXT);
|
|
315
408
|
clearEntityRecordEdits("postType", "attachment", id);
|
|
316
409
|
onClose?.();
|
|
317
410
|
};
|
|
@@ -325,87 +418,6 @@ function MediaEditorContent({
|
|
|
325
418
|
}
|
|
326
419
|
discardAndClose();
|
|
327
420
|
};
|
|
328
|
-
const handleSave = async () => {
|
|
329
|
-
removeAllNotices("snackbar", NOTICES_CONTEXT);
|
|
330
|
-
setIsSaving(true);
|
|
331
|
-
try {
|
|
332
|
-
let saved;
|
|
333
|
-
const modifiers = cropper.isDirty && cropper.state.image ? buildModifiers(cropper.state, {
|
|
334
|
-
width: cropper.state.image.naturalWidth,
|
|
335
|
-
height: cropper.state.image.naturalHeight
|
|
336
|
-
}) : [];
|
|
337
|
-
if (modifiers.length > 0) {
|
|
338
|
-
const pendingEdits = registry.select(coreStore).getEntityRecordNonTransientEdits(
|
|
339
|
-
"postType",
|
|
340
|
-
"attachment",
|
|
341
|
-
id
|
|
342
|
-
);
|
|
343
|
-
const metadataEdits = {};
|
|
344
|
-
for (const key of METADATA_EDIT_KEYS) {
|
|
345
|
-
if (pendingEdits && key in pendingEdits) {
|
|
346
|
-
metadataEdits[key] = pendingEdits[key];
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
if (!("post" in metadataEdits) && media?.post !== void 0) {
|
|
350
|
-
metadataEdits.post = media.post;
|
|
351
|
-
}
|
|
352
|
-
saved = await apiFetch({
|
|
353
|
-
path: `/wp/v2/media/${id}/edit`,
|
|
354
|
-
method: "POST",
|
|
355
|
-
data: {
|
|
356
|
-
src: media?.source_url,
|
|
357
|
-
modifiers,
|
|
358
|
-
...metadataEdits
|
|
359
|
-
}
|
|
360
|
-
});
|
|
361
|
-
if (saved) {
|
|
362
|
-
receiveEntityRecords(
|
|
363
|
-
"postType",
|
|
364
|
-
"attachment",
|
|
365
|
-
saved,
|
|
366
|
-
void 0,
|
|
367
|
-
true
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
} else {
|
|
371
|
-
saved = await saveEditedEntityRecord(
|
|
372
|
-
"postType",
|
|
373
|
-
"attachment",
|
|
374
|
-
id
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
const next = saved ?? media;
|
|
378
|
-
if (next && next.id !== id) {
|
|
379
|
-
clearEntityRecordEdits("postType", "attachment", id);
|
|
380
|
-
}
|
|
381
|
-
if (next && next.id) {
|
|
382
|
-
if (next.id === id) {
|
|
383
|
-
cropper.reset();
|
|
384
|
-
}
|
|
385
|
-
onSaved?.({
|
|
386
|
-
id: next.id,
|
|
387
|
-
url: next.source_url,
|
|
388
|
-
media: next
|
|
389
|
-
});
|
|
390
|
-
}
|
|
391
|
-
} catch (error) {
|
|
392
|
-
const message = error instanceof Error ? error.message : error?.message ?? __("An unknown error occurred.");
|
|
393
|
-
createErrorNotice(
|
|
394
|
-
isImage ? sprintf(
|
|
395
|
-
/* translators: %s: Error message. */
|
|
396
|
-
__("Could not save image. %s"),
|
|
397
|
-
message
|
|
398
|
-
) : sprintf(
|
|
399
|
-
/* translators: %s: Error message. */
|
|
400
|
-
__("Could not save media. %s"),
|
|
401
|
-
message
|
|
402
|
-
),
|
|
403
|
-
{ type: "snackbar", context: NOTICES_CONTEXT }
|
|
404
|
-
);
|
|
405
|
-
} finally {
|
|
406
|
-
setIsSaving(false);
|
|
407
|
-
}
|
|
408
|
-
};
|
|
409
421
|
const handleKeyDown = (event) => {
|
|
410
422
|
const isUndoShortcut = isKeyboardEvent.primary(event, "z");
|
|
411
423
|
const isRedoShortcut = isKeyboardEvent.primaryShift(event, "z") || !isAppleOS() && isKeyboardEvent.primary(event, "y");
|
|
@@ -442,7 +454,7 @@ function MediaEditorContent({
|
|
|
442
454
|
SnackbarNotices,
|
|
443
455
|
{
|
|
444
456
|
className: noticesClassName,
|
|
445
|
-
context:
|
|
457
|
+
context: MEDIA_EDITOR_NOTICES_CONTEXT
|
|
446
458
|
}
|
|
447
459
|
);
|
|
448
460
|
const children = /* @__PURE__ */ jsxs(
|
|
@@ -460,34 +472,17 @@ function MediaEditorContent({
|
|
|
460
472
|
className: "media-editor__skeleton",
|
|
461
473
|
labels: {
|
|
462
474
|
body: isImage ? __("Image editor") : __("Media preview"),
|
|
463
|
-
sidebar: __("Media details")
|
|
464
|
-
footer: __("Image editing tools")
|
|
475
|
+
sidebar: __("Media details")
|
|
465
476
|
},
|
|
466
477
|
content: /* @__PURE__ */ jsx("div", { className: "media-editor__canvas", children: isImage ? /* @__PURE__ */ jsx(
|
|
467
478
|
MediaEditorCanvas,
|
|
468
479
|
{
|
|
469
|
-
aspectRatio: resolveAspectRatio(
|
|
470
|
-
aspectRatioValue,
|
|
471
|
-
imageAspectRatio
|
|
472
|
-
),
|
|
473
|
-
freeformCrop,
|
|
474
480
|
focusOnMount: true,
|
|
475
481
|
isPlacementActive,
|
|
476
482
|
onGestureStart: handleCanvasGestureStart,
|
|
477
483
|
onGestureEnd: handleCanvasGestureEnd
|
|
478
484
|
}
|
|
479
485
|
) : /* @__PURE__ */ jsx(MediaPreview, {}) }),
|
|
480
|
-
footer: isImage ? /* @__PURE__ */ jsx(
|
|
481
|
-
MediaEditorToolbar,
|
|
482
|
-
{
|
|
483
|
-
onReset: () => {
|
|
484
|
-
setAspectRatioValue("0");
|
|
485
|
-
setFreeformCrop(true);
|
|
486
|
-
},
|
|
487
|
-
onPlacementControlInteraction: signalPlacementControlInteraction,
|
|
488
|
-
isUndoRedoDisabled: isCropInteractionActive
|
|
489
|
-
}
|
|
490
|
-
) : void 0,
|
|
491
486
|
sidebar: /* @__PURE__ */ jsx(ComplementaryArea.Slot, { scope: "media-editor" })
|
|
492
487
|
}
|
|
493
488
|
)
|
|
@@ -512,20 +507,72 @@ function MediaEditorContent({
|
|
|
512
507
|
]
|
|
513
508
|
}
|
|
514
509
|
);
|
|
510
|
+
const history = isImage ? /* @__PURE__ */ jsx(
|
|
511
|
+
HistoryActions,
|
|
512
|
+
{
|
|
513
|
+
isUndoRedoDisabled: isCropInteractionActive,
|
|
514
|
+
onReset: resetCropOptions
|
|
515
|
+
}
|
|
516
|
+
) : null;
|
|
517
|
+
const ruler = isImage ? /* @__PURE__ */ jsx(
|
|
518
|
+
MediaEditorFineRotation,
|
|
519
|
+
{
|
|
520
|
+
onPlacementControlInteraction: signalPlacementControlInteraction
|
|
521
|
+
}
|
|
522
|
+
) : null;
|
|
523
|
+
const transform = isImage ? /* @__PURE__ */ jsx(MediaEditorTransformControls, {}) : null;
|
|
524
|
+
const actions = /* @__PURE__ */ jsx(
|
|
525
|
+
FooterActions,
|
|
526
|
+
{
|
|
527
|
+
isSaving,
|
|
528
|
+
hasMedia: !!media,
|
|
529
|
+
hasChanges,
|
|
530
|
+
onCancel: handleRequestClose,
|
|
531
|
+
onSave: saveMediaEditor
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
let footerActions;
|
|
535
|
+
if (footerLayout === "wide") {
|
|
536
|
+
footerActions = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
537
|
+
history,
|
|
538
|
+
isImage && /* @__PURE__ */ jsxs("div", { className: "media-editor-modal__footer-toolbar", children: [
|
|
539
|
+
ruler,
|
|
540
|
+
transform
|
|
541
|
+
] }),
|
|
542
|
+
actions
|
|
543
|
+
] });
|
|
544
|
+
} else if (footerLayout === "medium") {
|
|
545
|
+
footerActions = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
546
|
+
ruler,
|
|
547
|
+
/* @__PURE__ */ jsxs("div", { className: "media-editor-modal__footer-row", children: [
|
|
548
|
+
history,
|
|
549
|
+
transform,
|
|
550
|
+
actions
|
|
551
|
+
] })
|
|
552
|
+
] });
|
|
553
|
+
} else {
|
|
554
|
+
footerActions = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
555
|
+
ruler,
|
|
556
|
+
transform,
|
|
557
|
+
/* @__PURE__ */ jsxs("div", { className: "media-editor-modal__footer-row", children: [
|
|
558
|
+
history,
|
|
559
|
+
actions
|
|
560
|
+
] })
|
|
561
|
+
] });
|
|
562
|
+
}
|
|
515
563
|
return renderFrame({
|
|
516
564
|
children,
|
|
517
565
|
headerActions: /* @__PURE__ */ jsx(
|
|
518
566
|
HeaderActions,
|
|
519
567
|
{
|
|
520
568
|
isSaving,
|
|
521
|
-
hasMedia: !!media,
|
|
522
|
-
hasChanges,
|
|
523
569
|
isImage,
|
|
524
570
|
showCloseButton,
|
|
525
|
-
onCancel: handleRequestClose
|
|
526
|
-
onSave: handleSave
|
|
571
|
+
onCancel: handleRequestClose
|
|
527
572
|
}
|
|
528
573
|
),
|
|
574
|
+
footerActions,
|
|
575
|
+
footerLayout,
|
|
529
576
|
onRequestClose: handleRequestClose,
|
|
530
577
|
onKeyDown: handleKeyDown,
|
|
531
578
|
shouldCloseOnClickOutside: !hasChanges && !isSaving,
|
|
@@ -535,7 +582,7 @@ function MediaEditorContent({
|
|
|
535
582
|
});
|
|
536
583
|
}
|
|
537
584
|
function MediaEditor(props) {
|
|
538
|
-
return /* @__PURE__ */ jsx(
|
|
585
|
+
return /* @__PURE__ */ jsx(MediaEditorStateProvider, { children: /* @__PURE__ */ jsx(MediaEditorContent, { ...props }) }, props.id);
|
|
539
586
|
}
|
|
540
587
|
var media_editor_default = MediaEditor;
|
|
541
588
|
export {
|