@wordpress/edit-site 4.14.2 → 4.15.1-next.4d3b314fd5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/add-custom-generic-template-modal.js +20 -6
  3. package/build/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  4. package/build/components/add-new-template/add-custom-template-modal.js +5 -2
  5. package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
  6. package/build/components/add-new-template/new-template.js +18 -5
  7. package/build/components/add-new-template/new-template.js.map +1 -1
  8. package/build/components/add-new-template/template-actions-loading-screen.js +29 -0
  9. package/build/components/add-new-template/template-actions-loading-screen.js.map +1 -0
  10. package/build/components/add-new-template/utils.js +21 -68
  11. package/build/components/add-new-template/utils.js.map +1 -1
  12. package/build/components/global-styles/palette.js +2 -2
  13. package/build/components/global-styles/palette.js.map +1 -1
  14. package/build/components/sidebar/global-styles-sidebar.js +1 -3
  15. package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
  16. package/build-module/components/add-new-template/add-custom-generic-template-modal.js +17 -6
  17. package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +1 -1
  18. package/build-module/components/add-new-template/add-custom-template-modal.js +4 -2
  19. package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
  20. package/build-module/components/add-new-template/new-template.js +17 -5
  21. package/build-module/components/add-new-template/new-template.js.map +1 -1
  22. package/build-module/components/add-new-template/template-actions-loading-screen.js +21 -0
  23. package/build-module/components/add-new-template/template-actions-loading-screen.js.map +1 -0
  24. package/build-module/components/add-new-template/utils.js +21 -68
  25. package/build-module/components/add-new-template/utils.js.map +1 -1
  26. package/build-module/components/global-styles/palette.js +2 -2
  27. package/build-module/components/global-styles/palette.js.map +1 -1
  28. package/build-module/components/sidebar/global-styles-sidebar.js +1 -3
  29. package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
  30. package/build-style/style-rtl.css +20 -3
  31. package/build-style/style.css +20 -3
  32. package/package.json +29 -29
  33. package/src/components/add-new-template/add-custom-generic-template-modal.js +24 -12
  34. package/src/components/add-new-template/add-custom-template-modal.js +8 -1
  35. package/src/components/add-new-template/new-template.js +65 -48
  36. package/src/components/add-new-template/style.scss +19 -0
  37. package/src/components/add-new-template/template-actions-loading-screen.js +23 -0
  38. package/src/components/add-new-template/utils.js +9 -88
  39. package/src/components/global-styles/palette.js +9 -5
  40. package/src/components/global-styles/style.scss +1 -1
  41. package/src/components/sidebar/global-styles-sidebar.js +0 -3
  42. package/src/components/sidebar/style.scss +1 -2
@@ -741,7 +741,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
741
741
  margin: 16px;
742
742
  }
743
743
  .edit-site-global-styles-screen-colors .component-color-indicator {
744
- background: linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
744
+ background: #fff linear-gradient(45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
745
745
  flex-shrink: 0;
746
746
  }
747
747
 
@@ -1620,6 +1620,24 @@ body.is-fullscreen-mode .edit-site-list-header {
1620
1620
  margin-top: 12px;
1621
1621
  }
1622
1622
 
1623
+ .edit-site-template-actions-loading-screen-modal {
1624
+ -webkit-backdrop-filter: none;
1625
+ backdrop-filter: none;
1626
+ background-color: transparent;
1627
+ }
1628
+ .edit-site-template-actions-loading-screen-modal.is-full-screen {
1629
+ background-color: #fff;
1630
+ box-shadow: 0 0 0 transparent;
1631
+ min-width: 100%;
1632
+ min-height: 100%;
1633
+ }
1634
+ .edit-site-template-actions-loading-screen-modal__content {
1635
+ display: flex;
1636
+ align-items: center;
1637
+ justify-content: center;
1638
+ height: 100%;
1639
+ }
1640
+
1623
1641
  .edit-site-sidebar {
1624
1642
  width: 280px;
1625
1643
  }
@@ -1694,8 +1712,7 @@ body.is-fullscreen-mode .edit-site-list-header {
1694
1712
  padding: 16px;
1695
1713
  }
1696
1714
 
1697
- .edit-site-navigation-sidebar__beta,
1698
- .edit-site-global-styles-sidebar__beta {
1715
+ .edit-site-navigation-sidebar__beta {
1699
1716
  display: inline-flex;
1700
1717
  margin-right: 8px;
1701
1718
  padding: 0 8px;
@@ -741,7 +741,7 @@ textarea.edit-site-code-editor-text-area.edit-site-code-editor-text-area:-ms-inp
741
741
  margin: 16px;
742
742
  }
743
743
  .edit-site-global-styles-screen-colors .component-color-indicator {
744
- background: linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
744
+ background: #fff linear-gradient(-45deg, transparent 48%, #ddd 48%, #ddd 52%, transparent 52%);
745
745
  flex-shrink: 0;
746
746
  }
747
747
 
@@ -1620,6 +1620,24 @@ body.is-fullscreen-mode .edit-site-list-header {
1620
1620
  margin-top: 12px;
1621
1621
  }
1622
1622
 
1623
+ .edit-site-template-actions-loading-screen-modal {
1624
+ -webkit-backdrop-filter: none;
1625
+ backdrop-filter: none;
1626
+ background-color: transparent;
1627
+ }
1628
+ .edit-site-template-actions-loading-screen-modal.is-full-screen {
1629
+ background-color: #fff;
1630
+ box-shadow: 0 0 0 transparent;
1631
+ min-width: 100%;
1632
+ min-height: 100%;
1633
+ }
1634
+ .edit-site-template-actions-loading-screen-modal__content {
1635
+ display: flex;
1636
+ align-items: center;
1637
+ justify-content: center;
1638
+ height: 100%;
1639
+ }
1640
+
1623
1641
  .edit-site-sidebar {
1624
1642
  width: 280px;
1625
1643
  }
@@ -1694,8 +1712,7 @@ body.is-fullscreen-mode .edit-site-list-header {
1694
1712
  padding: 16px;
1695
1713
  }
1696
1714
 
1697
- .edit-site-navigation-sidebar__beta,
1698
- .edit-site-global-styles-sidebar__beta {
1715
+ .edit-site-navigation-sidebar__beta {
1699
1716
  display: inline-flex;
1700
1717
  margin-left: 8px;
1701
1718
  padding: 0 8px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "4.14.2",
3
+ "version": "4.15.1-next.4d3b314fd5.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,33 +27,33 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.17.1",
31
- "@wordpress/api-fetch": "^6.14.1",
32
- "@wordpress/block-editor": "^10.0.2",
33
- "@wordpress/block-library": "^7.14.2",
34
- "@wordpress/blocks": "^11.16.2",
35
- "@wordpress/components": "^21.0.2",
36
- "@wordpress/compose": "^5.15.2",
37
- "@wordpress/core-data": "^5.0.2",
38
- "@wordpress/data": "^7.1.2",
39
- "@wordpress/deprecated": "^3.17.1",
40
- "@wordpress/editor": "^12.16.2",
41
- "@wordpress/element": "^4.15.1",
42
- "@wordpress/hooks": "^3.17.1",
43
- "@wordpress/html-entities": "^3.17.1",
44
- "@wordpress/i18n": "^4.17.1",
45
- "@wordpress/icons": "^9.8.1",
46
- "@wordpress/interface": "^4.16.2",
47
- "@wordpress/keyboard-shortcuts": "^3.15.2",
48
- "@wordpress/keycodes": "^3.17.1",
49
- "@wordpress/media-utils": "^4.8.1",
50
- "@wordpress/notices": "^3.17.2",
51
- "@wordpress/plugins": "^4.15.2",
52
- "@wordpress/preferences": "^2.9.2",
53
- "@wordpress/reusable-blocks": "^3.15.2",
54
- "@wordpress/style-engine": "^1.0.1",
55
- "@wordpress/url": "^3.18.1",
56
- "@wordpress/viewport": "^4.15.2",
30
+ "@wordpress/a11y": "^3.18.1-next.4d3b314fd5.0",
31
+ "@wordpress/api-fetch": "^6.15.1-next.4d3b314fd5.0",
32
+ "@wordpress/block-editor": "^10.1.1-next.4d3b314fd5.0",
33
+ "@wordpress/block-library": "^7.15.1-next.4d3b314fd5.0",
34
+ "@wordpress/blocks": "^11.18.1-next.4d3b314fd5.0",
35
+ "@wordpress/components": "^21.1.2-next.4d3b314fd5.0",
36
+ "@wordpress/compose": "^5.16.1-next.4d3b314fd5.0",
37
+ "@wordpress/core-data": "^5.1.1-next.4d3b314fd5.0",
38
+ "@wordpress/data": "^7.2.1-next.4d3b314fd5.0",
39
+ "@wordpress/deprecated": "^3.18.1-next.4d3b314fd5.0",
40
+ "@wordpress/editor": "^12.17.1-next.4d3b314fd5.0",
41
+ "@wordpress/element": "^4.16.1-next.4d3b314fd5.0",
42
+ "@wordpress/hooks": "^3.18.1-next.4d3b314fd5.0",
43
+ "@wordpress/html-entities": "^3.18.1-next.4d3b314fd5.0",
44
+ "@wordpress/i18n": "^4.18.1-next.4d3b314fd5.0",
45
+ "@wordpress/icons": "^9.9.1-next.4d3b314fd5.0",
46
+ "@wordpress/interface": "^4.17.1-next.4d3b314fd5.0",
47
+ "@wordpress/keyboard-shortcuts": "^3.16.1-next.4d3b314fd5.0",
48
+ "@wordpress/keycodes": "^3.18.1-next.4d3b314fd5.0",
49
+ "@wordpress/media-utils": "^4.9.1-next.4d3b314fd5.0",
50
+ "@wordpress/notices": "^3.18.1-next.4d3b314fd5.0",
51
+ "@wordpress/plugins": "^4.16.1-next.4d3b314fd5.0",
52
+ "@wordpress/preferences": "^2.10.1-next.4d3b314fd5.0",
53
+ "@wordpress/reusable-blocks": "^3.16.1-next.4d3b314fd5.0",
54
+ "@wordpress/style-engine": "^1.1.1-next.4d3b314fd5.0",
55
+ "@wordpress/url": "^3.19.1-next.4d3b314fd5.0",
56
+ "@wordpress/viewport": "^4.16.1-next.4d3b314fd5.0",
57
57
  "classnames": "^2.3.1",
58
58
  "downloadjs": "^1.4.7",
59
59
  "history": "^5.1.0",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "f6021282457317c7e12dcc3a3f02c9ac28e16a30"
71
+ "gitHead": "25054766423cb49d959eb656c2533530073ff5c2"
72
72
  }
@@ -16,27 +16,38 @@ import {
16
16
  TextControl,
17
17
  } from '@wordpress/components';
18
18
 
19
- function AddCustomGenericTemplateModal( { onClose, createTemplate } ) {
19
+ /**
20
+ * Internal dependencies
21
+ */
22
+ import TemplateActionsLoadingScreen from './template-actions-loading-screen';
23
+
24
+ function AddCustomGenericTemplateModal( {
25
+ onClose,
26
+ createTemplate,
27
+ isCreatingTemplate,
28
+ } ) {
20
29
  const [ title, setTitle ] = useState( '' );
21
30
  const defaultTitle = __( 'Custom Template' );
22
31
  const [ isBusy, setIsBusy ] = useState( false );
23
32
  async function onCreateTemplate( event ) {
24
33
  event.preventDefault();
25
-
26
34
  if ( isBusy ) {
27
35
  return;
28
36
  }
29
-
30
37
  setIsBusy( true );
31
-
32
- createTemplate(
33
- {
34
- slug:
35
- 'wp-custom-template-' + kebabCase( title || defaultTitle ),
36
- title: title || defaultTitle,
37
- },
38
- false
39
- );
38
+ try {
39
+ await createTemplate(
40
+ {
41
+ slug:
42
+ 'wp-custom-template-' +
43
+ kebabCase( title || defaultTitle ),
44
+ title: title || defaultTitle,
45
+ },
46
+ false
47
+ );
48
+ } finally {
49
+ setIsBusy( false );
50
+ }
40
51
  }
41
52
  return (
42
53
  <Modal
@@ -47,6 +58,7 @@ function AddCustomGenericTemplateModal( { onClose, createTemplate } ) {
47
58
  } }
48
59
  overlayClassName="edit-site-custom-generic-template__modal"
49
60
  >
61
+ { isCreatingTemplate && <TemplateActionsLoadingScreen /> }
50
62
  <form onSubmit={ onCreateTemplate }>
51
63
  <Flex align="flex-start" gap={ 8 }>
52
64
  <FlexItem>
@@ -21,6 +21,7 @@ import { useEntityRecords } from '@wordpress/core-data';
21
21
  /**
22
22
  * Internal dependencies
23
23
  */
24
+ import TemplateActionsLoadingScreen from './template-actions-loading-screen';
24
25
  import { mapToIHasNameAndId } from './utils';
25
26
 
26
27
  const EMPTY_ARRAY = [];
@@ -160,7 +161,12 @@ function SuggestionList( { entityForSuggestions, onSelect } ) {
160
161
  );
161
162
  }
162
163
 
163
- function AddCustomTemplateModal( { onClose, onSelect, entityForSuggestions } ) {
164
+ function AddCustomTemplateModal( {
165
+ onClose,
166
+ onSelect,
167
+ entityForSuggestions,
168
+ isCreatingTemplate,
169
+ } ) {
164
170
  const [ showSearchEntities, setShowSearchEntities ] = useState(
165
171
  entityForSuggestions.hasGeneralTemplate
166
172
  );
@@ -176,6 +182,7 @@ function AddCustomTemplateModal( { onClose, onSelect, entityForSuggestions } ) {
176
182
  closeLabel={ __( 'Close' ) }
177
183
  onRequestClose={ onClose }
178
184
  >
185
+ { isCreatingTemplate && <TemplateActionsLoadingScreen /> }
179
186
  { ! showSearchEntities && (
180
187
  <>
181
188
  <p>
@@ -44,6 +44,7 @@ import {
44
44
  usePostTypeArchiveMenuItems,
45
45
  } from './utils';
46
46
  import AddCustomGenericTemplateModal from './add-custom-generic-template-modal';
47
+ import TemplateActionsLoadingScreen from './template-actions-loading-screen';
47
48
  import { useHistory } from '../routes';
48
49
  import { store as editSiteStore } from '../../store';
49
50
 
@@ -86,6 +87,7 @@ export default function NewTemplate( { postType } ) {
86
87
  setShowCustomGenericTemplateModal,
87
88
  ] = useState( false );
88
89
  const [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );
90
+ const [ isCreatingTemplate, setIsCreatingTemplate ] = useState( false );
89
91
 
90
92
  const history = useHistory();
91
93
  const { saveEntityRecord } = useDispatch( coreStore );
@@ -94,6 +96,10 @@ export default function NewTemplate( { postType } ) {
94
96
  const { setTemplate } = useDispatch( editSiteStore );
95
97
 
96
98
  async function createTemplate( template, isWPSuggestion = true ) {
99
+ if ( isCreatingTemplate ) {
100
+ return;
101
+ }
102
+ setIsCreatingTemplate( true );
97
103
  try {
98
104
  const { title, description, slug, templatePrefix } = template;
99
105
  let templateContent = template.content;
@@ -106,7 +112,7 @@ export default function NewTemplate( { postType } ) {
106
112
  template_prefix: templatePrefix,
107
113
  } ),
108
114
  } );
109
- templateContent = fallbackTemplate.content;
115
+ templateContent = fallbackTemplate.content.raw;
110
116
  }
111
117
  const newTemplate = await saveEntityRecord(
112
118
  'postType',
@@ -151,6 +157,8 @@ export default function NewTemplate( { postType } ) {
151
157
  createErrorNotice( errorMessage, {
152
158
  type: 'snackbar',
153
159
  } );
160
+ } finally {
161
+ setIsCreatingTemplate( false );
154
162
  }
155
163
  }
156
164
 
@@ -176,53 +184,60 @@ export default function NewTemplate( { postType } ) {
176
184
  } }
177
185
  >
178
186
  { () => (
179
- <NavigableMenu className="edit-site-new-template-dropdown__popover">
180
- <MenuGroup label={ postType.labels.add_new_item }>
181
- { missingTemplates.map( ( template ) => {
182
- const {
183
- title,
184
- description,
185
- slug,
186
- onClick,
187
- icon,
188
- } = template;
189
- return (
190
- <MenuItem
191
- icon={
192
- icon ||
193
- TEMPLATE_ICONS[ slug ] ||
194
- post
195
- }
196
- iconPosition="left"
197
- info={ description }
198
- key={ slug }
199
- onClick={ () =>
200
- onClick
201
- ? onClick( template )
202
- : createTemplate( template )
203
- }
204
- >
205
- { title }
206
- </MenuItem>
207
- );
208
- } ) }
209
- </MenuGroup>
210
- <MenuGroup>
211
- <MenuItem
212
- icon={ customGenericTemplateIcon }
213
- iconPosition="left"
214
- info={ __(
215
- 'Custom templates can be applied to any post or page.'
216
- ) }
217
- key="custom-template"
218
- onClick={ () =>
219
- setShowCustomGenericTemplateModal( true )
220
- }
221
- >
222
- { __( 'Custom template' ) }
223
- </MenuItem>
224
- </MenuGroup>
225
- </NavigableMenu>
187
+ <>
188
+ { isCreatingTemplate && (
189
+ <TemplateActionsLoadingScreen />
190
+ ) }
191
+ <NavigableMenu className="edit-site-new-template-dropdown__popover">
192
+ <MenuGroup label={ postType.labels.add_new_item }>
193
+ { missingTemplates.map( ( template ) => {
194
+ const {
195
+ title,
196
+ description,
197
+ slug,
198
+ onClick,
199
+ icon,
200
+ } = template;
201
+ return (
202
+ <MenuItem
203
+ icon={
204
+ icon ||
205
+ TEMPLATE_ICONS[ slug ] ||
206
+ post
207
+ }
208
+ iconPosition="left"
209
+ info={ description }
210
+ key={ slug }
211
+ onClick={ () =>
212
+ onClick
213
+ ? onClick( template )
214
+ : createTemplate( template )
215
+ }
216
+ >
217
+ { title }
218
+ </MenuItem>
219
+ );
220
+ } ) }
221
+ </MenuGroup>
222
+ <MenuGroup>
223
+ <MenuItem
224
+ icon={ customGenericTemplateIcon }
225
+ iconPosition="left"
226
+ info={ __(
227
+ 'Custom templates can be applied to any post or page.'
228
+ ) }
229
+ key="custom-template"
230
+ onClick={ () =>
231
+ setShowCustomGenericTemplateModal(
232
+ true
233
+ )
234
+ }
235
+ >
236
+ { __( 'Custom template' ) }
237
+ </MenuItem>
238
+ </MenuGroup>
239
+ </NavigableMenu>
240
+ </>
226
241
  ) }
227
242
  </DropdownMenu>
228
243
  { showCustomTemplateModal && (
@@ -230,12 +245,14 @@ export default function NewTemplate( { postType } ) {
230
245
  onClose={ () => setShowCustomTemplateModal( false ) }
231
246
  onSelect={ createTemplate }
232
247
  entityForSuggestions={ entityForSuggestions }
248
+ isCreatingTemplate={ isCreatingTemplate }
233
249
  />
234
250
  ) }
235
251
  { showCustomGenericTemplateModal && (
236
252
  <AddCustomGenericTemplateModal
237
253
  onClose={ () => setShowCustomGenericTemplateModal( false ) }
238
254
  createTemplate={ createTemplate }
255
+ isCreatingTemplate={ isCreatingTemplate }
239
256
  />
240
257
  ) }
241
258
  </>
@@ -158,3 +158,22 @@
158
158
  .edit-site-custom-generic-template__modal-actions {
159
159
  margin-top: $grid-unit-15;
160
160
  }
161
+
162
+ .edit-site-template-actions-loading-screen-modal {
163
+ backdrop-filter: none;
164
+ background-color: transparent;
165
+
166
+ &.is-full-screen {
167
+ background-color: $white;
168
+ box-shadow: 0 0 0 transparent;
169
+ min-width: 100%;
170
+ min-height: 100%;
171
+ }
172
+
173
+ &__content {
174
+ display: flex;
175
+ align-items: center;
176
+ justify-content: center;
177
+ height: 100%;
178
+ }
179
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Spinner, Modal } from '@wordpress/components';
5
+
6
+ export default function TemplateActionsLoadingScreen() {
7
+ const baseCssClass = 'edit-site-template-actions-loading-screen-modal';
8
+ return (
9
+ <Modal
10
+ isFullScreen
11
+ isDismissible={ false }
12
+ shouldCloseOnClickOutside={ false }
13
+ shouldCloseOnEsc={ false }
14
+ onRequestClose={ () => {} }
15
+ __experimentalHideHeader
16
+ className={ baseCssClass }
17
+ >
18
+ <div className={ `${ baseCssClass }__content` }>
19
+ <Spinner />
20
+ </div>
21
+ </Modal>
22
+ );
23
+ }
@@ -253,29 +253,10 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
253
253
  };
254
254
  },
255
255
  getSpecificTemplate: ( suggestion ) => {
256
- let title = sprintf(
257
- // translators: Represents the title of a user's custom template in the Site Editor, where %1$s is the singular name of a post type and %2$s is the name of the post, e.g. "Page: Hello".
258
- __( '%1$s: %2$s' ),
259
- labels.singular_name,
260
- suggestion.name
261
- );
262
- const description = sprintf(
263
- // translators: Represents the description of a user's custom template in the Site Editor, e.g. "Template for Page: Hello"
264
- __( 'Template for %1$s' ),
265
- title
266
- );
267
- if ( _needsUniqueIdentifier ) {
268
- title = sprintf(
269
- // translators: Represents the title of a user's custom template in the Site Editor, where %1$s is the template title and %2$s is the slug of the post type, e.g. "Project: Hello (project_type)"
270
- __( '%1$s (%2$s)' ),
271
- title,
272
- slug
273
- );
274
- }
256
+ const templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;
275
257
  return {
276
- title,
277
- description,
278
- slug: `${ templatePrefixes[ slug ] }-${ suggestion.slug }`,
258
+ title: templateSlug,
259
+ slug: templateSlug,
279
260
  templatePrefix: templatePrefixes[ slug ],
280
261
  };
281
262
  },
@@ -417,29 +398,10 @@ export const useTaxonomiesMenuItems = ( onClickMenuItem ) => {
417
398
  };
418
399
  },
419
400
  getSpecificTemplate: ( suggestion ) => {
420
- let title = sprintf(
421
- // translators: Represents the title of a user's custom template in the Site Editor, where %1$s is the singular name of a taxonomy and %2$s is the name of the term, e.g. "Category: shoes".
422
- __( '%1$s: %2$s' ),
423
- labels.singular_name,
424
- suggestion.name
425
- );
426
- const description = sprintf(
427
- // translators: Represents the description of a user's custom template in the Site Editor, e.g. "Template for Category: shoes"
428
- __( 'Template for %1$s' ),
429
- title
430
- );
431
- if ( _needsUniqueIdentifier ) {
432
- title = sprintf(
433
- // translators: Represents the title of a user's custom template in the Site Editor, where %1$s is the template title and %2$s is the slug of the taxonomy, e.g. "Category: shoes (product_tag)"
434
- __( '%1$s (%2$s)' ),
435
- title,
436
- slug
437
- );
438
- }
401
+ const templateSlug = `${ templatePrefixes[ slug ] }-${ suggestion.slug }`;
439
402
  return {
440
- title,
441
- description,
442
- slug: `${ templatePrefixes[ slug ] }-${ suggestion.slug }`,
403
+ title: templateSlug,
404
+ slug: templateSlug,
443
405
  templatePrefix: templatePrefixes[ slug ],
444
406
  };
445
407
  },
@@ -480,26 +442,6 @@ export const useTaxonomiesMenuItems = ( onClickMenuItem ) => {
480
442
  return taxonomiesMenuItems;
481
443
  };
482
444
 
483
- function useAuthorNeedsUniqueIndentifier() {
484
- const authors = useSelect(
485
- ( select ) =>
486
- select( coreStore ).getUsers( { who: 'authors', per_page: -1 } ),
487
- []
488
- );
489
- const authorsCountByName = useMemo( () => {
490
- return ( authors || [] ).reduce( ( authorsCount, { name } ) => {
491
- authorsCount[ name ] = ( authorsCount[ name ] || 0 ) + 1;
492
- return authorsCount;
493
- }, {} );
494
- }, [ authors ] );
495
- return useCallback(
496
- ( name ) => {
497
- return authorsCountByName[ name ] > 1;
498
- },
499
- [ authorsCountByName ]
500
- );
501
- }
502
-
503
445
  const USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX = { user: 'author' };
504
446
  const USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS = { user: { who: 'authors' } };
505
447
  export function useAuthorMenuItem( onClickMenuItem ) {
@@ -510,7 +452,6 @@ export function useAuthorMenuItem( onClickMenuItem ) {
510
452
  USE_AUTHOR_MENU_ITEM_TEMPLATE_PREFIX,
511
453
  USE_AUTHOR_MENU_ITEM_QUERY_PARAMETERS
512
454
  );
513
- const authorNeedsUniqueId = useAuthorNeedsUniqueIndentifier();
514
455
  let authorMenuItem = defaultTemplateTypes?.find(
515
456
  ( { slug } ) => slug === 'author'
516
457
  );
@@ -542,30 +483,10 @@ export function useAuthorMenuItem( onClickMenuItem ) {
542
483
  };
543
484
  },
544
485
  getSpecificTemplate: ( suggestion ) => {
545
- const needsUniqueId = authorNeedsUniqueId(
546
- suggestion.name
547
- );
548
- const title = needsUniqueId
549
- ? sprintf(
550
- // translators: %1$s: Represents the name of an author e.g: "Jorge", %2$s: Represents the slug of an author e.g: "author-jorge-slug".
551
- __( 'Author: %1$s (%2$s)' ),
552
- suggestion.name,
553
- suggestion.slug
554
- )
555
- : sprintf(
556
- // translators: %s: Represents the name of an author e.g: "Jorge".
557
- __( 'Author: %s' ),
558
- suggestion.name
559
- );
560
- const description = sprintf(
561
- // translators: %s: Represents the name of an author e.g: "Jorge".
562
- __( 'Template for Author: %s' ),
563
- suggestion.name
564
- );
486
+ const templateSlug = `author-${ suggestion.slug }`;
565
487
  return {
566
- title,
567
- description,
568
- slug: `author-${ suggestion.slug }`,
488
+ title: templateSlug,
489
+ slug: templateSlug,
569
490
  templatePrefix: 'author',
570
491
  };
571
492
  },
@@ -68,11 +68,15 @@ function Palette( { name } ) {
68
68
  }
69
69
  >
70
70
  <ZStack isLayered={ false } offset={ -8 }>
71
- { colors.slice( 0, 5 ).map( ( { color } ) => (
72
- <ColorIndicatorWrapper key={ color }>
73
- <ColorIndicator colorValue={ color } />
74
- </ColorIndicatorWrapper>
75
- ) ) }
71
+ { colors
72
+ .slice( 0, 5 )
73
+ .map( ( { color }, index ) => (
74
+ <ColorIndicatorWrapper
75
+ key={ `${ color }-${ index }` }
76
+ >
77
+ <ColorIndicator colorValue={ color } />
78
+ </ColorIndicatorWrapper>
79
+ ) ) }
76
80
  </ZStack>
77
81
  <FlexItem>{ paletteButtonText }</FlexItem>
78
82
  </HStack>
@@ -46,7 +46,7 @@
46
46
 
47
47
  .component-color-indicator {
48
48
  // Show a diagonal line (crossed out) for empty swatches.
49
- background: linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%);
49
+ background: $white linear-gradient(-45deg, transparent 48%, $gray-300 48%, $gray-300 52%, transparent 52%);
50
50
  flex-shrink: 0;
51
51
  }
52
52
  }
@@ -29,9 +29,6 @@ export default function GlobalStylesSidebar() {
29
29
  <Flex>
30
30
  <FlexBlock>
31
31
  <strong>{ __( 'Styles' ) }</strong>
32
- <span className="edit-site-global-styles-sidebar__beta">
33
- { __( 'Beta' ) }
34
- </span>
35
32
  </FlexBlock>
36
33
  <FlexItem>
37
34
  <DropdownMenu
@@ -78,8 +78,7 @@
78
78
  padding: $grid-unit-20;
79
79
  }
80
80
 
81
- .edit-site-navigation-sidebar__beta,
82
- .edit-site-global-styles-sidebar__beta {
81
+ .edit-site-navigation-sidebar__beta {
83
82
  display: inline-flex;
84
83
  margin-left: $grid-unit-10;
85
84
  padding: 0 $grid-unit-10;