@wordpress/block-library 6.0.7 → 6.0.8

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 (70) hide show
  1. package/build/cover/transforms.js +2 -0
  2. package/build/cover/transforms.js.map +1 -1
  3. package/build/navigation/edit/index.js +14 -2
  4. package/build/navigation/edit/index.js.map +1 -1
  5. package/build/navigation/edit/inner-blocks.js +1 -1
  6. package/build/navigation/edit/inner-blocks.js.map +1 -1
  7. package/build/navigation/edit/responsive-wrapper.js +5 -2
  8. package/build/navigation/edit/responsive-wrapper.js.map +1 -1
  9. package/build/page-list/edit.js +40 -42
  10. package/build/page-list/edit.js.map +1 -1
  11. package/build/post-featured-image/edit.js +54 -23
  12. package/build/post-featured-image/edit.js.map +1 -1
  13. package/build-module/cover/transforms.js +2 -0
  14. package/build-module/cover/transforms.js.map +1 -1
  15. package/build-module/navigation/edit/index.js +14 -2
  16. package/build-module/navigation/edit/index.js.map +1 -1
  17. package/build-module/navigation/edit/inner-blocks.js +1 -1
  18. package/build-module/navigation/edit/inner-blocks.js.map +1 -1
  19. package/build-module/navigation/edit/responsive-wrapper.js +5 -2
  20. package/build-module/navigation/edit/responsive-wrapper.js.map +1 -1
  21. package/build-module/page-list/edit.js +41 -43
  22. package/build-module/page-list/edit.js.map +1 -1
  23. package/build-module/post-featured-image/edit.js +56 -26
  24. package/build-module/post-featured-image/edit.js.map +1 -1
  25. package/build-style/code/theme-rtl.css +1 -1
  26. package/build-style/code/theme.css +1 -1
  27. package/build-style/cover/style-rtl.css +8 -2
  28. package/build-style/cover/style.css +8 -2
  29. package/build-style/editor-rtl.css +101 -51
  30. package/build-style/editor.css +101 -51
  31. package/build-style/navigation/style-rtl.css +33 -1
  32. package/build-style/navigation/style.css +33 -1
  33. package/build-style/post-comments-form/style-rtl.css +18 -0
  34. package/build-style/post-comments-form/style.css +18 -0
  35. package/build-style/post-featured-image/editor-rtl.css +100 -16
  36. package/build-style/post-featured-image/editor.css +100 -16
  37. package/build-style/social-links/editor-rtl.css +1 -35
  38. package/build-style/social-links/editor.css +1 -35
  39. package/build-style/style-rtl.css +59 -25
  40. package/build-style/style.css +59 -25
  41. package/build-style/theme-rtl.css +1 -1
  42. package/build-style/theme.css +1 -1
  43. package/package.json +7 -7
  44. package/src/calendar/index.php +1 -1
  45. package/src/code/theme.scss +1 -1
  46. package/src/cover/style.scss +9 -2
  47. package/src/cover/transforms.js +2 -0
  48. package/src/gallery/index.php +1 -1
  49. package/src/home-link/index.php +1 -1
  50. package/src/image/index.php +1 -1
  51. package/src/navigation/edit/index.js +25 -0
  52. package/src/navigation/edit/inner-blocks.js +2 -1
  53. package/src/navigation/edit/responsive-wrapper.js +8 -1
  54. package/src/navigation/index.php +45 -5
  55. package/src/navigation/style.scss +46 -2
  56. package/src/navigation-area/index.php +1 -1
  57. package/src/navigation-link/index.php +1 -1
  58. package/src/navigation-submenu/index.php +2 -8
  59. package/src/page-list/edit.js +35 -44
  60. package/src/page-list/index.php +1 -1
  61. package/src/post-comments-form/style.scss +20 -1
  62. package/src/post-featured-image/edit.js +61 -26
  63. package/src/post-featured-image/editor.scss +124 -20
  64. package/src/site-logo/editor.scss +1 -0
  65. package/src/social-links/editor.scss +1 -47
  66. package/src/style.scss +0 -1
  67. package/src/table-of-contents/index.php +1 -1
  68. package/build-style/navigation-submenu/style-rtl.css +0 -97
  69. package/build-style/navigation-submenu/style.css +0 -97
  70. package/src/navigation-submenu/style.scss +0 -25
@@ -12,9 +12,9 @@ import { sortBy } from 'lodash';
12
12
  import { BlockControls, useBlockProps, getColorClassName } from '@wordpress/block-editor';
13
13
  import { ToolbarButton, Placeholder, Spinner } from '@wordpress/components';
14
14
  import { __ } from '@wordpress/i18n';
15
- import { useEffect, useState, memo } from '@wordpress/element';
16
- import apiFetch from '@wordpress/api-fetch';
17
- import { addQueryArgs } from '@wordpress/url';
15
+ import { useMemo, useState, memo } from '@wordpress/element';
16
+ import { useSelect } from '@wordpress/data';
17
+ import { store as coreStore } from '@wordpress/core-data';
18
18
  /**
19
19
  * Internal dependencies
20
20
  */
@@ -61,53 +61,51 @@ export default function PageListEdit(_ref) {
61
61
  }, __('Edit'))), allowConvertToLinks && isOpen && createElement(ConvertToLinksModal, {
62
62
  onClose: closeModal,
63
63
  clientId: clientId
64
- }), totalPages === null && createElement("div", blockProps, createElement(Placeholder, null, createElement(Spinner, null))), totalPages === 0 && createElement("div", blockProps, createElement("span", null, __('Page List: No pages to show.'))), totalPages > 0 && createElement("ul", blockProps, createElement(PageItems, {
64
+ }), totalPages === undefined && createElement("div", blockProps, createElement(Placeholder, null, createElement(Spinner, null))), totalPages === 0 && createElement("div", blockProps, createElement("span", null, __('Page List: No pages to show.'))), totalPages > 0 && createElement("ul", blockProps, createElement(PageItems, {
65
65
  context: context,
66
66
  pagesByParentId: pagesByParentId
67
67
  })));
68
68
  }
69
69
 
70
70
  function usePagesByParentId() {
71
- const [pagesByParentId, setPagesByParentId] = useState(null);
72
- const [totalPages, setTotalPages] = useState(null);
73
- useEffect(() => {
74
- async function performFetch() {
75
- setPagesByParentId(null);
76
- setTotalPages(null);
77
- let pages = await apiFetch({
78
- path: addQueryArgs('/wp/v2/pages', {
79
- orderby: 'menu_order',
80
- order: 'asc',
81
- _fields: ['id', 'link', 'parent', 'title', 'menu_order'],
82
- per_page: -1
83
- })
84
- }); // TODO: Once the REST API supports passing multiple values to
85
- // 'orderby', this can be removed.
86
- // https://core.trac.wordpress.org/ticket/39037
87
-
88
- pages = sortBy(pages, ['menu_order', 'title.rendered']);
89
- setPagesByParentId(pages.reduce((accumulator, page) => {
90
- const {
91
- parent
92
- } = page;
93
-
94
- if (accumulator.has(parent)) {
95
- accumulator.get(parent).push(page);
96
- } else {
97
- accumulator.set(parent, [page]);
98
- }
99
-
100
- return accumulator;
101
- }, new Map()));
102
- setTotalPages(pages.length);
103
- }
104
-
105
- performFetch();
71
+ const {
72
+ pages
73
+ } = useSelect(select => {
74
+ const {
75
+ getEntityRecords
76
+ } = select(coreStore);
77
+ return {
78
+ pages: getEntityRecords('postType', 'page', {
79
+ orderby: 'menu_order',
80
+ order: 'asc',
81
+ _fields: ['id', 'link', 'parent', 'title', 'menu_order'],
82
+ per_page: -1
83
+ })
84
+ };
106
85
  }, []);
107
- return {
108
- pagesByParentId,
109
- totalPages
110
- };
86
+ return useMemo(() => {
87
+ // TODO: Once the REST API supports passing multiple values to
88
+ // 'orderby', this can be removed.
89
+ // https://core.trac.wordpress.org/ticket/39037
90
+ const sortedPages = sortBy(pages, ['menu_order', 'title.rendered']);
91
+ const pagesByParentId = sortedPages.reduce((accumulator, page) => {
92
+ const {
93
+ parent
94
+ } = page;
95
+
96
+ if (accumulator.has(parent)) {
97
+ accumulator.get(parent).push(page);
98
+ } else {
99
+ accumulator.set(parent, [page]);
100
+ }
101
+
102
+ return accumulator;
103
+ }, new Map());
104
+ return {
105
+ pagesByParentId,
106
+ totalPages: pages === null || pages === void 0 ? void 0 : pages.length
107
+ };
108
+ }, [pages]);
111
109
  }
112
110
 
113
111
  const PageItems = memo(function PageItems(_ref2) {
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/page-list/edit.js"],"names":["classnames","sortBy","BlockControls","useBlockProps","getColorClassName","ToolbarButton","Placeholder","Spinner","__","useEffect","useState","memo","apiFetch","addQueryArgs","ConvertToLinksModal","ItemSubmenuIcon","MAX_PAGE_COUNT","PageListEdit","context","clientId","pagesByParentId","totalPages","usePagesByParentId","isNavigationChild","allowConvertToLinks","isOpen","setOpen","openModal","closeModal","blockProps","className","textColor","backgroundColor","style","color","setPagesByParentId","setTotalPages","performFetch","pages","path","orderby","order","_fields","per_page","reduce","accumulator","page","parent","has","get","push","set","Map","length","PageItems","parentId","depth","map","hasChildren","id","openSubmenusOnClick","showSubmenuIcon","title","rendered","link","ItemSubmenuToggle"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AAEA;A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;AAEC,MAAA,eAAe,EAAGE,eAFnB;AAGC,MAAA,QAAQ,EAAG0B,IAAI,CAACa,EAHjB;AAIC,MAAA,KAAK,EAAGH,KAAK,GAAG;AAJjB,MALD,CAHD,CA3BF,CADD;AA+CA,GAlDM,CAAP;AAmDA,CA/DqB,CAAtB;;AAiEA,SAASS,iBAAT,QAAwC;AAAA,MAAZ;AAAEH,IAAAA;AAAF,GAAY;AACvC,SACC;AACC,IAAA,SAAS,EAAC,uEADX;AAEC,qBAAc;AAFf,KAIGA,KAJH,EAKC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,eAAD,OADD,CALD,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, Placeholder, Spinner } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEffect, useState, memo } from '@wordpress/element';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport ConvertToLinksModal from './convert-to-links-modal';\nimport { ItemSubmenuIcon } from '../navigation-link/icons';\n\n// We only show the edit option when page count is <= MAX_PAGE_COUNT\n// Performance of Navigation Links is not good past this value.\nconst MAX_PAGE_COUNT = 100;\n\nexport default function PageListEdit( { context, clientId } ) {\n\tconst { pagesByParentId, totalPages } = usePagesByParentId();\n\n\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\tconst allowConvertToLinks =\n\t\tisNavigationChild && totalPages <= MAX_PAGE_COUNT;\n\n\tconst [ isOpen, setOpen ] = useState( false );\n\tconst openModal = () => setOpen( true );\n\tconst closeModal = () => setOpen( false );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( 'wp-block-page-list', {\n\t\t\t'has-text-color': !! context.textColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'color',\n\t\t\t\tcontext.textColor\n\t\t\t) ]: !! context.textColor,\n\t\t\t'has-background': !! context.backgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tcontext.backgroundColor\n\t\t\t) ]: !! context.backgroundColor,\n\t\t} ),\n\t\tstyle: { ...context.style?.color },\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ allowConvertToLinks && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ allowConvertToLinks && isOpen && (\n\t\t\t\t<ConvertToLinksModal\n\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ totalPages === null && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</Placeholder>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages === 0 && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<span>{ __( 'Page List: No pages to show.' ) }</span>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages > 0 && (\n\t\t\t\t<ul { ...blockProps }>\n\t\t\t\t\t<PageItems\n\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t/>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction usePagesByParentId() {\n\tconst [ pagesByParentId, setPagesByParentId ] = useState( null );\n\tconst [ totalPages, setTotalPages ] = useState( null );\n\n\tuseEffect( () => {\n\t\tasync function performFetch() {\n\t\t\tsetPagesByParentId( null );\n\t\t\tsetTotalPages( null );\n\n\t\t\tlet pages = await apiFetch( {\n\t\t\t\tpath: addQueryArgs( '/wp/v2/pages', {\n\t\t\t\t\torderby: 'menu_order',\n\t\t\t\t\torder: 'asc',\n\t\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} ),\n\t\t\t} );\n\n\t\t\t// TODO: Once the REST API supports passing multiple values to\n\t\t\t// 'orderby', this can be removed.\n\t\t\t// https://core.trac.wordpress.org/ticket/39037\n\t\t\tpages = sortBy( pages, [ 'menu_order', 'title.rendered' ] );\n\n\t\t\tsetPagesByParentId(\n\t\t\t\tpages.reduce( ( accumulator, page ) => {\n\t\t\t\t\tconst { parent } = page;\n\t\t\t\t\tif ( accumulator.has( parent ) ) {\n\t\t\t\t\t\taccumulator.get( parent ).push( page );\n\t\t\t\t\t} else {\n\t\t\t\t\t\taccumulator.set( parent, [ page ] );\n\t\t\t\t\t}\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}, new Map() )\n\t\t\t);\n\t\t\tsetTotalPages( pages.length );\n\t\t}\n\t\tperformFetch();\n\t}, [] );\n\n\treturn {\n\t\tpagesByParentId,\n\t\ttotalPages,\n\t};\n}\n\nconst PageItems = memo( function PageItems( {\n\tcontext,\n\tpagesByParentId,\n\tparentId = 0,\n\tdepth = 0,\n} ) {\n\tconst pages = pagesByParentId.get( parentId );\n\n\tif ( ! pages?.length ) {\n\t\treturn [];\n\t}\n\n\treturn pages.map( ( page ) => {\n\t\tconst hasChildren = pagesByParentId.has( page.id );\n\t\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\t\treturn (\n\t\t\t<li\n\t\t\t\tkey={ page.id }\n\t\t\t\tclassName={ classnames( 'wp-block-pages-list__item', {\n\t\t\t\t\t'has-child': hasChildren,\n\t\t\t\t\t'wp-block-navigation-item': isNavigationChild,\n\t\t\t\t\t'open-on-click': context.openSubmenusOnClick,\n\t\t\t\t\t'open-on-hover-click':\n\t\t\t\t\t\t! context.openSubmenusOnClick &&\n\t\t\t\t\t\tcontext.showSubmenuIcon,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ hasChildren && context.openSubmenusOnClick ? (\n\t\t\t\t\t<ItemSubmenuToggle title={ page.title?.rendered } />\n\t\t\t\t) : (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-pages-list__item__link',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'wp-block-navigation-item__content': isNavigationChild,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\thref={ page.link }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ hasChildren && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! context.openSubmenusOnClick &&\n\t\t\t\t\t\t\tcontext.showSubmenuIcon && <ItemSubmenuToggle /> }\n\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\tclassName={ classnames( 'submenu-container', {\n\t\t\t\t\t\t\t\t'wp-block-navigation__submenu-container': isNavigationChild,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PageItems\n\t\t\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t\t\t\tparentId={ page.id }\n\t\t\t\t\t\t\t\tdepth={ depth + 1 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t} );\n} );\n\nfunction ItemSubmenuToggle( { title } ) {\n\treturn (\n\t\t<button\n\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle\"\n\t\t\taria-expanded=\"false\"\n\t\t>\n\t\t\t{ title }\n\t\t\t<span className=\"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\">\n\t\t\t\t<ItemSubmenuIcon />\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/page-list/edit.js"],"names":["classnames","sortBy","BlockControls","useBlockProps","getColorClassName","ToolbarButton","Placeholder","Spinner","__","useMemo","useState","memo","useSelect","store","coreStore","ConvertToLinksModal","ItemSubmenuIcon","MAX_PAGE_COUNT","PageListEdit","context","clientId","pagesByParentId","totalPages","usePagesByParentId","isNavigationChild","allowConvertToLinks","isOpen","setOpen","openModal","closeModal","blockProps","className","textColor","backgroundColor","style","color","undefined","pages","select","getEntityRecords","orderby","order","_fields","per_page","sortedPages","reduce","accumulator","page","parent","has","get","push","set","Map","length","PageItems","parentId","depth","map","hasChildren","id","openSubmenusOnClick","showSubmenuIcon","title","rendered","link","ItemSubmenuToggle"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AACA,SAASC,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SACCC,aADD,EAECC,aAFD,EAGCC,iBAHD,QAIO,yBAJP;AAKA,SAASC,aAAT,EAAwBC,WAAxB,EAAqCC,OAArC,QAAoD,uBAApD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,OAAT,EAAkBC,QAAlB,EAA4BC,IAA5B,QAAwC,oBAAxC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,0BAAhC;AACA,SAASC,eAAT,QAAgC,0BAAhC,C,CAEA;AACA;;AACA,MAAMC,cAAc,GAAG,GAAvB;AAEA,eAAe,SAASC,YAAT,OAA+C;AAAA;;AAAA,MAAxB;AAAEC,IAAAA,OAAF;AAAWC,IAAAA;AAAX,GAAwB;AAC7D,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,MAAkCC,kBAAkB,EAA1D;AAEA,QAAMC,iBAAiB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ACgB,KAAR,gDAAG,YAAYC;AAAvC,MADC,GAGD;AACC,MAAA,SAAS,EAAGhE,UAAU,CACrB,iCADqB,EAErB;AACC,6CAAqCwB;AADtC,OAFqB,CADvB;AAOC,MAAA,IAAI,EAAGuB,IAAI,CAACkB;AAPb,uBASGlB,IAAI,CAACgB,KATR,iDASG,aAAYC,QATf,CAdF,EA0BGL,WAAW,IACZ,8BACG,CAAExC,OAAO,CAAC0C,mBAAV,IACD1C,OAAO,CAAC2C,eADP,IAC0B,cAAC,iBAAD,OAF7B,EAGC;AACC,MAAA,SAAS,EAAG9D,UAAU,CAAE,mBAAF,EAAuB;AAC5C,kDAA0CwB;AADE,OAAvB;AADvB,OAKC,cAAC,SAAD;AACC,MAAA,OAAO,EAAGL,OADX;AAEC,MAAA,eAAe,EAAGE,eAFnB;AAGC,MAAA,QAAQ,EAAG0B,IAAI,CAACa,EAHjB;AAIC,MAAA,KAAK,EAAGH,KAAK,GAAG;AAJjB,MALD,CAHD,CA3BF,CADD;AA+CA,GAlDM,CAAP;AAmDA,CA/DqB,CAAtB;;AAiEA,SAASS,iBAAT,QAAwC;AAAA,MAAZ;AAAEH,IAAAA;AAAF,GAAY;AACvC,SACC;AACC,IAAA,SAAS,EAAC,uEADX;AAEC,qBAAc;AAFf,KAIGA,KAJH,EAKC;AAAM,IAAA,SAAS,EAAC;AAAhB,KACC,cAAC,eAAD,OADD,CALD,CADD;AAWA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\nimport { sortBy } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\n\tuseBlockProps,\n\tgetColorClassName,\n} from '@wordpress/block-editor';\nimport { ToolbarButton, Placeholder, Spinner } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMemo, useState, memo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport ConvertToLinksModal from './convert-to-links-modal';\nimport { ItemSubmenuIcon } from '../navigation-link/icons';\n\n// We only show the edit option when page count is <= MAX_PAGE_COUNT\n// Performance of Navigation Links is not good past this value.\nconst MAX_PAGE_COUNT = 100;\n\nexport default function PageListEdit( { context, clientId } ) {\n\tconst { pagesByParentId, totalPages } = usePagesByParentId();\n\n\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\tconst allowConvertToLinks =\n\t\tisNavigationChild && totalPages <= MAX_PAGE_COUNT;\n\n\tconst [ isOpen, setOpen ] = useState( false );\n\tconst openModal = () => setOpen( true );\n\tconst closeModal = () => setOpen( false );\n\n\tconst blockProps = useBlockProps( {\n\t\tclassName: classnames( 'wp-block-page-list', {\n\t\t\t'has-text-color': !! context.textColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'color',\n\t\t\t\tcontext.textColor\n\t\t\t) ]: !! context.textColor,\n\t\t\t'has-background': !! context.backgroundColor,\n\t\t\t[ getColorClassName(\n\t\t\t\t'background-color',\n\t\t\t\tcontext.backgroundColor\n\t\t\t) ]: !! context.backgroundColor,\n\t\t} ),\n\t\tstyle: { ...context.style?.color },\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t{ allowConvertToLinks && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<ToolbarButton title={ __( 'Edit' ) } onClick={ openModal }>\n\t\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t\t</ToolbarButton>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t{ allowConvertToLinks && isOpen && (\n\t\t\t\t<ConvertToLinksModal\n\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\tclientId={ clientId }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ totalPages === undefined && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<Placeholder>\n\t\t\t\t\t\t<Spinner />\n\t\t\t\t\t</Placeholder>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages === 0 && (\n\t\t\t\t<div { ...blockProps }>\n\t\t\t\t\t<span>{ __( 'Page List: No pages to show.' ) }</span>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ totalPages > 0 && (\n\t\t\t\t<ul { ...blockProps }>\n\t\t\t\t\t<PageItems\n\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t/>\n\t\t\t\t</ul>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction usePagesByParentId() {\n\tconst { pages } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\n\t\treturn {\n\t\t\tpages: getEntityRecords( 'postType', 'page', {\n\t\t\t\torderby: 'menu_order',\n\t\t\t\torder: 'asc',\n\t\t\t\t_fields: [ 'id', 'link', 'parent', 'title', 'menu_order' ],\n\t\t\t\tper_page: -1,\n\t\t\t} ),\n\t\t};\n\t}, [] );\n\n\treturn useMemo( () => {\n\t\t// TODO: Once the REST API supports passing multiple values to\n\t\t// 'orderby', this can be removed.\n\t\t// https://core.trac.wordpress.org/ticket/39037\n\t\tconst sortedPages = sortBy( pages, [ 'menu_order', 'title.rendered' ] );\n\t\tconst pagesByParentId = sortedPages.reduce( ( accumulator, page ) => {\n\t\t\tconst { parent } = page;\n\t\t\tif ( accumulator.has( parent ) ) {\n\t\t\t\taccumulator.get( parent ).push( page );\n\t\t\t} else {\n\t\t\t\taccumulator.set( parent, [ page ] );\n\t\t\t}\n\t\t\treturn accumulator;\n\t\t}, new Map() );\n\n\t\treturn {\n\t\t\tpagesByParentId,\n\t\t\ttotalPages: pages?.length,\n\t\t};\n\t}, [ pages ] );\n}\n\nconst PageItems = memo( function PageItems( {\n\tcontext,\n\tpagesByParentId,\n\tparentId = 0,\n\tdepth = 0,\n} ) {\n\tconst pages = pagesByParentId.get( parentId );\n\n\tif ( ! pages?.length ) {\n\t\treturn [];\n\t}\n\n\treturn pages.map( ( page ) => {\n\t\tconst hasChildren = pagesByParentId.has( page.id );\n\t\tconst isNavigationChild = 'showSubmenuIcon' in context;\n\t\treturn (\n\t\t\t<li\n\t\t\t\tkey={ page.id }\n\t\t\t\tclassName={ classnames( 'wp-block-pages-list__item', {\n\t\t\t\t\t'has-child': hasChildren,\n\t\t\t\t\t'wp-block-navigation-item': isNavigationChild,\n\t\t\t\t\t'open-on-click': context.openSubmenusOnClick,\n\t\t\t\t\t'open-on-hover-click':\n\t\t\t\t\t\t! context.openSubmenusOnClick &&\n\t\t\t\t\t\tcontext.showSubmenuIcon,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t{ hasChildren && context.openSubmenusOnClick ? (\n\t\t\t\t\t<ItemSubmenuToggle title={ page.title?.rendered } />\n\t\t\t\t) : (\n\t\t\t\t\t<a\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'wp-block-pages-list__item__link',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'wp-block-navigation-item__content': isNavigationChild,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\thref={ page.link }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ page.title?.rendered }\n\t\t\t\t\t</a>\n\t\t\t\t) }\n\t\t\t\t{ hasChildren && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! context.openSubmenusOnClick &&\n\t\t\t\t\t\t\tcontext.showSubmenuIcon && <ItemSubmenuToggle /> }\n\t\t\t\t\t\t<ul\n\t\t\t\t\t\t\tclassName={ classnames( 'submenu-container', {\n\t\t\t\t\t\t\t\t'wp-block-navigation__submenu-container': isNavigationChild,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PageItems\n\t\t\t\t\t\t\t\tcontext={ context }\n\t\t\t\t\t\t\t\tpagesByParentId={ pagesByParentId }\n\t\t\t\t\t\t\t\tparentId={ page.id }\n\t\t\t\t\t\t\t\tdepth={ depth + 1 }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</li>\n\t\t);\n\t} );\n} );\n\nfunction ItemSubmenuToggle( { title } ) {\n\treturn (\n\t\t<button\n\t\t\tclassName=\"wp-block-navigation-item__content wp-block-navigation-submenu__toggle\"\n\t\t\taria-expanded=\"false\"\n\t\t>\n\t\t\t{ title }\n\t\t\t<span className=\"wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon\">\n\t\t\t\t<ItemSubmenuIcon />\n\t\t\t</span>\n\t\t</button>\n\t);\n}\n"]}
@@ -4,22 +4,33 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { useEntityProp, store as coreStore } from '@wordpress/core-data';
7
- import { useSelect } from '@wordpress/data';
8
- import { Icon, ToggleControl, PanelBody, withNotices } from '@wordpress/components';
9
- import { InspectorControls, BlockControls, MediaPlaceholder, MediaReplaceFlow, BlockIcon, useBlockProps } from '@wordpress/block-editor';
7
+ import { useSelect, useDispatch } from '@wordpress/data';
8
+ import { ToggleControl, PanelBody, Placeholder, Button } from '@wordpress/components';
9
+ import { InspectorControls, BlockControls, MediaPlaceholder, MediaReplaceFlow, useBlockProps } from '@wordpress/block-editor';
10
10
  import { __, sprintf } from '@wordpress/i18n';
11
- import { postFeaturedImage } from '@wordpress/icons';
11
+ import { upload } from '@wordpress/icons';
12
+ import { SVG, Path } from '@wordpress/primitives';
13
+ import { store as noticesStore } from '@wordpress/notices';
12
14
  /**
13
15
  * Internal dependencies
14
16
  */
15
17
 
16
18
  import DimensionControls from './dimension-controls';
19
+ const placeholderIllustration = createElement(SVG, {
20
+ className: "components-placeholder__illustration",
21
+ fill: "none",
22
+ xmlns: "http://www.w3.org/2000/svg",
23
+ viewBox: "0 0 60 60",
24
+ preserveAspectRatio: "xMidYMid slice" // @todo: "slice" matches the "cover" behavior, "meet" could be used for "container" and "fill" values.
25
+
26
+ }, createElement(Path, {
27
+ vectorEffect: "non-scaling-stroke",
28
+ d: "m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5"
29
+ }));
17
30
  const ALLOWED_MEDIA_TYPES = ['image'];
18
31
  const placeholderChip = createElement("div", {
19
- className: "post-featured-image_placeholder"
20
- }, createElement(Icon, {
21
- icon: postFeaturedImage
22
- }), createElement("p", null, " ", __('Featured Image')));
32
+ className: "wp-block-post-featured-image__placeholder"
33
+ }, placeholderIllustration);
23
34
 
24
35
  function PostFeaturedImageDisplay(_ref) {
25
36
  let {
@@ -29,9 +40,7 @@ function PostFeaturedImageDisplay(_ref) {
29
40
  postId,
30
41
  postType,
31
42
  queryId
32
- },
33
- noticeUI,
34
- noticeOperations
43
+ }
35
44
  } = _ref;
36
45
  const isDescendentOfQueryLoop = !!queryId;
37
46
  const {
@@ -46,20 +55,32 @@ function PostFeaturedImageDisplay(_ref) {
46
55
  }), [featuredImage]);
47
56
  const blockProps = useBlockProps({
48
57
  style: {
49
- width
58
+ width,
59
+ height
50
60
  }
51
61
  });
52
62
 
63
+ const placeholder = content => {
64
+ return createElement(Placeholder, {
65
+ className: "block-editor-media-placeholder"
66
+ }, placeholderIllustration, content);
67
+ };
68
+
53
69
  const onSelectImage = value => {
54
70
  if (value !== null && value !== void 0 && value.id) {
55
71
  setFeaturedImage(value.id);
56
72
  }
57
73
  };
58
74
 
59
- function onUploadError(message) {
60
- noticeOperations.removeAllNotices();
61
- noticeOperations.createErrorNotice(message);
62
- }
75
+ const {
76
+ createErrorNotice
77
+ } = useDispatch(noticesStore);
78
+
79
+ const onUploadError = message => {
80
+ createErrorNotice(message[2], {
81
+ type: 'snackbar'
82
+ });
83
+ };
63
84
 
64
85
  let image;
65
86
 
@@ -67,19 +88,29 @@ function PostFeaturedImageDisplay(_ref) {
67
88
  return createElement("div", blockProps, placeholderChip);
68
89
  }
69
90
 
91
+ const label = __('Add a featured image');
92
+
70
93
  if (!featuredImage) {
71
94
  image = createElement(MediaPlaceholder, {
72
- icon: createElement(BlockIcon, {
73
- icon: postFeaturedImage
74
- }),
75
95
  onSelect: onSelectImage,
76
- notices: noticeUI,
77
- onError: onUploadError,
78
96
  accept: "image/*",
79
97
  allowedTypes: ALLOWED_MEDIA_TYPES,
80
- labels: {
81
- title: __('Featured image'),
82
- instructions: __('Upload a media file or pick one from your media library.')
98
+ onError: onUploadError,
99
+ placeholder: placeholder,
100
+ mediaLibraryButton: _ref2 => {
101
+ let {
102
+ open
103
+ } = _ref2;
104
+ return createElement(Button, {
105
+ icon: upload,
106
+ variant: "primary",
107
+ label: label,
108
+ showTooltip: true,
109
+ tooltipPosition: "top center",
110
+ onClick: () => {
111
+ open();
112
+ }
113
+ });
83
114
  }
84
115
  });
85
116
  } else {
@@ -118,7 +149,6 @@ function PostFeaturedImageDisplay(_ref) {
118
149
  })), createElement("figure", blockProps, image));
119
150
  }
120
151
 
121
- const PostFeaturedImageWithNotices = withNotices(PostFeaturedImageDisplay);
122
152
  export default function PostFeaturedImageEdit(props) {
123
153
  var _props$context;
124
154
 
@@ -128,6 +158,6 @@ export default function PostFeaturedImageEdit(props) {
128
158
  return createElement("div", blockProps, placeholderChip);
129
159
  }
130
160
 
131
- return createElement(PostFeaturedImageWithNotices, props);
161
+ return createElement(PostFeaturedImageDisplay, props);
132
162
  }
133
163
  //# sourceMappingURL=edit.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["useEntityProp","store","coreStore","useSelect","Icon","ToggleControl","PanelBody","withNotices","InspectorControls","BlockControls","MediaPlaceholder","MediaReplaceFlow","BlockIcon","useBlockProps","__","sprintf","postFeaturedImage","DimensionControls","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","attributes","setAttributes","context","postId","postType","queryId","noticeUI","noticeOperations","isDescendentOfQueryLoop","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","getMedia","blockProps","style","onSelectImage","value","id","onUploadError","message","removeAllNotices","createErrorNotice","image","title","instructions","source_url","alt_text","objectF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,KAAK,CAACjC,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,qBAAUe,UAAV,EAAyBpB,eAAzB,CAAP;AACA;;AACD,SAAO,cAAC,4BAAD,EAAmCqC,KAAnC,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport {\n\tIcon,\n\tToggleControl,\n\tPanelBody,\n\twithNotices,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tBlockIcon,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { postFeaturedImage } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"post-featured-image_placeholder\">\n\t\t<Icon icon={ postFeaturedImage } />\n\t\t<p> { __( 'Featured Image' ) }</p>\n\t</div>\n);\n\nfunction PostFeaturedImageDisplay( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n\tnoticeUI,\n\tnoticeOperations,\n} ) {\n\tconst isDescendentOfQueryLoop = !! queryId;\n\tconst { isLink, height, width, scale } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width },\n\t} );\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\tfunction onUploadError( message ) {\n\t\tnoticeOperations.removeAllNotices();\n\t\tnoticeOperations.createErrorNotice( message );\n\t}\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\ticon={ <BlockIcon icon={ postFeaturedImage } /> }\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\tnotices={ noticeUI }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tlabels={ {\n\t\t\t\t\ttitle: __( 'Featured image' ),\n\t\t\t\t\tinstructions: __(\n\t\t\t\t\t\t'Upload a media file or pick one from your media library.'\n\t\t\t\t\t),\n\t\t\t\t} }\n\t\t\t/>\n\t\t);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ media.source_url }\n\t\t\t\talt={ media.alt_text || __( 'Featured image' ) }\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<DimensionControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ media.source_url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nconst PostFeaturedImageWithNotices = withNotices( PostFeaturedImageDisplay );\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageWithNotices { ...props } />;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/block-library/src/post-featured-image/edit.js"],"names":["useEntityProp","store","coreStore","useSelect","useDispatch","ToggleControl","PanelBody","Placeholder","Button","InspectorControls","BlockControls","MediaPlaceholder","MediaReplaceFlow","useBlockProps","__","sprintf","upload","SVG","Path","noticesStore","DimensionControls","placeholderIllustration","ALLOWED_MEDIA_TYPES","placeholderChip","PostFeaturedImageDisplay","attributes","setAttributes","context","postId","postType","queryId","isDescendentOfQueryLoop","isLink","height","width","scale","featuredImage","setFeaturedImage","media","select","getMedia","blockProps","style","placeholder","content","onSelectImage","value","id","createErrorNotice","onUploadError","message","type","image","label","open","source_url","alt_text","objectFit","PostFeaturedImageEdit","props"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,aAAT,EAAwBC,KAAK,IAAIC,SAAjC,QAAkD,sBAAlD;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,aADD,EAECC,SAFD,EAGCC,WAHD,EA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;AACC,IAAA,OAAO,EAAGK,aADX;AAEC,IAAA,QAAQ,EAAGE,KAAK,CAACiB,UAFlB;AAGC,IAAA,YAAY,EAAGjC,mBAHhB;AAIC,IAAA,MAAM,EAAC,SAJR;AAKC,IAAA,QAAQ,EAAGuB,aALZ;AAMC,IAAA,OAAO,EAAGI;AANX,IADD,CAnBF,EA8BC,wBAAaR,UAAb,EAA4BW,KAA5B,CA9BD,CADD;AAkCA;;AAED,eAAe,SAASM,qBAAT,CAAgCC,KAAhC,EAAwC;AAAA;;AACtD,QAAMlB,UAAU,GAAG5B,aAAa,EAAhC;;AACA,MAAK,oBAAE8C,KAAK,CAAChC,OAAR,2CAAE,eAAeC,MAAjB,CAAL,EAA+B;AAC9B,WAAO,qBAAUa,UAAV,EAAyBlB,eAAzB,CAAP;AACA;;AACD,SAAO,cAAC,wBAAD,EAA+BoC,KAA/B,CAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityProp, store as coreStore } from '@wordpress/core-data';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tToggleControl,\n\tPanelBody,\n\tPlaceholder,\n\tButton,\n} from '@wordpress/components';\nimport {\n\tInspectorControls,\n\tBlockControls,\n\tMediaPlaceholder,\n\tMediaReplaceFlow,\n\tuseBlockProps,\n} from '@wordpress/block-editor';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { upload } from '@wordpress/icons';\nimport { SVG, Path } from '@wordpress/primitives';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport DimensionControls from './dimension-controls';\n\nconst placeholderIllustration = (\n\t<SVG\n\t\tclassName=\"components-placeholder__illustration\"\n\t\tfill=\"none\"\n\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\tviewBox=\"0 0 60 60\"\n\t\tpreserveAspectRatio=\"xMidYMid slice\" // @todo: \"slice\" matches the \"cover\" behavior, \"meet\" could be used for \"container\" and \"fill\" values.\n\t>\n\t\t<Path\n\t\t\tvectorEffect=\"non-scaling-stroke\"\n\t\t\td=\"m61 32.622-13.555-9.137-15.888 9.859a5 5 0 0 1-5.386-.073l-9.095-5.989L1 37.5\"\n\t\t/>\n\t</SVG>\n);\n\nconst ALLOWED_MEDIA_TYPES = [ 'image' ];\nconst placeholderChip = (\n\t<div className=\"wp-block-post-featured-image__placeholder\">\n\t\t{ placeholderIllustration }\n\t</div>\n);\n\nfunction PostFeaturedImageDisplay( {\n\tattributes,\n\tsetAttributes,\n\tcontext: { postId, postType, queryId },\n} ) {\n\tconst isDescendentOfQueryLoop = !! queryId;\n\tconst { isLink, height, width, scale } = attributes;\n\tconst [ featuredImage, setFeaturedImage ] = useEntityProp(\n\t\t'postType',\n\t\tpostType,\n\t\t'featured_media',\n\t\tpostId\n\t);\n\n\tconst media = useSelect(\n\t\t( select ) =>\n\t\t\tfeaturedImage &&\n\t\t\tselect( coreStore ).getMedia( featuredImage, { context: 'view' } ),\n\t\t[ featuredImage ]\n\t);\n\n\tconst blockProps = useBlockProps( {\n\t\tstyle: { width, height },\n\t} );\n\n\tconst placeholder = ( content ) => {\n\t\treturn (\n\t\t\t<Placeholder className=\"block-editor-media-placeholder\">\n\t\t\t\t{ placeholderIllustration }\n\t\t\t\t{ content }\n\t\t\t</Placeholder>\n\t\t);\n\t};\n\n\tconst onSelectImage = ( value ) => {\n\t\tif ( value?.id ) {\n\t\t\tsetFeaturedImage( value.id );\n\t\t}\n\t};\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message[ 2 ], { type: 'snackbar' } );\n\t};\n\n\tlet image;\n\tif ( ! featuredImage && isDescendentOfQueryLoop ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\n\tconst label = __( 'Add a featured image' );\n\n\tif ( ! featuredImage ) {\n\t\timage = (\n\t\t\t<MediaPlaceholder\n\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\taccept=\"image/*\"\n\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\tonError={ onUploadError }\n\t\t\t\tplaceholder={ placeholder }\n\t\t\t\tmediaLibraryButton={ ( { open } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ upload }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tlabel={ label }\n\t\t\t\t\t\t\tshowTooltip\n\t\t\t\t\t\t\ttooltipPosition=\"top center\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\topen();\n\t\t\t\t\t\t\t} }\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);\n\t} else {\n\t\t// We have a Featured image so show a Placeholder if is loading.\n\t\timage = ! media ? (\n\t\t\tplaceholderChip\n\t\t) : (\n\t\t\t<img\n\t\t\t\tsrc={ media.source_url }\n\t\t\t\talt={ media.alt_text || __( 'Featured image' ) }\n\t\t\t\tstyle={ { height, objectFit: height && scale } }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<InspectorControls>\n\t\t\t\t<DimensionControls\n\t\t\t\t\tattributes={ attributes }\n\t\t\t\t\tsetAttributes={ setAttributes }\n\t\t\t\t/>\n\t\t\t\t<PanelBody title={ __( 'Link settings' ) }>\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ sprintf(\n\t\t\t\t\t\t\t// translators: %s: Name of the post type e.g: \"post\".\n\t\t\t\t\t\t\t__( 'Link to %s' ),\n\t\t\t\t\t\t\tpostType\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tonChange={ () => setAttributes( { isLink: ! isLink } ) }\n\t\t\t\t\t\tchecked={ isLink }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t</InspectorControls>\n\t\t\t{ !! media && ! isDescendentOfQueryLoop && (\n\t\t\t\t<BlockControls group=\"other\">\n\t\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\t\tmediaId={ featuredImage }\n\t\t\t\t\t\tmediaURL={ media.source_url }\n\t\t\t\t\t\tallowedTypes={ ALLOWED_MEDIA_TYPES }\n\t\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\t\tonSelect={ onSelectImage }\n\t\t\t\t\t\tonError={ onUploadError }\n\t\t\t\t\t/>\n\t\t\t\t</BlockControls>\n\t\t\t) }\n\t\t\t<figure { ...blockProps }>{ image }</figure>\n\t\t</>\n\t);\n}\n\nexport default function PostFeaturedImageEdit( props ) {\n\tconst blockProps = useBlockProps();\n\tif ( ! props.context?.postId ) {\n\t\treturn <div { ...blockProps }>{ placeholderChip }</div>;\n\t}\n\treturn <PostFeaturedImageDisplay { ...props } />;\n}\n"]}
@@ -74,7 +74,7 @@
74
74
  /**
75
75
  * Reset the WP Admin page styles for Gutenberg-like pages.
76
76
  */
77
- .wp-block-code {
77
+ .wp-block-code > code {
78
78
  font-family: Menlo, Consolas, monaco, monospace;
79
79
  color: #1e1e1e;
80
80
  padding: 0.8em 1em;
@@ -74,7 +74,7 @@
74
74
  /**
75
75
  * Reset the WP Admin page styles for Gutenberg-like pages.
76
76
  */
77
- .wp-block-code {
77
+ .wp-block-code > code {
78
78
  font-family: Menlo, Consolas, monaco, monospace;
79
79
  color: #1e1e1e;
80
80
  padding: 0.8em 1em;
@@ -119,17 +119,23 @@
119
119
  background-size: auto;
120
120
  }
121
121
  .wp-block-cover-image.has-background-dim:not([class*=-background-color]),
122
- .wp-block-cover.has-background-dim:not([class*=-background-color]) {
122
+ .wp-block-cover-image .has-background-dim:not([class*=-background-color]),
123
+ .wp-block-cover.has-background-dim:not([class*=-background-color]),
124
+ .wp-block-cover .has-background-dim:not([class*=-background-color]) {
123
125
  background-color: #000;
124
126
  }
125
127
  .wp-block-cover-image.has-background-dim::before,
126
- .wp-block-cover.has-background-dim::before {
128
+ .wp-block-cover-image .has-background-dim::before,
129
+ .wp-block-cover.has-background-dim::before,
130
+ .wp-block-cover .has-background-dim::before {
127
131
  content: "";
128
132
  background-color: inherit;
129
133
  }
130
134
  .wp-block-cover-image.has-background-dim:not(.has-background-gradient)::before,
135
+ .wp-block-cover-image .has-background-dim:not(.has-background-gradient)::before,
131
136
  .wp-block-cover-image .wp-block-cover__gradient-background,
132
137
  .wp-block-cover.has-background-dim:not(.has-background-gradient)::before,
138
+ .wp-block-cover .has-background-dim:not(.has-background-gradient)::before,
133
139
  .wp-block-cover .wp-block-cover__gradient-background {
134
140
  position: absolute;
135
141
  top: 0;
@@ -119,17 +119,23 @@
119
119
  background-size: auto;
120
120
  }
121
121
  .wp-block-cover-image.has-background-dim:not([class*=-background-color]),
122
- .wp-block-cover.has-background-dim:not([class*=-background-color]) {
122
+ .wp-block-cover-image .has-background-dim:not([class*=-background-color]),
123
+ .wp-block-cover.has-background-dim:not([class*=-background-color]),
124
+ .wp-block-cover .has-background-dim:not([class*=-background-color]) {
123
125
  background-color: #000;
124
126
  }
125
127
  .wp-block-cover-image.has-background-dim::before,
126
- .wp-block-cover.has-background-dim::before {
128
+ .wp-block-cover-image .has-background-dim::before,
129
+ .wp-block-cover.has-background-dim::before,
130
+ .wp-block-cover .has-background-dim::before {
127
131
  content: "";
128
132
  background-color: inherit;
129
133
  }
130
134
  .wp-block-cover-image.has-background-dim:not(.has-background-gradient)::before,
135
+ .wp-block-cover-image .has-background-dim:not(.has-background-gradient)::before,
131
136
  .wp-block-cover-image .wp-block-cover__gradient-background,
132
137
  .wp-block-cover.has-background-dim:not(.has-background-gradient)::before,
138
+ .wp-block-cover .has-background-dim:not(.has-background-gradient)::before,
133
139
  .wp-block-cover .wp-block-cover__gradient-background {
134
140
  position: absolute;
135
141
  top: 0;
@@ -2085,16 +2085,13 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2085
2085
  .wp-block-social-links__social-placeholder > .wp-block-social-links__social-placeholder-icons {
2086
2086
  display: flex;
2087
2087
  }
2088
- .wp-block-social-links__social-placeholder + .block-list-appender,
2089
2088
  .wp-block-social-links__social-placeholder .wp-social-link {
2090
2089
  padding: 0.25em;
2091
2090
  }
2092
- .is-style-pill-shape .wp-block-social-links__social-placeholder + .block-list-appender,
2093
2091
  .is-style-pill-shape .wp-block-social-links__social-placeholder .wp-social-link {
2094
2092
  padding-right: calc((2/3) * 1em);
2095
2093
  padding-left: calc((2/3) * 1em);
2096
2094
  }
2097
- .is-style-logos-only .wp-block-social-links__social-placeholder + .block-list-appender,
2098
2095
  .is-style-logos-only .wp-block-social-links__social-placeholder .wp-social-link {
2099
2096
  padding: 0;
2100
2097
  }
@@ -2110,6 +2107,7 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2110
2107
  }
2111
2108
 
2112
2109
  .wp-block-social-links .wp-block-social-links__social-prompt {
2110
+ min-height: 24px;
2113
2111
  list-style: none;
2114
2112
  order: 2;
2115
2113
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
@@ -2120,38 +2118,6 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2120
2118
  cursor: default;
2121
2119
  padding-left: 8px;
2122
2120
  }
2123
- .wp-block-social-links .wp-block-social-links__social-prompt + .block-list-appender {
2124
- margin-left: 8px;
2125
- padding: 0.25em;
2126
- }
2127
-
2128
- .wp-block-social-links .block-list-appender {
2129
- margin: 4px 0 4px auto;
2130
- border-radius: 9999px;
2131
- }
2132
- .wp-block-social-links .block-list-appender .block-editor-inserter {
2133
- display: flex;
2134
- align-items: center;
2135
- justify-content: center;
2136
- font-size: inherit;
2137
- width: 1em;
2138
- height: 1em;
2139
- }
2140
- .has-small-icon-size .wp-block-social-links .block-list-appender {
2141
- font-size: 16px;
2142
- }
2143
- .has-normal-icon-size .wp-block-social-links .block-list-appender {
2144
- font-size: 24px;
2145
- }
2146
- .has-large-icon-size .wp-block-social-links .block-list-appender {
2147
- font-size: 36px;
2148
- }
2149
- .has-huge-icon-size .wp-block-social-links .block-list-appender {
2150
- font-size: 48px;
2151
- }
2152
- .wp-block-social-links .block-list-appender::before {
2153
- content: none;
2154
- }
2155
2121
 
2156
2122
  .wp-block[data-align=center] > .wp-block-social-links {
2157
2123
  justify-content: center;
@@ -2496,28 +2462,112 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
2496
2462
  margin-right: 0;
2497
2463
  }
2498
2464
 
2499
- div[data-type="core/post-featured-image"] img {
2500
- max-width: 100%;
2501
- height: auto;
2465
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder,
2466
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-resizable-box__container {
2467
+ border-radius: inherit;
2468
+ }
2469
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder,
2470
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder {
2471
+ justify-content: center;
2472
+ align-items: center;
2473
+ box-shadow: none;
2474
+ padding: 0;
2475
+ color: currentColor;
2476
+ background: transparent;
2477
+ min-height: 200px;
2478
+ }
2479
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-form-file-upload,
2480
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-form-file-upload {
2481
+ display: none;
2482
+ }
2483
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__preview,
2484
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__preview {
2485
+ position: absolute;
2486
+ top: 4px;
2487
+ left: 4px;
2488
+ bottom: 4px;
2489
+ right: 4px;
2490
+ background: rgba(255, 255, 255, 0.8);
2491
+ display: flex;
2492
+ align-items: center;
2493
+ justify-content: center;
2494
+ }
2495
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder::before,
2496
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder::before {
2497
+ content: "";
2502
2498
  display: block;
2499
+ position: absolute;
2500
+ top: 0;
2501
+ left: 0;
2502
+ bottom: 0;
2503
+ right: 0;
2504
+ border: 1px dashed currentColor;
2505
+ opacity: 0.3;
2506
+ pointer-events: none;
2507
+ border-radius: inherit;
2503
2508
  }
2504
-
2505
- .editor-styles-wrapper .post-featured-image_placeholder {
2509
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__fieldset,
2510
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__fieldset {
2511
+ width: auto;
2512
+ }
2513
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button,
2514
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button {
2515
+ color: inherit;
2516
+ padding: 0;
2506
2517
  display: flex;
2507
- flex-direction: row;
2518
+ justify-content: center;
2508
2519
  align-items: center;
2509
- border-radius: 2px;
2510
- background-color: #fff;
2511
- box-shadow: inset 0 0 0 1px #1e1e1e;
2512
- padding: 12px;
2520
+ width: 48px;
2521
+ height: 48px;
2522
+ border-radius: 50%;
2523
+ position: relative;
2524
+ visibility: hidden;
2525
+ background: transparent;
2526
+ transition: all 0.1s linear;
2513
2527
  }
2514
- .editor-styles-wrapper .post-featured-image_placeholder svg {
2515
- margin-left: 12px;
2528
+ @media (prefers-reduced-motion: reduce) {
2529
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button,
2530
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button {
2531
+ transition-duration: 0s;
2532
+ transition-delay: 0s;
2533
+ }
2516
2534
  }
2517
- .editor-styles-wrapper .post-featured-image_placeholder p {
2518
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
2519
- font-size: 13px;
2520
- margin: 0;
2535
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-button.components-button > svg,
2536
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-button.components-button > svg {
2537
+ color: #fff;
2538
+ }
2539
+ .wp-block-post-featured-image.wp-block-post-featured-image .wp-block-post-featured-image__placeholder .components-placeholder__illustration,
2540
+ .wp-block-post-featured-image.wp-block-post-featured-image .components-placeholder .components-placeholder__illustration {
2541
+ position: absolute;
2542
+ top: 0;
2543
+ left: 0;
2544
+ bottom: 0;
2545
+ right: 0;
2546
+ width: 100%;
2547
+ height: 100%;
2548
+ stroke: currentColor;
2549
+ stroke-dasharray: 3;
2550
+ opacity: 0.3;
2551
+ }
2552
+ .wp-block-post-featured-image.wp-block-post-featured-image[style*=height] .components-placeholder {
2553
+ min-height: 48px;
2554
+ min-width: 48px;
2555
+ height: 100%;
2556
+ width: 100%;
2557
+ }
2558
+ .wp-block-post-featured-image.wp-block-post-featured-image.is-selected .components-button.components-button {
2559
+ background: var(--wp-admin-theme-color);
2560
+ border-color: var(--wp-admin-theme-color);
2561
+ border-style: solid;
2562
+ color: #fff;
2563
+ opacity: 1;
2564
+ visibility: visible;
2565
+ }
2566
+
2567
+ div[data-type="core/post-featured-image"] img {
2568
+ max-width: 100%;
2569
+ height: auto;
2570
+ display: block;
2521
2571
  }
2522
2572
 
2523
2573
  .block-library-post-featured-image-dimension-controls {