@wordpress/media-editor 0.8.0 → 0.8.1-next.v.202605131032.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/index.cjs +560 -0
- package/build/components/media-editor/index.cjs.map +7 -0
- package/build/components/media-editor-canvas/index.cjs +14 -2
- package/build/components/media-editor-canvas/index.cjs.map +2 -2
- package/build/components/media-editor-crop-panel/index.cjs +34 -27
- package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs +162 -0
- package/build/components/media-editor-keyboard-shortcuts-modal/index.cjs.map +7 -0
- package/build/components/media-editor-modal/index.cjs +42 -430
- package/build/components/media-editor-modal/index.cjs.map +3 -3
- package/build/components/media-editor-toolbar/index.cjs +143 -75
- package/build/components/media-editor-toolbar/index.cjs.map +3 -3
- package/build/components/media-form/index.cjs +3 -0
- package/build/components/media-form/index.cjs.map +2 -2
- package/build/components/rotation-ruler/index.cjs +197 -0
- package/build/components/rotation-ruler/index.cjs.map +7 -0
- package/build/components/rotation-ruler/use-ruler-drag.cjs +154 -0
- package/build/components/rotation-ruler/use-ruler-drag.cjs.map +7 -0
- package/build/hooks/use-crop-gesture-handlers.cjs +43 -0
- package/build/hooks/use-crop-gesture-handlers.cjs.map +7 -0
- package/build/image-editor/core/constants.cjs +9 -0
- package/build/image-editor/core/constants.cjs.map +2 -2
- package/build/image-editor/core/containment.cjs +7 -13
- package/build/image-editor/core/containment.cjs.map +2 -2
- package/build/image-editor/core/interaction-controller.cjs +43 -7
- package/build/image-editor/core/interaction-controller.cjs.map +2 -2
- package/build/image-editor/core/state.cjs +5 -1
- package/build/image-editor/core/state.cjs.map +2 -2
- package/build/image-editor/core/transform-style.cjs.map +1 -1
- package/build/image-editor/core/types.cjs.map +1 -1
- package/build/image-editor/core/viewport-state.cjs +50 -0
- package/build/image-editor/core/viewport-state.cjs.map +7 -0
- package/build/image-editor/react/components/cropper.cjs +192 -72
- package/build/image-editor/react/components/cropper.cjs.map +3 -3
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs +5 -2
- package/build/image-editor/react/components/overlays/dimming-overlay.cjs.map +2 -2
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs +16 -4
- package/build/image-editor/react/components/stencils/rectangle-stencil.cjs.map +2 -2
- package/build/image-editor/react/components/viewport-provider.cjs +51 -0
- package/build/image-editor/react/components/viewport-provider.cjs.map +7 -0
- package/build/image-editor/react/hooks/use-aria-announcer.cjs +53 -6
- package/build/image-editor/react/hooks/use-aria-announcer.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-cropper-state.cjs +127 -8
- package/build/image-editor/react/hooks/use-cropper-state.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-interaction.cjs +26 -5
- package/build/image-editor/react/hooks/use-interaction.cjs.map +2 -2
- package/build/image-editor/react/hooks/use-viewport-state.cjs +51 -0
- package/build/image-editor/react/hooks/use-viewport-state.cjs.map +7 -0
- package/build/image-editor/react/visually-hidden-style.cjs +41 -0
- package/build/image-editor/react/visually-hidden-style.cjs.map +7 -0
- package/build/private-apis.cjs +2 -0
- package/build/private-apis.cjs.map +2 -2
- package/build-module/components/media-editor/index.mjs +545 -0
- package/build-module/components/media-editor/index.mjs.map +7 -0
- package/build-module/components/media-editor-canvas/index.mjs +14 -2
- package/build-module/components/media-editor-canvas/index.mjs.map +2 -2
- package/build-module/components/media-editor-crop-panel/index.mjs +35 -28
- package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs +144 -0
- package/build-module/components/media-editor-keyboard-shortcuts-modal/index.mjs.map +7 -0
- package/build-module/components/media-editor-modal/index.mjs +46 -455
- package/build-module/components/media-editor-modal/index.mjs.map +2 -2
- package/build-module/components/media-editor-toolbar/index.mjs +137 -77
- package/build-module/components/media-editor-toolbar/index.mjs.map +2 -2
- package/build-module/components/media-form/index.mjs +3 -0
- package/build-module/components/media-form/index.mjs.map +2 -2
- package/build-module/components/rotation-ruler/index.mjs +166 -0
- package/build-module/components/rotation-ruler/index.mjs.map +7 -0
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs +126 -0
- package/build-module/components/rotation-ruler/use-ruler-drag.mjs.map +7 -0
- package/build-module/hooks/use-crop-gesture-handlers.mjs +17 -0
- package/build-module/hooks/use-crop-gesture-handlers.mjs.map +7 -0
- package/build-module/image-editor/core/constants.mjs +6 -0
- package/build-module/image-editor/core/constants.mjs.map +2 -2
- package/build-module/image-editor/core/containment.mjs +6 -12
- package/build-module/image-editor/core/containment.mjs.map +2 -2
- package/build-module/image-editor/core/interaction-controller.mjs +50 -8
- package/build-module/image-editor/core/interaction-controller.mjs.map +2 -2
- package/build-module/image-editor/core/state.mjs +5 -1
- package/build-module/image-editor/core/state.mjs.map +2 -2
- package/build-module/image-editor/core/transform-style.mjs.map +1 -1
- package/build-module/image-editor/core/viewport-state.mjs +24 -0
- package/build-module/image-editor/core/viewport-state.mjs.map +7 -0
- package/build-module/image-editor/react/components/cropper.mjs +195 -73
- package/build-module/image-editor/react/components/cropper.mjs.map +3 -3
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs +5 -2
- package/build-module/image-editor/react/components/overlays/dimming-overlay.mjs.map +2 -2
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs +26 -5
- package/build-module/image-editor/react/components/stencils/rectangle-stencil.mjs.map +2 -2
- package/build-module/image-editor/react/components/viewport-provider.mjs +27 -0
- package/build-module/image-editor/react/components/viewport-provider.mjs.map +7 -0
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs +59 -7
- package/build-module/image-editor/react/hooks/use-aria-announcer.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs +134 -9
- package/build-module/image-editor/react/hooks/use-cropper-state.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-interaction.mjs +26 -5
- package/build-module/image-editor/react/hooks/use-interaction.mjs.map +2 -2
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs +29 -0
- package/build-module/image-editor/react/hooks/use-viewport-state.mjs.map +7 -0
- package/build-module/image-editor/react/visually-hidden-style.mjs +16 -0
- package/build-module/image-editor/react/visually-hidden-style.mjs.map +7 -0
- package/build-module/private-apis.mjs +2 -0
- package/build-module/private-apis.mjs.map +2 -2
- package/build-style/style-rtl.css +254 -29
- package/build-style/style.css +254 -29
- package/build-types/components/media-editor/index.d.ts +34 -0
- package/build-types/components/media-editor/index.d.ts.map +1 -0
- package/build-types/components/media-editor-canvas/index.d.ts +10 -1
- package/build-types/components/media-editor-canvas/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts +6 -0
- package/build-types/components/media-editor-keyboard-shortcuts-modal/index.d.ts.map +1 -0
- package/build-types/components/media-editor-modal/index.d.ts +2 -2
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/build-types/components/media-editor-provider/index.d.ts +1 -1
- package/build-types/components/media-editor-provider/index.d.ts.map +1 -1
- package/build-types/components/media-editor-toolbar/index.d.ts +4 -1
- package/build-types/components/media-editor-toolbar/index.d.ts.map +1 -1
- package/build-types/components/media-form/index.d.ts +1 -1
- package/build-types/components/media-form/index.d.ts.map +1 -1
- package/build-types/components/rotation-ruler/index.d.ts +46 -0
- package/build-types/components/rotation-ruler/index.d.ts.map +1 -0
- package/build-types/components/rotation-ruler/stories/index.story.d.ts +14 -0
- package/build-types/components/rotation-ruler/stories/index.story.d.ts.map +1 -0
- package/build-types/components/rotation-ruler/use-ruler-drag.d.ts +61 -0
- package/build-types/components/rotation-ruler/use-ruler-drag.d.ts.map +1 -0
- package/build-types/hooks/use-crop-gesture-handlers.d.ts +42 -0
- package/build-types/hooks/use-crop-gesture-handlers.d.ts.map +1 -0
- package/build-types/image-editor/core/constants.d.ts +9 -0
- package/build-types/image-editor/core/constants.d.ts.map +1 -1
- package/build-types/image-editor/core/containment.d.ts +11 -7
- package/build-types/image-editor/core/containment.d.ts.map +1 -1
- package/build-types/image-editor/core/interaction-controller.d.ts +14 -2
- package/build-types/image-editor/core/interaction-controller.d.ts.map +1 -1
- package/build-types/image-editor/core/state.d.ts.map +1 -1
- package/build-types/image-editor/core/transform-style.d.ts +1 -1
- package/build-types/image-editor/core/types.d.ts +25 -0
- package/build-types/image-editor/core/types.d.ts.map +1 -1
- package/build-types/image-editor/core/viewport-state.d.ts +7 -0
- package/build-types/image-editor/core/viewport-state.d.ts.map +1 -0
- package/build-types/image-editor/react/components/cropper-provider.d.ts +1 -1
- package/build-types/image-editor/react/components/cropper-provider.d.ts.map +1 -1
- package/build-types/image-editor/react/components/cropper.d.ts +2 -1
- package/build-types/image-editor/react/components/cropper.d.ts.map +1 -1
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts +3 -13
- package/build-types/image-editor/react/components/overlays/dimming-overlay.d.ts.map +1 -1
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts +1 -1
- package/build-types/image-editor/react/components/overlays/grid-overlay.d.ts.map +1 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts +1 -1
- package/build-types/image-editor/react/components/stencils/rectangle-stencil.d.ts.map +1 -1
- package/build-types/image-editor/react/components/viewport-provider.d.ts +9 -0
- package/build-types/image-editor/react/components/viewport-provider.d.ts.map +1 -0
- package/build-types/image-editor/react/hooks/use-aria-announcer.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts +29 -0
- package/build-types/image-editor/react/hooks/use-cropper-state.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-interaction.d.ts +5 -2
- package/build-types/image-editor/react/hooks/use-interaction.d.ts.map +1 -1
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts +19 -0
- package/build-types/image-editor/react/hooks/use-viewport-state.d.ts.map +1 -0
- package/build-types/image-editor/react/visually-hidden-style.d.ts +6 -0
- package/build-types/image-editor/react/visually-hidden-style.d.ts.map +1 -0
- package/build-types/image-editor/stories/rectangle-crop.story.d.ts.map +1 -1
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/store/actions.d.ts +3 -3
- package/build-types/store/actions.d.ts.map +1 -1
- package/package.json +16 -15
- package/src/components/media-editor/index.tsx +709 -0
- package/src/components/media-editor/style.scss +89 -0
- package/src/components/media-editor-canvas/index.tsx +24 -0
- package/src/components/media-editor-crop-panel/index.tsx +39 -27
- package/src/components/media-editor-crop-panel/test/index.tsx +109 -0
- package/src/components/media-editor-keyboard-shortcuts-modal/index.tsx +177 -0
- package/src/components/media-editor-keyboard-shortcuts-modal/style.scss +53 -0
- package/src/components/media-editor-modal/index.tsx +49 -589
- package/src/components/media-editor-modal/style.scss +13 -112
- package/src/components/media-editor-toolbar/index.tsx +122 -63
- package/src/components/media-editor-toolbar/style.scss +39 -11
- package/src/components/media-form/index.tsx +5 -0
- package/src/components/rotation-ruler/README.md +37 -0
- package/src/components/rotation-ruler/index.tsx +266 -0
- package/src/components/rotation-ruler/stories/index.story.tsx +54 -0
- package/src/components/rotation-ruler/style.scss +147 -0
- package/src/components/rotation-ruler/test/index.tsx +109 -0
- package/src/components/rotation-ruler/use-ruler-drag.ts +230 -0
- package/src/hooks/use-crop-gesture-handlers.ts +54 -0
- package/src/image-editor/core/constants.ts +12 -0
- package/src/image-editor/core/containment.ts +16 -28
- package/src/image-editor/core/interaction-controller.ts +66 -10
- package/src/image-editor/core/state.ts +15 -8
- package/src/image-editor/core/test/camera.ts +15 -26
- package/src/image-editor/core/test/interaction-controller.ts +158 -7
- package/src/image-editor/core/test/state.ts +21 -1
- package/src/image-editor/core/transform-style.ts +1 -1
- package/src/image-editor/core/types.ts +16 -0
- package/src/image-editor/core/viewport-state.ts +33 -0
- package/src/image-editor/docs/architecture.md +1 -1
- package/src/image-editor/docs/recipes.md +2 -2
- package/src/image-editor/react/components/cropper.scss +28 -0
- package/src/image-editor/react/components/cropper.tsx +268 -72
- package/src/image-editor/react/components/overlays/dimming-overlay.tsx +12 -12
- package/src/image-editor/react/components/stencils/rectangle-stencil.tsx +27 -8
- package/src/image-editor/react/components/stencils/test/rectangle-stencil.tsx +29 -3
- package/src/image-editor/react/components/test/cropper.tsx +294 -5
- package/src/image-editor/react/components/viewport-provider.tsx +39 -0
- package/src/image-editor/react/hooks/test/use-aria-announcer.ts +81 -0
- package/src/image-editor/react/hooks/test/use-cropper-state.ts +286 -0
- package/src/image-editor/react/hooks/test/use-interaction.ts +1 -0
- package/src/image-editor/react/hooks/use-aria-announcer.ts +68 -7
- package/src/image-editor/react/hooks/use-cropper-state.ts +230 -11
- package/src/image-editor/react/hooks/use-interaction.ts +36 -6
- package/src/image-editor/react/hooks/use-viewport-state.ts +48 -0
- package/src/image-editor/react/visually-hidden-style.ts +15 -0
- package/src/private-apis.ts +2 -0
- package/src/style.scss +3 -0
- package/tsconfig.json +1 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,80 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
Flex,
|
|
8
|
-
Modal,
|
|
9
|
-
Spinner,
|
|
10
|
-
__experimentalConfirmDialog as ConfirmDialog,
|
|
11
|
-
privateApis as componentsPrivateApis,
|
|
12
|
-
} from '@wordpress/components';
|
|
13
|
-
import { Stack } from '@wordpress/ui';
|
|
14
|
-
import { useDispatch, useRegistry, useSelect } from '@wordpress/data';
|
|
15
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
16
|
-
import {
|
|
17
|
-
createPortal,
|
|
18
|
-
useCallback,
|
|
19
|
-
useContext,
|
|
20
|
-
useEffect,
|
|
21
|
-
useMemo,
|
|
22
|
-
useRef,
|
|
23
|
-
useState,
|
|
24
|
-
} from '@wordpress/element';
|
|
25
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
26
|
-
import { close, drawerRight } from '@wordpress/icons';
|
|
27
|
-
import { SnackbarNotices, store as noticesStore } from '@wordpress/notices';
|
|
4
|
+
import { Modal } from '@wordpress/components';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
28
7
|
import type { Field } from '@wordpress/dataviews';
|
|
29
|
-
import {
|
|
30
|
-
ComplementaryArea,
|
|
31
|
-
InterfaceSkeleton,
|
|
32
|
-
PinnedItems,
|
|
33
|
-
// No type declarations available for @wordpress/interface.
|
|
34
|
-
// @ts-expect-error
|
|
35
|
-
} from '@wordpress/interface';
|
|
36
8
|
|
|
37
9
|
/**
|
|
38
10
|
* Internal dependencies
|
|
39
11
|
*/
|
|
40
|
-
import
|
|
12
|
+
import MediaEditor from '../media-editor';
|
|
41
13
|
import type { Media } from '../media-editor-provider';
|
|
42
|
-
import MediaPreview from '../media-preview';
|
|
43
|
-
import MediaEditorCanvas from '../media-editor-canvas';
|
|
44
|
-
import MediaEditorToolbar from '../media-editor-toolbar';
|
|
45
|
-
import MediaEditorCropPanel, {
|
|
46
|
-
resolveAspectRatio,
|
|
47
|
-
} from '../media-editor-crop-panel';
|
|
48
|
-
import MediaForm from '../media-form';
|
|
49
14
|
import { store as mediaEditorStore } from '../../store';
|
|
50
15
|
import type { MediaEditorModalUpdate } from '../../store/actions';
|
|
51
|
-
import { unlock } from '../../lock-unlock';
|
|
52
|
-
import { getMediaTypeFromMimeType } from '../../utils';
|
|
53
|
-
import { CropperProvider, useCropper } from '../../image-editor';
|
|
54
16
|
import type { AspectRatioPreset } from '../../image-editor/core/constants';
|
|
55
|
-
import { buildModifiers } from './build-modifiers';
|
|
56
|
-
|
|
57
|
-
// Details-tab edits the modal bundles into a transformed `/edit` request.
|
|
58
|
-
// Matches Core's `WP_REST_Attachments_Controller::get_edit_media_item_args`
|
|
59
|
-
// — that endpoint's arg schema explicitly whitelists only these fields
|
|
60
|
-
// (title / caption / description / alt_text / post), so forwarding any
|
|
61
|
-
// others would fail REST validation with `rest_invalid_param`. Staged
|
|
62
|
-
// edits to fields outside this list are not forwarded; a follow-up could
|
|
63
|
-
// persist them via a separate `saveEditedEntityRecord` call.
|
|
64
|
-
const METADATA_EDIT_KEYS = [
|
|
65
|
-
'title',
|
|
66
|
-
'caption',
|
|
67
|
-
'description',
|
|
68
|
-
'alt_text',
|
|
69
|
-
'post',
|
|
70
|
-
] as const;
|
|
71
|
-
|
|
72
|
-
// Scope save-failure snackbars to this modal so they don't leak into the
|
|
73
|
-
// host editor's notices tray (and vice versa).
|
|
74
|
-
const NOTICES_CONTEXT = 'media-editor';
|
|
75
|
-
const PLACEMENT_CONTROL_IDLE_MS = 300;
|
|
76
|
-
|
|
77
|
-
const { Tabs } = unlock( componentsPrivateApis );
|
|
78
17
|
|
|
79
18
|
interface MediaEditorModalProps {
|
|
80
19
|
/**
|
|
@@ -86,494 +25,11 @@ interface MediaEditorModalProps {
|
|
|
86
25
|
fields?: Field< Media >[];
|
|
87
26
|
/**
|
|
88
27
|
* Fixed aspect-ratio presets for image cropping. Free and Original are
|
|
89
|
-
* always provided by the
|
|
28
|
+
* always provided by the media editor.
|
|
90
29
|
*/
|
|
91
30
|
aspectRatioPresets?: AspectRatioPreset[];
|
|
92
31
|
}
|
|
93
32
|
|
|
94
|
-
interface ModalTab {
|
|
95
|
-
id: string;
|
|
96
|
-
title: string;
|
|
97
|
-
panel: JSX.Element;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Renders the `ComplementaryArea` with a tab list in its header, mirroring
|
|
101
|
-
// the post editor's pattern in
|
|
102
|
-
// `packages/editor/src/components/sidebar/index.js`. The `header` prop
|
|
103
|
-
// replaces `ComplementaryArea`'s default `<h2>{ title }</h2>` row — `title`
|
|
104
|
-
// is still passed so it can label the pinned toolbar button. Tabs context
|
|
105
|
-
// must be re-provided on both sides of the Slot/Fill because the Fill
|
|
106
|
-
// doesn't preserve the Tabs React context across to the Slot.
|
|
107
|
-
function MediaEditorModalSidebar( { tabs }: { tabs: ModalTab[] } ) {
|
|
108
|
-
const tabsContextValue = useContext( Tabs.Context );
|
|
109
|
-
return (
|
|
110
|
-
<ComplementaryArea
|
|
111
|
-
scope="media-editor"
|
|
112
|
-
identifier="media-editor/details"
|
|
113
|
-
title={ __( 'Details' ) }
|
|
114
|
-
icon={ drawerRight }
|
|
115
|
-
isActiveByDefault
|
|
116
|
-
className="media-editor-modal__sidebar"
|
|
117
|
-
panelClassName="media-editor-modal__sidebar-panel"
|
|
118
|
-
headerClassName="media-editor-modal__sidebar-header"
|
|
119
|
-
header={
|
|
120
|
-
<Tabs.Context.Provider value={ tabsContextValue }>
|
|
121
|
-
<Tabs.TabList>
|
|
122
|
-
{ tabs.map( ( tab ) => (
|
|
123
|
-
<Tabs.Tab key={ tab.id } tabId={ tab.id }>
|
|
124
|
-
{ tab.title }
|
|
125
|
-
</Tabs.Tab>
|
|
126
|
-
) ) }
|
|
127
|
-
</Tabs.TabList>
|
|
128
|
-
</Tabs.Context.Provider>
|
|
129
|
-
}
|
|
130
|
-
>
|
|
131
|
-
<Tabs.Context.Provider value={ tabsContextValue }>
|
|
132
|
-
{ tabs.map( ( tab ) => (
|
|
133
|
-
<Tabs.TabPanel
|
|
134
|
-
key={ tab.id }
|
|
135
|
-
tabId={ tab.id }
|
|
136
|
-
focusable={ false }
|
|
137
|
-
>
|
|
138
|
-
{ tab.panel }
|
|
139
|
-
</Tabs.TabPanel>
|
|
140
|
-
) ) }
|
|
141
|
-
</Tabs.Context.Provider>
|
|
142
|
-
</ComplementaryArea>
|
|
143
|
-
);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
interface HeaderActionsProps {
|
|
147
|
-
isSaving: boolean;
|
|
148
|
-
hasMedia: boolean;
|
|
149
|
-
hasChanges: boolean;
|
|
150
|
-
onCancel: () => void;
|
|
151
|
-
onSave: () => void;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function HeaderActions( {
|
|
155
|
-
isSaving,
|
|
156
|
-
hasMedia,
|
|
157
|
-
hasChanges,
|
|
158
|
-
onCancel,
|
|
159
|
-
onSave,
|
|
160
|
-
}: HeaderActionsProps ) {
|
|
161
|
-
const saveDisabled = isSaving || ! hasMedia || ! hasChanges;
|
|
162
|
-
return (
|
|
163
|
-
<Flex
|
|
164
|
-
className="media-editor-modal__header-actions"
|
|
165
|
-
justify="flex-end"
|
|
166
|
-
expanded={ false }
|
|
167
|
-
gap={ 2 }
|
|
168
|
-
>
|
|
169
|
-
<PinnedItems.Slot scope="media-editor" />
|
|
170
|
-
<Button
|
|
171
|
-
size="compact"
|
|
172
|
-
variant="tertiary"
|
|
173
|
-
onClick={ onCancel }
|
|
174
|
-
disabled={ isSaving }
|
|
175
|
-
accessibleWhenDisabled
|
|
176
|
-
>
|
|
177
|
-
{ __( 'Cancel' ) }
|
|
178
|
-
</Button>
|
|
179
|
-
<Button
|
|
180
|
-
size="compact"
|
|
181
|
-
variant="primary"
|
|
182
|
-
onClick={ onSave }
|
|
183
|
-
isBusy={ isSaving }
|
|
184
|
-
disabled={ saveDisabled }
|
|
185
|
-
accessibleWhenDisabled
|
|
186
|
-
>
|
|
187
|
-
{ __( 'Save' ) }
|
|
188
|
-
</Button>
|
|
189
|
-
<Button
|
|
190
|
-
size="compact"
|
|
191
|
-
icon={ close }
|
|
192
|
-
label={ __( 'Close' ) }
|
|
193
|
-
onClick={ onCancel }
|
|
194
|
-
disabled={ isSaving }
|
|
195
|
-
accessibleWhenDisabled
|
|
196
|
-
/>
|
|
197
|
-
</Flex>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
interface MediaEditorModalContentProps {
|
|
202
|
-
fields: Field< Media >[];
|
|
203
|
-
id: number;
|
|
204
|
-
media: Media | null;
|
|
205
|
-
hasEdits: boolean;
|
|
206
|
-
aspectRatioPresets?: AspectRatioPreset[];
|
|
207
|
-
onUpdate: ( ( updated: MediaEditorModalUpdate ) => void ) | null;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Inner component rendered inside `CropperProvider` so it can read
|
|
211
|
-
// `isDirty` from the cropper. The outer `MediaEditorModal` keeps the
|
|
212
|
-
// store reads and provider tree above this.
|
|
213
|
-
function MediaEditorModalContent( {
|
|
214
|
-
fields,
|
|
215
|
-
id,
|
|
216
|
-
media,
|
|
217
|
-
hasEdits,
|
|
218
|
-
aspectRatioPresets,
|
|
219
|
-
onUpdate,
|
|
220
|
-
}: MediaEditorModalContentProps ) {
|
|
221
|
-
const cropper = useCropper();
|
|
222
|
-
const hasChanges = cropper.isDirty || hasEdits;
|
|
223
|
-
|
|
224
|
-
const registry = useRegistry();
|
|
225
|
-
const {
|
|
226
|
-
clearEntityRecordEdits,
|
|
227
|
-
editEntityRecord,
|
|
228
|
-
receiveEntityRecords,
|
|
229
|
-
saveEditedEntityRecord,
|
|
230
|
-
} = useDispatch( coreStore );
|
|
231
|
-
const { closeMediaEditorModal } = useDispatch( mediaEditorStore );
|
|
232
|
-
const { createErrorNotice, removeAllNotices } = useDispatch( noticesStore );
|
|
233
|
-
|
|
234
|
-
const [ isSaving, setIsSaving ] = useState( false );
|
|
235
|
-
const [ isDiscardDialogOpen, setIsDiscardDialogOpen ] = useState( false );
|
|
236
|
-
const [ isPlacementActive, setIsPlacementActive ] = useState( false );
|
|
237
|
-
const placementControlTimerRef =
|
|
238
|
-
useRef< ReturnType< typeof setTimeout > >();
|
|
239
|
-
|
|
240
|
-
const [ aspectRatioValue, setAspectRatioValue ] = useState( '0' );
|
|
241
|
-
const [ freeformCrop, setFreeformCrop ] = useState( true );
|
|
242
|
-
|
|
243
|
-
const signalPlacementControlInteraction = useCallback( () => {
|
|
244
|
-
setIsPlacementActive( true );
|
|
245
|
-
clearTimeout( placementControlTimerRef.current );
|
|
246
|
-
placementControlTimerRef.current = setTimeout( () => {
|
|
247
|
-
setIsPlacementActive( false );
|
|
248
|
-
}, PLACEMENT_CONTROL_IDLE_MS );
|
|
249
|
-
}, [] );
|
|
250
|
-
|
|
251
|
-
useEffect( () => {
|
|
252
|
-
return () => {
|
|
253
|
-
clearTimeout( placementControlTimerRef.current );
|
|
254
|
-
};
|
|
255
|
-
}, [] );
|
|
256
|
-
|
|
257
|
-
// Reset aspect-ratio / freeform state when the media changes, so the
|
|
258
|
-
// next image starts from the defaults.
|
|
259
|
-
useEffect( () => {
|
|
260
|
-
setAspectRatioValue( '0' );
|
|
261
|
-
setFreeformCrop( true );
|
|
262
|
-
}, [ id ] );
|
|
263
|
-
|
|
264
|
-
const mediaType = getMediaTypeFromMimeType( media?.mime_type ).type;
|
|
265
|
-
const isImage = !! media && mediaType === 'image';
|
|
266
|
-
|
|
267
|
-
const imageAspectRatio = useMemo( () => {
|
|
268
|
-
if ( ! isImage ) {
|
|
269
|
-
return null;
|
|
270
|
-
}
|
|
271
|
-
const naturalWidth = Number( media?.media_details?.width );
|
|
272
|
-
const naturalHeight = Number( media?.media_details?.height );
|
|
273
|
-
if (
|
|
274
|
-
Number.isFinite( naturalWidth ) &&
|
|
275
|
-
Number.isFinite( naturalHeight ) &&
|
|
276
|
-
naturalHeight > 0
|
|
277
|
-
) {
|
|
278
|
-
return naturalWidth / naturalHeight;
|
|
279
|
-
}
|
|
280
|
-
return null;
|
|
281
|
-
}, [ isImage, media ] );
|
|
282
|
-
|
|
283
|
-
const tabs = useMemo< ModalTab[] >( () => {
|
|
284
|
-
const detailsTab: ModalTab = {
|
|
285
|
-
id: 'details',
|
|
286
|
-
title: __( 'Details' ),
|
|
287
|
-
panel: (
|
|
288
|
-
<Stack
|
|
289
|
-
className="media-editor-modal__panel"
|
|
290
|
-
direction="column"
|
|
291
|
-
gap="lg"
|
|
292
|
-
>
|
|
293
|
-
<MediaForm />
|
|
294
|
-
</Stack>
|
|
295
|
-
),
|
|
296
|
-
};
|
|
297
|
-
if ( ! isImage ) {
|
|
298
|
-
return [ detailsTab ];
|
|
299
|
-
}
|
|
300
|
-
return [
|
|
301
|
-
{
|
|
302
|
-
id: 'crop',
|
|
303
|
-
title: __( 'Crop' ),
|
|
304
|
-
panel: (
|
|
305
|
-
<Stack
|
|
306
|
-
className="media-editor-modal__panel"
|
|
307
|
-
direction="column"
|
|
308
|
-
gap="lg"
|
|
309
|
-
>
|
|
310
|
-
<MediaEditorCropPanel
|
|
311
|
-
aspectRatioValue={ aspectRatioValue }
|
|
312
|
-
onAspectRatioChange={ setAspectRatioValue }
|
|
313
|
-
freeformCrop={ freeformCrop }
|
|
314
|
-
onFreeformChange={ setFreeformCrop }
|
|
315
|
-
onPlacementControlInteraction={
|
|
316
|
-
signalPlacementControlInteraction
|
|
317
|
-
}
|
|
318
|
-
aspectRatioPresets={ aspectRatioPresets }
|
|
319
|
-
/>
|
|
320
|
-
</Stack>
|
|
321
|
-
),
|
|
322
|
-
},
|
|
323
|
-
detailsTab,
|
|
324
|
-
];
|
|
325
|
-
}, [
|
|
326
|
-
isImage,
|
|
327
|
-
aspectRatioValue,
|
|
328
|
-
freeformCrop,
|
|
329
|
-
aspectRatioPresets,
|
|
330
|
-
signalPlacementControlInteraction,
|
|
331
|
-
] );
|
|
332
|
-
|
|
333
|
-
const handleChange = ( updates: Partial< Media > ) => {
|
|
334
|
-
editEntityRecord( 'postType', 'attachment', id, updates );
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
const discardAndClose = () => {
|
|
338
|
-
removeAllNotices( 'snackbar', NOTICES_CONTEXT );
|
|
339
|
-
clearEntityRecordEdits( 'postType', 'attachment', id );
|
|
340
|
-
closeMediaEditorModal();
|
|
341
|
-
};
|
|
342
|
-
|
|
343
|
-
const handleRequestClose = () => {
|
|
344
|
-
// Disallow closing while a save is in flight so the in-progress
|
|
345
|
-
// request can settle without the modal unmounting under it.
|
|
346
|
-
if ( isSaving ) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
if ( hasChanges ) {
|
|
350
|
-
setIsDiscardDialogOpen( true );
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
discardAndClose();
|
|
354
|
-
};
|
|
355
|
-
|
|
356
|
-
const handleSave = async () => {
|
|
357
|
-
// Clear any prior failure snackbar so a successful retry doesn't
|
|
358
|
-
// leave a stale "Could not save image" hovering.
|
|
359
|
-
removeAllNotices( 'snackbar', NOTICES_CONTEXT );
|
|
360
|
-
setIsSaving( true );
|
|
361
|
-
try {
|
|
362
|
-
let saved: Media | null | undefined;
|
|
363
|
-
|
|
364
|
-
const modifiers =
|
|
365
|
-
cropper.isDirty && cropper.state.image
|
|
366
|
-
? buildModifiers( cropper.state, {
|
|
367
|
-
width: cropper.state.image.naturalWidth,
|
|
368
|
-
height: cropper.state.image.naturalHeight,
|
|
369
|
-
} )
|
|
370
|
-
: [];
|
|
371
|
-
|
|
372
|
-
if ( modifiers.length > 0 ) {
|
|
373
|
-
// Bundle staged Details-tab edits into the same /edit
|
|
374
|
-
// request. Transformed saves duplicate the attachment,
|
|
375
|
-
// and the prior core-data edits were staged against the
|
|
376
|
-
// old id — if we don't forward them here they'd be
|
|
377
|
-
// silently lost. Core's `edit_media_item` honors these
|
|
378
|
-
// keys via `prepare_item_for_database` and `alt_text`.
|
|
379
|
-
const pendingEdits = registry
|
|
380
|
-
.select( coreStore )
|
|
381
|
-
.getEntityRecordNonTransientEdits(
|
|
382
|
-
'postType',
|
|
383
|
-
'attachment',
|
|
384
|
-
id
|
|
385
|
-
) as Record< string, unknown > | undefined;
|
|
386
|
-
const metadataEdits: Record< string, unknown > = {};
|
|
387
|
-
for ( const key of METADATA_EDIT_KEYS ) {
|
|
388
|
-
if ( pendingEdits && key in pendingEdits ) {
|
|
389
|
-
metadataEdits[ key ] = pendingEdits[ key ];
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
saved = ( await apiFetch( {
|
|
394
|
-
path: `/wp/v2/media/${ id }/edit`,
|
|
395
|
-
method: 'POST',
|
|
396
|
-
data: {
|
|
397
|
-
src: media?.source_url,
|
|
398
|
-
modifiers,
|
|
399
|
-
...metadataEdits,
|
|
400
|
-
},
|
|
401
|
-
} ) ) as Media;
|
|
402
|
-
|
|
403
|
-
if ( saved ) {
|
|
404
|
-
// Put the newly-created attachment into the core-data
|
|
405
|
-
// cache so downstream consumers see it without an
|
|
406
|
-
// extra fetch round-trip.
|
|
407
|
-
receiveEntityRecords(
|
|
408
|
-
'postType',
|
|
409
|
-
'attachment',
|
|
410
|
-
saved,
|
|
411
|
-
undefined,
|
|
412
|
-
true
|
|
413
|
-
);
|
|
414
|
-
}
|
|
415
|
-
} else {
|
|
416
|
-
saved = ( await saveEditedEntityRecord(
|
|
417
|
-
'postType',
|
|
418
|
-
'attachment',
|
|
419
|
-
id
|
|
420
|
-
) ) as Media | undefined;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
const next = ( saved ?? media ) as Media | null;
|
|
424
|
-
|
|
425
|
-
// A transformed save creates a new attachment; clear staged
|
|
426
|
-
// edits on the old record so it doesn't appear dirty in the
|
|
427
|
-
// Media Library afterwards.
|
|
428
|
-
if ( next && next.id !== id ) {
|
|
429
|
-
clearEntityRecordEdits( 'postType', 'attachment', id );
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if ( next && next.id && onUpdate ) {
|
|
433
|
-
// Normalize to the public callback shape — see
|
|
434
|
-
// `MediaEditorModalUpdate` in `../../store/actions.ts`.
|
|
435
|
-
onUpdate( { id: next.id, url: next.source_url } );
|
|
436
|
-
}
|
|
437
|
-
closeMediaEditorModal();
|
|
438
|
-
} catch ( error ) {
|
|
439
|
-
const message =
|
|
440
|
-
error instanceof Error
|
|
441
|
-
? error.message
|
|
442
|
-
: ( error as { message?: string } )?.message ??
|
|
443
|
-
__( 'An unknown error occurred.' );
|
|
444
|
-
createErrorNotice(
|
|
445
|
-
sprintf(
|
|
446
|
-
/* translators: %s: Error message. */
|
|
447
|
-
__( 'Could not save image. %s' ),
|
|
448
|
-
message
|
|
449
|
-
),
|
|
450
|
-
{ type: 'snackbar', context: NOTICES_CONTEXT }
|
|
451
|
-
);
|
|
452
|
-
} finally {
|
|
453
|
-
setIsSaving( false );
|
|
454
|
-
}
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
return (
|
|
458
|
-
<Modal
|
|
459
|
-
className="media-editor-modal"
|
|
460
|
-
title={ __( 'Edit media' ) }
|
|
461
|
-
size="fill"
|
|
462
|
-
isDismissible={ false }
|
|
463
|
-
shouldCloseOnClickOutside={ ! hasChanges && ! isSaving }
|
|
464
|
-
onKeyDown={ ( event ) => {
|
|
465
|
-
if ( event.code !== 'Escape' && event.key !== 'Escape' ) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
// While saving, swallow ESC so the in-progress request
|
|
469
|
-
// can settle without the modal closing under it.
|
|
470
|
-
if ( isSaving ) {
|
|
471
|
-
event.preventDefault();
|
|
472
|
-
return;
|
|
473
|
-
}
|
|
474
|
-
// When there are pending changes, intercept ESC and
|
|
475
|
-
// open the confirm dialog ourselves. `preventDefault`
|
|
476
|
-
// short-circuits Modal's own ESC-to-close handler on
|
|
477
|
-
// the overlay so the modal doesn't animate out before
|
|
478
|
-
// the dialog appears.
|
|
479
|
-
if ( hasChanges ) {
|
|
480
|
-
event.preventDefault();
|
|
481
|
-
setIsDiscardDialogOpen( true );
|
|
482
|
-
}
|
|
483
|
-
} }
|
|
484
|
-
onRequestClose={ handleRequestClose }
|
|
485
|
-
headerActions={
|
|
486
|
-
<HeaderActions
|
|
487
|
-
isSaving={ isSaving }
|
|
488
|
-
hasMedia={ !! media }
|
|
489
|
-
hasChanges={ hasChanges }
|
|
490
|
-
onCancel={ handleRequestClose }
|
|
491
|
-
onSave={ handleSave }
|
|
492
|
-
/>
|
|
493
|
-
}
|
|
494
|
-
>
|
|
495
|
-
<MediaEditorProvider
|
|
496
|
-
value={ media ?? undefined }
|
|
497
|
-
onChange={ handleChange }
|
|
498
|
-
settings={ { fields } }
|
|
499
|
-
>
|
|
500
|
-
{ ! media ? (
|
|
501
|
-
<div className="media-editor-modal__loading">
|
|
502
|
-
<Spinner />
|
|
503
|
-
</div>
|
|
504
|
-
) : (
|
|
505
|
-
<>
|
|
506
|
-
<Tabs>
|
|
507
|
-
<MediaEditorModalSidebar tabs={ tabs } />
|
|
508
|
-
</Tabs>
|
|
509
|
-
<InterfaceSkeleton
|
|
510
|
-
className="media-editor-modal__skeleton"
|
|
511
|
-
content={
|
|
512
|
-
<div className="media-editor-modal__canvas">
|
|
513
|
-
{ isImage ? (
|
|
514
|
-
<MediaEditorCanvas
|
|
515
|
-
aspectRatio={ resolveAspectRatio(
|
|
516
|
-
aspectRatioValue,
|
|
517
|
-
imageAspectRatio
|
|
518
|
-
) }
|
|
519
|
-
freeformCrop={ freeformCrop }
|
|
520
|
-
isPlacementActive={
|
|
521
|
-
isPlacementActive
|
|
522
|
-
}
|
|
523
|
-
/>
|
|
524
|
-
) : (
|
|
525
|
-
<MediaPreview />
|
|
526
|
-
) }
|
|
527
|
-
</div>
|
|
528
|
-
}
|
|
529
|
-
footer={
|
|
530
|
-
isImage ? (
|
|
531
|
-
<MediaEditorToolbar
|
|
532
|
-
onReset={ () => {
|
|
533
|
-
setAspectRatioValue( '0' );
|
|
534
|
-
setFreeformCrop( true );
|
|
535
|
-
} }
|
|
536
|
-
onPlacementControlInteraction={
|
|
537
|
-
signalPlacementControlInteraction
|
|
538
|
-
}
|
|
539
|
-
/>
|
|
540
|
-
) : undefined
|
|
541
|
-
}
|
|
542
|
-
sidebar={
|
|
543
|
-
<ComplementaryArea.Slot scope="media-editor" />
|
|
544
|
-
}
|
|
545
|
-
/>
|
|
546
|
-
</>
|
|
547
|
-
) }
|
|
548
|
-
{ /* Rendered inside the parent Modal so it's tracked as
|
|
549
|
-
a nested dismisser. As a top-level sibling it would,
|
|
550
|
-
on mount, request the parent Modal close. */ }
|
|
551
|
-
<ConfirmDialog
|
|
552
|
-
isOpen={ isDiscardDialogOpen }
|
|
553
|
-
confirmButtonText={ __( 'Discard' ) }
|
|
554
|
-
cancelButtonText={ __( 'Keep editing' ) }
|
|
555
|
-
onCancel={ () => setIsDiscardDialogOpen( false ) }
|
|
556
|
-
onConfirm={ () => {
|
|
557
|
-
setIsDiscardDialogOpen( false );
|
|
558
|
-
discardAndClose();
|
|
559
|
-
} }
|
|
560
|
-
>
|
|
561
|
-
{ __(
|
|
562
|
-
'Are you sure you want to discard your unsaved changes?'
|
|
563
|
-
) }
|
|
564
|
-
</ConfirmDialog>
|
|
565
|
-
</MediaEditorProvider>
|
|
566
|
-
{ createPortal(
|
|
567
|
-
<SnackbarNotices
|
|
568
|
-
className="media-editor-modal__snackbar"
|
|
569
|
-
context={ NOTICES_CONTEXT }
|
|
570
|
-
/>,
|
|
571
|
-
document.body
|
|
572
|
-
) }
|
|
573
|
-
</Modal>
|
|
574
|
-
);
|
|
575
|
-
}
|
|
576
|
-
|
|
577
33
|
export function MediaEditorModal( {
|
|
578
34
|
fields = [],
|
|
579
35
|
aspectRatioPresets,
|
|
@@ -587,52 +43,56 @@ export function MediaEditorModal( {
|
|
|
587
43
|
};
|
|
588
44
|
}, [] );
|
|
589
45
|
|
|
590
|
-
const {
|
|
591
|
-
( select ) => {
|
|
592
|
-
if ( ! id ) {
|
|
593
|
-
return { media: null, hasEdits: false };
|
|
594
|
-
}
|
|
595
|
-
const { getEditedEntityRecord, hasEditsForEntityRecord } =
|
|
596
|
-
select( coreStore );
|
|
597
|
-
return {
|
|
598
|
-
media: getEditedEntityRecord(
|
|
599
|
-
'postType',
|
|
600
|
-
'attachment',
|
|
601
|
-
id
|
|
602
|
-
) as Media,
|
|
603
|
-
hasEdits: hasEditsForEntityRecord(
|
|
604
|
-
'postType',
|
|
605
|
-
'attachment',
|
|
606
|
-
id
|
|
607
|
-
),
|
|
608
|
-
};
|
|
609
|
-
},
|
|
610
|
-
[ id ]
|
|
611
|
-
);
|
|
46
|
+
const { closeMediaEditorModal } = useDispatch( mediaEditorStore );
|
|
612
47
|
|
|
613
48
|
if ( ! isModalOpen || ! id ) {
|
|
614
49
|
return null;
|
|
615
50
|
}
|
|
616
51
|
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
// `key` remounts the provider when the edited attachment changes,
|
|
621
|
-
// discarding the previous cropper state. Keying on `id` (rather than
|
|
622
|
-
// `media?.id`) avoids a remount when `media` resolves from `null` to
|
|
623
|
-
// the loaded record on open — that flip would otherwise re-run the
|
|
624
|
-
// modal's entry animation and cause a visible flicker.
|
|
52
|
+
const portalElement =
|
|
53
|
+
typeof document === 'undefined' ? null : document.body;
|
|
54
|
+
|
|
625
55
|
return (
|
|
626
|
-
<
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
56
|
+
<MediaEditor
|
|
57
|
+
id={ id }
|
|
58
|
+
fields={ fields }
|
|
59
|
+
aspectRatioPresets={ aspectRatioPresets }
|
|
60
|
+
showCloseButton
|
|
61
|
+
shouldCloseOnEsc
|
|
62
|
+
noticesClassName="media-editor-modal__snackbar"
|
|
63
|
+
noticesPortalElement={ portalElement }
|
|
64
|
+
onClose={ closeMediaEditorModal }
|
|
65
|
+
onSaved={ ( { id: savedId, url } ) => {
|
|
66
|
+
if ( savedId && onUpdate ) {
|
|
67
|
+
const update: MediaEditorModalUpdate = {
|
|
68
|
+
id: savedId,
|
|
69
|
+
url,
|
|
70
|
+
};
|
|
71
|
+
onUpdate( update );
|
|
72
|
+
}
|
|
73
|
+
closeMediaEditorModal();
|
|
74
|
+
} }
|
|
75
|
+
renderFrame={ ( {
|
|
76
|
+
children,
|
|
77
|
+
headerActions,
|
|
78
|
+
onRequestClose,
|
|
79
|
+
onKeyDown,
|
|
80
|
+
shouldCloseOnClickOutside,
|
|
81
|
+
} ) => (
|
|
82
|
+
<Modal
|
|
83
|
+
className="media-editor-modal"
|
|
84
|
+
title={ __( 'Edit media' ) }
|
|
85
|
+
size="fill"
|
|
86
|
+
isDismissible={ false }
|
|
87
|
+
shouldCloseOnClickOutside={ shouldCloseOnClickOutside }
|
|
88
|
+
onKeyDown={ onKeyDown }
|
|
89
|
+
onRequestClose={ onRequestClose }
|
|
90
|
+
headerActions={ headerActions }
|
|
91
|
+
>
|
|
92
|
+
{ children }
|
|
93
|
+
</Modal>
|
|
94
|
+
) }
|
|
95
|
+
/>
|
|
636
96
|
);
|
|
637
97
|
}
|
|
638
98
|
|