@wordpress/media-editor 0.17.0 → 0.17.2-next.v.202608281122.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -1
- package/build/components/media-editor/index.cjs +152 -133
- package/build/components/media-editor/index.cjs.map +3 -3
- package/build/components/media-editor-crop-panel/index.cjs +2 -3
- package/build/components/media-editor-crop-panel/index.cjs.map +2 -2
- package/build/components/media-editor-modal/index.cjs +7 -21
- package/build/components/media-editor-modal/index.cjs.map +2 -2
- package/build-module/components/media-editor/index.mjs +154 -140
- package/build-module/components/media-editor/index.mjs.map +2 -2
- package/build-module/components/media-editor-crop-panel/index.mjs +2 -3
- package/build-module/components/media-editor-crop-panel/index.mjs.map +2 -2
- package/build-module/components/media-editor-modal/index.mjs +9 -23
- package/build-module/components/media-editor-modal/index.mjs.map +2 -2
- package/build-style/style-rtl.css +61 -94
- package/build-style/style.css +61 -94
- package/build-types/components/media-editor/index.d.ts +7 -14
- package/build-types/components/media-editor/index.d.ts.map +1 -1
- package/build-types/components/media-editor-crop-panel/index.d.ts +4 -11
- package/build-types/components/media-editor-crop-panel/index.d.ts.map +1 -1
- package/build-types/components/media-editor-modal/index.d.ts.map +1 -1
- package/package.json +19 -20
- package/src/components/media-editor/index.tsx +276 -200
- package/src/components/media-editor/style.scss +136 -134
- package/src/components/media-editor-crop-panel/index.tsx +4 -12
- package/src/components/media-editor-crop-panel/test/index.tsx +2 -10
- package/src/components/media-editor-modal/index.tsx +9 -29
- package/src/components/media-editor-modal/style.scss +8 -49
- package/tsconfig.build.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
@use "@wordpress/base-styles/breakpoints" as
|
|
1
|
+
@use "@wordpress/base-styles/breakpoints" as *;
|
|
2
2
|
@use "@wordpress/base-styles/colors" as *;
|
|
3
3
|
@use "@wordpress/base-styles/mixins" as *;
|
|
4
4
|
@use "@wordpress/base-styles/variables" as *;
|
|
@@ -17,72 +17,96 @@
|
|
|
17
17
|
justify-content: center;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
// selector ties the reset's specificity, so source order lets it win and
|
|
37
|
-
// pushes the editor (and the fine-rotation ruler under the canvas) down
|
|
38
|
-
// inside our full-screen modal that already overlays the admin bar.
|
|
39
|
-
// Re-assert `top` at a specificity that beats it, anchored on the modal
|
|
40
|
-
// frame (`.media-editor` only ever renders inside `.media-editor-modal`).
|
|
41
|
-
.media-editor-modal & .interface-interface-skeleton.interface-interface-skeleton {
|
|
42
|
-
top: auto;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.interface-interface-skeleton__editor {
|
|
46
|
-
min-width: 0;
|
|
20
|
+
// The media editor owns this layout rather than borrowing
|
|
21
|
+
// `InterfaceSkeleton`, whose header/footer/secondary-sidebar slots,
|
|
22
|
+
// distraction-free mode and admin-bar offsets were all unused here and had
|
|
23
|
+
// to be reset in CSS.
|
|
24
|
+
//
|
|
25
|
+
// Below `small` one view fills it at a time, switched from the header.
|
|
26
|
+
// From `small` up the canvas and the panel are columns side by side.
|
|
27
|
+
//
|
|
28
|
+
// A containment context, so the canvas can size itself against the room
|
|
29
|
+
// it actually has rather than the viewport. The two differ by whatever
|
|
30
|
+
// chrome the host puts beside the editor: none in the modal, but 160px
|
|
31
|
+
// of wp-admin menu in the route until it folds at 960px.
|
|
32
|
+
.media-editor__body {
|
|
33
|
+
container-type: inline-size;
|
|
34
|
+
container-name: media-editor-body;
|
|
35
|
+
display: flex;
|
|
47
36
|
flex: 1;
|
|
37
|
+
min-height: 0;
|
|
48
38
|
}
|
|
49
39
|
|
|
50
|
-
// Canvas column:
|
|
51
|
-
//
|
|
40
|
+
// Canvas column: the grey stage on top, the controls that act on it
|
|
41
|
+
// beneath. The column itself is transparent — only the stage is grey.
|
|
52
42
|
.media-editor__content {
|
|
53
43
|
display: flex;
|
|
54
44
|
flex: 1;
|
|
55
45
|
flex-direction: column;
|
|
46
|
+
min-width: 0;
|
|
56
47
|
min-height: 0;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
margin: $grid-unit-30 $grid-unit-30 $grid-unit-10 $grid-unit-30;
|
|
49
|
+
|
|
50
|
+
// The panel docks from `small`, so between there and `large` the
|
|
51
|
+
// canvas takes whatever the 320px panel leaves — about 200px at
|
|
52
|
+
// 600px, 380px at 782px. Cramped, but a cramped preview beside
|
|
53
|
+
// reachable controls beats a panel that hides the image outright.
|
|
54
|
+
@include break-small() {
|
|
55
|
+
margin: 0 $grid-unit-30;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Promise the canvas a floor only where the body is wide enough to
|
|
59
|
+
// keep it: 520px canvas + 320px panel + this column's 24px gutter.
|
|
60
|
+
// Asking for it below that pushes the layout past its container
|
|
61
|
+
// instead of shrinking the canvas, which is what put a scrollbar on
|
|
62
|
+
// the route between 961px and 1024px — wide enough for the floor by
|
|
63
|
+
// viewport, but not once the wp-admin menu had taken its 160px.
|
|
64
|
+
@container media-editor-body (min-width: #{520px + 320px + $grid-unit-30}) {
|
|
65
|
+
min-width: 520px;
|
|
66
|
+
}
|
|
64
67
|
}
|
|
65
68
|
|
|
69
|
+
// The fine-rotation ruler and, below `small`, the rotate/flip/zoom
|
|
70
|
+
// controls: ruler on top, controls below, centred. Sized to its content
|
|
71
|
+
// (`flex: 0 0 auto`) so the stage above keeps every pixel the toolbar
|
|
72
|
+
// doesn't need. Transparent itself — only the ruler takes the grey.
|
|
66
73
|
.media-editor__canvas-toolbar {
|
|
67
74
|
display: flex;
|
|
68
|
-
flex
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
background: $gray-200;
|
|
73
|
-
padding: $grid-unit-10 $grid-unit-20;
|
|
75
|
+
flex: 0 0 auto;
|
|
76
|
+
flex-direction: column;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: $grid-unit-15;
|
|
74
79
|
|
|
80
|
+
// The ruler strip carries the canvas grey, as on trunk, so it reads as
|
|
81
|
+
// the same surface the image sits on: the band spans the column while
|
|
82
|
+
// the ruler itself is capped and centred within it. The controls
|
|
83
|
+
// below stay on the modal's own background — they act on the image
|
|
84
|
+
// but are not part of it.
|
|
75
85
|
.media-editor-fine-rotation {
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
display: flex;
|
|
87
|
+
justify-content: center;
|
|
88
|
+
align-self: stretch;
|
|
89
|
+
background: $gray-200;
|
|
90
|
+
border-radius: 0 0 $radius-large $radius-large;
|
|
91
|
+
padding: $grid-unit-10 $grid-unit-20;
|
|
92
|
+
|
|
93
|
+
// Trunk's measure for the ruler itself (`flex: 0 1 360px` there,
|
|
94
|
+
// where the strip was a row); the grey band around it spans.
|
|
95
|
+
.rotation-ruler {
|
|
96
|
+
flex: 0 1 360px;
|
|
97
|
+
min-width: 0;
|
|
98
|
+
}
|
|
78
99
|
}
|
|
79
100
|
}
|
|
80
101
|
|
|
102
|
+
// The stage: the surface the image sits on. Fully rounded on its own —
|
|
103
|
+
// non-image media has no ruler band beneath it (see `:has` below).
|
|
81
104
|
.media-editor__canvas-area {
|
|
82
105
|
display: flex;
|
|
83
106
|
align-items: center;
|
|
84
107
|
justify-content: center;
|
|
85
108
|
background: $gray-200;
|
|
109
|
+
border-radius: $radius-large;
|
|
86
110
|
overflow: auto;
|
|
87
111
|
flex: 1;
|
|
88
112
|
min-height: 0;
|
|
@@ -99,114 +123,92 @@
|
|
|
99
123
|
}
|
|
100
124
|
}
|
|
101
125
|
|
|
126
|
+
// Settings panel. Below `small` it takes the whole body: there is no room
|
|
127
|
+
// to put a 320px column beside a canvas worth looking at, and that is
|
|
128
|
+
// also where the transform controls fall back to a row under the canvas.
|
|
129
|
+
// From `small` up it docks as a column, so cropping and previewing happen
|
|
130
|
+
// together — the canvas is tight at the bottom of that range but present,
|
|
131
|
+
// where a full-screen panel would have hidden it completely.
|
|
102
132
|
.media-editor__sidebar {
|
|
103
|
-
|
|
133
|
+
display: flex;
|
|
134
|
+
flex: 1;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
min-width: 0;
|
|
137
|
+
min-height: 0;
|
|
138
|
+
// No scrolling here: the tab strip has to stay put while the fields
|
|
139
|
+
// move, so the open pane is the scroll container instead.
|
|
140
|
+
overflow: hidden;
|
|
104
141
|
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
// still clips the 2px focus outline.
|
|
142
|
+
// The `sm` surface-width token, up from the 280px `$sidebar-width`
|
|
143
|
+
// this used to inherit: #81121 reports the panel reading as squished
|
|
144
|
+
// at roughly 250px, with four editable fields stacked above six
|
|
145
|
+
// read-only facts.
|
|
110
146
|
@include break-small() {
|
|
111
|
-
|
|
147
|
+
flex: none;
|
|
148
|
+
width: var(--wpds-dimension-surface-width-sm);
|
|
112
149
|
}
|
|
113
150
|
}
|
|
114
151
|
|
|
115
|
-
.
|
|
116
|
-
|
|
152
|
+
// The strip and the open pane, stacked. No inline padding: the pane below
|
|
153
|
+
// scrolls, and a gutter here would inset its scrollbar from the sidebar
|
|
154
|
+
// edge. The strip and the pane carry their own instead.
|
|
155
|
+
.media-editor__tabs {
|
|
156
|
+
display: flex;
|
|
157
|
+
flex: 1;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
min-height: 0;
|
|
117
160
|
}
|
|
118
161
|
|
|
119
|
-
//
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
//
|
|
125
|
-
.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
162
|
+
// Wraps `Tabs.List`, which sizes itself to its tabs and so cannot carry a
|
|
163
|
+
// rule across the strip. A sibling of the scrolling pane rather than a
|
|
164
|
+
// sticky box inside it, so it holds its place without joining the scroll
|
|
165
|
+
// container — which is what lets the pane's scrollbar reach the edge.
|
|
166
|
+
//
|
|
167
|
+
// Margin, not padding: the rule below is drawn on this box's edge, so an
|
|
168
|
+
// inset from inside would still run the sidebar's full width. The margin
|
|
169
|
+
// pulls the box in instead, ending the rule where the tabs and the fields
|
|
170
|
+
// below it start.
|
|
171
|
+
.media-editor__tablist {
|
|
172
|
+
flex-shrink: 0;
|
|
173
|
+
margin-inline: $grid-unit-30;
|
|
174
|
+
background: $white;
|
|
175
|
+
border-bottom: $border-width solid $gray-300;
|
|
129
176
|
}
|
|
130
177
|
|
|
131
|
-
//
|
|
132
|
-
//
|
|
133
|
-
//
|
|
178
|
+
// The scrolling pane. Full width so its scrollbar sits against the
|
|
179
|
+
// sidebar edge; the gutter is padding here rather than margin so the
|
|
180
|
+
// scrollbar stays outside it. Matches the canvas column's inline margin,
|
|
181
|
+
// so the fields line up with the image when the panel is closed.
|
|
134
182
|
.media-editor__panel {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
183
|
+
flex: 1;
|
|
184
|
+
min-height: 0;
|
|
185
|
+
overflow-y: auto;
|
|
186
|
+
padding-block: $grid-unit-30;
|
|
187
|
+
padding-inline: $grid-unit-30;
|
|
140
188
|
}
|
|
141
189
|
|
|
142
|
-
//
|
|
143
|
-
//
|
|
144
|
-
//
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// When the sidebar is not a full page column, we offset the header to match the overall gutter.
|
|
152
|
-
@include break-small() {
|
|
153
|
-
margin-right: $grid-unit-30;
|
|
154
|
-
}
|
|
155
|
-
.components-button.has-icon {
|
|
156
|
-
padding: 0;
|
|
157
|
-
|
|
158
|
-
@include break-small() {
|
|
159
|
-
display: flex;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
190
|
+
// The ruler band shares the canvas grey and sits flush under it, so the
|
|
191
|
+
// two are one panel with four rounded corners rather than two stacked
|
|
192
|
+
// cards: the canvas gives up its bottom corners and the band takes them.
|
|
193
|
+
// Keyed on the band actually being there — non-image media has no ruler,
|
|
194
|
+
// and its canvas stays rounded all round.
|
|
195
|
+
.media-editor__content:has(.media-editor-fine-rotation) .media-editor__canvas-area {
|
|
196
|
+
border-end-start-radius: 0;
|
|
197
|
+
border-end-end-radius: 0;
|
|
162
198
|
}
|
|
163
199
|
|
|
164
|
-
// `
|
|
165
|
-
//
|
|
166
|
-
//
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// the only way to beat an inline style). `:has(__fill)` scopes the changes
|
|
170
|
-
// to when the panel is actually open: the skeleton sidebar wrapper is always
|
|
171
|
-
// present (empty when closed), so touching it unconditionally would paint an
|
|
172
|
-
// empty box over the canvas.
|
|
173
|
-
|
|
174
|
-
// Column (small–medium): between 600px and 782px `ComplementaryArea` is
|
|
175
|
-
// still in its mobile mode (inline `100vw`, see above) and the skeleton
|
|
176
|
-
// sidebar is absolutely positioned, so pull the open panel back in-flow at
|
|
177
|
-
// the sidebar width to sit it beside the canvas as a column.
|
|
178
|
-
//
|
|
179
|
-
// Bounded *below* the medium breakpoint on purpose. From 782px up,
|
|
180
|
-
// `InterfaceSkeleton` already makes the sidebar a `position: relative`,
|
|
181
|
-
// `width: auto` column and `ComplementaryArea` animates its width to
|
|
182
|
-
// `$sidebar-width` — exactly like the main editor. Pinning the width with
|
|
183
|
-
// `!important` there would freeze that open/close tween (the panel would
|
|
184
|
-
// sit mounted and unchanged for the animation's duration, then pop in or
|
|
185
|
-
// out), so we leave it to the skeleton. Below 782px there's nothing to
|
|
186
|
-
// freeze: `ComplementaryArea` zeroes the animation duration in mobile mode.
|
|
187
|
-
@media (min-width: #{ breakpoints.$break-small }) and (max-width: #{ (breakpoints.$break-medium - 1) }) {
|
|
188
|
-
.interface-interface-skeleton__sidebar:has(.interface-complementary-area__fill) {
|
|
189
|
-
position: relative !important;
|
|
190
|
-
}
|
|
200
|
+
// Below `small` an open panel owns the body, so the canvas steps aside
|
|
201
|
+
// rather than being squeezed into an unusable sliver. Keyed on any panel
|
|
202
|
+
// being open rather than on which one: no rule needs to tell them apart.
|
|
203
|
+
.media-editor__body.has-panel-open .media-editor__content {
|
|
204
|
+
display: none;
|
|
191
205
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
206
|
+
@include break-small() {
|
|
207
|
+
display: flex;
|
|
208
|
+
margin: 0 0 0 $grid-unit-30;
|
|
195
209
|
}
|
|
196
210
|
}
|
|
197
211
|
|
|
198
|
-
// Overlay (< small): the open panel fills the modal width (it would
|
|
199
|
-
// otherwise shrink-wrap, since the inline `100vw` is overridden below).
|
|
200
|
-
@media (max-width: #{ (breakpoints.$break-small - 1) }) {
|
|
201
|
-
.interface-interface-skeleton__sidebar:has(.interface-complementary-area__fill) {
|
|
202
|
-
width: 100%;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.interface-complementary-area__fill,
|
|
206
|
-
.interface-complementary-area {
|
|
207
|
-
width: 100% !important;
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
212
|
}
|
|
211
213
|
|
|
212
214
|
.media-editor__snackbar {
|
|
@@ -16,29 +16,21 @@ export interface MediaEditorCropPanelProps {
|
|
|
16
16
|
onAspectRatioChange: ( value: string ) => void;
|
|
17
17
|
/** Aspect-ratio presets to display in the selector. */
|
|
18
18
|
aspectRatioOptions: AspectRatioPreset[];
|
|
19
|
-
/**
|
|
20
|
-
* When `true`, render the rotate/flip/zoom image controls at the top of
|
|
21
|
-
* the panel. Used on wide viewports where the footer no longer carries
|
|
22
|
-
* them.
|
|
23
|
-
*/
|
|
24
|
-
showTransformControls?: boolean;
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
/**
|
|
28
|
-
* Sidebar panel for crop controls
|
|
29
|
-
*
|
|
30
|
-
*
|
|
22
|
+
* Sidebar panel for crop controls: rotate, flip and zoom above the
|
|
23
|
+
* aspect-ratio selector. Rendered where the panel docks; below that the
|
|
24
|
+
* transform controls sit under the canvas instead, placed by the editor.
|
|
31
25
|
* @param props
|
|
32
26
|
* @param props.aspectRatioValue
|
|
33
27
|
* @param props.onAspectRatioChange
|
|
34
28
|
* @param props.aspectRatioOptions
|
|
35
|
-
* @param props.showTransformControls
|
|
36
29
|
*/
|
|
37
30
|
export default function MediaEditorCropPanel( {
|
|
38
31
|
aspectRatioValue,
|
|
39
32
|
onAspectRatioChange,
|
|
40
33
|
aspectRatioOptions,
|
|
41
|
-
showTransformControls = false,
|
|
42
34
|
}: MediaEditorCropPanelProps ) {
|
|
43
35
|
return (
|
|
44
36
|
// Tag the whole panel as a crop-control region so the modal's
|
|
@@ -52,7 +44,7 @@ export default function MediaEditorCropPanel( {
|
|
|
52
44
|
<VisuallyHidden render={ <h2 /> }>
|
|
53
45
|
{ __( 'Crop options' ) }
|
|
54
46
|
</VisuallyHidden>
|
|
55
|
-
|
|
47
|
+
<MediaEditorImageControls withLabels />
|
|
56
48
|
<SelectControl
|
|
57
49
|
label={ __( 'Aspect ratio' ) }
|
|
58
50
|
value={ aspectRatioValue }
|
|
@@ -44,17 +44,9 @@ describe( 'MediaEditorCropPanel', () => {
|
|
|
44
44
|
).toBe( '0' );
|
|
45
45
|
} );
|
|
46
46
|
|
|
47
|
-
it( '
|
|
47
|
+
it( 'renders rotate, flip and zoom controls', () => {
|
|
48
48
|
setupCropPanel();
|
|
49
49
|
|
|
50
|
-
expect( screen.queryByText( 'Rotate' ) ).not.toBeInTheDocument();
|
|
51
|
-
expect( screen.queryByText( 'Flip' ) ).not.toBeInTheDocument();
|
|
52
|
-
expect( screen.queryByText( 'Zoom' ) ).not.toBeInTheDocument();
|
|
53
|
-
} );
|
|
54
|
-
|
|
55
|
-
it( 'renders rotate, flip and zoom controls when showTransformControls is set', () => {
|
|
56
|
-
setupCropPanel( { showTransformControls: true } );
|
|
57
|
-
|
|
58
50
|
expect( screen.getByText( 'Rotate' ) ).toBeInTheDocument();
|
|
59
51
|
expect( screen.getByText( 'Flip' ) ).toBeInTheDocument();
|
|
60
52
|
expect( screen.getByText( 'Zoom' ) ).toBeInTheDocument();
|
|
@@ -67,7 +59,7 @@ describe( 'MediaEditorCropPanel', () => {
|
|
|
67
59
|
} );
|
|
68
60
|
|
|
69
61
|
it( 'renders the image controls above the aspect-ratio selector', () => {
|
|
70
|
-
setupCropPanel(
|
|
62
|
+
setupCropPanel();
|
|
71
63
|
|
|
72
64
|
const rotate = screen.getByText( 'Rotate' );
|
|
73
65
|
const aspectRatio = screen.getByLabelText( 'Aspect ratio' );
|
|
@@ -26,40 +26,21 @@ interface MediaEditorModalProps {
|
|
|
26
26
|
aspectRatioPresets?: AspectRatioPreset[];
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
interface ModalFooterProps {
|
|
30
|
-
layout: 'wide' | 'narrow';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
29
|
/**
|
|
34
|
-
* The modal's footer chrome. The fine-rotation ruler
|
|
35
|
-
* canvas (in `media-editor__content`), never here, so
|
|
36
|
-
*
|
|
37
|
-
*
|
|
30
|
+
* The modal's footer chrome. The fine-rotation ruler and the image controls
|
|
31
|
+
* both live under the canvas (in `media-editor__content`), never here, so the
|
|
32
|
+
* footer has one layout at every width: History on the left, Cancel/Save on
|
|
33
|
+
* the right.
|
|
38
34
|
*/
|
|
39
|
-
function ModalFooter(
|
|
35
|
+
function ModalFooter() {
|
|
40
36
|
return (
|
|
41
37
|
<div
|
|
42
|
-
className=
|
|
38
|
+
className="media-editor-modal__footer"
|
|
43
39
|
role="region"
|
|
44
40
|
aria-label={ __( 'Editor actions' ) }
|
|
45
41
|
>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
// panel, so the footer is just History + Cancel/Save.
|
|
49
|
-
<>
|
|
50
|
-
<MediaEditor.HistoryActions />
|
|
51
|
-
<MediaEditor.SaveActions />
|
|
52
|
-
</>
|
|
53
|
-
) : (
|
|
54
|
-
// Sidebar collapsed: the image controls drop into the footer.
|
|
55
|
-
<>
|
|
56
|
-
<MediaEditor.ImageControls />
|
|
57
|
-
<div className="media-editor-modal__footer-row">
|
|
58
|
-
<MediaEditor.HistoryActions />
|
|
59
|
-
<MediaEditor.SaveActions />
|
|
60
|
-
</div>
|
|
61
|
-
</>
|
|
62
|
-
) }
|
|
42
|
+
<MediaEditor.HistoryActions />
|
|
43
|
+
<MediaEditor.SaveActions />
|
|
63
44
|
</div>
|
|
64
45
|
);
|
|
65
46
|
}
|
|
@@ -144,7 +125,6 @@ export function MediaEditorModal( {
|
|
|
144
125
|
} }
|
|
145
126
|
renderFrame={ ( {
|
|
146
127
|
children,
|
|
147
|
-
layout,
|
|
148
128
|
onRequestClose,
|
|
149
129
|
onKeyDown,
|
|
150
130
|
shouldCloseOnClickOutside,
|
|
@@ -166,7 +146,7 @@ export function MediaEditorModal( {
|
|
|
166
146
|
}
|
|
167
147
|
>
|
|
168
148
|
{ children }
|
|
169
|
-
<ModalFooter
|
|
149
|
+
<ModalFooter />
|
|
170
150
|
</Modal>
|
|
171
151
|
</ShortcutProvider>
|
|
172
152
|
) }
|
|
@@ -21,61 +21,20 @@
|
|
|
21
21
|
min-height: 0;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
// Footer chrome
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// `flex-direction: column` (image controls above the History |
|
|
28
|
-
// Cancel/Save row). Each layout has its own JSX tree (not `order`
|
|
29
|
-
// reshuffling, which the project's stylelint rule treats as an a11y red
|
|
30
|
-
// flag), so DOM order always matches visual order.
|
|
24
|
+
// Footer chrome. The image controls live under the canvas at every viewport,
|
|
25
|
+
// so the footer has a single layout at every width: History on the left,
|
|
26
|
+
// Cancel/Save on the right.
|
|
31
27
|
.media-editor-modal.components-modal__frame .media-editor-modal__footer {
|
|
32
28
|
flex-shrink: 0;
|
|
33
29
|
display: flex;
|
|
34
|
-
|
|
35
|
-
// Borderless: sections are demarcated by the inset canvas panel and
|
|
36
|
-
// spacing, not divider lines. 16px top / 32px sides / 24px bottom.
|
|
37
|
-
padding: $grid-unit-20 $grid-unit-40 $grid-unit-30;
|
|
38
|
-
background: $white;
|
|
39
|
-
// Above the `.interface-interface-skeleton__sidebar` which has a z-index of 100000.
|
|
40
|
-
z-index: z-index(".media-editor-modal__footer");
|
|
41
|
-
|
|
42
|
-
&.is-wide {
|
|
43
|
-
flex-direction: row;
|
|
44
|
-
align-items: center;
|
|
45
|
-
|
|
46
|
-
// Panel mode: the footer holds only History (left) and
|
|
47
|
-
// Cancel/Save (right). `margin-left: auto` pins the actions to the
|
|
48
|
-
// right edge whether or not History renders (e.g. non-image
|
|
49
|
-
// attachments show only `SaveActions`).
|
|
50
|
-
.media-editor__save-actions {
|
|
51
|
-
margin-left: auto;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&.is-narrow {
|
|
56
|
-
flex-direction: column;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// Narrow only: image controls sit on their own row, centered.
|
|
60
|
-
&.is-narrow > .media-editor-image-controls {
|
|
61
|
-
align-self: center;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Secondary row used by medium (History + Image controls + Cancel/Save) and
|
|
66
|
-
// narrow (History + Cancel/Save). `margin-left: auto` on the image controls
|
|
67
|
-
// cluster and on Cancel/Save splits any free space — History gets the
|
|
68
|
-
// left edge, Cancel/Save the right edge, and the image controls (when
|
|
69
|
-
// present, i.e. medium only) approximately centers. Exact centering only
|
|
70
|
-
// holds when History and Cancel/Save have matching widths; in practice
|
|
71
|
-
// they're close enough that the offset is imperceptible.
|
|
72
|
-
.media-editor-modal__footer-row {
|
|
73
|
-
display: flex;
|
|
74
|
-
flex-wrap: wrap;
|
|
30
|
+
flex-direction: row;
|
|
75
31
|
align-items: center;
|
|
76
32
|
gap: $grid-unit-20;
|
|
33
|
+
padding: $grid-unit-30;
|
|
34
|
+
background: $white;
|
|
77
35
|
|
|
78
|
-
|
|
36
|
+
// `margin-left: auto` pins the actions to the right edge whether or not
|
|
37
|
+
// History renders (e.g. non-image attachments show only `SaveActions`).
|
|
79
38
|
.media-editor__save-actions {
|
|
80
39
|
margin-left: auto;
|
|
81
40
|
}
|
package/tsconfig.build.json
CHANGED
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
},
|
|
8
8
|
"references": [
|
|
9
9
|
{ "path": "../a11y/tsconfig.build.json" },
|
|
10
|
+
{ "path": "../admin-ui/tsconfig.build.json" },
|
|
10
11
|
{ "path": "../api-fetch/tsconfig.build.json" },
|
|
11
12
|
{ "path": "../components/tsconfig.build.json" },
|
|
12
13
|
{ "path": "../compose/tsconfig.build.json" },
|
|
13
14
|
{ "path": "../core-data/tsconfig.build.json" },
|
|
14
15
|
{ "path": "../data" },
|
|
15
16
|
{ "path": "../dataviews/tsconfig.build.json" },
|
|
16
|
-
{ "path": "../date" },
|
|
17
17
|
{ "path": "../element/tsconfig.build.json" },
|
|
18
18
|
{ "path": "../i18n/tsconfig.build.json" },
|
|
19
19
|
{ "path": "../icons/tsconfig.build.json" },
|