@wordpress/editor 14.27.0 → 14.28.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 +2 -0
- package/build/bindings/api.js +2 -0
- package/build/bindings/api.js.map +1 -1
- package/build/bindings/pattern-overrides.js +4 -0
- package/build/bindings/pattern-overrides.js.map +1 -1
- package/build/bindings/post-data.js +141 -0
- package/build/bindings/post-data.js.map +1 -0
- package/build/bindings/post-meta.js +4 -0
- package/build/bindings/post-meta.js.map +1 -1
- package/build/components/media-categories/index.js +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/post-card-panel/index.js +2 -2
- package/build/components/post-card-panel/index.js.map +1 -1
- package/build/components/post-featured-image/index.js +3 -3
- package/build/components/post-featured-image/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/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/provider/index.native.js +4 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +9 -4
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/store/actions.js +0 -15
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +9 -3
- package/build/store/selectors.js.map +1 -1
- package/build/utils/media-upload/index.js +1 -1
- package/build/utils/media-upload/index.js.map +1 -1
- package/build-module/bindings/api.js +2 -0
- package/build-module/bindings/api.js.map +1 -1
- package/build-module/bindings/pattern-overrides.js +4 -0
- package/build-module/bindings/pattern-overrides.js.map +1 -1
- package/build-module/bindings/post-data.js +135 -0
- package/build-module/bindings/post-data.js.map +1 -0
- package/build-module/bindings/post-meta.js +4 -0
- package/build-module/bindings/post-meta.js.map +1 -1
- package/build-module/components/media-categories/index.js +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/post-card-panel/index.js +2 -2
- package/build-module/components/post-card-panel/index.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +3 -3
- package/build-module/components/post-featured-image/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/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/provider/index.native.js +4 -1
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +9 -4
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/store/actions.js +0 -15
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +9 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/media-upload/index.js +1 -1
- package/build-module/utils/media-upload/index.js.map +1 -1
- package/build-style/style-rtl.css +41 -15
- package/build-style/style.css +41 -15
- package/build-types/bindings/api.d.ts.map +1 -1
- package/build-types/bindings/pattern-overrides.d.ts +6 -6
- package/build-types/bindings/pattern-overrides.d.ts.map +1 -1
- package/build-types/bindings/post-data.d.ts +24 -0
- package/build-types/bindings/post-data.d.ts.map +1 -0
- package/build-types/bindings/post-meta.d.ts +7 -7
- package/build-types/bindings/post-meta.d.ts.map +1 -1
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +11 -11
- package/build-types/components/media-categories/index.d.ts.map +1 -1
- package/build-types/components/post-actions/set-as-homepage.d.ts +1 -1
- package/build-types/components/post-actions/set-as-posts-page.d.ts +1 -1
- package/build-types/components/post-format/index.d.ts +10 -10
- package/build-types/components/post-status/index.d.ts +10 -10
- package/build-types/components/post-visibility/utils.d.ts +6 -6
- package/build-types/components/provider/use-block-editor-settings.d.ts.map +1 -1
- package/build-types/store/actions.d.ts.map +1 -1
- package/build-types/store/selectors.d.ts +6 -2
- package/build-types/store/selectors.d.ts.map +1 -1
- package/build-types/utils/pageTypeBadge.d.ts +1 -1
- package/build-types/utils/pageTypeBadge.d.ts.map +1 -1
- package/package.json +37 -37
- package/src/bindings/api.js +2 -0
- package/src/bindings/pattern-overrides.js +3 -0
- package/src/bindings/post-data.js +128 -0
- package/src/bindings/post-meta.js +3 -0
- package/src/components/collapsible-block-toolbar/style.scss +4 -3
- package/src/components/error-boundary/style.scss +1 -1
- package/src/components/header/style.scss +1 -0
- package/src/components/media-categories/index.js +8 -4
- package/src/components/post-card-panel/index.js +3 -3
- package/src/components/post-featured-image/index.js +7 -3
- package/src/components/post-publish-panel/style.scss +1 -0
- package/src/components/post-taxonomies/flat-term-selector.js +1 -1
- package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -4
- package/src/components/post-taxonomies/test/index.js +6 -6
- package/src/components/provider/index.native.js +5 -1
- package/src/components/provider/use-block-editor-settings.js +8 -3
- package/src/components/sidebar/style.scss +4 -0
- package/src/components/text-editor/style.scss +1 -0
- package/src/store/actions.js +0 -15
- package/src/store/selectors.js +12 -3
- package/src/store/test/selectors.js +30 -0
- package/src/utils/media-upload/index.js +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AAyEA;;;;;;;GAOG;AACH,gDAFY,MAAM,CAUjB;AAED;;;;;GAKG;AACH;;EAOC;AAED;;;;;;GAMG;AACH,8BAHY,MAAM,CAWjB;AAED;;;;;;GAMG;AACH,uCAFW,MAAM,UAQhB;AAED;;;;;;;GAOG;AACH,wCALW,MAAM,UACN,MAAM,GAEL,MAAM,CAQjB;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AAyEA;;;;;;;GAOG;AACH,gDAFY,MAAM,CAUjB;AAED;;;;;GAKG;AACH;;EAOC;AAED;;;;;;GAMG;AACH,8BAHY,MAAM,CAWjB;AAED;;;;;;GAMG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AAuBK,yDAFJ;IAA0B,YAAY;CACxC;;;WAiEC;AAKK;;WA8BL;AAKK;;WA+BL;AAOK,uCAFI,MAAM;;;WAyBf;AA2CD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC;AATD;;WASC"}
|
|
@@ -96,10 +96,14 @@ export function getCurrentPostAttribute(state: Object, attributeName: string): a
|
|
|
96
96
|
* const getFeaturedMediaUrl = useSelect( ( select ) => {
|
|
97
97
|
* const getFeaturedMediaId =
|
|
98
98
|
* select( 'core/editor' ).getEditedPostAttribute( 'featured_media' );
|
|
99
|
-
* const
|
|
99
|
+
* const media = select( 'core' ).getEntityRecord(
|
|
100
|
+
* 'postType',
|
|
101
|
+
* 'attachment',
|
|
102
|
+
* getFeaturedMediaId
|
|
103
|
+
* );
|
|
100
104
|
*
|
|
101
105
|
* return (
|
|
102
|
-
*
|
|
106
|
+
* media?.media_details?.sizes?.large?.source_url || media?.source_url || ''
|
|
103
107
|
* );
|
|
104
108
|
* }, [] );
|
|
105
109
|
*```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.js"],"names":[],"mappings":"AAgEA;;;;;;;GAOG;AACH,uCAJW,MAAM,GAEL,OAAO,CAIlB;AAED;;;;;;GAMG;AACH,yCAJW,MAAM,GAEL,OAAO,CAKlB;AA+CD;;;;;;;GAOG;AACH,sCAJW,MAAM,GAEL,OAAO,CAIlB;AAgCD;;;;;;;;;;;GAWG;AACH,0CATW,MAAM,GAOL,M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;EAA6E;AAE7E;;GAEG;AACH;;;;EACgD;AAEhD;;GAEG;AACH;;;;EAAqE;AAErE;;GAEG;AACH;;;;EAA6D;AAE7D;;GAEG;AACH;;;;EAEE;AAEF;;GAEG;AACH;;;;EAEE;AAEF;;GAEG;AACH;;;;EAEE;AAEF;;GAEG;AACH;;;;EAA2E;AAE3E;;GAEG;AACH;;;;EAAmE;AAEnE;;GAEG;AACH;;;;EAA2E;AAE3E;;GAEG;AACH;;;;EACgD;AAEhD;;GAEG;AACH;;;;EAA6E;AAE7E;;GAEG;AACH;;;;EAA6E;AAE7E;;GAEG;AACH;;;;EAEE;AAEF;;;;EAYE;AAEF;;;;;;GAMG;AACH;;;;EAoBE;AAEF;;;;;;;GAOG;AACH;;;;EAsBE;AAEF;;;;;;;GAOG;AACH;;;;EAuBE;AAEF;;;;;;GAMG;AACH;;;;EAQE;;;;;;;;cAtmBY,MAAM;;;;kBACN,MAAM;;;;;YACN,MAAM"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {number|string} postId postId of the current post being edited.
|
|
5
5
|
*/
|
|
6
|
-
export default function usePageTypeBadge(postId: number | string): false | import("@wordpress/i18n
|
|
6
|
+
export default function usePageTypeBadge(postId: number | string): false | import("@wordpress/i18n").TranslatableText<"Homepage"> | import("@wordpress/i18n").TranslatableText<"Posts Page">;
|
|
7
7
|
//# sourceMappingURL=pageTypeBadge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pageTypeBadge.d.ts","sourceRoot":"","sources":["../../src/utils/pageTypeBadge.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,iDAFW,MAAM,GAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"pageTypeBadge.d.ts","sourceRoot":"","sources":["../../src/utils/pageTypeBadge.js"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,iDAFW,MAAM,GAAC,MAAM,6HA2BvB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.28.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -34,41 +34,41 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "7.25.7",
|
|
37
|
-
"@wordpress/a11y": "^4.
|
|
38
|
-
"@wordpress/api-fetch": "^7.
|
|
39
|
-
"@wordpress/blob": "^4.
|
|
40
|
-
"@wordpress/block-editor": "^15.
|
|
41
|
-
"@wordpress/blocks": "^15.
|
|
42
|
-
"@wordpress/commands": "^1.
|
|
43
|
-
"@wordpress/components": "^30.
|
|
44
|
-
"@wordpress/compose": "^7.
|
|
45
|
-
"@wordpress/core-data": "^7.
|
|
46
|
-
"@wordpress/data": "^10.
|
|
47
|
-
"@wordpress/dataviews": "^
|
|
48
|
-
"@wordpress/date": "^5.
|
|
49
|
-
"@wordpress/deprecated": "^4.
|
|
50
|
-
"@wordpress/dom": "^4.
|
|
51
|
-
"@wordpress/element": "^6.
|
|
52
|
-
"@wordpress/fields": "^0.
|
|
53
|
-
"@wordpress/hooks": "^4.
|
|
54
|
-
"@wordpress/html-entities": "^4.
|
|
55
|
-
"@wordpress/i18n": "^6.
|
|
56
|
-
"@wordpress/icons": "^10.
|
|
57
|
-
"@wordpress/interface": "^9.
|
|
58
|
-
"@wordpress/keyboard-shortcuts": "^5.
|
|
59
|
-
"@wordpress/keycodes": "^4.
|
|
60
|
-
"@wordpress/media-utils": "^5.
|
|
61
|
-
"@wordpress/notices": "^5.
|
|
62
|
-
"@wordpress/patterns": "^2.
|
|
63
|
-
"@wordpress/plugins": "^7.
|
|
64
|
-
"@wordpress/preferences": "^4.
|
|
65
|
-
"@wordpress/private-apis": "^1.
|
|
66
|
-
"@wordpress/reusable-blocks": "^5.
|
|
67
|
-
"@wordpress/rich-text": "^7.
|
|
68
|
-
"@wordpress/server-side-render": "^6.
|
|
69
|
-
"@wordpress/url": "^4.
|
|
70
|
-
"@wordpress/warning": "^3.
|
|
71
|
-
"@wordpress/wordcount": "^4.
|
|
37
|
+
"@wordpress/a11y": "^4.28.0",
|
|
38
|
+
"@wordpress/api-fetch": "^7.28.0",
|
|
39
|
+
"@wordpress/blob": "^4.28.0",
|
|
40
|
+
"@wordpress/block-editor": "^15.1.0",
|
|
41
|
+
"@wordpress/blocks": "^15.1.0",
|
|
42
|
+
"@wordpress/commands": "^1.28.0",
|
|
43
|
+
"@wordpress/components": "^30.1.0",
|
|
44
|
+
"@wordpress/compose": "^7.28.0",
|
|
45
|
+
"@wordpress/core-data": "^7.28.0",
|
|
46
|
+
"@wordpress/data": "^10.28.0",
|
|
47
|
+
"@wordpress/dataviews": "^6.0.0",
|
|
48
|
+
"@wordpress/date": "^5.28.0",
|
|
49
|
+
"@wordpress/deprecated": "^4.28.0",
|
|
50
|
+
"@wordpress/dom": "^4.28.0",
|
|
51
|
+
"@wordpress/element": "^6.28.0",
|
|
52
|
+
"@wordpress/fields": "^0.20.0",
|
|
53
|
+
"@wordpress/hooks": "^4.28.0",
|
|
54
|
+
"@wordpress/html-entities": "^4.28.0",
|
|
55
|
+
"@wordpress/i18n": "^6.1.0",
|
|
56
|
+
"@wordpress/icons": "^10.28.0",
|
|
57
|
+
"@wordpress/interface": "^9.13.0",
|
|
58
|
+
"@wordpress/keyboard-shortcuts": "^5.28.0",
|
|
59
|
+
"@wordpress/keycodes": "^4.28.0",
|
|
60
|
+
"@wordpress/media-utils": "^5.28.0",
|
|
61
|
+
"@wordpress/notices": "^5.28.0",
|
|
62
|
+
"@wordpress/patterns": "^2.28.0",
|
|
63
|
+
"@wordpress/plugins": "^7.28.0",
|
|
64
|
+
"@wordpress/preferences": "^4.28.0",
|
|
65
|
+
"@wordpress/private-apis": "^1.28.0",
|
|
66
|
+
"@wordpress/reusable-blocks": "^5.28.0",
|
|
67
|
+
"@wordpress/rich-text": "^7.28.0",
|
|
68
|
+
"@wordpress/server-side-render": "^6.4.0",
|
|
69
|
+
"@wordpress/url": "^4.28.0",
|
|
70
|
+
"@wordpress/warning": "^3.28.0",
|
|
71
|
+
"@wordpress/wordcount": "^4.28.0",
|
|
72
72
|
"change-case": "^4.1.2",
|
|
73
73
|
"client-zip": "^2.4.5",
|
|
74
74
|
"clsx": "^2.1.1",
|
|
@@ -88,5 +88,5 @@
|
|
|
88
88
|
"publishConfig": {
|
|
89
89
|
"access": "public"
|
|
90
90
|
},
|
|
91
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "28cc2098f5ee28f89096b638533796538f495f72"
|
|
92
92
|
}
|
package/src/bindings/api.js
CHANGED
|
@@ -7,6 +7,7 @@ import { registerBlockBindingsSource } from '@wordpress/blocks';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import patternOverrides from './pattern-overrides';
|
|
10
|
+
import postData from './post-data';
|
|
10
11
|
import postMeta from './post-meta';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -21,5 +22,6 @@ import postMeta from './post-meta';
|
|
|
21
22
|
*/
|
|
22
23
|
export function registerCoreBlockBindingsSources() {
|
|
23
24
|
registerBlockBindingsSource( patternOverrides );
|
|
25
|
+
registerBlockBindingsSource( postData );
|
|
24
26
|
registerBlockBindingsSource( postMeta );
|
|
25
27
|
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { store as coreDataStore } from '@wordpress/core-data';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Gets a list of post data fields with their values and labels
|
|
9
|
+
* to be consumed in the needed callbacks.
|
|
10
|
+
* If the value is not available based on context, like in templates,
|
|
11
|
+
* it falls back to the default value, label, or key.
|
|
12
|
+
*
|
|
13
|
+
* @param {Object} select The select function from the data store.
|
|
14
|
+
* @param {Object} context The context provided.
|
|
15
|
+
* @return {Object} List of post data fields with their value and label.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```js
|
|
19
|
+
* {
|
|
20
|
+
* field_1_key: {
|
|
21
|
+
* label: 'Field 1 Label',
|
|
22
|
+
* value: 'Field 1 Value',
|
|
23
|
+
* },
|
|
24
|
+
* field_2_key: {
|
|
25
|
+
* label: 'Field 2 Label',
|
|
26
|
+
* value: 'Field 2 Value',
|
|
27
|
+
* },
|
|
28
|
+
* ...
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
function getPostDataFields( select, context ) {
|
|
33
|
+
const { getEditedEntityRecord } = select( coreDataStore );
|
|
34
|
+
|
|
35
|
+
let entityDataValues, dataFields;
|
|
36
|
+
// Try to get the current entity data values.
|
|
37
|
+
if ( context?.postType && context?.postId ) {
|
|
38
|
+
entityDataValues = getEditedEntityRecord(
|
|
39
|
+
'postType',
|
|
40
|
+
context?.postType,
|
|
41
|
+
context?.postId
|
|
42
|
+
);
|
|
43
|
+
dataFields = {
|
|
44
|
+
date: {
|
|
45
|
+
label: __( 'Post Date' ),
|
|
46
|
+
value: entityDataValues?.date,
|
|
47
|
+
type: 'string',
|
|
48
|
+
},
|
|
49
|
+
modified: {
|
|
50
|
+
label: __( 'Post Modified Date' ),
|
|
51
|
+
value: entityDataValues?.modified,
|
|
52
|
+
type: 'string',
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if ( ! Object.keys( dataFields || {} ).length ) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return dataFields;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @type {WPBlockBindingsSource}
|
|
66
|
+
*/
|
|
67
|
+
export default {
|
|
68
|
+
name: 'core/post-data',
|
|
69
|
+
getValues( { select, context, bindings } ) {
|
|
70
|
+
const dataFields = getPostDataFields( select, context );
|
|
71
|
+
|
|
72
|
+
const newValues = {};
|
|
73
|
+
for ( const [ attributeName, source ] of Object.entries( bindings ) ) {
|
|
74
|
+
// Use the value, the field label, or the field key.
|
|
75
|
+
const fieldKey = source.args.key;
|
|
76
|
+
const { value: fieldValue, label: fieldLabel } =
|
|
77
|
+
dataFields?.[ fieldKey ] || {};
|
|
78
|
+
newValues[ attributeName ] = fieldValue ?? fieldLabel ?? fieldKey;
|
|
79
|
+
}
|
|
80
|
+
return newValues;
|
|
81
|
+
},
|
|
82
|
+
setValues( { dispatch, context, bindings } ) {
|
|
83
|
+
const newData = {};
|
|
84
|
+
Object.values( bindings ).forEach( ( { args, newValue } ) => {
|
|
85
|
+
newData[ args.key ] = newValue;
|
|
86
|
+
} );
|
|
87
|
+
|
|
88
|
+
dispatch( coreDataStore ).editEntityRecord(
|
|
89
|
+
'postType',
|
|
90
|
+
context?.postType,
|
|
91
|
+
context?.postId,
|
|
92
|
+
newData
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
canUserEditValue( { select, context, args } ) {
|
|
96
|
+
// Lock editing in query loop.
|
|
97
|
+
if ( context?.query || context?.queryId ) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Lock editing when `postType` is not defined.
|
|
102
|
+
if ( ! context?.postType ) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const fieldValue = getPostDataFields( select, context )?.[ args.key ]
|
|
107
|
+
?.value;
|
|
108
|
+
// Empty string or `false` could be a valid value, so we need to check if the field value is undefined.
|
|
109
|
+
if ( fieldValue === undefined ) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Check that the user has the capability to edit post data.
|
|
114
|
+
const canUserEdit = select( coreDataStore ).canUser( 'update', {
|
|
115
|
+
kind: 'postType',
|
|
116
|
+
name: context?.postType,
|
|
117
|
+
id: context?.postId,
|
|
118
|
+
} );
|
|
119
|
+
if ( ! canUserEdit ) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return true;
|
|
124
|
+
},
|
|
125
|
+
getFieldsList( { select, context } ) {
|
|
126
|
+
return getPostDataFields( select, context );
|
|
127
|
+
},
|
|
128
|
+
};
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
.block-editor-block-toolbar {
|
|
15
15
|
height: 100%;
|
|
16
16
|
// Push down so that buttons are centered vertically.
|
|
17
|
-
// It should be
|
|
17
|
+
// It should be 16px (64px header height - 32px compact button height = 32 / 2),
|
|
18
18
|
// but there is a -1px top-margin down the stack that affects this.
|
|
19
19
|
padding-top: math.div($header-height - $button-size-compact, 2) + 1;
|
|
20
20
|
|
|
@@ -62,12 +62,13 @@
|
|
|
62
62
|
overflow: visible;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
//
|
|
65
|
+
// Reduce height and move up a little to prevent the toolbar
|
|
66
|
+
// shift when focus is on the vertical movers.
|
|
66
67
|
@include break-small() {
|
|
67
68
|
&:not(.is-horizontal) .block-editor-block-mover__move-button-container {
|
|
68
69
|
height: $grid-unit-50;
|
|
69
70
|
position: relative;
|
|
70
|
-
top: -
|
|
71
|
+
top: #{$grid-unit-05 * -1};
|
|
71
72
|
}
|
|
72
73
|
}
|
|
73
74
|
}
|
|
@@ -125,10 +125,14 @@ const getOpenverseCaption = ( item ) => {
|
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
const coreMediaFetch = async ( query = {} ) => {
|
|
128
|
-
const mediaItems = await resolveSelect( coreStore ).
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
const mediaItems = await resolveSelect( coreStore ).getEntityRecords(
|
|
129
|
+
'postType',
|
|
130
|
+
'attachment',
|
|
131
|
+
{
|
|
132
|
+
...query,
|
|
133
|
+
orderBy: !! query?.search ? 'relevance' : 'date',
|
|
134
|
+
}
|
|
135
|
+
);
|
|
132
136
|
return mediaItems.map( ( mediaItem ) => ( {
|
|
133
137
|
...mediaItem,
|
|
134
138
|
alt: mediaItem.alt_text,
|
|
@@ -88,9 +88,9 @@ export default function PostCardPanel( {
|
|
|
88
88
|
let title = __( 'No title' );
|
|
89
89
|
if ( labels?.name && postIds.length > 1 ) {
|
|
90
90
|
title = sprintf(
|
|
91
|
-
// translators: %
|
|
92
|
-
__( '%
|
|
93
|
-
|
|
91
|
+
// translators: %1$d number of selected items %2$s: Name of the plural post type e.g: "Posts".
|
|
92
|
+
__( '%1$d %2$s' ),
|
|
93
|
+
postIds.length,
|
|
94
94
|
labels?.name
|
|
95
95
|
);
|
|
96
96
|
} else if ( postTitle ) {
|
|
@@ -305,21 +305,25 @@ function PostFeaturedImage( {
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
const applyWithSelect = withSelect( ( select ) => {
|
|
308
|
-
const {
|
|
308
|
+
const { getEntityRecord, getPostType, hasFinishedResolution } =
|
|
309
309
|
select( coreStore );
|
|
310
310
|
const { getCurrentPostId, getEditedPostAttribute } = select( editorStore );
|
|
311
311
|
const featuredImageId = getEditedPostAttribute( 'featured_media' );
|
|
312
312
|
|
|
313
313
|
return {
|
|
314
314
|
media: featuredImageId
|
|
315
|
-
?
|
|
315
|
+
? getEntityRecord( 'postType', 'attachment', featuredImageId, {
|
|
316
|
+
context: 'view',
|
|
317
|
+
} )
|
|
316
318
|
: null,
|
|
317
319
|
currentPostId: getCurrentPostId(),
|
|
318
320
|
postType: getPostType( getEditedPostAttribute( 'type' ) ),
|
|
319
321
|
featuredImageId,
|
|
320
322
|
isRequestingFeaturedImageMedia:
|
|
321
323
|
!! featuredImageId &&
|
|
322
|
-
! hasFinishedResolution( '
|
|
324
|
+
! hasFinishedResolution( 'getEntityRecord', [
|
|
325
|
+
'postType',
|
|
326
|
+
'attachment',
|
|
323
327
|
featuredImageId,
|
|
324
328
|
{ context: 'view' },
|
|
325
329
|
] ),
|
|
@@ -279,7 +279,7 @@ export function FlatTermSelector( { slug, __nextHasNoMarginBottom } ) {
|
|
|
279
279
|
|
|
280
280
|
const newTermLabel =
|
|
281
281
|
taxonomy?.labels?.add_new_item ??
|
|
282
|
-
( slug === 'post_tag' ? __( 'Add
|
|
282
|
+
( slug === 'post_tag' ? __( 'Add Tag' ) : __( 'Add Term' ) );
|
|
283
283
|
const singularName =
|
|
284
284
|
taxonomy?.labels?.singular_name ??
|
|
285
285
|
( slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' ) );
|
|
@@ -389,13 +389,13 @@ export function HierarchicalTermSelector( { slug } ) {
|
|
|
389
389
|
|
|
390
390
|
const newTermButtonLabel = labelWithFallback(
|
|
391
391
|
'add_new_item',
|
|
392
|
-
__( 'Add
|
|
393
|
-
__( 'Add
|
|
392
|
+
__( 'Add Category' ),
|
|
393
|
+
__( 'Add Term' )
|
|
394
394
|
);
|
|
395
395
|
const newTermLabel = labelWithFallback(
|
|
396
396
|
'new_item_name',
|
|
397
|
-
__( 'Add
|
|
398
|
-
__( 'Add
|
|
397
|
+
__( 'Add Category' ),
|
|
398
|
+
__( 'Add Term' )
|
|
399
399
|
);
|
|
400
400
|
const parentSelectLabel = labelWithFallback(
|
|
401
401
|
'parent_item',
|
|
@@ -26,7 +26,7 @@ describe( 'PostTaxonomies', () => {
|
|
|
26
26
|
show_ui: true,
|
|
27
27
|
},
|
|
28
28
|
labels: {
|
|
29
|
-
add_new_item: 'Add
|
|
29
|
+
add_new_item: 'Add Genre',
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
|
|
@@ -40,7 +40,7 @@ describe( 'PostTaxonomies', () => {
|
|
|
40
40
|
show_ui: true,
|
|
41
41
|
},
|
|
42
42
|
labels: {
|
|
43
|
-
add_new_item: 'Add
|
|
43
|
+
add_new_item: 'Add Category',
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -135,10 +135,10 @@ describe( 'PostTaxonomies', () => {
|
|
|
135
135
|
screen.queryByRole( 'group', { name: 'Categories' } )
|
|
136
136
|
).not.toBeInTheDocument();
|
|
137
137
|
expect(
|
|
138
|
-
screen.getByRole( 'button', { name: 'Add
|
|
138
|
+
screen.getByRole( 'button', { name: 'Add Genre' } )
|
|
139
139
|
).toBeVisible();
|
|
140
140
|
expect(
|
|
141
|
-
screen.queryByRole( 'button', { name: 'Add
|
|
141
|
+
screen.queryByRole( 'button', { name: 'Add Category' } )
|
|
142
142
|
).not.toBeInTheDocument();
|
|
143
143
|
} );
|
|
144
144
|
|
|
@@ -158,13 +158,13 @@ describe( 'PostTaxonomies', () => {
|
|
|
158
158
|
|
|
159
159
|
expect( screen.getByRole( 'group', { name: 'Genres' } ) ).toBeVisible();
|
|
160
160
|
expect(
|
|
161
|
-
screen.getByRole( 'button', { name: 'Add
|
|
161
|
+
screen.getByRole( 'button', { name: 'Add Genre' } )
|
|
162
162
|
).toBeVisible();
|
|
163
163
|
expect(
|
|
164
164
|
screen.queryByRole( 'group', { name: 'Categories' } )
|
|
165
165
|
).not.toBeInTheDocument();
|
|
166
166
|
expect(
|
|
167
|
-
screen.queryByRole( 'button', { name: 'Add
|
|
167
|
+
screen.queryByRole( 'button', { name: 'Add Category' } )
|
|
168
168
|
).not.toBeInTheDocument();
|
|
169
169
|
} );
|
|
170
170
|
} );
|
|
@@ -47,7 +47,11 @@ import { __ } from '@wordpress/i18n';
|
|
|
47
47
|
const postTypeEntities = [
|
|
48
48
|
{ name: 'post', baseURL: '/wp/v2/posts' },
|
|
49
49
|
{ name: 'page', baseURL: '/wp/v2/pages' },
|
|
50
|
-
{
|
|
50
|
+
{
|
|
51
|
+
name: 'attachment',
|
|
52
|
+
baseURL: '/wp/v2/media',
|
|
53
|
+
baseURLParams: { context: 'edit' },
|
|
54
|
+
},
|
|
51
55
|
{ name: 'wp_block', baseURL: '/wp/v2/blocks' },
|
|
52
56
|
].map( ( postTypeEntity ) => ( {
|
|
53
57
|
kind: 'postType',
|
|
@@ -94,6 +94,7 @@ const {
|
|
|
94
94
|
selectBlockPatternsKey,
|
|
95
95
|
reusableBlocksSelectKey,
|
|
96
96
|
sectionRootClientIdKey,
|
|
97
|
+
mediaEditKey,
|
|
97
98
|
} = unlock( privateApis );
|
|
98
99
|
|
|
99
100
|
/**
|
|
@@ -176,8 +177,8 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
176
177
|
keepCaretInsideBlock: get( 'core', 'keepCaretInsideBlock' ),
|
|
177
178
|
hasUploadPermissions:
|
|
178
179
|
canUser( 'create', {
|
|
179
|
-
kind: '
|
|
180
|
-
name: '
|
|
180
|
+
kind: 'postType',
|
|
181
|
+
name: 'attachment',
|
|
181
182
|
} ) ?? true,
|
|
182
183
|
userCanCreatePages: canUser( 'create', {
|
|
183
184
|
kind: 'postType',
|
|
@@ -231,7 +232,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
231
232
|
);
|
|
232
233
|
|
|
233
234
|
const { undo, setIsInserterOpened } = useDispatch( editorStore );
|
|
234
|
-
|
|
235
|
+
const { editMediaEntity } = unlock( useDispatch( coreStore ) );
|
|
235
236
|
const { saveEntityRecord } = useDispatch( coreStore );
|
|
236
237
|
|
|
237
238
|
/**
|
|
@@ -291,6 +292,9 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
291
292
|
hasFixedToolbar,
|
|
292
293
|
isDistractionFree,
|
|
293
294
|
keepCaretInsideBlock,
|
|
295
|
+
[ mediaEditKey ]: hasUploadPermissions
|
|
296
|
+
? editMediaEntity
|
|
297
|
+
: undefined,
|
|
294
298
|
mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
|
|
295
299
|
mediaSideload: hasUploadPermissions ? mediaSideload : undefined,
|
|
296
300
|
__experimentalBlockPatterns: blockPatterns,
|
|
@@ -363,6 +367,7 @@ function useBlockEditorSettings( settings, postType, postId, renderingMode ) {
|
|
|
363
367
|
globalStylesData,
|
|
364
368
|
globalStylesLinksData,
|
|
365
369
|
renderingMode,
|
|
370
|
+
editMediaEntity,
|
|
366
371
|
] );
|
|
367
372
|
}
|
|
368
373
|
|
package/src/store/actions.js
CHANGED
|
@@ -165,21 +165,6 @@ export function setEditedPost( postType, postId ) {
|
|
|
165
165
|
* wp.data.dispatch( 'core/editor' ).editPost( { title: `${ newTitle }` } );
|
|
166
166
|
* ```
|
|
167
167
|
*
|
|
168
|
-
* @example
|
|
169
|
-
*```js
|
|
170
|
-
* // Get specific media size based on the featured media ID
|
|
171
|
-
* // Note: change sizes?.large for any registered size
|
|
172
|
-
* const getFeaturedMediaUrl = useSelect( ( select ) => {
|
|
173
|
-
* const getFeaturedMediaId =
|
|
174
|
-
* select( 'core/editor' ).getEditedPostAttribute( 'featured_media' );
|
|
175
|
-
* const getMedia = select( 'core' ).getMedia( getFeaturedMediaId );
|
|
176
|
-
*
|
|
177
|
-
* return (
|
|
178
|
-
* getMedia?.media_details?.sizes?.large?.source_url || getMedia?.source_url || ''
|
|
179
|
-
* );
|
|
180
|
-
* }, [] );
|
|
181
|
-
* ```
|
|
182
|
-
*
|
|
183
168
|
* @return {Object} Action object
|
|
184
169
|
*/
|
|
185
170
|
export const editPost =
|
package/src/store/selectors.js
CHANGED
|
@@ -330,10 +330,14 @@ const getNestedEditedPostProperty = createSelector(
|
|
|
330
330
|
* const getFeaturedMediaUrl = useSelect( ( select ) => {
|
|
331
331
|
* const getFeaturedMediaId =
|
|
332
332
|
* select( 'core/editor' ).getEditedPostAttribute( 'featured_media' );
|
|
333
|
-
* const
|
|
333
|
+
* const media = select( 'core' ).getEntityRecord(
|
|
334
|
+
* 'postType',
|
|
335
|
+
* 'attachment',
|
|
336
|
+
* getFeaturedMediaId
|
|
337
|
+
* );
|
|
334
338
|
*
|
|
335
339
|
* return (
|
|
336
|
-
*
|
|
340
|
+
* media?.media_details?.sizes?.large?.source_url || media?.source_url || ''
|
|
337
341
|
* );
|
|
338
342
|
* }, [] );
|
|
339
343
|
*```
|
|
@@ -610,9 +614,14 @@ export const isEditedPostAutosaveable = createRegistrySelector(
|
|
|
610
614
|
}
|
|
611
615
|
|
|
612
616
|
const postType = getCurrentPostType( state );
|
|
617
|
+
const postTypeObject = select( coreStore ).getPostType( postType );
|
|
613
618
|
|
|
614
619
|
// Currently template autosaving is not supported.
|
|
615
|
-
|
|
620
|
+
// @todo: Remove hardcode check for template after bumping required WP version to 6.8.
|
|
621
|
+
if (
|
|
622
|
+
postType === 'wp_template' ||
|
|
623
|
+
! postTypeObject?.supports?.autosave
|
|
624
|
+
) {
|
|
616
625
|
return false;
|
|
617
626
|
}
|
|
618
627
|
|