@wordpress/edit-post 5.0.15 → 5.0.18

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.
@@ -52,6 +52,11 @@ function EditTemplateTitle() {
52
52
  const {
53
53
  updateEditorSettings
54
54
  } = (0, _data.useDispatch)(_editor.store);
55
+
56
+ if (template.has_theme_file) {
57
+ return null;
58
+ }
59
+
55
60
  let templateTitle = (0, _i18n.__)('Default');
56
61
 
57
62
  if (template !== null && template !== void 0 && template.title) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["EditTemplateTitle","template","select","getEditedPostTemplate","editPostStore","editEntityRecord","coreStore","getEditorSettings","editorStore","updateEditorSettings","templateTitle","title","slug","newTitle","settings","newAvailableTemplates","availableTemplates","existingTitle","id"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAaC,MAAF,IAAc;AAC7C,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,YAAF,CAAxC;AACA,WAAO;AACNH,MAAAA,QAAQ,EAAEE,qBAAqB;AADzB,KAAP;AAGA,GALoB,EAKlB,EALkB,CAArB;AAOA,QAAM;AAAEE,IAAAA;AAAF,MAAuB,uBAAaC,eAAb,CAA7B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAwB,qBAAWC,aAAX,CAA9B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,uBAAaD,aAAb,CAAjC;AAEA,MAAIE,aAAa,GAAG,cAAI,SAAJ,CAApB;;AACA,MAAKT,QAAL,aAAKA,QAAL,eAAKA,QAAQ,CAAEU,KAAf,EAAuB;AACtBD,IAAAA,aAAa,GAAGT,QAAQ,CAACU,KAAzB;AACA,GAFD,MAEO,IAAK,CAAC,CAAEV,QAAR,EAAmB;AACzBS,IAAAA,aAAa,GAAGT,QAAQ,CAACW,IAAzB;AACA;;AAED,SACC,4BAAC,uBAAD;AACC,IAAA,KAAK,EAAG,cAAI,OAAJ,CADT;AAEC,IAAA,KAAK,EAAGF,aAFT;AAGC,IAAA,IAAI,EAAG,cACN,0EADM,CAHR;AAMC,IAAA,QAAQ,EAAKG,QAAF,IAAgB;AAC1B,YAAMC,QAAQ,GAAGP,iBAAiB,EAAlC;AACA,YAAMQ,qBAAqB,GAAG,uBAC7BD,QAAQ,CAACE,kBADoB,EAE7B,CAAEC,aAAF,EAAiBC,EAAjB,KAAyB;AACxB,YAAKA,EAAE,KAAKjB,QAAQ,CAACW,IAArB,EAA4B;AAC3B,iBAAOK,aAAP;AACA;;AACD,eAAOJ,QAAP;AACA,OAP4B,CAA9B;AASAJ,MAAAA,oBAAoB,CAAE,EACrB,GAAGK,QADkB;AAErBE,QAAAA,kBAAkB,EAAED;AAFC,OAAF,CAApB;AAIAV,MAAAA,gBAAgB,CAAE,UAAF,EAAc,aAAd,EAA6BJ,QAAQ,CAACiB,EAAtC,EAA0C;AACzDP,QAAAA,KAAK,EAAEE;AADkD,OAA1C,CAAhB;AAGA;AAxBF,IADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function EditTemplateTitle() {\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttemplate: getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings } = useDispatch( editorStore );\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ templateTitle }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tconst settings = getEditorSettings();\n\t\t\t\tconst newAvailableTemplates = mapValues(\n\t\t\t\t\tsettings.availableTemplates,\n\t\t\t\t\t( existingTitle, id ) => {\n\t\t\t\t\t\tif ( id !== template.slug ) {\n\t\t\t\t\t\t\treturn existingTitle;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn newTitle;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tupdateEditorSettings( {\n\t\t\t\t\t...settings,\n\t\t\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t\t\t} );\n\t\t\t\teditEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\t\t\ttitle: newTitle,\n\t\t\t\t} );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["EditTemplateTitle","template","select","getEditedPostTemplate","editPostStore","editEntityRecord","coreStore","getEditorSettings","editorStore","updateEditorSettings","has_theme_file","templateTitle","title","slug","newTitle","settings","newAvailableTemplates","availableTemplates","existingTitle","id"],"mappings":";;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,iBAAT,GAA6B;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAe,qBAAaC,MAAF,IAAc;AAC7C,UA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Ac,aAAd,EAA6BJ,QAAQ,CAACkB,EAAtC,EAA0C;AACzDP,QAAAA,KAAK,EAAEE;AADkD,OAA1C,CAAhB;AAGA;AAxBF,IADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function EditTemplateTitle() {\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttemplate: getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings } = useDispatch( editorStore );\n\n\tif ( template.has_theme_file ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ templateTitle }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tconst settings = getEditorSettings();\n\t\t\t\tconst newAvailableTemplates = mapValues(\n\t\t\t\t\tsettings.availableTemplates,\n\t\t\t\t\t( existingTitle, id ) => {\n\t\t\t\t\t\tif ( id !== template.slug ) {\n\t\t\t\t\t\t\treturn existingTitle;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn newTitle;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tupdateEditorSettings( {\n\t\t\t\t\t...settings,\n\t\t\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t\t\t} );\n\t\t\t\teditEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\t\t\ttitle: newTitle,\n\t\t\t\t} );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
@@ -77,6 +77,7 @@ function TemplateTitle() {
77
77
  templateTitle = template.slug;
78
78
  }
79
79
 
80
+ const hasOptions = !!(template.custom || template.wp_id || template.description);
80
81
  return (0, _element.createElement)("div", {
81
82
  className: "edit-post-template-top-area"
82
83
  }, (0, _element.createElement)(_components.Button, {
@@ -90,7 +91,7 @@ function TemplateTitle() {
90
91
  clearSelectedBlock();
91
92
  setIsEditingTemplate(false);
92
93
  }
93
- }, title), (0, _element.createElement)(_components.Dropdown, {
94
+ }, title), hasOptions ? (0, _element.createElement)(_components.Dropdown, {
94
95
  position: "bottom center",
95
96
  contentClassName: "edit-post-template-top-area__popover",
96
97
  renderToggle: _ref => {
@@ -106,8 +107,14 @@ function TemplateTitle() {
106
107
  label: (0, _i18n.__)('Template Options')
107
108
  }, templateTitle);
108
109
  },
109
- renderContent: () => (0, _element.createElement)(_element.Fragment, null, template.has_theme_file ? (0, _element.createElement)(_templateDescription.default, null) : (0, _element.createElement)(_editTemplateTitle.default, null), (0, _element.createElement)(_deleteTemplate.default, null))
110
- }));
110
+ renderContent: () => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_editTemplateTitle.default, null), (0, _element.createElement)(_templateDescription.default, null), (0, _element.createElement)(_deleteTemplate.default, null))
111
+ }) : (0, _element.createElement)(_components.__experimentalText, {
112
+ className: "edit-post-template-title",
113
+ size: "body",
114
+ style: {
115
+ lineHeight: '24px'
116
+ }
117
+ }, templateTitle));
111
118
  }
112
119
 
113
120
  var _default = TemplateTitle;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/index.js"],"names":["TemplateTitle","template","isEditing","title","select","isEditingTemplate","getEditedPostTemplate","editPostStore","getEditedPostAttribute","editorStore","_isEditing","clearSelectedBlock","blockEditorStore","setIsEditingTemplate","templateTitle","slug","onToggle","chevronDown","has_theme_file"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAhBA;AACA;AACA;;AAMA;AACA;AACA;AAQA,SAASA,aAAT,GAAyB;AACxB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA;AAAvB,MAAiC,qBAAaC,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAA+CF,MAAM,CAC1DG,YAD0D,CAA3D;AAGA,UAAM;AAAEC,MAAAA;AAAF,QAA6BJ,MAAM,CAAEK,aAAF,CAAzC;;AAEA,UAAMC,UAAU,GAAGL,iBAAiB,EAApC;;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAES,UAAU,GAAGJ,qBAAqB,EAAxB,GAA6B,IAD3C;AAENJ,MAAAA,SAAS,EAAEQ,UAFL;AAGNP,MAAAA,KAAK,EAAEK,sBAAsB,CAAE,OAAF,CAAtB,GACJA,sBAAsB,CAAE,OAAF,CADlB,GAEJ,cAAI,UAAJ;AALG,KAAP;AAOA,GAfsC,EAepC,EAfoC,CAAvC;AAiBA,QAAM;AAAEG,IAAAA;AAAF,MAAyB,uBAAaC,kBAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAA2B,uBAAaN,YAAb,CAAjC;;AAEA,MAAK,CAAEL,SAAF,IAAe,CAAED,QAAtB,EAAiC;AAChC,WAAO,IAAP;AACA;;AAED,MAAIa,aAAa,GAAG,cAAI,SAAJ,CAApB;;AACA,MAAKb,QAAL,aAAKA,QAAL,eAAKA,QAAQ,CAAEE,KAAf,EAAuB;AACtBW,IAAAA,aAAa,GAAGb,QAAQ,CAACE,KAAzB;AACA,GAFD,MAEO,IAAK,CAAC,CAAEF,QAAR,EAAmB;AACzBa,IAAAA,aAAa,GAAGb,QAAQ,CAACc,IAAzB;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,+BADX;AAEC,IAAA,MAAM,MAFP;AAGC,IAAA,WAAW,MAHZ;AAIC,IAAA,KAAK,EAAG;AACP;AACA,kBAAI,SAAJ,CAFO,EAGPZ,KAHO,CAJT;AASC,IAAA,OAAO,EAAG,MAAM;AACfQ,MAAAA,kBAAkB;AAClBE,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AAZF,KAcGV,KAdH,CADD,EAiBC,4BAAC,oBAAD;AACC,IAAA,QAAQ,EAAC,eADV;AAEC,IAAA,gBAAgB,EAAC,sCAFlB;AAGC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEa,QAAAA;AAAF,OAAF;AAAA,aACd,4BAAC,kBAAD;AACC,QAAA,SAAS,EAAC,0BADX;AAEC,QAAA,MAAM,MAFP;AAGC,QAAA,IAAI,EAAGC,kBAHR;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,OAAO,EAAGD,QALX;AAMC,QAAA,KAAK,EAAG,cAAI,kBAAJ;AANT,SAQGF,aARH,CADc;AAAA,KAHhB;AAeC,IAAA,aAAa,EAAG,MACf,qDACGb,QAAQ,CAACiB,cAAT,GACD,4BAAC,4BAAD,OADC,GAGD,4BAAC,0BAAD,OAJF,EAMC,4BAAC,uBAAD,OAND;AAhBF,IAjBD,CADD;AA8CA;;eAEclB,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport DeleteTemplate from './delete-template';\nimport EditTemplateTitle from './edit-template-title';\nimport TemplateDescription from './template-description';\n\nfunction TemplateTitle() {\n\tconst { template, isEditing, title } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } = select(\n\t\t\teditPostStore\n\t\t);\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\n\t\tconst _isEditing = isEditingTemplate();\n\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t\tisEditing: _isEditing,\n\t\t\ttitle: getEditedPostAttribute( 'title' )\n\t\t\t\t? getEditedPostAttribute( 'title' )\n\t\t\t\t: __( 'Untitled' ),\n\t\t};\n\t}, [] );\n\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\n\tif ( ! isEditing || ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-post-template-top-area\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-template-post-title\"\n\t\t\t\tisLink\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t/* translators: %s: Title of the referring post, e.g: \"Hello World!\" */\n\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\ttitle\n\t\t\t\t) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</Button>\n\t\t\t<Dropdown\n\t\t\t\tposition=\"bottom center\"\n\t\t\t\tcontentClassName=\"edit-post-template-top-area__popover\"\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\t\tisLink\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\tlabel={ __( 'Template Options' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ template.has_theme_file ? (\n\t\t\t\t\t\t\t<TemplateDescription />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<EditTemplateTitle />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<DeleteTemplate />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default TemplateTitle;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/index.js"],"names":["TemplateTitle","template","isEditing","title","select","isEditingTemplate","getEditedPostTemplate","editPostStore","getEditedPostAttribute","editorStore","_isEditing","clearSelectedBlock","blockEditorStore","setIsEditingTemplate","templateTitle","slug","hasOptions","custom","wp_id","description","onToggle","chevronDown","lineHeight"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AAKA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,SAASA,aAAT,GAAyB;AACxB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA;AAAvB,MAAiC,qBAAaC,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAA+CF,MAAM,CAC1DG,YAD0D,CAA3D;AAGA,UAAM;AAAEC,MAAAA;AAAF,QAA6BJ,MAAM,CAAEK,aAAF,CAAzC;;AAEA,UAAMC,UAAU,GAAGL,iBAAiB,EAApC;;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAES,UAAU,GAAGJ,qBAAqB,EAAxB,GAA6B,IA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AAA,UAAE;AAAEI,QAAAA;AAAF,OAAF;AAAA,aACd,4BAAC,kBAAD;AACC,QAAA,SAAS,EAAC,0BADX;AAEC,QAAA,MAAM,MAFP;AAGC,QAAA,IAAI,EAAGC,kBAHR;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,OAAO,EAAGD,QALX;AAMC,QAAA,KAAK,EAAG,cAAI,kBAAJ;AANT,SAQGN,aARH,CADc;AAAA,KAHhB;AAeC,IAAA,aAAa,EAAG,MACf,qDACC,4BAAC,0BAAD,OADD,EAEC,4BAAC,4BAAD,OAFD,EAGC,4BAAC,uBAAD,OAHD;AAhBF,IADW,GAyBX,4BAAC,8BAAD;AACC,IAAA,SAAS,EAAC,0BADX;AAEC,IAAA,IAAI,EAAC,MAFN;AAGC,IAAA,KAAK,EAAG;AAAEQ,MAAAA,UAAU,EAAE;AAAd;AAHT,KAKGR,aALH,CA1CF,CADD;AAqDA;;eAEcd,a","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport DeleteTemplate from './delete-template';\nimport EditTemplateTitle from './edit-template-title';\nimport TemplateDescription from './template-description';\n\nfunction TemplateTitle() {\n\tconst { template, isEditing, title } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } = select(\n\t\t\teditPostStore\n\t\t);\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\n\t\tconst _isEditing = isEditingTemplate();\n\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t\tisEditing: _isEditing,\n\t\t\ttitle: getEditedPostAttribute( 'title' )\n\t\t\t\t? getEditedPostAttribute( 'title' )\n\t\t\t\t: __( 'Untitled' ),\n\t\t};\n\t}, [] );\n\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\n\tif ( ! isEditing || ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\tconst hasOptions = !! (\n\t\ttemplate.custom ||\n\t\ttemplate.wp_id ||\n\t\ttemplate.description\n\t);\n\n\treturn (\n\t\t<div className=\"edit-post-template-top-area\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-template-post-title\"\n\t\t\t\tisLink\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t/* translators: %s: Title of the referring post, e.g: \"Hello World!\" */\n\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\ttitle\n\t\t\t\t) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</Button>\n\t\t\t{ hasOptions ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\tcontentClassName=\"edit-post-template-top-area__popover\"\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\t\t\tisLink\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\tlabel={ __( 'Template Options' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<EditTemplateTitle />\n\t\t\t\t\t\t\t<TemplateDescription />\n\t\t\t\t\t\t\t<DeleteTemplate />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Text\n\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tstyle={ { lineHeight: '24px' } }\n\t\t\t\t>\n\t\t\t\t\t{ templateTitle }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default TemplateTitle;\n"]}
@@ -22,12 +22,14 @@ var _store = require("../../../store");
22
22
  */
23
23
  function TemplateDescription() {
24
24
  const {
25
- description
25
+ description,
26
+ title
26
27
  } = (0, _data.useSelect)(select => {
27
28
  const {
28
29
  getEditedPostTemplate
29
30
  } = select(_store.store);
30
31
  return {
32
+ title: getEditedPostTemplate().title,
31
33
  description: getEditedPostTemplate().description
32
34
  };
33
35
  }, []);
@@ -36,8 +38,16 @@ function TemplateDescription() {
36
38
  return null;
37
39
  }
38
40
 
39
- return (0, _element.createElement)(_components.__experimentalText, {
40
- size: "body"
41
- }, description);
41
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.__experimentalHeading, {
42
+ level: 4,
43
+ weight: 600
44
+ }, title), (0, _element.createElement)(_components.__experimentalText, {
45
+ className: "edit-post-template-details__description",
46
+ size: "body",
47
+ as: "p",
48
+ style: {
49
+ marginTop: '12px'
50
+ }
51
+ }, description));
42
52
  }
43
53
  //# sourceMappingURL=template-description.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/template-description.js"],"names":["TemplateDescription","description","select","getEditedPostTemplate","editPostStore"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AATA;AACA;AACA;;AAIA;AACA;AACA;AAGe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AAAEC,IAAAA;AAAF,MAAkB,qBAAaC,MAAF,IAAc;AAChD,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,YAAF,CAAxC;AACA,WAAO;AACNH,MAAAA,WAAW,EAAEE,qBAAqB,GAAGF;AAD/B,KAAP;AAGA,GALuB,EAKrB,EALqB,CAAxB;;AAMA,MAAK,CAAEA,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SAAO,4BAAC,8BAAD;AAAM,IAAA,IAAI,EAAC;AAAX,KAAoBA,WAApB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalText as Text } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function TemplateDescription() {\n\tconst { description } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\tdescription: getEditedPostTemplate().description,\n\t\t};\n\t}, [] );\n\tif ( ! description ) {\n\t\treturn null;\n\t}\n\treturn <Text size=\"body\">{ description }</Text>;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/template-description.js"],"names":["TemplateDescription","description","title","select","getEditedPostTemplate","editPostStore","marginTop"],"mappings":";;;;;;;;;AAGA;;AACA;;AAQA;;AAZA;AACA;AACA;;AAOA;AACA;AACA;AAGe,SAASA,mBAAT,GAA+B;AAC7C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAyB,qBAAaC,MAAF,IAAc;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEE,YAAF,CAAxC;AACA,WAAO;AACNH,MAAAA,KAAK,EAAEE,qBAAqB,GAAGF,KADzB;AAEND,MAAAA,WAAW,EAAEG,qBAAqB,GAAGH;AAF/B,KAAP;AAIA,GAN8B,EAM5B,EAN4B,CAA/B;;AAOA,MAAK,CAAEA,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SACC,qDACC,4BAAC,iCAAD;AAAS,IAAA,KAAK,EAAG,CAAjB;AAAqB,IAAA,MAAM,EAAG;AAA9B,KACGC,KADH,CADD,EAIC,4BAAC,8BAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,IAAI,EAAC,MAFN;AAGC,IAAA,EAAE,EAAC,GAHJ;AAIC,IAAA,KAAK,EAAG;AAAEI,MAAAA,SAAS,EAAE;AAAb;AAJT,KAMGL,WANH,CAJD,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function TemplateDescription() {\n\tconst { description, title } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttitle: getEditedPostTemplate().title,\n\t\t\tdescription: getEditedPostTemplate().description,\n\t\t};\n\t}, [] );\n\tif ( ! description ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<Heading level={ 4 } weight={ 600 }>\n\t\t\t\t{ title }\n\t\t\t</Heading>\n\t\t\t<Text\n\t\t\t\tclassName=\"edit-post-template-details__description\"\n\t\t\t\tsize=\"body\"\n\t\t\t\tas=\"p\"\n\t\t\t\tstyle={ { marginTop: '12px' } }\n\t\t\t>\n\t\t\t\t{ description }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n"]}
@@ -39,6 +39,10 @@ export default function EditTemplateTitle() {
39
39
  updateEditorSettings
40
40
  } = useDispatch(editorStore);
41
41
 
42
+ if (template.has_theme_file) {
43
+ return null;
44
+ }
45
+
42
46
  let templateTitle = __('Default');
43
47
 
44
48
  if (template !== null && template !== void 0 && template.title) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["mapValues","__","TextControl","useDispatch","useSelect","store","editorStore","coreStore","editPostStore","EditTemplateTitle","template","select","getEditedPostTemplate","editEntityRecord","getEditorSettings","updateEditorSettings","templateTitle","title","slug","newTitle","settings","newAvailableTemplates","availableTemplates","existingTitle","id"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,gBAAvC;AAEA,eAAe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AAAEC,IAAAA;AAAF,MAAeN,SAAS,CAAIO,MAAF,IAAc;AAC7C,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEH,aAAF,CAAxC;AACA,WAAO;AACNE,MAAAA,QAAQ,EAAEE,qBAAqB;AADzB,KAAP;AAGA,GAL6B,EAK3B,EAL2B,CAA9B;AAOA,QAAM;AAAEC,IAAAA;AAAF,MAAuBV,WAAW,CAAEI,SAAF,CAAxC;AACA,QAAM;AAAEO,IAAAA;AAAF,MAAwBV,SAAS,CAAEE,WAAF,CAAvC;AACA,QAAM;AAAES,IAAAA;AAAF,MAA2BZ,WAAW,CAAEG,WAAF,CAA5C;;AAEA,MAAIU,aAAa,GAAGf,EAAE,CAAE,SAAF,CAAtB;;AACA,MAAKS,QAAL,aAAKA,QAAL,eAAKA,QAAQ,CAAEO,KAAf,EAAuB;AACtBD,IAAAA,aAAa,GAAGN,QAAQ,CAACO,KAAzB;AACA,GAFD,MAEO,IAAK,CAAC,CAAEP,QAAR,EAAmB;AACzBM,IAAAA,aAAa,GAAGN,QAAQ,CAACQ,IAAzB;AACA;;AAED,SACC,cAAC,WAAD;AACC,IAAA,KAAK,EAAGjB,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,KAAK,EAAGe,aAFT;AAGC,IAAA,IAAI,EAAGf,EAAE,CACR,0EADQ,CAHV;AAMC,IAAA,QAAQ,EAAKkB,QAAF,IAAgB;AAC1B,YAAMC,QAAQ,GAAGN,iBAAiB,EAAlC;AACA,YAAMO,qBAAqB,GAAGrB,SAAS,CACtCoB,QAAQ,CAACE,kBAD6B,EAEtC,CAAEC,aAAF,EAAiBC,EAAjB,KAAyB;AACxB,YAAKA,EAAE,KAAKd,QAAQ,CAACQ,IAArB,EAA4B;AAC3B,iBAAOK,aAAP;AACA;;AACD,eAAOJ,QAAP;AACA,OAPqC,CAAvC;AASAJ,MAAAA,oBAAoB,CAAE,EACrB,GAAGK,QADkB;AAErBE,QAAAA,kBAAkB,EAAED;AAFC,OAAF,CAApB;AAIAR,MAAAA,gBAAgB,CAAE,UAAF,EAAc,aAAd,EAA6BH,QAAQ,CAACc,EAAtC,EAA0C;AACzDP,QAAAA,KAAK,EAAEE;AADkD,OAA1C,CAAhB;AAGA;AAxBF,IADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function EditTemplateTitle() {\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttemplate: getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings } = useDispatch( editorStore );\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ templateTitle }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tconst settings = getEditorSettings();\n\t\t\t\tconst newAvailableTemplates = mapValues(\n\t\t\t\t\tsettings.availableTemplates,\n\t\t\t\t\t( existingTitle, id ) => {\n\t\t\t\t\t\tif ( id !== template.slug ) {\n\t\t\t\t\t\t\treturn existingTitle;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn newTitle;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tupdateEditorSettings( {\n\t\t\t\t\t...settings,\n\t\t\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t\t\t} );\n\t\t\t\teditEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\t\t\ttitle: newTitle,\n\t\t\t\t} );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/edit-template-title.js"],"names":["mapValues","__","TextControl","useDispatch","useSelect","store","editorStore","coreStore","editPostStore","EditTemplateTitle","template","select","getEditedPostTemplate","editEntityRecord","getEditorSettings","updateEditorSettings","has_theme_file","templateTitle","title","slug","newTitle","settings","newAvailableTemplates","availableTemplates","existingTitle","id"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,uBAA5B;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,WAAlB,QAAqC,mBAArC;AACA,SAASD,KAAK,I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KAAyB;AACxB,YAAKA,EAAE,KAAKf,QAAQ,CAACS,IAArB,EAA4B;AAC3B,iBAAOK,aAAP;AACA;;AACD,eAAOJ,QAAP;AACA,OAPqC,CAAvC;AASAL,MAAAA,oBAAoB,CAAE,EACrB,GAAGM,QADkB;AAErBE,QAAAA,kBAAkB,EAAED;AAFC,OAAF,CAApB;AAIAT,MAAAA,gBAAgB,CAAE,UAAF,EAAc,aAAd,EAA6BH,QAAQ,CAACe,EAAtC,EAA0C;AACzDP,QAAAA,KAAK,EAAEE;AADkD,OAA1C,CAAhB;AAGA;AAxBF,IADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport { mapValues } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { TextControl } from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function EditTemplateTitle() {\n\tconst { template } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttemplate: getEditedPostTemplate(),\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { getEditorSettings } = useSelect( editorStore );\n\tconst { updateEditorSettings } = useDispatch( editorStore );\n\n\tif ( template.has_theme_file ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<TextControl\n\t\t\tlabel={ __( 'Title' ) }\n\t\t\tvalue={ templateTitle }\n\t\t\thelp={ __(\n\t\t\t\t'Give the template a title that indicates its purpose, e.g. \"Full Width\".'\n\t\t\t) }\n\t\t\tonChange={ ( newTitle ) => {\n\t\t\t\tconst settings = getEditorSettings();\n\t\t\t\tconst newAvailableTemplates = mapValues(\n\t\t\t\t\tsettings.availableTemplates,\n\t\t\t\t\t( existingTitle, id ) => {\n\t\t\t\t\t\tif ( id !== template.slug ) {\n\t\t\t\t\t\t\treturn existingTitle;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn newTitle;\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t\t\tupdateEditorSettings( {\n\t\t\t\t\t...settings,\n\t\t\t\t\tavailableTemplates: newAvailableTemplates,\n\t\t\t\t} );\n\t\t\t\teditEntityRecord( 'postType', 'wp_template', template.id, {\n\t\t\t\t\ttitle: newTitle,\n\t\t\t\t} );\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
@@ -5,7 +5,7 @@ import { createElement, Fragment } from "@wordpress/element";
5
5
  */
6
6
  import { __, sprintf } from '@wordpress/i18n';
7
7
  import { useSelect, useDispatch } from '@wordpress/data';
8
- import { Dropdown, Button } from '@wordpress/components';
8
+ import { Dropdown, Button, __experimentalText as Text } from '@wordpress/components';
9
9
  import { chevronDown } from '@wordpress/icons';
10
10
  /**
11
11
  * Internal dependencies
@@ -59,6 +59,7 @@ function TemplateTitle() {
59
59
  templateTitle = template.slug;
60
60
  }
61
61
 
62
+ const hasOptions = !!(template.custom || template.wp_id || template.description);
62
63
  return createElement("div", {
63
64
  className: "edit-post-template-top-area"
64
65
  }, createElement(Button, {
@@ -72,7 +73,7 @@ function TemplateTitle() {
72
73
  clearSelectedBlock();
73
74
  setIsEditingTemplate(false);
74
75
  }
75
- }, title), createElement(Dropdown, {
76
+ }, title), hasOptions ? createElement(Dropdown, {
76
77
  position: "bottom center",
77
78
  contentClassName: "edit-post-template-top-area__popover",
78
79
  renderToggle: _ref => {
@@ -88,8 +89,14 @@ function TemplateTitle() {
88
89
  label: __('Template Options')
89
90
  }, templateTitle);
90
91
  },
91
- renderContent: () => createElement(Fragment, null, template.has_theme_file ? createElement(TemplateDescription, null) : createElement(EditTemplateTitle, null), createElement(DeleteTemplate, null))
92
- }));
92
+ renderContent: () => createElement(Fragment, null, createElement(EditTemplateTitle, null), createElement(TemplateDescription, null), createElement(DeleteTemplate, null))
93
+ }) : createElement(Text, {
94
+ className: "edit-post-template-title",
95
+ size: "body",
96
+ style: {
97
+ lineHeight: '24px'
98
+ }
99
+ }, templateTitle));
93
100
  }
94
101
 
95
102
  export default TemplateTitle;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/index.js"],"names":["__","sprintf","useSelect","useDispatch","Dropdown","Button","chevronDown","store","editPostStore","blockEditorStore","editorStore","DeleteTemplate","EditTemplateTitle","TemplateDescription","TemplateTitle","template","isEditing","title","select","isEditingTemplate","getEditedPostTemplate","getEditedPostAttribute","_isEditing","clearSelectedBlock","setIsEditingTemplate","templateTitle","slug","onToggle","has_theme_file"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,QAAT,EAAmBC,MAAnB,QAAiC,uBAAjC;AACA,SAASC,WAAT,QAA4B,kBAA5B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,mBAArC;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,mBAAP,MAAgC,wBAAhC;;AAEA,SAASC,aAAT,GAAyB;AACxB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA;AAAvB,MAAiCf,SAAS,CAAIgB,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAA+CF,MAAM,CAC1DV,aAD0D,CAA3D;AAGA,UAAM;AAAEa,MAAAA;AA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AQ,EAAC,eADV;AAEC,IAAA,gBAAgB,EAAC,sCAFlB;AAGC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEU,QAAAA;AAAF,OAAF;AAAA,aACd,cAAC,MAAD;AACC,QAAA,SAAS,EAAC,0BADX;AAEC,QAAA,MAAM,MAFP;AAGC,QAAA,IAAI,EAAGrB,WAHR;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,OAAO,EAAGqB,QALX;AAMC,QAAA,KAAK,EAAG3B,EAAE,CAAE,kBAAF;AANX,SAQGyB,aARH,CADc;AAAA,KAHhB;AAeC,IAAA,aAAa,EAAG,MACf,8BACGV,QAAQ,CAACa,cAAT,GACD,cAAC,mBAAD,OADC,GAGD,cAAC,iBAAD,OAJF,EAMC,cAAC,cAAD,OAND;AAhBF,IAjBD,CADD;AA8CA;;AAED,eAAed,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Dropdown, Button } from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport DeleteTemplate from './delete-template';\nimport EditTemplateTitle from './edit-template-title';\nimport TemplateDescription from './template-description';\n\nfunction TemplateTitle() {\n\tconst { template, isEditing, title } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } = select(\n\t\t\teditPostStore\n\t\t);\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\n\t\tconst _isEditing = isEditingTemplate();\n\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t\tisEditing: _isEditing,\n\t\t\ttitle: getEditedPostAttribute( 'title' )\n\t\t\t\t? getEditedPostAttribute( 'title' )\n\t\t\t\t: __( 'Untitled' ),\n\t\t};\n\t}, [] );\n\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\n\tif ( ! isEditing || ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\treturn (\n\t\t<div className=\"edit-post-template-top-area\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-template-post-title\"\n\t\t\t\tisLink\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t/* translators: %s: Title of the referring post, e.g: \"Hello World!\" */\n\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\ttitle\n\t\t\t\t) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</Button>\n\t\t\t<Dropdown\n\t\t\t\tposition=\"bottom center\"\n\t\t\t\tcontentClassName=\"edit-post-template-top-area__popover\"\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\t\tisLink\n\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\tlabel={ __( 'Template Options' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ template.has_theme_file ? (\n\t\t\t\t\t\t\t<TemplateDescription />\n\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t<EditTemplateTitle />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<DeleteTemplate />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</div>\n\t);\n}\n\nexport default TemplateTitle;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/index.js"],"names":["__","sprintf","useSelect","useDispatch","Dropdown","Button","__experimentalText","Text","chevronDown","store","editPostStore","blockEditorStore","editorStore","DeleteTemplate","EditTemplateTitle","TemplateDescription","TemplateTitle","template","isEditing","title","select","isEditingTemplate","getEditedPostTemplate","getEditedPostAttribute","_isEditing","clearSelectedBlock","setIsEditingTemplate","templateTitle","slug","hasOptions","custom","wp_id","description","onToggle","lineHeight"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,QADD,EAECC,MAFD,EAGCC,kBAAkB,IAAIC,IAHvB,QAIO,uBAJP;AAKA,SAASC,WAAT,QAA4B,kBAA5B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;AACA,SAASD,KAAK,IAAIE,gBAAlB,QAA0C,yBAA1C;AACA,SAASF,KAAK,IAAIG,WAAlB,QAAqC,mBAArC;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,mBAAP,MAAgC,wBAAhC;;AAEA,SAASC,aAAT,GAAyB;AACxB,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,SAAZ;AAAuBC,IAAAA;AAAvB,MAAiCjB,SAAS,CAAIkB,MAAF,IAAc;AAC/D,UAAM;AAAEC,MAAAA,iBAAF;AAAqBC,MAAAA;AAArB,QAA+CF,MAAM,CAC1DV,aAD0D,CAA3D;AAGA,UAAM;AAAEa,MAAAA;AAAF,QAA6BH,MAAM,CAAER,WAAF,CAAzC;;AAEA,UAAMY,UAAU,GAAGH,iBAAiB,EAApC;;AAEA,WAAO;AACNJ,MAAAA,QAAQ,EAAEO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,IAAA,QAAQ,EAAC,eADV;AAEC,IAAA,gBAAgB,EAAC,sCAFlB;AAGC,IAAA,YAAY,EAAG;AAAA,UAAE;AAAEI,QAAAA;AAAF,OAAF;AAAA,aACd,cAAC,MAAD;AACC,QAAA,SAAS,EAAC,0BADX;AAEC,QAAA,MAAM,MAFP;AAGC,QAAA,IAAI,EAAGzB,WAHR;AAIC,QAAA,WAAW,MAJZ;AAKC,QAAA,OAAO,EAAGyB,QALX;AAMC,QAAA,KAAK,EAAGjC,EAAE,CAAE,kBAAF;AANX,SAQG2B,aARH,CADc;AAAA,KAHhB;AAeC,IAAA,aAAa,EAAG,MACf,8BACC,cAAC,iBAAD,OADD,EAEC,cAAC,mBAAD,OAFD,EAGC,cAAC,cAAD,OAHD;AAhBF,IADW,GAyBX,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,0BADX;AAEC,IAAA,IAAI,EAAC,MAFN;AAGC,IAAA,KAAK,EAAG;AAAEO,MAAAA,UAAU,EAAE;AAAd;AAHT,KAKGP,aALH,CA1CF,CADD;AAqDA;;AAED,eAAeX,aAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tDropdown,\n\tButton,\n\t__experimentalText as Text,\n} from '@wordpress/components';\nimport { chevronDown } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport DeleteTemplate from './delete-template';\nimport EditTemplateTitle from './edit-template-title';\nimport TemplateDescription from './template-description';\n\nfunction TemplateTitle() {\n\tconst { template, isEditing, title } = useSelect( ( select ) => {\n\t\tconst { isEditingTemplate, getEditedPostTemplate } = select(\n\t\t\teditPostStore\n\t\t);\n\t\tconst { getEditedPostAttribute } = select( editorStore );\n\n\t\tconst _isEditing = isEditingTemplate();\n\n\t\treturn {\n\t\t\ttemplate: _isEditing ? getEditedPostTemplate() : null,\n\t\t\tisEditing: _isEditing,\n\t\t\ttitle: getEditedPostAttribute( 'title' )\n\t\t\t\t? getEditedPostAttribute( 'title' )\n\t\t\t\t: __( 'Untitled' ),\n\t\t};\n\t}, [] );\n\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setIsEditingTemplate } = useDispatch( editPostStore );\n\n\tif ( ! isEditing || ! template ) {\n\t\treturn null;\n\t}\n\n\tlet templateTitle = __( 'Default' );\n\tif ( template?.title ) {\n\t\ttemplateTitle = template.title;\n\t} else if ( !! template ) {\n\t\ttemplateTitle = template.slug;\n\t}\n\n\tconst hasOptions = !! (\n\t\ttemplate.custom ||\n\t\ttemplate.wp_id ||\n\t\ttemplate.description\n\t);\n\n\treturn (\n\t\t<div className=\"edit-post-template-top-area\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-post-template-post-title\"\n\t\t\t\tisLink\n\t\t\t\tshowTooltip\n\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t/* translators: %s: Title of the referring post, e.g: \"Hello World!\" */\n\t\t\t\t\t__( 'Edit %s' ),\n\t\t\t\t\ttitle\n\t\t\t\t) }\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetIsEditingTemplate( false );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</Button>\n\t\t\t{ hasOptions ? (\n\t\t\t\t<Dropdown\n\t\t\t\t\tposition=\"bottom center\"\n\t\t\t\t\tcontentClassName=\"edit-post-template-top-area__popover\"\n\t\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\t\t\tisLink\n\t\t\t\t\t\t\ticon={ chevronDown }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t\t\tlabel={ __( 'Template Options' ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ templateTitle }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t) }\n\t\t\t\t\trenderContent={ () => (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<EditTemplateTitle />\n\t\t\t\t\t\t\t<TemplateDescription />\n\t\t\t\t\t\t\t<DeleteTemplate />\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t/>\n\t\t\t) : (\n\t\t\t\t<Text\n\t\t\t\t\tclassName=\"edit-post-template-title\"\n\t\t\t\t\tsize=\"body\"\n\t\t\t\t\tstyle={ { lineHeight: '24px' } }\n\t\t\t\t>\n\t\t\t\t\t{ templateTitle }\n\t\t\t\t</Text>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default TemplateTitle;\n"]}
@@ -1,10 +1,10 @@
1
- import { createElement } from "@wordpress/element";
1
+ import { createElement, Fragment } from "@wordpress/element";
2
2
 
3
3
  /**
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { useSelect } from '@wordpress/data';
7
- import { __experimentalText as Text } from '@wordpress/components';
7
+ import { __experimentalHeading as Heading, __experimentalText as Text } from '@wordpress/components';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
@@ -12,12 +12,14 @@ import { __experimentalText as Text } from '@wordpress/components';
12
12
  import { store as editPostStore } from '../../../store';
13
13
  export default function TemplateDescription() {
14
14
  const {
15
- description
15
+ description,
16
+ title
16
17
  } = useSelect(select => {
17
18
  const {
18
19
  getEditedPostTemplate
19
20
  } = select(editPostStore);
20
21
  return {
22
+ title: getEditedPostTemplate().title,
21
23
  description: getEditedPostTemplate().description
22
24
  };
23
25
  }, []);
@@ -26,8 +28,16 @@ export default function TemplateDescription() {
26
28
  return null;
27
29
  }
28
30
 
29
- return createElement(Text, {
30
- size: "body"
31
- }, description);
31
+ return createElement(Fragment, null, createElement(Heading, {
32
+ level: 4,
33
+ weight: 600
34
+ }, title), createElement(Text, {
35
+ className: "edit-post-template-details__description",
36
+ size: "body",
37
+ as: "p",
38
+ style: {
39
+ marginTop: '12px'
40
+ }
41
+ }, description));
32
42
  }
33
43
  //# sourceMappingURL=template-description.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/template-description.js"],"names":["useSelect","__experimentalText","Text","store","editPostStore","TemplateDescription","description","select","getEditedPostTemplate"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SAASC,kBAAkB,IAAIC,IAA/B,QAA2C,uBAA3C;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM;AAAEC,IAAAA;AAAF,MAAkBN,SAAS,CAAIO,MAAF,IAAc;AAChD,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEH,aAAF,CAAxC;AACA,WAAO;AACNE,MAAAA,WAAW,EAAEE,qBAAqB,GAAGF;AAD/B,KAAP;AAGA,GALgC,EAK9B,EAL8B,CAAjC;;AAMA,MAAK,CAAEA,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SAAO,cAAC,IAAD;AAAM,IAAA,IAAI,EAAC;AAAX,KAAoBA,WAApB,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { __experimentalText as Text } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function TemplateDescription() {\n\tconst { description } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\tdescription: getEditedPostTemplate().description,\n\t\t};\n\t}, [] );\n\tif ( ! description ) {\n\t\treturn null;\n\t}\n\treturn <Text size=\"body\">{ description }</Text>;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-post/src/components/header/template-title/template-description.js"],"names":["useSelect","__experimentalHeading","Heading","__experimentalText","Text","store","editPostStore","TemplateDescription","description","title","select","getEditedPostTemplate","marginTop"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,qBAAqB,IAAIC,OAD1B,EAECC,kBAAkB,IAAIC,IAFvB,QAGO,uBAHP;AAKA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,gBAAvC;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA;AAAf,MAAyBT,SAAS,CAAIU,MAAF,IAAc;AACvD,UAAM;AAAEC,MAAAA;AAAF,QAA4BD,MAAM,CAAEJ,aAAF,CAAxC;AACA,WAAO;AACNG,MAAAA,KAAK,EAAEE,qBAAqB,GAAGF,KADzB;AAEND,MAAAA,WAAW,EAAEG,qBAAqB,GAAGH;AAF/B,KAAP;AAIA,GANuC,EAMrC,EANqC,CAAxC;;AAOA,MAAK,CAAEA,WAAP,EAAqB;AACpB,WAAO,IAAP;AACA;;AACD,SACC,8BACC,cAAC,OAAD;AAAS,IAAA,KAAK,EAAG,CAAjB;AAAqB,IAAA,MAAM,EAAG;AAA9B,KACGC,KADH,CADD,EAIC,cAAC,IAAD;AACC,IAAA,SAAS,EAAC,yCADX;AAEC,IAAA,IAAI,EAAC,MAFN;AAGC,IAAA,EAAE,EAAC,GAHJ;AAIC,IAAA,KAAK,EAAG;AAAEG,MAAAA,SAAS,EAAE;AAAb;AAJT,KAMGJ,WANH,CAJD,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__experimentalHeading as Heading,\n\t__experimentalText as Text,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { store as editPostStore } from '../../../store';\n\nexport default function TemplateDescription() {\n\tconst { description, title } = useSelect( ( select ) => {\n\t\tconst { getEditedPostTemplate } = select( editPostStore );\n\t\treturn {\n\t\t\ttitle: getEditedPostTemplate().title,\n\t\t\tdescription: getEditedPostTemplate().description,\n\t\t};\n\t}, [] );\n\tif ( ! description ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<Heading level={ 4 } weight={ 600 }>\n\t\t\t\t{ title }\n\t\t\t</Heading>\n\t\t\t<Text\n\t\t\t\tclassName=\"edit-post-template-details__description\"\n\t\t\t\tsize=\"body\"\n\t\t\t\tas=\"p\"\n\t\t\t\tstyle={ { marginTop: '12px' } }\n\t\t\t>\n\t\t\t\t{ description }\n\t\t\t</Text>\n\t\t</>\n\t);\n}\n"]}
@@ -928,12 +928,16 @@ body.is-fullscreen-mode .interface-interface-skeleton {
928
928
 
929
929
  .edit-post-template-top-area__popover .components-popover__content {
930
930
  min-width: 280px;
931
+ padding: 8px;
932
+ }
933
+ .edit-post-template-top-area__popover .edit-post-template-details__description {
934
+ color: #757575;
931
935
  }
932
936
 
933
937
  .edit-post-template-top-area__second-menu-group {
934
- margin-right: -12px;
935
- margin-left: -12px;
936
- padding: 12px;
938
+ margin-right: -16px;
939
+ margin-left: -16px;
940
+ padding: 16px;
937
941
  padding-bottom: 0;
938
942
  border-top: 1px solid #ddd;
939
943
  }
@@ -943,6 +947,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
943
947
  }
944
948
  .edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button .components-menu-item__item {
945
949
  margin-left: 0;
950
+ min-width: 0;
946
951
  }
947
952
 
948
953
  .edit-post-keyboard-shortcut-help-modal__section {
@@ -928,12 +928,16 @@ body.is-fullscreen-mode .interface-interface-skeleton {
928
928
 
929
929
  .edit-post-template-top-area__popover .components-popover__content {
930
930
  min-width: 280px;
931
+ padding: 8px;
932
+ }
933
+ .edit-post-template-top-area__popover .edit-post-template-details__description {
934
+ color: #757575;
931
935
  }
932
936
 
933
937
  .edit-post-template-top-area__second-menu-group {
934
- margin-left: -12px;
935
- margin-right: -12px;
936
- padding: 12px;
938
+ margin-left: -16px;
939
+ margin-right: -16px;
940
+ padding: 16px;
937
941
  padding-bottom: 0;
938
942
  border-top: 1px solid #ddd;
939
943
  }
@@ -943,6 +947,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
943
947
  }
944
948
  .edit-post-template-top-area__second-menu-group .edit-post-template-top-area__delete-template-button .components-menu-item__item {
945
949
  margin-right: 0;
950
+ min-width: 0;
946
951
  }
947
952
 
948
953
  .edit-post-keyboard-shortcut-help-modal__section {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "5.0.15",
3
+ "version": "5.0.18",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,28 +29,28 @@
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.2.4",
31
31
  "@wordpress/api-fetch": "^5.2.6",
32
- "@wordpress/block-editor": "^8.0.9",
33
- "@wordpress/block-library": "^6.0.13",
34
- "@wordpress/blocks": "^11.1.4",
35
- "@wordpress/components": "^19.1.3",
36
- "@wordpress/compose": "^5.0.6",
37
- "@wordpress/core-data": "^4.0.8",
38
- "@wordpress/data": "^6.1.4",
39
- "@wordpress/data-controls": "^2.2.7",
40
- "@wordpress/editor": "^12.0.12",
32
+ "@wordpress/block-editor": "^8.0.12",
33
+ "@wordpress/block-library": "^6.0.16",
34
+ "@wordpress/blocks": "^11.1.5",
35
+ "@wordpress/components": "^19.1.6",
36
+ "@wordpress/compose": "^5.0.7",
37
+ "@wordpress/core-data": "^4.0.9",
38
+ "@wordpress/data": "^6.1.5",
39
+ "@wordpress/data-controls": "^2.2.8",
40
+ "@wordpress/editor": "^12.0.15",
41
41
  "@wordpress/element": "^4.0.4",
42
42
  "@wordpress/hooks": "^3.2.2",
43
43
  "@wordpress/i18n": "^4.2.4",
44
44
  "@wordpress/icons": "^6.1.1",
45
- "@wordpress/interface": "^4.1.11",
46
- "@wordpress/keyboard-shortcuts": "^3.0.6",
45
+ "@wordpress/interface": "^4.1.14",
46
+ "@wordpress/keyboard-shortcuts": "^3.0.7",
47
47
  "@wordpress/keycodes": "^3.2.4",
48
48
  "@wordpress/media-utils": "^3.0.5",
49
- "@wordpress/notices": "^3.2.7",
50
- "@wordpress/plugins": "^4.0.6",
49
+ "@wordpress/notices": "^3.2.8",
50
+ "@wordpress/plugins": "^4.0.7",
51
51
  "@wordpress/primitives": "^3.0.4",
52
52
  "@wordpress/url": "^3.3.1",
53
- "@wordpress/viewport": "^4.0.6",
53
+ "@wordpress/viewport": "^4.0.7",
54
54
  "@wordpress/warning": "^2.2.2",
55
55
  "classnames": "^2.3.1",
56
56
  "lodash": "^4.17.21",
@@ -61,5 +61,5 @@
61
61
  "publishConfig": {
62
62
  "access": "public"
63
63
  },
64
- "gitHead": "f8c50499a12f926661103acfaeea6780d85b947b"
64
+ "gitHead": "1081a28b2368fcebd9a14554fbd0e25eb33fbcb6"
65
65
  }
@@ -29,6 +29,10 @@ export default function EditTemplateTitle() {
29
29
  const { getEditorSettings } = useSelect( editorStore );
30
30
  const { updateEditorSettings } = useDispatch( editorStore );
31
31
 
32
+ if ( template.has_theme_file ) {
33
+ return null;
34
+ }
35
+
32
36
  let templateTitle = __( 'Default' );
33
37
  if ( template?.title ) {
34
38
  templateTitle = template.title;
@@ -3,7 +3,11 @@
3
3
  */
4
4
  import { __, sprintf } from '@wordpress/i18n';
5
5
  import { useSelect, useDispatch } from '@wordpress/data';
6
- import { Dropdown, Button } from '@wordpress/components';
6
+ import {
7
+ Dropdown,
8
+ Button,
9
+ __experimentalText as Text,
10
+ } from '@wordpress/components';
7
11
  import { chevronDown } from '@wordpress/icons';
8
12
 
9
13
  /**
@@ -48,6 +52,12 @@ function TemplateTitle() {
48
52
  templateTitle = template.slug;
49
53
  }
50
54
 
55
+ const hasOptions = !! (
56
+ template.custom ||
57
+ template.wp_id ||
58
+ template.description
59
+ );
60
+
51
61
  return (
52
62
  <div className="edit-post-template-top-area">
53
63
  <Button
@@ -66,32 +76,39 @@ function TemplateTitle() {
66
76
  >
67
77
  { title }
68
78
  </Button>
69
- <Dropdown
70
- position="bottom center"
71
- contentClassName="edit-post-template-top-area__popover"
72
- renderToggle={ ( { onToggle } ) => (
73
- <Button
74
- className="edit-post-template-title"
75
- isLink
76
- icon={ chevronDown }
77
- showTooltip
78
- onClick={ onToggle }
79
- label={ __( 'Template Options' ) }
80
- >
81
- { templateTitle }
82
- </Button>
83
- ) }
84
- renderContent={ () => (
85
- <>
86
- { template.has_theme_file ? (
87
- <TemplateDescription />
88
- ) : (
79
+ { hasOptions ? (
80
+ <Dropdown
81
+ position="bottom center"
82
+ contentClassName="edit-post-template-top-area__popover"
83
+ renderToggle={ ( { onToggle } ) => (
84
+ <Button
85
+ className="edit-post-template-title"
86
+ isLink
87
+ icon={ chevronDown }
88
+ showTooltip
89
+ onClick={ onToggle }
90
+ label={ __( 'Template Options' ) }
91
+ >
92
+ { templateTitle }
93
+ </Button>
94
+ ) }
95
+ renderContent={ () => (
96
+ <>
89
97
  <EditTemplateTitle />
90
- ) }
91
- <DeleteTemplate />
92
- </>
93
- ) }
94
- />
98
+ <TemplateDescription />
99
+ <DeleteTemplate />
100
+ </>
101
+ ) }
102
+ />
103
+ ) : (
104
+ <Text
105
+ className="edit-post-template-title"
106
+ size="body"
107
+ style={ { lineHeight: '24px' } }
108
+ >
109
+ { templateTitle }
110
+ </Text>
111
+ ) }
95
112
  </div>
96
113
  );
97
114
  }
@@ -46,14 +46,21 @@
46
46
  }
47
47
  }
48
48
 
49
- .edit-post-template-top-area__popover .components-popover__content {
50
- min-width: 280px;
49
+ .edit-post-template-top-area__popover {
50
+ .components-popover__content {
51
+ min-width: 280px;
52
+ padding: $grid-unit-10;
53
+ }
54
+
55
+ .edit-post-template-details__description {
56
+ color: $gray-700;
57
+ }
51
58
  }
52
59
 
53
60
  .edit-post-template-top-area__second-menu-group {
54
- margin-left: -$grid-unit-15;
55
- margin-right: -$grid-unit-15;
56
- padding: $grid-unit-15;
61
+ margin-left: -$grid-unit-20;
62
+ margin-right: -$grid-unit-20;
63
+ padding: $grid-unit-20;
57
64
  padding-bottom: 0;
58
65
  border-top: $border-width solid $gray-300;
59
66
 
@@ -63,6 +70,7 @@
63
70
 
64
71
  .components-menu-item__item {
65
72
  margin-right: 0;
73
+ min-width: 0;
66
74
  }
67
75
  }
68
76
  }
@@ -2,7 +2,10 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
- import { __experimentalText as Text } from '@wordpress/components';
5
+ import {
6
+ __experimentalHeading as Heading,
7
+ __experimentalText as Text,
8
+ } from '@wordpress/components';
6
9
 
7
10
  /**
8
11
  * Internal dependencies
@@ -10,14 +13,29 @@ import { __experimentalText as Text } from '@wordpress/components';
10
13
  import { store as editPostStore } from '../../../store';
11
14
 
12
15
  export default function TemplateDescription() {
13
- const { description } = useSelect( ( select ) => {
16
+ const { description, title } = useSelect( ( select ) => {
14
17
  const { getEditedPostTemplate } = select( editPostStore );
15
18
  return {
19
+ title: getEditedPostTemplate().title,
16
20
  description: getEditedPostTemplate().description,
17
21
  };
18
22
  }, [] );
19
23
  if ( ! description ) {
20
24
  return null;
21
25
  }
22
- return <Text size="body">{ description }</Text>;
26
+ return (
27
+ <>
28
+ <Heading level={ 4 } weight={ 600 }>
29
+ { title }
30
+ </Heading>
31
+ <Text
32
+ className="edit-post-template-details__description"
33
+ size="body"
34
+ as="p"
35
+ style={ { marginTop: '12px' } }
36
+ >
37
+ { description }
38
+ </Text>
39
+ </>
40
+ );
23
41
  }