@wordpress/editor 13.8.0 → 13.10.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/entities-saved-states/index.js +59 -13
  3. package/build/components/entities-saved-states/index.js.map +1 -1
  4. package/build/components/post-featured-image/index.js +24 -29
  5. package/build/components/post-featured-image/index.js.map +1 -1
  6. package/build/components/post-saved-state/index.js +0 -8
  7. package/build/components/post-saved-state/index.js.map +1 -1
  8. package/build/components/post-switch-to-draft-button/index.js +9 -4
  9. package/build/components/post-switch-to-draft-button/index.js.map +1 -1
  10. package/build/components/post-template/index.js +1 -7
  11. package/build/components/post-template/index.js.map +1 -1
  12. package/build/components/post-title/index.native.js +41 -11
  13. package/build/components/post-title/index.native.js.map +1 -1
  14. package/build/hooks/custom-sources-backwards-compatibility.js +2 -8
  15. package/build/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  16. package/build-module/components/entities-saved-states/index.js +60 -13
  17. package/build-module/components/entities-saved-states/index.js.map +1 -1
  18. package/build-module/components/post-featured-image/index.js +26 -32
  19. package/build-module/components/post-featured-image/index.js.map +1 -1
  20. package/build-module/components/post-saved-state/index.js +0 -7
  21. package/build-module/components/post-saved-state/index.js.map +1 -1
  22. package/build-module/components/post-switch-to-draft-button/index.js +12 -7
  23. package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
  24. package/build-module/components/post-template/index.js +1 -6
  25. package/build-module/components/post-template/index.js.map +1 -1
  26. package/build-module/components/post-title/index.native.js +41 -11
  27. package/build-module/components/post-title/index.native.js.map +1 -1
  28. package/build-module/hooks/custom-sources-backwards-compatibility.js +2 -7
  29. package/build-module/hooks/custom-sources-backwards-compatibility.js.map +1 -1
  30. package/build-style/style-rtl.css +37 -15
  31. package/build-style/style.css +37 -15
  32. package/package.json +31 -32
  33. package/src/components/entities-saved-states/index.js +65 -21
  34. package/src/components/post-featured-image/index.js +26 -35
  35. package/src/components/post-featured-image/style.scss +38 -14
  36. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +3 -1
  37. package/src/components/post-saved-state/index.js +0 -7
  38. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +0 -9
  39. package/src/components/post-saved-state/test/index.js +0 -10
  40. package/src/components/post-switch-to-draft-button/index.js +7 -6
  41. package/src/components/post-taxonomies/style.scss +4 -4
  42. package/src/components/post-template/index.js +5 -6
  43. package/src/components/post-title/index.native.js +31 -8
  44. package/src/components/post-trash/style.scss +1 -3
  45. package/src/hooks/custom-sources-backwards-compatibility.js +2 -7
@@ -282,10 +282,6 @@
282
282
  .editor-post-featured-image {
283
283
  padding: 0;
284
284
  }
285
- .editor-post-featured-image__container {
286
- margin-bottom: 1em;
287
- position: relative;
288
- }
289
285
  .editor-post-featured-image .components-spinner {
290
286
  position: absolute;
291
287
  top: 50%;
@@ -293,22 +289,28 @@
293
289
  margin-top: -9px;
294
290
  margin-right: -9px;
295
291
  }
296
- .editor-post-featured-image .components-button + .components-button {
297
- display: block;
298
- margin-top: 1em;
299
- }
300
292
  .editor-post-featured-image .components-responsive-wrapper__content {
301
293
  max-width: 100%;
302
294
  width: auto;
303
295
  }
304
296
 
297
+ .editor-post-featured-image__container {
298
+ position: relative;
299
+ }
300
+ .editor-post-featured-image__container:hover .editor-post-featured-image__actions, .editor-post-featured-image__container:focus .editor-post-featured-image__actions, .editor-post-featured-image__container:focus-within .editor-post-featured-image__actions {
301
+ opacity: 1;
302
+ }
303
+
305
304
  .editor-post-featured-image__toggle,
306
305
  .editor-post-featured-image__preview {
307
- display: block;
308
306
  width: 100%;
309
307
  padding: 0;
310
308
  transition: all 0.1s ease-out;
311
309
  box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
310
+ overflow: hidden;
311
+ display: flex;
312
+ justify-content: center;
313
+ max-height: 150px;
312
314
  }
313
315
  @media (prefers-reduced-motion: reduce) {
314
316
  .editor-post-featured-image__toggle,
@@ -321,9 +323,9 @@
321
323
  .editor-post-featured-image__preview {
322
324
  height: auto;
323
325
  }
324
-
325
- .editor-post-featured-image__preview:not(:disabled):not([aria-disabled=true]):focus {
326
- box-shadow: 0 0 0 4px var(--wp-admin-theme-color);
326
+ .editor-post-featured-image__preview .components-responsive-wrapper {
327
+ width: 100%;
328
+ background: #f0f0f0;
327
329
  }
328
330
 
329
331
  .editor-post-featured-image__toggle {
@@ -339,6 +341,28 @@
339
341
  color: #1e1e1e;
340
342
  }
341
343
 
344
+ .editor-post-featured-image__actions {
345
+ bottom: 0;
346
+ opacity: 0;
347
+ padding: 8px;
348
+ position: absolute;
349
+ transition: opacity 50ms ease-out;
350
+ }
351
+ @media (prefers-reduced-motion: reduce) {
352
+ .editor-post-featured-image__actions {
353
+ transition-duration: 0s;
354
+ transition-delay: 0s;
355
+ }
356
+ }
357
+
358
+ .editor-post-featured-image__action {
359
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
360
+ backdrop-filter: blur(16px) saturate(180%);
361
+ background: rgba(255, 255, 255, 0.75);
362
+ flex-grow: 1;
363
+ justify-content: center;
364
+ }
365
+
342
366
  [class].editor-post-format__suggestion {
343
367
  margin: 4px 0 0 0;
344
368
  }
@@ -833,10 +857,8 @@
833
857
  }
834
858
 
835
859
  .editor-post-trash.components-button {
836
- display: flex;
837
- justify-content: center;
838
- margin-top: 4px;
839
860
  width: 100%;
861
+ display: block;
840
862
  }
841
863
 
842
864
  .table-of-contents__popover.components-popover .components-popover__content {
@@ -282,10 +282,6 @@
282
282
  .editor-post-featured-image {
283
283
  padding: 0;
284
284
  }
285
- .editor-post-featured-image__container {
286
- margin-bottom: 1em;
287
- position: relative;
288
- }
289
285
  .editor-post-featured-image .components-spinner {
290
286
  position: absolute;
291
287
  top: 50%;
@@ -293,22 +289,28 @@
293
289
  margin-top: -9px;
294
290
  margin-left: -9px;
295
291
  }
296
- .editor-post-featured-image .components-button + .components-button {
297
- display: block;
298
- margin-top: 1em;
299
- }
300
292
  .editor-post-featured-image .components-responsive-wrapper__content {
301
293
  max-width: 100%;
302
294
  width: auto;
303
295
  }
304
296
 
297
+ .editor-post-featured-image__container {
298
+ position: relative;
299
+ }
300
+ .editor-post-featured-image__container:hover .editor-post-featured-image__actions, .editor-post-featured-image__container:focus .editor-post-featured-image__actions, .editor-post-featured-image__container:focus-within .editor-post-featured-image__actions {
301
+ opacity: 1;
302
+ }
303
+
305
304
  .editor-post-featured-image__toggle,
306
305
  .editor-post-featured-image__preview {
307
- display: block;
308
306
  width: 100%;
309
307
  padding: 0;
310
308
  transition: all 0.1s ease-out;
311
309
  box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
310
+ overflow: hidden;
311
+ display: flex;
312
+ justify-content: center;
313
+ max-height: 150px;
312
314
  }
313
315
  @media (prefers-reduced-motion: reduce) {
314
316
  .editor-post-featured-image__toggle,
@@ -321,9 +323,9 @@
321
323
  .editor-post-featured-image__preview {
322
324
  height: auto;
323
325
  }
324
-
325
- .editor-post-featured-image__preview:not(:disabled):not([aria-disabled=true]):focus {
326
- box-shadow: 0 0 0 4px var(--wp-admin-theme-color);
326
+ .editor-post-featured-image__preview .components-responsive-wrapper {
327
+ width: 100%;
328
+ background: #f0f0f0;
327
329
  }
328
330
 
329
331
  .editor-post-featured-image__toggle {
@@ -339,6 +341,28 @@
339
341
  color: #1e1e1e;
340
342
  }
341
343
 
344
+ .editor-post-featured-image__actions {
345
+ bottom: 0;
346
+ opacity: 0;
347
+ padding: 8px;
348
+ position: absolute;
349
+ transition: opacity 50ms ease-out;
350
+ }
351
+ @media (prefers-reduced-motion: reduce) {
352
+ .editor-post-featured-image__actions {
353
+ transition-duration: 0s;
354
+ transition-delay: 0s;
355
+ }
356
+ }
357
+
358
+ .editor-post-featured-image__action {
359
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
360
+ backdrop-filter: blur(16px) saturate(180%);
361
+ background: rgba(255, 255, 255, 0.75);
362
+ flex-grow: 1;
363
+ justify-content: center;
364
+ }
365
+
342
366
  [class].editor-post-format__suggestion {
343
367
  margin: 4px 0 0 0;
344
368
  }
@@ -837,10 +861,8 @@
837
861
  }
838
862
 
839
863
  .editor-post-trash.components-button {
840
- display: flex;
841
- justify-content: center;
842
- margin-top: 4px;
843
864
  width: 100%;
865
+ display: block;
844
866
  }
845
867
 
846
868
  .table-of-contents__popover.components-popover .components-popover__content {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "13.8.0",
3
+ "version": "13.10.0",
4
4
  "description": "Enhanced block editor for WordPress posts.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,41 +31,40 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.31.0",
35
- "@wordpress/api-fetch": "^6.28.0",
36
- "@wordpress/blob": "^3.31.0",
37
- "@wordpress/block-editor": "^11.8.0",
38
- "@wordpress/blocks": "^12.8.0",
39
- "@wordpress/components": "^23.8.0",
40
- "@wordpress/compose": "^6.8.0",
41
- "@wordpress/core-data": "^6.8.0",
42
- "@wordpress/data": "^9.1.0",
43
- "@wordpress/date": "^4.31.0",
44
- "@wordpress/deprecated": "^3.31.0",
45
- "@wordpress/dom": "^3.31.0",
46
- "@wordpress/element": "^5.8.0",
47
- "@wordpress/hooks": "^3.31.0",
48
- "@wordpress/html-entities": "^3.31.0",
49
- "@wordpress/i18n": "^4.31.0",
50
- "@wordpress/icons": "^9.22.0",
51
- "@wordpress/keyboard-shortcuts": "^4.8.0",
52
- "@wordpress/keycodes": "^3.31.0",
53
- "@wordpress/media-utils": "^4.22.0",
54
- "@wordpress/notices": "^3.31.0",
55
- "@wordpress/preferences": "^3.8.0",
56
- "@wordpress/private-apis": "^0.13.0",
57
- "@wordpress/reusable-blocks": "^4.8.0",
58
- "@wordpress/rich-text": "^6.8.0",
59
- "@wordpress/server-side-render": "^4.8.0",
60
- "@wordpress/url": "^3.32.0",
61
- "@wordpress/wordcount": "^3.31.0",
34
+ "@wordpress/a11y": "^3.33.0",
35
+ "@wordpress/api-fetch": "^6.30.0",
36
+ "@wordpress/blob": "^3.33.0",
37
+ "@wordpress/block-editor": "^12.1.0",
38
+ "@wordpress/blocks": "^12.10.0",
39
+ "@wordpress/components": "^24.0.0",
40
+ "@wordpress/compose": "^6.10.0",
41
+ "@wordpress/core-data": "^6.10.0",
42
+ "@wordpress/data": "^9.3.0",
43
+ "@wordpress/date": "^4.33.0",
44
+ "@wordpress/deprecated": "^3.33.0",
45
+ "@wordpress/dom": "^3.33.0",
46
+ "@wordpress/element": "^5.10.0",
47
+ "@wordpress/hooks": "^3.33.0",
48
+ "@wordpress/html-entities": "^3.33.0",
49
+ "@wordpress/i18n": "^4.33.0",
50
+ "@wordpress/icons": "^9.24.0",
51
+ "@wordpress/keyboard-shortcuts": "^4.10.0",
52
+ "@wordpress/keycodes": "^3.33.0",
53
+ "@wordpress/media-utils": "^4.24.0",
54
+ "@wordpress/notices": "^4.1.0",
55
+ "@wordpress/preferences": "^3.10.0",
56
+ "@wordpress/private-apis": "^0.15.0",
57
+ "@wordpress/reusable-blocks": "^4.10.0",
58
+ "@wordpress/rich-text": "^6.10.0",
59
+ "@wordpress/server-side-render": "^4.10.0",
60
+ "@wordpress/url": "^3.34.0",
61
+ "@wordpress/wordcount": "^3.33.0",
62
62
  "classnames": "^2.3.1",
63
63
  "date-fns": "^2.28.0",
64
64
  "escape-html": "^1.0.3",
65
- "lodash": "^4.17.21",
66
65
  "memize": "^1.1.0",
67
66
  "react-autosize-textarea": "^7.1.0",
68
- "rememo": "^4.0.0",
67
+ "rememo": "^4.0.2",
69
68
  "remove-accents": "^0.4.2"
70
69
  },
71
70
  "peerDependencies": {
@@ -75,5 +74,5 @@
75
74
  "publishConfig": {
76
75
  "access": "public"
77
76
  },
78
- "gitHead": "d61700b9f1c72ba0b030fc815ef1685b4f4031ec"
77
+ "gitHead": "e936127e1e13881f1a940b7bd1593a9e500147f3"
79
78
  }
@@ -1,19 +1,15 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { groupBy } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
9
4
  import { Button, Flex, FlexItem } from '@wordpress/components';
10
- import { __ } from '@wordpress/i18n';
5
+ import { __, sprintf } from '@wordpress/i18n';
11
6
  import { useSelect, useDispatch } from '@wordpress/data';
12
7
  import { useState, useCallback, useRef } from '@wordpress/element';
13
8
  import { store as coreStore } from '@wordpress/core-data';
14
9
  import { store as blockEditorStore } from '@wordpress/block-editor';
15
10
  import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
16
11
  import { store as noticesStore } from '@wordpress/notices';
12
+ import { getQueryArg } from '@wordpress/url';
17
13
 
18
14
  /**
19
15
  * Internal dependencies
@@ -36,8 +32,28 @@ const PUBLISH_ON_SAVE_ENTITIES = [
36
32
  },
37
33
  ];
38
34
 
39
- export default function EntitiesSavedStates( { close } ) {
35
+ function identity( values ) {
36
+ return values;
37
+ }
38
+
39
+ function isPreviewingTheme() {
40
+ return (
41
+ window?.__experimentalEnableThemePreviews &&
42
+ getQueryArg( window.location.href, 'theme_preview' ) !== undefined
43
+ );
44
+ }
45
+
46
+ function currentlyPreviewingTheme() {
47
+ if ( isPreviewingTheme() ) {
48
+ return getQueryArg( window.location.href, 'theme_preview' );
49
+ }
50
+ return null;
51
+ }
52
+
53
+ export default function EntitiesSavedStates( { close, onSave = identity } ) {
40
54
  const saveButtonRef = useRef();
55
+ const { getTheme } = useSelect( coreStore );
56
+ const theme = getTheme( currentlyPreviewingTheme() );
41
57
  const { dirtyEntityRecords } = useSelect( ( select ) => {
42
58
  const dirtyRecords =
43
59
  select( coreStore ).__experimentalGetDirtyEntityRecords();
@@ -83,7 +99,14 @@ export default function EntitiesSavedStates( { close } ) {
83
99
  useDispatch( noticesStore );
84
100
 
85
101
  // To group entities by type.
86
- const partitionedSavables = groupBy( dirtyEntityRecords, 'name' );
102
+ const partitionedSavables = dirtyEntityRecords.reduce( ( acc, record ) => {
103
+ const { name } = record;
104
+ if ( ! acc[ name ] ) {
105
+ acc[ name ] = [];
106
+ }
107
+ acc[ name ].push( record );
108
+ return acc;
109
+ }, {} );
87
110
 
88
111
  // Sort entity groups.
89
112
  const {
@@ -124,7 +147,7 @@ export default function EntitiesSavedStates( { close } ) {
124
147
  }
125
148
  };
126
149
 
127
- const saveCheckedEntities = () => {
150
+ const saveCheckedEntitiesAndActivate = () => {
128
151
  const entitiesToSave = dirtyEntityRecords.filter(
129
152
  ( { kind, name, key, property } ) => {
130
153
  return ! unselectedEntities.some(
@@ -174,6 +197,9 @@ export default function EntitiesSavedStates( { close } ) {
174
197
  __unstableMarkLastChangeAsPersistent();
175
198
 
176
199
  Promise.all( pendingSavedRecords )
200
+ .then( ( values ) => {
201
+ return onSave( values );
202
+ } )
177
203
  .then( ( values ) => {
178
204
  if (
179
205
  values.some( ( value ) => typeof value === 'undefined' )
@@ -198,6 +224,18 @@ export default function EntitiesSavedStates( { close } ) {
198
224
  onClose: () => dismissPanel(),
199
225
  } );
200
226
 
227
+ const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
228
+ const activateSaveEnabled = isPreviewingTheme() || isDirty;
229
+
230
+ let activateSaveLabel;
231
+ if ( isPreviewingTheme() && isDirty ) {
232
+ activateSaveLabel = __( 'Activate & Save' );
233
+ } else if ( isPreviewingTheme() ) {
234
+ activateSaveLabel = __( 'Activate' );
235
+ } else {
236
+ activateSaveLabel = __( 'Save' );
237
+ }
238
+
201
239
  return (
202
240
  <div
203
241
  ref={ saveDialogRef }
@@ -210,15 +248,11 @@ export default function EntitiesSavedStates( { close } ) {
210
248
  as={ Button }
211
249
  ref={ saveButtonRef }
212
250
  variant="primary"
213
- disabled={
214
- dirtyEntityRecords.length -
215
- unselectedEntities.length ===
216
- 0
217
- }
218
- onClick={ saveCheckedEntities }
251
+ disabled={ ! activateSaveEnabled }
252
+ onClick={ saveCheckedEntitiesAndActivate }
219
253
  className="editor-entities-saved-states__save-button"
220
254
  >
221
- { __( 'Save' ) }
255
+ { activateSaveLabel }
222
256
  </FlexItem>
223
257
  <FlexItem
224
258
  isBlock
@@ -232,11 +266,21 @@ export default function EntitiesSavedStates( { close } ) {
232
266
 
233
267
  <div className="entities-saved-states__text-prompt">
234
268
  <strong>{ __( 'Are you ready to save?' ) }</strong>
235
- <p>
236
- { __(
237
- 'The following changes have been made to your site, templates, and content.'
238
- ) }
239
- </p>
269
+ { isPreviewingTheme() && (
270
+ <p>
271
+ { sprintf(
272
+ 'Saving your changes will change your active theme to %1$s.',
273
+ theme?.name?.rendered
274
+ ) }
275
+ </p>
276
+ ) }
277
+ { isDirty && (
278
+ <p>
279
+ { __(
280
+ 'The following changes have been made to your site, templates, and content.'
281
+ ) }
282
+ </p>
283
+ ) }
240
284
  </div>
241
285
 
242
286
  { sortedPartitionedSavables.map( ( list ) => {
@@ -10,9 +10,10 @@ import {
10
10
  ResponsiveWrapper,
11
11
  withNotices,
12
12
  withFilters,
13
+ __experimentalHStack as HStack,
13
14
  } from '@wordpress/components';
14
15
  import { isBlobURL } from '@wordpress/blob';
15
- import { useState } from '@wordpress/element';
16
+ import { useState, useRef } from '@wordpress/element';
16
17
  import { compose } from '@wordpress/compose';
17
18
  import { useSelect, withDispatch, withSelect } from '@wordpress/data';
18
19
  import {
@@ -33,7 +34,6 @@ const ALLOWED_MEDIA_TYPES = [ 'image' ];
33
34
  // Used when labels from post type were not yet loaded or when they are not present.
34
35
  const DEFAULT_FEATURE_IMAGE_LABEL = __( 'Featured image' );
35
36
  const DEFAULT_SET_FEATURE_IMAGE_LABEL = __( 'Set featured image' );
36
- const DEFAULT_REMOVE_FEATURE_IMAGE_LABEL = __( 'Remove image' );
37
37
 
38
38
  const instructions = (
39
39
  <p>
@@ -96,6 +96,7 @@ function PostFeaturedImage( {
96
96
  noticeUI,
97
97
  noticeOperations,
98
98
  } ) {
99
+ const toggleRef = useRef();
99
100
  const [ isLoading, setIsLoading ] = useState( false );
100
101
  const mediaUpload = useSelect( ( select ) => {
101
102
  return select( blockEditorStore ).getSettings().mediaUpload;
@@ -163,6 +164,7 @@ function PostFeaturedImage( {
163
164
  render={ ( { open } ) => (
164
165
  <div className="editor-post-featured-image__container">
165
166
  <Button
167
+ ref={ toggleRef }
166
168
  className={
167
169
  ! featuredImageId
168
170
  ? 'editor-post-featured-image__toggle'
@@ -172,7 +174,7 @@ function PostFeaturedImage( {
172
174
  aria-label={
173
175
  ! featuredImageId
174
176
  ? null
175
- : __( 'Edit or update the image' )
177
+ : __( 'Edit or replace the image' )
176
178
  }
177
179
  aria-describedby={
178
180
  ! featuredImageId
@@ -199,44 +201,33 @@ function PostFeaturedImage( {
199
201
  ?.set_featured_image ||
200
202
  DEFAULT_SET_FEATURE_IMAGE_LABEL ) }
201
203
  </Button>
204
+ { !! featuredImageId && (
205
+ <HStack className="editor-post-featured-image__actions">
206
+ <Button
207
+ className="editor-post-featured-image__action"
208
+ onClick={ open }
209
+ // Prefer that screen readers use the .editor-post-featured-image__preview button.
210
+ aria-hidden="true"
211
+ >
212
+ { __( 'Replace' ) }
213
+ </Button>
214
+ <Button
215
+ className="editor-post-featured-image__action"
216
+ onClick={ () => {
217
+ onRemoveImage();
218
+ toggleRef.current.focus();
219
+ } }
220
+ >
221
+ { __( 'Remove' ) }
222
+ </Button>
223
+ </HStack>
224
+ ) }
202
225
  <DropZone onFilesDrop={ onDropFiles } />
203
226
  </div>
204
227
  ) }
205
228
  value={ featuredImageId }
206
229
  />
207
230
  </MediaUploadCheck>
208
- { !! featuredImageId && (
209
- <MediaUploadCheck>
210
- { media && (
211
- <MediaUpload
212
- title={
213
- postType?.labels?.featured_image ||
214
- DEFAULT_FEATURE_IMAGE_LABEL
215
- }
216
- onSelect={ onUpdateImage }
217
- unstableFeaturedImageFlow
218
- allowedTypes={ ALLOWED_MEDIA_TYPES }
219
- modalClass="editor-post-featured-image__media-modal"
220
- render={ ( { open } ) => (
221
- <Button
222
- onClick={ open }
223
- variant="secondary"
224
- >
225
- { __( 'Replace Image' ) }
226
- </Button>
227
- ) }
228
- />
229
- ) }
230
- <Button
231
- onClick={ onRemoveImage }
232
- variant="link"
233
- isDestructive
234
- >
235
- { postType?.labels?.remove_featured_image ||
236
- DEFAULT_REMOVE_FEATURE_IMAGE_LABEL }
237
- </Button>
238
- </MediaUploadCheck>
239
- ) }
240
231
  </div>
241
232
  </PostFeaturedImageCheck>
242
233
  );
@@ -1,10 +1,6 @@
1
1
  .editor-post-featured-image {
2
2
  padding: 0;
3
3
 
4
- &__container {
5
- margin-bottom: 1em;
6
- position: relative;
7
- }
8
4
 
9
5
  .components-spinner {
10
6
  position: absolute;
@@ -14,12 +10,6 @@
14
10
  margin-left: -9px;
15
11
  }
16
12
 
17
- // Stack consecutive buttons.
18
- .components-button + .components-button {
19
- display: block;
20
- margin-top: 1em;
21
- }
22
-
23
13
  // This keeps images at their intrinsic size (eg. a 50px
24
14
  // image will never be wider than 50px).
25
15
  .components-responsive-wrapper__content {
@@ -28,22 +18,40 @@
28
18
  }
29
19
  }
30
20
 
21
+ .editor-post-featured-image__container {
22
+ position: relative;
23
+
24
+ &:hover,
25
+ &:focus,
26
+ &:focus-within {
27
+ .editor-post-featured-image__actions {
28
+ opacity: 1;
29
+ }
30
+ }
31
+ }
32
+
31
33
  .editor-post-featured-image__toggle,
32
34
  .editor-post-featured-image__preview {
33
- display: block;
34
35
  width: 100%;
35
36
  padding: 0;
36
37
  transition: all 0.1s ease-out;
37
38
  @include reduce-motion("transition");
38
39
  box-shadow: 0 0 0 0 var(--wp-admin-theme-color);
40
+ overflow: hidden; // Ensure the focus style properly encapsulates the image.
41
+
42
+ // Apply a max-height.
43
+ display: flex;
44
+ justify-content: center;
45
+ max-height: 150px;
39
46
  }
40
47
 
41
48
  .editor-post-featured-image__preview {
42
49
  height: auto;
43
- }
44
50
 
45
- .editor-post-featured-image__preview:not(:disabled):not([aria-disabled="true"]):focus {
46
- box-shadow: 0 0 0 4px var(--wp-admin-theme-color);
51
+ .components-responsive-wrapper {
52
+ width: 100%;
53
+ background: $gray-100;
54
+ }
47
55
  }
48
56
 
49
57
  .editor-post-featured-image__toggle {
@@ -59,3 +67,19 @@
59
67
  color: $gray-900;
60
68
  }
61
69
  }
70
+
71
+ .editor-post-featured-image__actions {
72
+ @include reduce-motion("transition");
73
+ bottom: 0;
74
+ opacity: 0; // Use opacity instead of visibility so that the buttons remain in the tab order.
75
+ padding: $grid-unit-10;
76
+ position: absolute;
77
+ transition: opacity 50ms ease-out;
78
+ }
79
+
80
+ .editor-post-featured-image__action {
81
+ backdrop-filter: blur(16px) saturate(180%);
82
+ background: rgba(255, 255, 255, 0.75);
83
+ flex-grow: 1;
84
+ justify-content: center;
85
+ }
@@ -593,8 +593,10 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
593
593
  display: inline-block;
594
594
  margin: 5px 11px 0;
595
595
  position: relative;
596
- color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
596
+ color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
597
597
  overflow: visible;
598
+ opacity: 1;
599
+ background-color: transparent;
598
600
  }
599
601
 
600
602
  .emotion-2 {
@@ -20,7 +20,6 @@ import { displayShortcut } from '@wordpress/keycodes';
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
23
- import PostSwitchToDraftButton from '../post-switch-to-draft-button';
24
23
  import { store as editorStore } from '../../store';
25
24
 
26
25
  /**
@@ -48,10 +47,8 @@ export default function PostSavedState( {
48
47
  isDirty,
49
48
  isNew,
50
49
  isPending,
51
- isPublished,
52
50
  isSaveable,
53
51
  isSaving,
54
- isScheduled,
55
52
  hasPublishAction,
56
53
  } = useSelect(
57
54
  ( select ) => {
@@ -106,10 +103,6 @@ export default function PostSavedState( {
106
103
  return null;
107
104
  }
108
105
 
109
- if ( isPublished || isScheduled ) {
110
- return <PostSwitchToDraftButton />;
111
- }
112
-
113
106
  /* translators: button label text should, if possible, be under 16 characters. */
114
107
  const label = isPending ? __( 'Save as pending' ) : __( 'Save draft' );
115
108
 
@@ -22,15 +22,6 @@ exports[`PostSavedState returns a disabled button if the post is not saveable 1`
22
22
  </button>
23
23
  `;
24
24
 
25
- exports[`PostSavedState returns a switch to draft link if the post is published 1`] = `
26
- <button
27
- class="components-button editor-post-switch-to-draft is-tertiary"
28
- type="button"
29
- >
30
- Switch to draft
31
- </button>
32
- `;
33
-
34
25
  exports[`PostSavedState should return Save button if edits to be saved 1`] = `
35
26
  <button
36
27
  aria-disabled="false"