@wordpress/edit-site 4.14.2 → 4.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template.js +1 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/add-new-template/utils.js +21 -68
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/sidebar/global-styles-sidebar.js +1 -3
- package/build/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +1 -1
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +21 -68
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/sidebar/global-styles-sidebar.js +1 -3
- package/build-module/components/sidebar/global-styles-sidebar.js.map +1 -1
- package/build-style/style-rtl.css +1 -2
- package/build-style/style.css +1 -2
- package/package.json +12 -12
- package/src/components/add-new-template/new-template.js +1 -1
- package/src/components/add-new-template/utils.js +9 -88
- package/src/components/sidebar/global-styles-sidebar.js +0 -3
- package/src/components/sidebar/style.scss +1 -2
|
@@ -253,29 +253,10 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => {
|
|
|
253
253
|
};
|
|
254
254
|
},
|
|
255
255
|
getSpecificTemplate: ( suggestion ) => {
|
|
256
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
568
|
-
slug: `author-${ suggestion.slug }`,
|
|
488
|
+
title: templateSlug,
|
|
489
|
+
slug: templateSlug,
|
|
569
490
|
templatePrefix: 'author',
|
|
570
491
|
};
|
|
571
492
|
},
|