@wordpress/editor 13.9.0 → 13.11.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 +4 -0
- package/build/components/entities-saved-states/index.js +53 -8
- package/build/components/entities-saved-states/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +24 -29
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-saved-state/index.js +0 -8
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-switch-to-draft-button/index.js +9 -4
- package/build/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/entities-saved-states/index.js +54 -9
- package/build-module/components/entities-saved-states/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +26 -32
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +0 -7
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-switch-to-draft-button/index.js +12 -7
- package/build-module/components/post-switch-to-draft-button/index.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-style/style-rtl.css +38 -16
- package/build-style/style.css +38 -16
- package/package.json +31 -31
- package/src/components/entities-saved-states/index.js +61 -16
- package/src/components/post-featured-image/index.js +26 -35
- package/src/components/post-featured-image/style.scss +38 -14
- package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +1 -1
- package/src/components/post-saved-state/index.js +0 -7
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +0 -9
- package/src/components/post-saved-state/test/index.js +0 -10
- package/src/components/post-switch-to-draft-button/index.js +7 -6
- package/src/components/post-taxonomies/flat-term-selector.js +1 -1
- package/src/components/post-taxonomies/style.scss +4 -4
- package/src/components/post-trash/style.scss +1 -3
- package/src/components/provider/use-block-editor-settings.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.11.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,38 +31,38 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^12.
|
|
38
|
-
"@wordpress/blocks": "^12.
|
|
39
|
-
"@wordpress/components": "^
|
|
40
|
-
"@wordpress/compose": "^6.
|
|
41
|
-
"@wordpress/core-data": "^6.
|
|
42
|
-
"@wordpress/data": "^9.
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/dom": "^3.
|
|
46
|
-
"@wordpress/element": "^5.
|
|
47
|
-
"@wordpress/hooks": "^3.
|
|
48
|
-
"@wordpress/html-entities": "^3.
|
|
49
|
-
"@wordpress/i18n": "^4.
|
|
50
|
-
"@wordpress/icons": "^9.
|
|
51
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
52
|
-
"@wordpress/keycodes": "^3.
|
|
53
|
-
"@wordpress/media-utils": "^4.
|
|
54
|
-
"@wordpress/notices": "^4.
|
|
55
|
-
"@wordpress/preferences": "^3.
|
|
56
|
-
"@wordpress/private-apis": "^0.
|
|
57
|
-
"@wordpress/reusable-blocks": "^4.
|
|
58
|
-
"@wordpress/rich-text": "^6.
|
|
59
|
-
"@wordpress/server-side-render": "^4.
|
|
60
|
-
"@wordpress/url": "^3.
|
|
61
|
-
"@wordpress/wordcount": "^3.
|
|
34
|
+
"@wordpress/a11y": "^3.34.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.31.0",
|
|
36
|
+
"@wordpress/blob": "^3.34.0",
|
|
37
|
+
"@wordpress/block-editor": "^12.2.0",
|
|
38
|
+
"@wordpress/blocks": "^12.11.0",
|
|
39
|
+
"@wordpress/components": "^25.0.0",
|
|
40
|
+
"@wordpress/compose": "^6.11.0",
|
|
41
|
+
"@wordpress/core-data": "^6.11.0",
|
|
42
|
+
"@wordpress/data": "^9.4.0",
|
|
43
|
+
"@wordpress/date": "^4.34.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.34.0",
|
|
45
|
+
"@wordpress/dom": "^3.34.0",
|
|
46
|
+
"@wordpress/element": "^5.11.0",
|
|
47
|
+
"@wordpress/hooks": "^3.34.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.34.0",
|
|
49
|
+
"@wordpress/i18n": "^4.34.0",
|
|
50
|
+
"@wordpress/icons": "^9.25.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.11.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.34.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.25.0",
|
|
54
|
+
"@wordpress/notices": "^4.2.0",
|
|
55
|
+
"@wordpress/preferences": "^3.11.0",
|
|
56
|
+
"@wordpress/private-apis": "^0.16.0",
|
|
57
|
+
"@wordpress/reusable-blocks": "^4.11.0",
|
|
58
|
+
"@wordpress/rich-text": "^6.11.0",
|
|
59
|
+
"@wordpress/server-side-render": "^4.11.0",
|
|
60
|
+
"@wordpress/url": "^3.35.0",
|
|
61
|
+
"@wordpress/wordcount": "^3.34.0",
|
|
62
62
|
"classnames": "^2.3.1",
|
|
63
63
|
"date-fns": "^2.28.0",
|
|
64
64
|
"escape-html": "^1.0.3",
|
|
65
|
-
"memize": "^
|
|
65
|
+
"memize": "^2.1.0",
|
|
66
66
|
"react-autosize-textarea": "^7.1.0",
|
|
67
67
|
"rememo": "^4.0.2",
|
|
68
68
|
"remove-accents": "^0.4.2"
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "c7c79cb11b677adcbf06cf5f8cfb6c5ec1699f19"
|
|
78
78
|
}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { Button, Flex, FlexItem } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { useState, useCallback, useRef } from '@wordpress/element';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
9
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
10
|
import { __experimentalUseDialog as useDialog } from '@wordpress/compose';
|
|
11
11
|
import { store as noticesStore } from '@wordpress/notices';
|
|
12
|
+
import { getQueryArg } from '@wordpress/url';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -31,8 +32,28 @@ const PUBLISH_ON_SAVE_ENTITIES = [
|
|
|
31
32
|
},
|
|
32
33
|
];
|
|
33
34
|
|
|
34
|
-
|
|
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 } ) {
|
|
35
54
|
const saveButtonRef = useRef();
|
|
55
|
+
const { getTheme } = useSelect( coreStore );
|
|
56
|
+
const theme = getTheme( currentlyPreviewingTheme() );
|
|
36
57
|
const { dirtyEntityRecords } = useSelect( ( select ) => {
|
|
37
58
|
const dirtyRecords =
|
|
38
59
|
select( coreStore ).__experimentalGetDirtyEntityRecords();
|
|
@@ -74,7 +95,7 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
74
95
|
const { __unstableMarkLastChangeAsPersistent } =
|
|
75
96
|
useDispatch( blockEditorStore );
|
|
76
97
|
|
|
77
|
-
const { createSuccessNotice, createErrorNotice } =
|
|
98
|
+
const { createSuccessNotice, createErrorNotice, removeNotice } =
|
|
78
99
|
useDispatch( noticesStore );
|
|
79
100
|
|
|
80
101
|
// To group entities by type.
|
|
@@ -126,7 +147,9 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
126
147
|
}
|
|
127
148
|
};
|
|
128
149
|
|
|
129
|
-
const
|
|
150
|
+
const saveCheckedEntitiesAndActivate = () => {
|
|
151
|
+
const saveNoticeId = 'site-editor-save-success';
|
|
152
|
+
removeNotice( saveNoticeId );
|
|
130
153
|
const entitiesToSave = dirtyEntityRecords.filter(
|
|
131
154
|
( { kind, name, key, property } ) => {
|
|
132
155
|
return ! unselectedEntities.some(
|
|
@@ -176,6 +199,9 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
176
199
|
__unstableMarkLastChangeAsPersistent();
|
|
177
200
|
|
|
178
201
|
Promise.all( pendingSavedRecords )
|
|
202
|
+
.then( ( values ) => {
|
|
203
|
+
return onSave( values );
|
|
204
|
+
} )
|
|
179
205
|
.then( ( values ) => {
|
|
180
206
|
if (
|
|
181
207
|
values.some( ( value ) => typeof value === 'undefined' )
|
|
@@ -184,6 +210,7 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
184
210
|
} else {
|
|
185
211
|
createSuccessNotice( __( 'Site updated.' ), {
|
|
186
212
|
type: 'snackbar',
|
|
213
|
+
id: saveNoticeId,
|
|
187
214
|
} );
|
|
188
215
|
}
|
|
189
216
|
} )
|
|
@@ -200,6 +227,18 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
200
227
|
onClose: () => dismissPanel(),
|
|
201
228
|
} );
|
|
202
229
|
|
|
230
|
+
const isDirty = dirtyEntityRecords.length - unselectedEntities.length > 0;
|
|
231
|
+
const activateSaveEnabled = isPreviewingTheme() || isDirty;
|
|
232
|
+
|
|
233
|
+
let activateSaveLabel;
|
|
234
|
+
if ( isPreviewingTheme() && isDirty ) {
|
|
235
|
+
activateSaveLabel = __( 'Activate & Save' );
|
|
236
|
+
} else if ( isPreviewingTheme() ) {
|
|
237
|
+
activateSaveLabel = __( 'Activate' );
|
|
238
|
+
} else {
|
|
239
|
+
activateSaveLabel = __( 'Save' );
|
|
240
|
+
}
|
|
241
|
+
|
|
203
242
|
return (
|
|
204
243
|
<div
|
|
205
244
|
ref={ saveDialogRef }
|
|
@@ -212,15 +251,11 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
212
251
|
as={ Button }
|
|
213
252
|
ref={ saveButtonRef }
|
|
214
253
|
variant="primary"
|
|
215
|
-
disabled={
|
|
216
|
-
|
|
217
|
-
unselectedEntities.length ===
|
|
218
|
-
0
|
|
219
|
-
}
|
|
220
|
-
onClick={ saveCheckedEntities }
|
|
254
|
+
disabled={ ! activateSaveEnabled }
|
|
255
|
+
onClick={ saveCheckedEntitiesAndActivate }
|
|
221
256
|
className="editor-entities-saved-states__save-button"
|
|
222
257
|
>
|
|
223
|
-
{
|
|
258
|
+
{ activateSaveLabel }
|
|
224
259
|
</FlexItem>
|
|
225
260
|
<FlexItem
|
|
226
261
|
isBlock
|
|
@@ -234,11 +269,21 @@ export default function EntitiesSavedStates( { close } ) {
|
|
|
234
269
|
|
|
235
270
|
<div className="entities-saved-states__text-prompt">
|
|
236
271
|
<strong>{ __( 'Are you ready to save?' ) }</strong>
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
272
|
+
{ isPreviewingTheme() && (
|
|
273
|
+
<p>
|
|
274
|
+
{ sprintf(
|
|
275
|
+
'Saving your changes will change your active theme to %1$s.',
|
|
276
|
+
theme?.name?.rendered
|
|
277
|
+
) }
|
|
278
|
+
</p>
|
|
279
|
+
) }
|
|
280
|
+
{ isDirty && (
|
|
281
|
+
<p>
|
|
282
|
+
{ __(
|
|
283
|
+
'The following changes have been made to your site, templates, and content.'
|
|
284
|
+
) }
|
|
285
|
+
</p>
|
|
286
|
+
) }
|
|
242
287
|
</div>
|
|
243
288
|
|
|
244
289
|
{ 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
|
|
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
|
-
.
|
|
46
|
-
|
|
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,7 +593,7 @@ 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, #
|
|
596
|
+
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #3858e9));
|
|
597
597
|
overflow: visible;
|
|
598
598
|
opacity: 1;
|
|
599
599
|
background-color: transparent;
|
|
@@ -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"
|
|
@@ -67,16 +67,6 @@ describe( 'PostSavedState', () => {
|
|
|
67
67
|
expect( screen.getByRole( 'button' ) ).toMatchSnapshot();
|
|
68
68
|
} );
|
|
69
69
|
|
|
70
|
-
it( 'returns a switch to draft link if the post is published', () => {
|
|
71
|
-
useSelect.mockImplementation( () => ( {
|
|
72
|
-
isPublished: true,
|
|
73
|
-
} ) );
|
|
74
|
-
|
|
75
|
-
render( <PostSavedState /> );
|
|
76
|
-
|
|
77
|
-
expect( screen.getByRole( 'button' ) ).toMatchSnapshot();
|
|
78
|
-
} );
|
|
79
|
-
|
|
80
70
|
it( 'should return Saved text if not new and not dirty', () => {
|
|
81
71
|
useSelect.mockImplementation( () => ( {
|
|
82
72
|
isDirty: false,
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
Button,
|
|
6
|
+
FlexItem,
|
|
6
7
|
__experimentalConfirmDialog as ConfirmDialog,
|
|
7
8
|
} from '@wordpress/components';
|
|
8
9
|
import { __ } from '@wordpress/i18n';
|
|
9
10
|
import { withSelect, withDispatch } from '@wordpress/data';
|
|
10
|
-
import { compose
|
|
11
|
+
import { compose } from '@wordpress/compose';
|
|
11
12
|
import { useState } from '@wordpress/element';
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -21,7 +22,6 @@ function PostSwitchToDraftButton( {
|
|
|
21
22
|
isScheduled,
|
|
22
23
|
onClick,
|
|
23
24
|
} ) {
|
|
24
|
-
const isMobileViewport = useViewportMatch( 'small', '<' );
|
|
25
25
|
const [ showConfirmDialog, setShowConfirmDialog ] = useState( false );
|
|
26
26
|
|
|
27
27
|
if ( ! isPublished && ! isScheduled ) {
|
|
@@ -41,16 +41,17 @@ function PostSwitchToDraftButton( {
|
|
|
41
41
|
};
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
|
|
44
|
+
<FlexItem isBlock>
|
|
45
45
|
<Button
|
|
46
46
|
className="editor-post-switch-to-draft"
|
|
47
47
|
onClick={ () => {
|
|
48
48
|
setShowConfirmDialog( true );
|
|
49
49
|
} }
|
|
50
50
|
disabled={ isSaving }
|
|
51
|
-
variant="
|
|
51
|
+
variant="secondary"
|
|
52
|
+
style={ { width: '100%', display: 'block' } }
|
|
52
53
|
>
|
|
53
|
-
{
|
|
54
|
+
{ __( 'Switch to draft' ) }
|
|
54
55
|
</Button>
|
|
55
56
|
<ConfirmDialog
|
|
56
57
|
isOpen={ showConfirmDialog }
|
|
@@ -59,7 +60,7 @@ function PostSwitchToDraftButton( {
|
|
|
59
60
|
>
|
|
60
61
|
{ alertMessage }
|
|
61
62
|
</ConfirmDialog>
|
|
62
|
-
|
|
63
|
+
</FlexItem>
|
|
63
64
|
);
|
|
64
65
|
}
|
|
65
66
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
overflow: auto;
|
|
4
4
|
|
|
5
5
|
// Extra left padding prevents checkbox focus borders from being cut off.
|
|
6
|
-
margin-left: -$border-width * 4 - $border-width-focus;
|
|
7
|
-
padding-left: $border-width * 4 + $border-width-focus;
|
|
8
|
-
margin-top: -$border-width * 4 - $border-width-focus;
|
|
9
|
-
padding-top: $border-width * 4 + $border-width-focus;
|
|
6
|
+
margin-left: -$border-width * 4 - $border-width-focus-fallback;
|
|
7
|
+
padding-left: $border-width * 4 + $border-width-focus-fallback;
|
|
8
|
+
margin-top: -$border-width * 4 - $border-width-focus-fallback;
|
|
9
|
+
padding-top: $border-width * 4 + $border-width-focus-fallback;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.editor-post-taxonomies__hierarchical-terms-choice {
|