@wordpress/editor 12.5.1 → 12.5.2
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/components/entities-saved-states/entity-type-list.js +11 -5
- package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/build-module/components/entities-saved-states/entity-type-list.js +12 -6
- package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
- package/package.json +27 -27
- package/src/components/entities-saved-states/entity-type-list.js +15 -16
|
@@ -32,13 +32,13 @@ var _entityRecordItem = _interopRequireDefault(require("./entity-record-item"));
|
|
|
32
32
|
/**
|
|
33
33
|
* Internal dependencies
|
|
34
34
|
*/
|
|
35
|
-
function getEntityDescription(entity,
|
|
35
|
+
function getEntityDescription(entity, count) {
|
|
36
36
|
switch (entity) {
|
|
37
37
|
case 'site':
|
|
38
|
-
return (0, _i18n.
|
|
38
|
+
return 1 === count ? (0, _i18n.__)('This change will affect your whole site.') : (0, _i18n.__)('These changes will affect your whole site.');
|
|
39
39
|
|
|
40
40
|
case 'wp_template':
|
|
41
|
-
return (0, _i18n.
|
|
41
|
+
return (0, _i18n.__)('This change will affect pages and posts that use this template.');
|
|
42
42
|
|
|
43
43
|
case 'page':
|
|
44
44
|
case 'post':
|
|
@@ -53,14 +53,20 @@ function EntityTypeList(_ref) {
|
|
|
53
53
|
setUnselectedEntities,
|
|
54
54
|
closePanel
|
|
55
55
|
} = _ref;
|
|
56
|
+
const count = list.length;
|
|
56
57
|
const firstRecord = list[0];
|
|
57
58
|
const entityConfig = (0, _data.useSelect)(select => select(_coreData.store).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
|
|
58
59
|
const {
|
|
59
60
|
name
|
|
60
61
|
} = firstRecord;
|
|
61
|
-
|
|
62
|
+
let entityLabel = entityConfig.label;
|
|
62
63
|
|
|
63
|
-
|
|
64
|
+
if (name === 'wp_template_part') {
|
|
65
|
+
entityLabel = 1 === count ? (0, _i18n.__)('Template Part') : (0, _i18n.__)('Template Parts');
|
|
66
|
+
} // Set description based on type of entity.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
const description = getEntityDescription(name, count);
|
|
64
70
|
return (0, _element.createElement)(_components.PanelBody, {
|
|
65
71
|
title: entityLabel,
|
|
66
72
|
initialOpen: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["getEntityDescription","entity","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["getEntityDescription","entity","count","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","length","firstRecord","entityConfig","select","coreStore","getEntityConfig","kind","name","entityLabel","label","description","map","record","key","property","elt","value"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AAhBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,oBAAT,CAA+BC,MAA/B,EAAuCC,KAAvC,EAA+C;AAC9C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAO,MAAMC,KAAN,GACJ,cAAI,0CAAJ,CADI,GAEJ,cAAI,4CAAJ,CAFH;;AAGD,SAAK,aAAL;AACC,aAAO,cACN,iEADM,CAAP;;AAGD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAO,cAAI,0CAAJ,CAAP;AAXF;AAaA;;AAEc,SAASC,cAAT,OAKX;AAAA,MALoC;AACvCC,IAAAA,IADuC;AAEvCC,IAAAA,kBAFuC;AAGvCC,IAAAA,qBAHuC;AAIvCC,IAAAA;AAJuC,GAKpC;AACH,QAAML,KAAK,GAAGE,IAAI,CAACI,MAAnB;AACA,QAAMC,WAAW,GAAGL,IAAI,CAAE,CAAF,CAAxB;AACA,QAAMM,YAAY,GAAG,qBAClBC,MAAF,IACCA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,CACCJ,WAAW,CAACK,IADb,EAECL,WAAW,CAACM,IAFb,CAFmB,EAMpB,CAAEN,WAAW,CAACK,IAAd,EAAoBL,WAAW,CAACM,IAAhC,CANoB,CAArB;AAQA,QAAM;AAAEA,IAAAA;AAAF,MAAWN,WAAjB;AAEA,MAAIO,WAAW,GAAGN,YAAY,CAACO,KAA/B;;AACA,MAAKF,IAAI,KAAK,kBAAd,EAAmC;AAClCC,IAAAA,WAAW,GACV,MAAMd,KAAN,GAAc,cAAI,eAAJ,CAAd,GAAsC,cAAI,gBAAJ,CADvC;AAEA,GAjBE,CAkBH;;;AACA,QAAMgB,WAAW,GAAGlB,oBAAoB,CAAEe,IAAF,EAAQb,KAAR,CAAxC;AAEA,SACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAGc,WAAnB;AAAiC,IAAA,WAAW,EAAG;AAA/C,KACGE,WAAW,IAAI,4BAAC,oBAAD,QAAYA,WAAZ,CADlB,EAEGd,IAAI,CAACe,GAAL,CAAYC,MAAF,IAAc;AACzB,WACC,4BAAC,yBAAD;AACC,MAAA,GAAG,EAAGA,MAAM,CAACC,GAAP,IAAcD,MAAM,CAACE,QAD5B;AAEC,MAAA,MAAM,EAAGF,MAFV;AAGC,MAAA,OAAO,EACN,CAAE,kBACDf,kBADC,EAECkB,GAAF,IACCA,GAAG,CAACT,IAAJ,KAAaM,MAAM,CAACN,IAApB,IACAS,GAAG,CAACR,IAAJ,KAAaK,MAAM,CAACL,IADpB,IAEAQ,GAAG,CAACF,GAAJ,KAAYD,MAAM,CAACC,GAFnB,IAGAE,GAAG,CAACD,QAAJ,KAAiBF,MAAM,CAACE,QANxB,CAJJ;AAaC,MAAA,QAAQ,EAAKE,KAAF,IACVlB,qBAAqB,CAAEc,MAAF,EAAUI,KAAV,CAdvB;AAgBC,MAAA,UAAU,EAAGjB;AAhBd,MADD;AAoBA,GArBC,CAFH,CADD;AA2BA","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n\tclosePanel,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\tconst { name } = firstRecord;\n\n\tlet entityLabel = entityConfig.label;\n\tif ( name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, count );\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t{ description && <PanelRow>{ description }</PanelRow> }\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! some(\n\t\t\t\t\t\t\t\tunselectedEntities,\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclosePanel={ closePanel }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
|
@@ -8,7 +8,7 @@ import { some } from 'lodash';
|
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { __
|
|
11
|
+
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { useSelect } from '@wordpress/data';
|
|
13
13
|
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
14
14
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -18,13 +18,13 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
18
18
|
|
|
19
19
|
import EntityRecordItem from './entity-record-item';
|
|
20
20
|
|
|
21
|
-
function getEntityDescription(entity,
|
|
21
|
+
function getEntityDescription(entity, count) {
|
|
22
22
|
switch (entity) {
|
|
23
23
|
case 'site':
|
|
24
|
-
return
|
|
24
|
+
return 1 === count ? __('This change will affect your whole site.') : __('These changes will affect your whole site.');
|
|
25
25
|
|
|
26
26
|
case 'wp_template':
|
|
27
|
-
return
|
|
27
|
+
return __('This change will affect pages and posts that use this template.');
|
|
28
28
|
|
|
29
29
|
case 'page':
|
|
30
30
|
case 'post':
|
|
@@ -39,14 +39,20 @@ export default function EntityTypeList(_ref) {
|
|
|
39
39
|
setUnselectedEntities,
|
|
40
40
|
closePanel
|
|
41
41
|
} = _ref;
|
|
42
|
+
const count = list.length;
|
|
42
43
|
const firstRecord = list[0];
|
|
43
44
|
const entityConfig = useSelect(select => select(coreStore).getEntityConfig(firstRecord.kind, firstRecord.name), [firstRecord.kind, firstRecord.name]);
|
|
44
45
|
const {
|
|
45
46
|
name
|
|
46
47
|
} = firstRecord;
|
|
47
|
-
|
|
48
|
+
let entityLabel = entityConfig.label;
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
if (name === 'wp_template_part') {
|
|
51
|
+
entityLabel = 1 === count ? __('Template Part') : __('Template Parts');
|
|
52
|
+
} // Set description based on type of entity.
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
const description = getEntityDescription(name, count);
|
|
50
56
|
return createElement(PanelBody, {
|
|
51
57
|
title: entityLabel,
|
|
52
58
|
initialOpen: true
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["some","__","
|
|
1
|
+
{"version":3,"sources":["@wordpress/editor/src/components/entities-saved-states/entity-type-list.js"],"names":["some","__","useSelect","PanelBody","PanelRow","store","coreStore","EntityRecordItem","getEntityDescription","entity","count","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","length","firstRecord","entityConfig","select","getEntityConfig","kind","name","entityLabel","label","description","map","record","key","property","elt","value"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,SAAT,EAAoBC,QAApB,QAAoC,uBAApC;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;;AAEA,SAASC,oBAAT,CAA+BC,MAA/B,EAAuCC,KAAvC,EAA+C;AAC9C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAO,MAAMC,KAAN,GACJT,EAAE,CAAE,0CAAF,CADE,GAEJA,EAAE,CAAE,4CAAF,CAFL;;AAGD,SAAK,aAAL;AACC,aAAOA,EAAE,CACR,iEADQ,CAAT;;AAGD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAOA,EAAE,CAAE,0CAAF,CAAT;AAXF;AAaA;;AAED,eAAe,SAASU,cAAT,OAKX;AAAA,MALoC;AACvCC,IAAAA,IADuC;AAEvCC,IAAAA,kBAFuC;AAGvCC,IAAAA,qBAHuC;AAIvCC,IAAAA;AAJuC,GAKpC;AACH,QAAML,KAAK,GAAGE,IAAI,CAACI,MAAnB;AACA,QAAMC,WAAW,GAAGL,IAAI,CAAE,CAAF,CAAxB;AACA,QAAMM,YAAY,GAAGhB,SAAS,CAC3BiB,MAAF,IACCA,MAAM,CAAEb,SAAF,CAAN,CAAoBc,eAApB,CACCH,WAAW,CAACI,IADb,EAECJ,WAAW,CAACK,IAFb,CAF4B,EAM7B,CAAEL,WAAW,CAACI,IAAd,EAAoBJ,WAAW,CAACK,IAAhC,CAN6B,CAA9B;AAQA,QAAM;AAAEA,IAAAA;AAAF,MAAWL,WAAjB;AAEA,MAAIM,WAAW,GAAGL,YAAY,CAACM,KAA/B;;AACA,MAAKF,IAAI,KAAK,kBAAd,EAAmC;AAClCC,IAAAA,WAAW,GACV,MAAMb,KAAN,GAAcT,EAAE,CAAE,eAAF,CAAhB,GAAsCA,EAAE,CAAE,gBAAF,CADzC;AAEA,GAjBE,CAkBH;;;AACA,QAAMwB,WAAW,GAAGjB,oBAAoB,CAAEc,IAAF,EAAQZ,KAAR,CAAxC;AAEA,SACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAGa,WAAnB;AAAiC,IAAA,WAAW,EAAG;AAA/C,KACGE,WAAW,IAAI,cAAC,QAAD,QAAYA,WAAZ,CADlB,EAEGb,IAAI,CAACc,GAAL,CAAYC,MAAF,IAAc;AACzB,WACC,cAAC,gBAAD;AACC,MAAA,GAAG,EAAGA,MAAM,CAACC,GAAP,IAAcD,MAAM,CAACE,QAD5B;AAEC,MAAA,MAAM,EAAGF,MAFV;AAGC,MAAA,OAAO,EACN,CAAE3B,IAAI,CACLa,kBADK,EAEHiB,GAAF,IACCA,GAAG,CAACT,IAAJ,KAAaM,MAAM,CAACN,IAApB,IACAS,GAAG,CAACR,IAAJ,KAAaK,MAAM,CAACL,IADpB,IAEAQ,GAAG,CAACF,GAAJ,KAAYD,MAAM,CAACC,GAFnB,IAGAE,GAAG,CAACD,QAAJ,KAAiBF,MAAM,CAACE,QANpB,CAJR;AAaC,MAAA,QAAQ,EAAKE,KAAF,IACVjB,qBAAqB,CAAEa,MAAF,EAAUI,KAAV,CAdvB;AAgBC,MAAA,UAAU,EAAGhB;AAhBd,MADD;AAoBA,GArBC,CAFH,CADD;AA2BA","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport EntityRecordItem from './entity-record-item';\n\nfunction getEntityDescription( entity, count ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn 1 === count\n\t\t\t\t? __( 'This change will affect your whole site.' )\n\t\t\t\t: __( 'These changes will affect your whole site.' );\n\t\tcase 'wp_template':\n\t\t\treturn __(\n\t\t\t\t'This change will affect pages and posts that use this template.'\n\t\t\t);\n\t\tcase 'page':\n\t\tcase 'post':\n\t\t\treturn __( 'The following content has been modified.' );\n\t}\n}\n\nexport default function EntityTypeList( {\n\tlist,\n\tunselectedEntities,\n\tsetUnselectedEntities,\n\tclosePanel,\n} ) {\n\tconst count = list.length;\n\tconst firstRecord = list[ 0 ];\n\tconst entityConfig = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityConfig(\n\t\t\t\tfirstRecord.kind,\n\t\t\t\tfirstRecord.name\n\t\t\t),\n\t\t[ firstRecord.kind, firstRecord.name ]\n\t);\n\tconst { name } = firstRecord;\n\n\tlet entityLabel = entityConfig.label;\n\tif ( name === 'wp_template_part' ) {\n\t\tentityLabel =\n\t\t\t1 === count ? __( 'Template Part' ) : __( 'Template Parts' );\n\t}\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, count );\n\n\treturn (\n\t\t<PanelBody title={ entityLabel } initialOpen={ true }>\n\t\t\t{ description && <PanelRow>{ description }</PanelRow> }\n\t\t\t{ list.map( ( record ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<EntityRecordItem\n\t\t\t\t\t\tkey={ record.key || record.property }\n\t\t\t\t\t\trecord={ record }\n\t\t\t\t\t\tchecked={\n\t\t\t\t\t\t\t! some(\n\t\t\t\t\t\t\t\tunselectedEntities,\n\t\t\t\t\t\t\t\t( elt ) =>\n\t\t\t\t\t\t\t\t\telt.kind === record.kind &&\n\t\t\t\t\t\t\t\t\telt.name === record.name &&\n\t\t\t\t\t\t\t\t\telt.key === record.key &&\n\t\t\t\t\t\t\t\t\telt.property === record.property\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tsetUnselectedEntities( record, value )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tclosePanel={ closePanel }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</PanelBody>\n\t);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "12.5.
|
|
3
|
+
"version": "12.5.2",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,31 +31,31 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.6.
|
|
35
|
-
"@wordpress/api-fetch": "^6.3.
|
|
36
|
-
"@wordpress/block-editor": "^8.5.
|
|
37
|
-
"@wordpress/blocks": "^11.5.
|
|
38
|
-
"@wordpress/components": "^19.8.
|
|
39
|
-
"@wordpress/compose": "^5.4.
|
|
40
|
-
"@wordpress/core-data": "^4.4.
|
|
41
|
-
"@wordpress/data": "^6.6.
|
|
42
|
-
"@wordpress/date": "^4.6.
|
|
43
|
-
"@wordpress/deprecated": "^3.6.
|
|
44
|
-
"@wordpress/element": "^4.4.
|
|
45
|
-
"@wordpress/hooks": "^3.6.
|
|
46
|
-
"@wordpress/html-entities": "^3.6.
|
|
47
|
-
"@wordpress/i18n": "^4.6.
|
|
48
|
-
"@wordpress/icons": "^8.2.
|
|
49
|
-
"@wordpress/keyboard-shortcuts": "^3.4.
|
|
50
|
-
"@wordpress/keycodes": "^3.6.
|
|
51
|
-
"@wordpress/media-utils": "^3.4.
|
|
52
|
-
"@wordpress/notices": "^3.6.
|
|
53
|
-
"@wordpress/preferences": "^1.2.
|
|
54
|
-
"@wordpress/reusable-blocks": "^3.4.
|
|
55
|
-
"@wordpress/rich-text": "^5.4.
|
|
56
|
-
"@wordpress/server-side-render": "^3.4.
|
|
57
|
-
"@wordpress/url": "^3.7.
|
|
58
|
-
"@wordpress/wordcount": "^3.6.
|
|
34
|
+
"@wordpress/a11y": "^3.6.1",
|
|
35
|
+
"@wordpress/api-fetch": "^6.3.1",
|
|
36
|
+
"@wordpress/block-editor": "^8.5.2",
|
|
37
|
+
"@wordpress/blocks": "^11.5.2",
|
|
38
|
+
"@wordpress/components": "^19.8.1",
|
|
39
|
+
"@wordpress/compose": "^5.4.1",
|
|
40
|
+
"@wordpress/core-data": "^4.4.2",
|
|
41
|
+
"@wordpress/data": "^6.6.1",
|
|
42
|
+
"@wordpress/date": "^4.6.1",
|
|
43
|
+
"@wordpress/deprecated": "^3.6.1",
|
|
44
|
+
"@wordpress/element": "^4.4.1",
|
|
45
|
+
"@wordpress/hooks": "^3.6.1",
|
|
46
|
+
"@wordpress/html-entities": "^3.6.1",
|
|
47
|
+
"@wordpress/i18n": "^4.6.1",
|
|
48
|
+
"@wordpress/icons": "^8.2.1",
|
|
49
|
+
"@wordpress/keyboard-shortcuts": "^3.4.1",
|
|
50
|
+
"@wordpress/keycodes": "^3.6.1",
|
|
51
|
+
"@wordpress/media-utils": "^3.4.1",
|
|
52
|
+
"@wordpress/notices": "^3.6.1",
|
|
53
|
+
"@wordpress/preferences": "^1.2.1",
|
|
54
|
+
"@wordpress/reusable-blocks": "^3.4.2",
|
|
55
|
+
"@wordpress/rich-text": "^5.4.1",
|
|
56
|
+
"@wordpress/server-side-render": "^3.4.2",
|
|
57
|
+
"@wordpress/url": "^3.7.1",
|
|
58
|
+
"@wordpress/wordcount": "^3.6.1",
|
|
59
59
|
"classnames": "^2.3.1",
|
|
60
60
|
"lodash": "^4.17.21",
|
|
61
61
|
"memize": "^1.1.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"publishConfig": {
|
|
70
70
|
"access": "public"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "446565ecaa40370173c18926535e975ec5652b71"
|
|
73
73
|
}
|
|
@@ -6,7 +6,7 @@ import { some } from 'lodash';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import { __
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import { useSelect } from '@wordpress/data';
|
|
11
11
|
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -16,19 +16,15 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
16
16
|
*/
|
|
17
17
|
import EntityRecordItem from './entity-record-item';
|
|
18
18
|
|
|
19
|
-
function getEntityDescription( entity,
|
|
19
|
+
function getEntityDescription( entity, count ) {
|
|
20
20
|
switch ( entity ) {
|
|
21
21
|
case 'site':
|
|
22
|
-
return
|
|
23
|
-
'This change will affect your whole site.'
|
|
24
|
-
'These changes will affect your whole site.'
|
|
25
|
-
length
|
|
26
|
-
);
|
|
22
|
+
return 1 === count
|
|
23
|
+
? __( 'This change will affect your whole site.' )
|
|
24
|
+
: __( 'These changes will affect your whole site.' );
|
|
27
25
|
case 'wp_template':
|
|
28
|
-
return
|
|
29
|
-
'This change will affect pages and posts that use this template.'
|
|
30
|
-
'These changes will affect pages and posts that use these templates.',
|
|
31
|
-
length
|
|
26
|
+
return __(
|
|
27
|
+
'This change will affect pages and posts that use this template.'
|
|
32
28
|
);
|
|
33
29
|
case 'page':
|
|
34
30
|
case 'post':
|
|
@@ -42,6 +38,7 @@ export default function EntityTypeList( {
|
|
|
42
38
|
setUnselectedEntities,
|
|
43
39
|
closePanel,
|
|
44
40
|
} ) {
|
|
41
|
+
const count = list.length;
|
|
45
42
|
const firstRecord = list[ 0 ];
|
|
46
43
|
const entityConfig = useSelect(
|
|
47
44
|
( select ) =>
|
|
@@ -52,12 +49,14 @@ export default function EntityTypeList( {
|
|
|
52
49
|
[ firstRecord.kind, firstRecord.name ]
|
|
53
50
|
);
|
|
54
51
|
const { name } = firstRecord;
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
|
|
53
|
+
let entityLabel = entityConfig.label;
|
|
54
|
+
if ( name === 'wp_template_part' ) {
|
|
55
|
+
entityLabel =
|
|
56
|
+
1 === count ? __( 'Template Part' ) : __( 'Template Parts' );
|
|
57
|
+
}
|
|
59
58
|
// Set description based on type of entity.
|
|
60
|
-
const description = getEntityDescription( name,
|
|
59
|
+
const description = getEntityDescription( name, count );
|
|
61
60
|
|
|
62
61
|
return (
|
|
63
62
|
<PanelBody title={ entityLabel } initialOpen={ true }>
|