@wordpress/editor 14.0.4 → 14.0.5
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/bindings/post-meta.js +4 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-actions/actions.js +13 -35
- package/build/components/post-actions/actions.js.map +1 -1
- package/build/components/post-actions/export-pattern-action.js +2 -2
- package/build/components/post-actions/export-pattern-action.js.map +1 -1
- package/build/components/post-saved-state/index.js +11 -1
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-status/index.js +2 -1
- package/build/components/post-status/index.js.map +1 -1
- package/build/store/utils/is-template-revertable.js +6 -8
- package/build/store/utils/is-template-revertable.js.map +1 -1
- package/build-module/bindings/post-meta.js +4 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +2 -1
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-actions/actions.js +13 -35
- package/build-module/components/post-actions/actions.js.map +1 -1
- package/build-module/components/post-actions/export-pattern-action.js +2 -2
- package/build-module/components/post-actions/export-pattern-action.js.map +1 -1
- package/build-module/components/post-saved-state/index.js +11 -1
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-status/index.js +1 -1
- package/build-module/components/post-status/index.js.map +1 -1
- package/build-module/store/utils/is-template-revertable.js +6 -8
- package/build-module/store/utils/is-template-revertable.js.map +1 -1
- package/build-style/style-rtl.css +1 -0
- package/build-style/style.css +1 -0
- package/package.json +6 -6
- package/src/bindings/post-meta.js +5 -0
- package/src/components/page-attributes/parent.js +6 -3
- package/src/components/post-actions/actions.js +28 -57
- package/src/components/post-actions/export-pattern-action.js +4 -2
- package/src/components/post-panel-row/style.scss +1 -0
- package/src/components/post-saved-state/index.js +11 -1
- package/src/components/post-status/index.js +1 -1
- package/src/store/utils/is-template-revertable.js +8 -8
|
@@ -6,17 +6,15 @@ import { TEMPLATE_ORIGINS } from '../constants';
|
|
|
6
6
|
// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Check if a template is revertable to its original theme-provided
|
|
9
|
+
* Check if a template or template part is revertable to its original theme-provided file.
|
|
10
10
|
*
|
|
11
|
-
* @param {Object}
|
|
12
|
-
* @return {boolean} Whether the
|
|
11
|
+
* @param {Object} templateOrTemplatePart The entity to check.
|
|
12
|
+
* @return {boolean} Whether the entity is revertable.
|
|
13
13
|
*/
|
|
14
|
-
export default function isTemplateRevertable(
|
|
15
|
-
if (!
|
|
14
|
+
export default function isTemplateRevertable(templateOrTemplatePart) {
|
|
15
|
+
if (!templateOrTemplatePart) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
|
-
|
|
19
|
-
return template?.source === TEMPLATE_ORIGINS.custom && template?.has_theme_file;
|
|
20
|
-
/* eslint-enable camelcase */
|
|
18
|
+
return templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom && templateOrTemplatePart.has_theme_file;
|
|
21
19
|
}
|
|
22
20
|
//# sourceMappingURL=is-template-revertable.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TEMPLATE_ORIGINS","isTemplateRevertable","
|
|
1
|
+
{"version":3,"names":["TEMPLATE_ORIGINS","isTemplateRevertable","templateOrTemplatePart","source","custom","has_theme_file"],"sources":["@wordpress/editor/src/store/utils/is-template-revertable.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { TEMPLATE_ORIGINS } from '../constants';\n\n// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js\n\n/**\n * Check if a template or template part is revertable to its original theme-provided file.\n *\n * @param {Object} templateOrTemplatePart The entity to check.\n * @return {boolean} Whether the entity is revertable.\n */\nexport default function isTemplateRevertable( templateOrTemplatePart ) {\n\tif ( ! templateOrTemplatePart ) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\ttemplateOrTemplatePart.source === TEMPLATE_ORIGINS.custom &&\n\t\ttemplateOrTemplatePart.has_theme_file\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,cAAc;;AAE/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAAEC,sBAAsB,EAAG;EACtE,IAAK,CAAEA,sBAAsB,EAAG;IAC/B,OAAO,KAAK;EACb;EAEA,OACCA,sBAAsB,CAACC,MAAM,KAAKH,gBAAgB,CAACI,MAAM,IACzDF,sBAAsB,CAACG,cAAc;AAEvC","ignoreList":[]}
|
|
@@ -1703,6 +1703,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1703
1703
|
.editor-post-panel__row-control .components-button {
|
|
1704
1704
|
max-width: 100%;
|
|
1705
1705
|
text-align: right;
|
|
1706
|
+
white-space: normal;
|
|
1706
1707
|
text-wrap: balance;
|
|
1707
1708
|
text-wrap: pretty;
|
|
1708
1709
|
height: auto;
|
package/build-style/style.css
CHANGED
|
@@ -1703,6 +1703,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
|
|
|
1703
1703
|
.editor-post-panel__row-control .components-button {
|
|
1704
1704
|
max-width: 100%;
|
|
1705
1705
|
text-align: left;
|
|
1706
|
+
white-space: normal;
|
|
1706
1707
|
text-wrap: balance;
|
|
1707
1708
|
text-wrap: pretty;
|
|
1708
1709
|
height: auto;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.5",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"@wordpress/a11y": "^4.0.1",
|
|
36
36
|
"@wordpress/api-fetch": "^7.0.1",
|
|
37
37
|
"@wordpress/blob": "^4.0.1",
|
|
38
|
-
"@wordpress/block-editor": "^13.0.
|
|
38
|
+
"@wordpress/block-editor": "^13.0.5",
|
|
39
39
|
"@wordpress/blocks": "^13.0.3",
|
|
40
40
|
"@wordpress/commands": "^1.0.3",
|
|
41
41
|
"@wordpress/components": "^28.0.3",
|
|
42
42
|
"@wordpress/compose": "^7.0.1",
|
|
43
|
-
"@wordpress/core-data": "^7.0.
|
|
43
|
+
"@wordpress/core-data": "^7.0.5",
|
|
44
44
|
"@wordpress/data": "^10.0.2",
|
|
45
45
|
"@wordpress/date": "^5.0.1",
|
|
46
46
|
"@wordpress/deprecated": "^4.0.1",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
"@wordpress/keycodes": "^4.0.1",
|
|
56
56
|
"@wordpress/media-utils": "^5.0.1",
|
|
57
57
|
"@wordpress/notices": "^5.0.2",
|
|
58
|
-
"@wordpress/patterns": "^2.0.
|
|
58
|
+
"@wordpress/patterns": "^2.0.5",
|
|
59
59
|
"@wordpress/plugins": "^7.0.3",
|
|
60
60
|
"@wordpress/preferences": "^4.0.3",
|
|
61
61
|
"@wordpress/private-apis": "^1.0.2",
|
|
62
|
-
"@wordpress/reusable-blocks": "^5.0.
|
|
62
|
+
"@wordpress/reusable-blocks": "^5.0.5",
|
|
63
63
|
"@wordpress/rich-text": "^7.0.2",
|
|
64
64
|
"@wordpress/server-side-render": "^5.0.3",
|
|
65
65
|
"@wordpress/url": "^4.0.1",
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"publishConfig": {
|
|
84
84
|
"access": "public"
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "38063ae466e1b62d400b910136757a4cafdbe7fa"
|
|
87
87
|
}
|
|
@@ -34,6 +34,11 @@ export default {
|
|
|
34
34
|
} );
|
|
35
35
|
},
|
|
36
36
|
canUserEditValue( { select, context, args } ) {
|
|
37
|
+
// Lock editing in query loop.
|
|
38
|
+
if ( context?.query || context?.queryId ) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
const postType =
|
|
38
43
|
context?.postType || select( editorStore ).getCurrentPostType();
|
|
39
44
|
|
|
@@ -249,9 +249,12 @@ export function ParentRow() {
|
|
|
249
249
|
onClose={ onClose }
|
|
250
250
|
/>
|
|
251
251
|
<div>
|
|
252
|
-
{
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
{
|
|
253
|
+
/* translators: The domain name should be a reserved domain name to prevent linking to third party sites outside the WordPress project's control. You may also wish to use wordpress.org or a wordpress.org sub-domain. */
|
|
254
|
+
__(
|
|
255
|
+
"Child pages inherit characteristics from their parent, such as URL structure. For instance, if 'Web Design' is a child of 'Services', its URL would be example.org/services/web-design."
|
|
256
|
+
)
|
|
257
|
+
}
|
|
255
258
|
<p>
|
|
256
259
|
{ __(
|
|
257
260
|
'They also show up as sub-items in the default navigation menu. '
|
|
@@ -59,11 +59,6 @@ function isTemplateRemovable( template ) {
|
|
|
59
59
|
! template.templatePart?.has_theme_file
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
const canDeleteOrReset = ( item ) => {
|
|
63
|
-
const isTemplatePart = item.type === TEMPLATE_PART_POST_TYPE;
|
|
64
|
-
const isUserPattern = item.type === PATTERN_TYPES.user;
|
|
65
|
-
return isUserPattern || ( isTemplatePart && item.isCustom );
|
|
66
|
-
};
|
|
67
62
|
|
|
68
63
|
function getItemTitle( item ) {
|
|
69
64
|
if ( typeof item.title === 'string' ) {
|
|
@@ -254,7 +249,7 @@ const trashPostAction = {
|
|
|
254
249
|
__( '"%s" moved to trash.' ),
|
|
255
250
|
getItemTitle( items[ 0 ] )
|
|
256
251
|
);
|
|
257
|
-
} else
|
|
252
|
+
} else {
|
|
258
253
|
successMessage = sprintf(
|
|
259
254
|
/* translators: The number of items. */
|
|
260
255
|
_n(
|
|
@@ -264,12 +259,6 @@ const trashPostAction = {
|
|
|
264
259
|
),
|
|
265
260
|
items.length
|
|
266
261
|
);
|
|
267
|
-
} else {
|
|
268
|
-
successMessage = sprintf(
|
|
269
|
-
/* translators: The number of posts. */
|
|
270
|
-
__( '%s items move to trash.' ),
|
|
271
|
-
items.length
|
|
272
|
-
);
|
|
273
262
|
}
|
|
274
263
|
createSuccessNotice( successMessage, {
|
|
275
264
|
type: 'snackbar',
|
|
@@ -885,21 +874,11 @@ const duplicatePostAction = {
|
|
|
885
874
|
},
|
|
886
875
|
};
|
|
887
876
|
|
|
888
|
-
const isTemplatePartRevertable = ( item ) => {
|
|
889
|
-
if ( ! item ) {
|
|
890
|
-
return false;
|
|
891
|
-
}
|
|
892
|
-
const hasThemeFile = item.templatePart?.has_theme_file;
|
|
893
|
-
return canDeleteOrReset( item ) && hasThemeFile;
|
|
894
|
-
};
|
|
895
|
-
|
|
896
877
|
const resetTemplateAction = {
|
|
897
878
|
id: 'reset-template',
|
|
898
879
|
label: __( 'Reset' ),
|
|
899
880
|
isEligible: ( item ) => {
|
|
900
|
-
return item
|
|
901
|
-
? isTemplatePartRevertable( item )
|
|
902
|
-
: isTemplateRevertable( item );
|
|
881
|
+
return isTemplateRevertable( item );
|
|
903
882
|
},
|
|
904
883
|
icon: backup,
|
|
905
884
|
supportsBulk: true,
|
|
@@ -911,47 +890,39 @@ const resetTemplateAction = {
|
|
|
911
890
|
onActionPerformed,
|
|
912
891
|
} ) => {
|
|
913
892
|
const [ isBusy, setIsBusy ] = useState( false );
|
|
914
|
-
const { revertTemplate
|
|
915
|
-
useDispatch( editorStore )
|
|
916
|
-
);
|
|
893
|
+
const { revertTemplate } = unlock( useDispatch( editorStore ) );
|
|
917
894
|
const { saveEditedEntityRecord } = useDispatch( coreStore );
|
|
918
895
|
const { createSuccessNotice, createErrorNotice } =
|
|
919
896
|
useDispatch( noticesStore );
|
|
920
897
|
const onConfirm = async () => {
|
|
921
898
|
try {
|
|
922
|
-
|
|
923
|
-
await
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
await saveEditedEntityRecord(
|
|
931
|
-
'postType',
|
|
932
|
-
template.type,
|
|
933
|
-
template.id
|
|
934
|
-
);
|
|
935
|
-
}
|
|
936
|
-
}
|
|
937
|
-
createSuccessNotice(
|
|
938
|
-
items.length > 1
|
|
939
|
-
? sprintf(
|
|
940
|
-
/* translators: The number of items. */
|
|
941
|
-
__( '%s items reset.' ),
|
|
942
|
-
items.length
|
|
943
|
-
)
|
|
944
|
-
: sprintf(
|
|
945
|
-
/* translators: The template/part's name. */
|
|
946
|
-
__( '"%s" reset.' ),
|
|
947
|
-
decodeEntities( getItemTitle( items[ 0 ] ) )
|
|
948
|
-
),
|
|
949
|
-
{
|
|
950
|
-
type: 'snackbar',
|
|
951
|
-
id: 'revert-template-action',
|
|
952
|
-
}
|
|
899
|
+
for ( const template of items ) {
|
|
900
|
+
await revertTemplate( template, {
|
|
901
|
+
allowUndo: false,
|
|
902
|
+
} );
|
|
903
|
+
await saveEditedEntityRecord(
|
|
904
|
+
'postType',
|
|
905
|
+
template.type,
|
|
906
|
+
template.id
|
|
953
907
|
);
|
|
954
908
|
}
|
|
909
|
+
createSuccessNotice(
|
|
910
|
+
items.length > 1
|
|
911
|
+
? sprintf(
|
|
912
|
+
/* translators: The number of items. */
|
|
913
|
+
__( '%s items reset.' ),
|
|
914
|
+
items.length
|
|
915
|
+
)
|
|
916
|
+
: sprintf(
|
|
917
|
+
/* translators: The template/part's name. */
|
|
918
|
+
__( '"%s" reset.' ),
|
|
919
|
+
decodeEntities( getItemTitle( items[ 0 ] ) )
|
|
920
|
+
),
|
|
921
|
+
{
|
|
922
|
+
type: 'snackbar',
|
|
923
|
+
id: 'revert-template-action',
|
|
924
|
+
}
|
|
925
|
+
);
|
|
955
926
|
} catch ( error ) {
|
|
956
927
|
let fallbackErrorMessage;
|
|
957
928
|
if ( items[ 0 ].type === TEMPLATE_POST_TYPE ) {
|
|
@@ -24,8 +24,10 @@ function getJsonFromItem( item ) {
|
|
|
24
24
|
{
|
|
25
25
|
__file: item.type,
|
|
26
26
|
title: item.title || item.name,
|
|
27
|
-
content: item
|
|
28
|
-
syncStatus:
|
|
27
|
+
content: item?.patternPost?.content?.raw || item.content,
|
|
28
|
+
syncStatus:
|
|
29
|
+
item?.patternPost?.wp_pattern_sync_status ||
|
|
30
|
+
item.wp_pattern_sync_status,
|
|
29
31
|
},
|
|
30
32
|
null,
|
|
31
33
|
2
|
|
@@ -21,6 +21,7 @@ import { store as preferencesStore } from '@wordpress/preferences';
|
|
|
21
21
|
/**
|
|
22
22
|
* Internal dependencies
|
|
23
23
|
*/
|
|
24
|
+
import { STATUS_OPTIONS } from '../../components/post-status';
|
|
24
25
|
import { store as editorStore } from '../../store';
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -104,10 +105,19 @@ export default function PostSavedState( { forceIsDirty } ) {
|
|
|
104
105
|
return null;
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
// We shouldn't render the button if the post has not one of the following statuses: pending, draft, auto-draft.
|
|
109
|
+
// The reason for this is that this button handles the `save as pending` and `save draft` actions.
|
|
110
|
+
// An exception for this is when the post has a custom status and there should be a way to save changes without
|
|
111
|
+
// having to publish. This should be handled better in the future when custom statuses have better support.
|
|
112
|
+
// @see https://github.com/WordPress/gutenberg/issues/3144.
|
|
113
|
+
const isIneligibleStatus =
|
|
114
|
+
! [ 'pending', 'draft', 'auto-draft' ].includes( postStatus ) &&
|
|
115
|
+
STATUS_OPTIONS.map( ( { value } ) => value ).includes( postStatus );
|
|
116
|
+
|
|
107
117
|
if (
|
|
108
118
|
isPublished ||
|
|
109
119
|
isScheduled ||
|
|
110
|
-
|
|
120
|
+
isIneligibleStatus ||
|
|
111
121
|
( postStatusHasChanged &&
|
|
112
122
|
[ 'pending', 'draft' ].includes( postStatus ) )
|
|
113
123
|
) {
|
|
@@ -6,18 +6,18 @@ import { TEMPLATE_ORIGINS } from '../constants';
|
|
|
6
6
|
// Copy of the function from packages/edit-site/src/utils/is-template-revertable.js
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Check if a template is revertable to its original theme-provided
|
|
9
|
+
* Check if a template or template part is revertable to its original theme-provided file.
|
|
10
10
|
*
|
|
11
|
-
* @param {Object}
|
|
12
|
-
* @return {boolean} Whether the
|
|
11
|
+
* @param {Object} templateOrTemplatePart The entity to check.
|
|
12
|
+
* @return {boolean} Whether the entity is revertable.
|
|
13
13
|
*/
|
|
14
|
-
export default function isTemplateRevertable(
|
|
15
|
-
if ( !
|
|
14
|
+
export default function isTemplateRevertable( templateOrTemplatePart ) {
|
|
15
|
+
if ( ! templateOrTemplatePart ) {
|
|
16
16
|
return false;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
return (
|
|
20
|
-
|
|
20
|
+
templateOrTemplatePart.source === TEMPLATE_ORIGINS.custom &&
|
|
21
|
+
templateOrTemplatePart.has_theme_file
|
|
21
22
|
);
|
|
22
|
-
/* eslint-enable camelcase */
|
|
23
23
|
}
|