@wordpress/editor 12.5.1 → 12.5.4

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.
@@ -32,13 +32,13 @@ var _entityRecordItem = _interopRequireDefault(require("./entity-record-item"));
32
32
  /**
33
33
  * Internal dependencies
34
34
  */
35
- function getEntityDescription(entity, length) {
35
+ function getEntityDescription(entity, count) {
36
36
  switch (entity) {
37
37
  case 'site':
38
- return (0, _i18n._n)('This change will affect your whole site.', 'These changes will affect your whole site.', length);
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._n)('This change will affect pages and posts that use this template.', 'These changes will affect pages and posts that use these templates.', length);
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
- const entityLabel = name === 'wp_template_part' ? (0, _i18n._n)('Template Part', 'Template Parts', list.length) : entityConfig.label; // Set description based on type of entity.
62
+ let entityLabel = entityConfig.label;
62
63
 
63
- const description = getEntityDescription(name, list.length);
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","length","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","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,MAAvC,EAAgD;AAC/C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAO,cACN,0CADM,EAEN,4CAFM,EAGNC,MAHM,CAAP;;AAKD,SAAK,aAAL;AACC,aAAO,cACN,iEADM,EAEN,qEAFM,EAGNA,MAHM,CAAP;;AAKD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAO,cAAI,0CAAJ,CAAP;AAfF;AAiBA;;AAEc,SAASC,cAAT,OAKX;AAAA,MALoC;AACvCC,IAAAA,IADuC;AAEvCC,IAAAA,kBAFuC;AAGvCC,IAAAA,qBAHuC;AAIvCC,IAAAA;AAJuC,GAKpC;AACH,QAAMC,WAAW,GAAGJ,IAAI,CAAE,CAAF,CAAxB;AACA,QAAMK,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;AACA,QAAMO,WAAW,GAChBD,IAAI,KAAK,kBAAT,GACG,cAAI,eAAJ,EAAqB,gBAArB,EAAuCV,IAAI,CAACF,MAA5C,CADH,GAEGO,YAAY,CAACO,KAHjB,CAXG,CAeH;;AACA,QAAMC,WAAW,GAAGjB,oBAAoB,CAAEc,IAAF,EAAQV,IAAI,CAACF,MAAb,CAAxC;AAEA,SACC,4BAAC,qBAAD;AAAW,IAAA,KAAK,EAAGa,WAAnB;AAAiC,IAAA,WAAW,EAAG;AAA/C,KACGE,WAAW,IAAI,4BAAC,oBAAD,QAAYA,WAAZ,CADlB,EAEGb,IAAI,CAACc,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,kBACDd,kBADC,EAECiB,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,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 { __, _n } 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, length ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn _n(\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\t\t\tlength\n\t\t\t);\n\t\tcase 'wp_template':\n\t\t\treturn _n(\n\t\t\t\t'This change will affect pages and posts that use this template.',\n\t\t\t\t'These changes will affect pages and posts that use these templates.',\n\t\t\t\tlength\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 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\tconst entityLabel =\n\t\tname === 'wp_template_part'\n\t\t\t? _n( 'Template Part', 'Template Parts', list.length )\n\t\t\t: entityConfig.label;\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, list.length );\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"]}
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"]}
@@ -42,7 +42,13 @@ function PostTaxonomies(_ref) {
42
42
  taxonomyWrapper = _lodash.identity
43
43
  } = _ref;
44
44
  const availableTaxonomies = (0, _lodash.filter)(taxonomies, taxonomy => (0, _lodash.includes)(taxonomy.types, postType));
45
- const visibleTaxonomies = (0, _lodash.filter)(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui);
45
+ const visibleTaxonomies = (0, _lodash.filter)(availableTaxonomies, // In some circumstances .visibility can end up as undefined so optional chaining operator required.
46
+ // https://github.com/WordPress/gutenberg/issues/40326
47
+ taxonomy => {
48
+ var _taxonomy$visibility;
49
+
50
+ return (_taxonomy$visibility = taxonomy.visibility) === null || _taxonomy$visibility === void 0 ? void 0 : _taxonomy$visibility.show_ui;
51
+ });
46
52
  return visibleTaxonomies.map(taxonomy => {
47
53
  const TaxonomyComponent = taxonomy.hierarchical ? _hierarchicalTermSelector.default : _flatTermSelector.default;
48
54
  return (0, _element.createElement)(_element.Fragment, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"names":["PostTaxonomies","postType","taxonomies","taxonomyWrapper","identity","availableTaxonomies","taxonomy","types","visibleTaxonomies","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","slug","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page"],"mappings":";;;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKO,SAASA,cAAT,OAIH;AAAA,MAJ4B;AAC/BC,IAAAA,QAD+B;AAE/BC,IAAAA,UAF+B;AAG/BC,IAAAA,eAAe,GAAGC;AAHa,GAI5B;AACH,QAAMC,mBAAmB,GAAG,oBAAQH,UAAR,EAAsBI,QAAF,IAC/C,sBAAUA,QAAQ,CAACC,KAAnB,EAA0BN,QAA1B,CAD2B,CAA5B;AAGA,QAAMO,iBAAiB,GAAG,oBACzBH,mBADyB,EAEvBC,QAAF,IAAgBA,QAAQ,CAACG,UAAT,CAAoBC,OAFX,CAA1B;AAIA,SAAOF,iBAAiB,CAACG,GAAlB,CAAyBL,QAAF,IAAgB;AAC7C,UAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAT,GACvBC,iCADuB,GAEvBC,yBAFH;AAGA,WACC,4BAAC,iBAAD;AAAU,MAAA,GAAG,EAAI,YAAYT,QAAQ,CAACU,IAAM;AAA5C,OACGb,eAAe,CAChB,4BAAC,iBAAD;AAAmB,MAAA,IAAI,EAAGG,QAAQ,CAACU;AAAnC,MADgB,EAEhBV,QAFgB,CADlB,CADD;AAQA,GAZM,CAAP;AAaA;;eAEc,sBAAS,CACvB,sBAAcW,MAAF,IAAc;AACzB,SAAO;AACNhB,IAAAA,QAAQ,EAAEgB,MAAM,CAAEC,YAAF,CAAN,CAAsBC,kBAAtB,EADJ;AAENjB,IAAAA,UAAU,EAAEe,MAAM,CAAEG,eAAF,CAAN,CAAoBC,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALD,CADuB,CAAT,EAOVtB,cAPU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, identity, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomies( {\n\tpostType,\n\ttaxonomies,\n\ttaxonomyWrapper = identity,\n} ) {\n\tconst availableTaxonomies = filter( taxonomies, ( taxonomy ) =>\n\t\tincludes( taxonomy.types, postType )\n\t);\n\tconst visibleTaxonomies = filter(\n\t\tavailableTaxonomies,\n\t\t( taxonomy ) => taxonomy.visibility.show_ui\n\t);\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomies );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"names":["PostTaxonomies","postType","taxonomies","taxonomyWrapper","identity","availableTaxonomies","taxonomy","types","visibleTaxonomies","visibility","show_ui","map","TaxonomyComponent","hierarchical","HierarchicalTermSelector","FlatTermSelector","slug","select","editorStore","getCurrentPostType","coreStore","getTaxonomies","per_page"],"mappings":";;;;;;;;;;AAQA;;AALA;;AAMA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAGA;AACA;AACA;;AAMA;AACA;AACA;AAKO,SAASA,cAAT,OAIH;AAAA,MAJ4B;AAC/BC,IAAAA,QAD+B;AAE/BC,IAAAA,UAF+B;AAG/BC,IAAAA,eAAe,GAAGC;AAHa,GAI5B;AACH,QAAMC,mBAAmB,GAAG,oBAAQH,UAAR,EAAsBI,QAAF,IAC/C,sBAAUA,QAAQ,CAACC,KAAnB,EAA0BN,QAA1B,CAD2B,CAA5B;AAGA,QAAMO,iBAAiB,GAAG,oBACzBH,mBADyB,EAEzB;AACA;AACEC,EAAAA,QAAF;AAAA;;AAAA,mCAAgBA,QAAQ,CAACG,UAAzB,yDAAgB,qBAAqBC,OAArC;AAAA,GAJyB,CAA1B;AAMA,SAAOF,iBAAiB,CAACG,GAAlB,CAAyBL,QAAF,IAAgB;AAC7C,UAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAT,GACvBC,iCADuB,GAEvBC,yBAFH;AAGA,WACC,4BAAC,iBAAD;AAAU,MAAA,GAAG,EAAI,YAAYT,QAAQ,CAACU,IAAM;AAA5C,OACGb,eAAe,CAChB,4BAAC,iBAAD;AAAmB,MAAA,IAAI,EAAGG,QAAQ,CAACU;AAAnC,MADgB,EAEhBV,QAFgB,CADlB,CADD;AAQA,GAZM,CAAP;AAaA;;eAEc,sBAAS,CACvB,sBAAcW,MAAF,IAAc;AACzB,SAAO;AACNhB,IAAAA,QAAQ,EAAEgB,MAAM,CAAEC,YAAF,CAAN,CAAsBC,kBAAtB,EADJ;AAENjB,IAAAA,UAAU,EAAEe,MAAM,CAAEG,eAAF,CAAN,CAAoBC,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALD,CADuB,CAAT,EAOVtB,cAPU,C","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, identity, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomies( {\n\tpostType,\n\ttaxonomies,\n\ttaxonomyWrapper = identity,\n} ) {\n\tconst availableTaxonomies = filter( taxonomies, ( taxonomy ) =>\n\t\tincludes( taxonomy.types, postType )\n\t);\n\tconst visibleTaxonomies = filter(\n\t\tavailableTaxonomies,\n\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t( taxonomy ) => taxonomy.visibility?.show_ui\n\t);\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomies );\n"]}
@@ -8,7 +8,7 @@ import { some } from 'lodash';
8
8
  * WordPress dependencies
9
9
  */
10
10
 
11
- import { __, _n } from '@wordpress/i18n';
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, length) {
21
+ function getEntityDescription(entity, count) {
22
22
  switch (entity) {
23
23
  case 'site':
24
- return _n('This change will affect your whole site.', 'These changes will affect your whole site.', length);
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 _n('This change will affect pages and posts that use this template.', 'These changes will affect pages and posts that use these templates.', length);
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
- const entityLabel = name === 'wp_template_part' ? _n('Template Part', 'Template Parts', list.length) : entityConfig.label; // Set description based on type of entity.
48
+ let entityLabel = entityConfig.label;
48
49
 
49
- const description = getEntityDescription(name, list.length);
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","__","_n","useSelect","PanelBody","PanelRow","store","coreStore","EntityRecordItem","getEntityDescription","entity","length","EntityTypeList","list","unselectedEntities","setUnselectedEntities","closePanel","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,EAAaC,EAAb,QAAuB,iBAAvB;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,MAAvC,EAAgD;AAC/C,UAASD,MAAT;AACC,SAAK,MAAL;AACC,aAAOR,EAAE,CACR,0CADQ,EAER,4CAFQ,EAGRS,MAHQ,CAAT;;AAKD,SAAK,aAAL;AACC,aAAOT,EAAE,CACR,iEADQ,EAER,qEAFQ,EAGRS,MAHQ,CAAT;;AAKD,SAAK,MAAL;AACA,SAAK,MAAL;AACC,aAAOV,EAAE,CAAE,0CAAF,CAAT;AAfF;AAiBA;;AAED,eAAe,SAASW,cAAT,OAKX;AAAA,MALoC;AACvCC,IAAAA,IADuC;AAEvCC,IAAAA,kBAFuC;AAGvCC,IAAAA,qBAHuC;AAIvCC,IAAAA;AAJuC,GAKpC;AACH,QAAMC,WAAW,GAAGJ,IAAI,CAAE,CAAF,CAAxB;AACA,QAAMK,YAAY,GAAGf,SAAS,CAC3BgB,MAAF,IACCA,MAAM,CAAEZ,SAAF,CAAN,CAAoBa,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;AACA,QAAMM,WAAW,GAChBD,IAAI,KAAK,kBAAT,GACGpB,EAAE,CAAE,eAAF,EAAmB,gBAAnB,EAAqCW,IAAI,CAACF,MAA1C,CADL,GAEGO,YAAY,CAACM,KAHjB,CAXG,CAeH;;AACA,QAAMC,WAAW,GAAGhB,oBAAoB,CAAEa,IAAF,EAAQT,IAAI,CAACF,MAAb,CAAxC;AAEA,SACC,cAAC,SAAD;AAAW,IAAA,KAAK,EAAGY,WAAnB;AAAiC,IAAA,WAAW,EAAG;AAA/C,KACGE,WAAW,IAAI,cAAC,QAAD,QAAYA,WAAZ,CADlB,EAEGZ,IAAI,CAACa,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,CACLc,kBADK,EAEHgB,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,IACVhB,qBAAqB,CAAEY,MAAF,EAAUI,KAAV,CAdvB;AAgBC,MAAA,UAAU,EAAGf;AAhBd,MADD;AAoBA,GArBC,CAFH,CADD;AA2BA","sourcesContent":["/**\n * External dependencies\n */\nimport { some } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __, _n } 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, length ) {\n\tswitch ( entity ) {\n\t\tcase 'site':\n\t\t\treturn _n(\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\t\t\tlength\n\t\t\t);\n\t\tcase 'wp_template':\n\t\t\treturn _n(\n\t\t\t\t'This change will affect pages and posts that use this template.',\n\t\t\t\t'These changes will affect pages and posts that use these templates.',\n\t\t\t\tlength\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 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\tconst entityLabel =\n\t\tname === 'wp_template_part'\n\t\t\t? _n( 'Template Part', 'Template Parts', list.length )\n\t\t\t: entityConfig.label;\n\t// Set description based on type of entity.\n\tconst description = getEntityDescription( name, list.length );\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"]}
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"]}
@@ -26,7 +26,13 @@ export function PostTaxonomies(_ref) {
26
26
  taxonomyWrapper = identity
27
27
  } = _ref;
28
28
  const availableTaxonomies = filter(taxonomies, taxonomy => includes(taxonomy.types, postType));
29
- const visibleTaxonomies = filter(availableTaxonomies, taxonomy => taxonomy.visibility.show_ui);
29
+ const visibleTaxonomies = filter(availableTaxonomies, // In some circumstances .visibility can end up as undefined so optional chaining operator required.
30
+ // https://github.com/WordPress/gutenberg/issues/40326
31
+ taxonomy => {
32
+ var _taxonomy$visibility;
33
+
34
+ return (_taxonomy$visibility = taxonomy.visibility) === null || _taxonomy$visibility === void 0 ? void 0 : _taxonomy$visibility.show_ui;
35
+ });
30
36
  return visibleTaxonomies.map(taxonomy => {
31
37
  const TaxonomyComponent = taxonomy.hierarchical ? HierarchicalTermSelector : FlatTermSelector;
32
38
  return createElement(Fragment, {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"names":["filter","identity","includes","Fragment","withSelect","compose","store","coreStore","HierarchicalTermSelector","FlatTermSelector","editorStore","PostTaxonomies","postType","taxonomies","taxonomyWrapper","availableTaxonomies","taxonomy","types","visibleTaxonomies","visibility","show_ui","map","TaxonomyComponent","hierarchical","slug","select","getCurrentPostType","getTaxonomies","per_page"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,QAA3B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,8BAArC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,cAAT,OAIH;AAAA,MAJ4B;AAC/BC,IAAAA,QAD+B;AAE/BC,IAAAA,UAF+B;AAG/BC,IAAAA,eAAe,GAAGb;AAHa,GAI5B;AACH,QAAMc,mBAAmB,GAAGf,MAAM,CAAEa,UAAF,EAAgBG,QAAF,IAC/Cd,QAAQ,CAAEc,QAAQ,CAACC,KAAX,EAAkBL,QAAlB,CADyB,CAAlC;AAGA,QAAMM,iBAAiB,GAAGlB,MAAM,CAC/Be,mBAD+B,EAE7BC,QAAF,IAAgBA,QAAQ,CAACG,UAAT,CAAoBC,OAFL,CAAhC;AAIA,SAAOF,iBAAiB,CAACG,GAAlB,CAAyBL,QAAF,IAAgB;AAC7C,UAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAT,GACvBf,wBADuB,GAEvBC,gBAFH;AAGA,WACC,cAAC,QAAD;AAAU,MAAA,GAAG,EAAI,YAAYO,QAAQ,CAACQ,IAAM;AAA5C,OACGV,eAAe,CAChB,cAAC,iBAAD;AAAmB,MAAA,IAAI,EAAGE,QAAQ,CAACQ;AAAnC,MADgB,EAEhBR,QAFgB,CADlB,CADD;AAQA,GAZM,CAAP;AAaA;AAED,eAAeX,OAAO,CAAE,CACvBD,UAAU,CAAIqB,MAAF,IAAc;AACzB,SAAO;AACNb,IAAAA,QAAQ,EAAEa,MAAM,CAAEf,WAAF,CAAN,CAAsBgB,kBAAtB,EADJ;AAENb,IAAAA,UAAU,EAAEY,MAAM,CAAElB,SAAF,CAAN,CAAoBoB,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALS,CADa,CAAF,CAAP,CAOVjB,cAPU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, identity, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomies( {\n\tpostType,\n\ttaxonomies,\n\ttaxonomyWrapper = identity,\n} ) {\n\tconst availableTaxonomies = filter( taxonomies, ( taxonomy ) =>\n\t\tincludes( taxonomy.types, postType )\n\t);\n\tconst visibleTaxonomies = filter(\n\t\tavailableTaxonomies,\n\t\t( taxonomy ) => taxonomy.visibility.show_ui\n\t);\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomies );\n"]}
1
+ {"version":3,"sources":["@wordpress/editor/src/components/post-taxonomies/index.js"],"names":["filter","identity","includes","Fragment","withSelect","compose","store","coreStore","HierarchicalTermSelector","FlatTermSelector","editorStore","PostTaxonomies","postType","taxonomies","taxonomyWrapper","availableTaxonomies","taxonomy","types","visibleTaxonomies","visibility","show_ui","map","TaxonomyComponent","hierarchical","slug","select","getCurrentPostType","getTaxonomies","per_page"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,MAAT,EAAiBC,QAAjB,EAA2BC,QAA3B,QAA2C,QAA3C;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,UAAT,QAA2B,iBAA3B;AACA,SAASC,OAAT,QAAwB,oBAAxB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,wBAAP,MAAqC,8BAArC;AACA,OAAOC,gBAAP,MAA6B,sBAA7B;AACA,SAASH,KAAK,IAAII,WAAlB,QAAqC,aAArC;AAEA,OAAO,SAASC,cAAT,OAIH;AAAA,MAJ4B;AAC/BC,IAAAA,QAD+B;AAE/BC,IAAAA,UAF+B;AAG/BC,IAAAA,eAAe,GAAGb;AAHa,GAI5B;AACH,QAAMc,mBAAmB,GAAGf,MAAM,CAAEa,UAAF,EAAgBG,QAAF,IAC/Cd,QAAQ,CAAEc,QAAQ,CAACC,KAAX,EAAkBL,QAAlB,CADyB,CAAlC;AAGA,QAAMM,iBAAiB,GAAGlB,MAAM,CAC/Be,mBAD+B,EAE/B;AACA;AACEC,EAAAA,QAAF;AAAA;;AAAA,mCAAgBA,QAAQ,CAACG,UAAzB,yDAAgB,qBAAqBC,OAArC;AAAA,GAJ+B,CAAhC;AAMA,SAAOF,iBAAiB,CAACG,GAAlB,CAAyBL,QAAF,IAAgB;AAC7C,UAAMM,iBAAiB,GAAGN,QAAQ,CAACO,YAAT,GACvBf,wBADuB,GAEvBC,gBAFH;AAGA,WACC,cAAC,QAAD;AAAU,MAAA,GAAG,EAAI,YAAYO,QAAQ,CAACQ,IAAM;AAA5C,OACGV,eAAe,CAChB,cAAC,iBAAD;AAAmB,MAAA,IAAI,EAAGE,QAAQ,CAACQ;AAAnC,MADgB,EAEhBR,QAFgB,CADlB,CADD;AAQA,GAZM,CAAP;AAaA;AAED,eAAeX,OAAO,CAAE,CACvBD,UAAU,CAAIqB,MAAF,IAAc;AACzB,SAAO;AACNb,IAAAA,QAAQ,EAAEa,MAAM,CAAEf,WAAF,CAAN,CAAsBgB,kBAAtB,EADJ;AAENb,IAAAA,UAAU,EAAEY,MAAM,CAAElB,SAAF,CAAN,CAAoBoB,aAApB,CAAmC;AAAEC,MAAAA,QAAQ,EAAE,CAAC;AAAb,KAAnC;AAFN,GAAP;AAIA,CALS,CADa,CAAF,CAAP,CAOVjB,cAPU,CAAf","sourcesContent":["/**\n * External dependencies\n */\nimport { filter, identity, includes } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { Fragment } from '@wordpress/element';\nimport { withSelect } from '@wordpress/data';\nimport { compose } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport HierarchicalTermSelector from './hierarchical-term-selector';\nimport FlatTermSelector from './flat-term-selector';\nimport { store as editorStore } from '../../store';\n\nexport function PostTaxonomies( {\n\tpostType,\n\ttaxonomies,\n\ttaxonomyWrapper = identity,\n} ) {\n\tconst availableTaxonomies = filter( taxonomies, ( taxonomy ) =>\n\t\tincludes( taxonomy.types, postType )\n\t);\n\tconst visibleTaxonomies = filter(\n\t\tavailableTaxonomies,\n\t\t// In some circumstances .visibility can end up as undefined so optional chaining operator required.\n\t\t// https://github.com/WordPress/gutenberg/issues/40326\n\t\t( taxonomy ) => taxonomy.visibility?.show_ui\n\t);\n\treturn visibleTaxonomies.map( ( taxonomy ) => {\n\t\tconst TaxonomyComponent = taxonomy.hierarchical\n\t\t\t? HierarchicalTermSelector\n\t\t\t: FlatTermSelector;\n\t\treturn (\n\t\t\t<Fragment key={ `taxonomy-${ taxonomy.slug }` }>\n\t\t\t\t{ taxonomyWrapper(\n\t\t\t\t\t<TaxonomyComponent slug={ taxonomy.slug } />,\n\t\t\t\t\ttaxonomy\n\t\t\t\t) }\n\t\t\t</Fragment>\n\t\t);\n\t} );\n}\n\nexport default compose( [\n\twithSelect( ( select ) => {\n\t\treturn {\n\t\t\tpostType: select( editorStore ).getCurrentPostType(),\n\t\t\ttaxonomies: select( coreStore ).getTaxonomies( { per_page: -1 } ),\n\t\t};\n\t} ),\n] )( PostTaxonomies );\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/editor",
3
- "version": "12.5.1",
3
+ "version": "12.5.4",
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.0",
35
- "@wordpress/api-fetch": "^6.3.0",
36
- "@wordpress/block-editor": "^8.5.1",
37
- "@wordpress/blocks": "^11.5.1",
38
- "@wordpress/components": "^19.8.0",
39
- "@wordpress/compose": "^5.4.0",
40
- "@wordpress/core-data": "^4.4.1",
41
- "@wordpress/data": "^6.6.0",
42
- "@wordpress/date": "^4.6.0",
43
- "@wordpress/deprecated": "^3.6.0",
44
- "@wordpress/element": "^4.4.0",
45
- "@wordpress/hooks": "^3.6.0",
46
- "@wordpress/html-entities": "^3.6.0",
47
- "@wordpress/i18n": "^4.6.0",
48
- "@wordpress/icons": "^8.2.0",
49
- "@wordpress/keyboard-shortcuts": "^3.4.0",
50
- "@wordpress/keycodes": "^3.6.0",
51
- "@wordpress/media-utils": "^3.4.0",
52
- "@wordpress/notices": "^3.6.0",
53
- "@wordpress/preferences": "^1.2.0",
54
- "@wordpress/reusable-blocks": "^3.4.1",
55
- "@wordpress/rich-text": "^5.4.0",
56
- "@wordpress/server-side-render": "^3.4.1",
57
- "@wordpress/url": "^3.7.0",
58
- "@wordpress/wordcount": "^3.6.0",
34
+ "@wordpress/a11y": "^3.6.1",
35
+ "@wordpress/api-fetch": "^6.3.1",
36
+ "@wordpress/block-editor": "^8.5.4",
37
+ "@wordpress/blocks": "^11.5.3",
38
+ "@wordpress/components": "^19.8.3",
39
+ "@wordpress/compose": "^5.4.1",
40
+ "@wordpress/core-data": "^4.4.4",
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.2",
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.3",
54
+ "@wordpress/reusable-blocks": "^3.4.4",
55
+ "@wordpress/rich-text": "^5.4.2",
56
+ "@wordpress/server-side-render": "^3.4.4",
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": "9c15c669843d53c5ca6024a4c486d01d819d123f"
72
+ "gitHead": "1fdd4758150247d6b690051aed18fa27c15f3a32"
73
73
  }
@@ -6,7 +6,7 @@ import { some } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { __, _n } from '@wordpress/i18n';
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, length ) {
19
+ function getEntityDescription( entity, count ) {
20
20
  switch ( entity ) {
21
21
  case 'site':
22
- return _n(
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 _n(
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
- const entityLabel =
56
- name === 'wp_template_part'
57
- ? _n( 'Template Part', 'Template Parts', list.length )
58
- : entityConfig.label;
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, list.length );
59
+ const description = getEntityDescription( name, count );
61
60
 
62
61
  return (
63
62
  <PanelBody title={ entityLabel } initialOpen={ true }>
@@ -28,7 +28,9 @@ export function PostTaxonomies( {
28
28
  );
29
29
  const visibleTaxonomies = filter(
30
30
  availableTaxonomies,
31
- ( taxonomy ) => taxonomy.visibility.show_ui
31
+ // In some circumstances .visibility can end up as undefined so optional chaining operator required.
32
+ // https://github.com/WordPress/gutenberg/issues/40326
33
+ ( taxonomy ) => taxonomy.visibility?.show_ui
32
34
  );
33
35
  return visibleTaxonomies.map( ( taxonomy ) => {
34
36
  const TaxonomyComponent = taxonomy.hierarchical