@wordpress/edit-site 5.3.6 → 5.3.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.
- package/build/components/add-new-template/new-template.js +16 -10
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +2 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/layout/index.js +6 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +2 -5
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/sidebar/index.js +2 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +5 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +100 -11
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +18 -4
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +134 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +0 -3
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +18 -11
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +2 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/layout/index.js +6 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -5
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +2 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +94 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +18 -5
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +135 -22
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +0 -3
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +96 -111
- package/build-style/style.css +96 -111
- package/package.json +10 -10
- package/src/components/add-new-template/new-template.js +57 -32
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/layout/index.js +14 -0
- package/src/components/layout/style.scss +1 -3
- package/src/components/list/index.js +3 -1
- package/src/components/routes/link.js +9 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/style.scss +2 -1
- package/src/components/sidebar-navigation-item/style.scss +0 -20
- package/src/components/sidebar-navigation-screen/index.js +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +3 -0
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +104 -10
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +59 -4
- package/src/components/sidebar-navigation-screen-template/index.js +21 -7
- package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/index.js +209 -54
- package/src/components/style-book/style.scss +1 -45
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
- package/src/components/template-details/index.js +0 -3
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/index.js +5 -1
- package/src/style.scss +1 -1
- package/src/utils/history.js +13 -9
- package/build/components/navigation-inspector/index.js +0 -190
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -62
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -173
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/navigation-inspector/index.js +0 -223
- package/src/components/navigation-inspector/navigation-menu.js +0 -66
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -19,7 +19,8 @@ export default function SidebarNavigationScreen(_ref) {
|
|
|
19
19
|
isRoot,
|
|
20
20
|
title,
|
|
21
21
|
actions,
|
|
22
|
-
content
|
|
22
|
+
content,
|
|
23
|
+
description
|
|
23
24
|
} = _ref;
|
|
24
25
|
const {
|
|
25
26
|
dashboardLink
|
|
@@ -50,6 +51,8 @@ export default function SidebarNavigationScreen(_ref) {
|
|
|
50
51
|
className: "edit-site-sidebar-navigation-screen__title"
|
|
51
52
|
}, title), actions), createElement("nav", {
|
|
52
53
|
className: "edit-site-sidebar-navigation-screen__content"
|
|
53
|
-
},
|
|
54
|
+
}, description && createElement("p", {
|
|
55
|
+
className: "edit-site-sidebar-navigation-screen__description"
|
|
56
|
+
}, description), content));
|
|
54
57
|
}
|
|
55
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","SidebarButton","SidebarNavigationScreen","isRoot","title","actions","content","dashboardLink","select","getSettings","__experimentalDashboardLink"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,QAIO,uBAJP;AAKA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,YAAT,EAAuBC,WAAvB,QAA0C,kBAA1C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,uBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","SidebarButton","SidebarNavigationScreen","isRoot","title","actions","content","description","dashboardLink","select","getSettings","__experimentalDashboardLink"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,oBAAoB,IAAIC,MADzB,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,qCAAqC,IAAIC,uBAH1C,QAIO,uBAJP;AAKA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,YAAT,EAAuBC,WAAvB,QAA0C,kBAA1C;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,uBAAT,OAMX;AAAA,MAN6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA,OAJgD;AAKhDC,IAAAA;AALgD,GAM7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBX,SAAS,CAAIY,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBV,MAAM,CAAES,MAAM,CAAEV,aAAF,CAAR,CAA9B;AACA,WAAO;AACNS,MAAAA,aAAa,EAAEE,WAAW,GAAGC;AADvB,KAAP;AAGA,GALkC,EAKhC,EALgC,CAAnC;AAOA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAG,CADX;AAEC,IAAA,OAAO,EAAC,YAFT;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG,CAAER,MAAF,GACD,cAAC,uBAAD;AACC,IAAA,EAAE,EAAGF,aADN;AAEC,IAAA,IAAI,EAAGR,KAAK,KAAKE,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,EAAE,CAAE,MAAF;AAHhB,IADC,GAOD,cAAC,aAAD;AACC,IAAA,IAAI,EAAGD,KAAK,KAAKE,YAAL,GAAoBC,WADjC;AAEC,kBAAaF,EAAE,CAAE,2BAAF,CAFhB;AAGC,IAAA,IAAI,EAAGc,aAAa,IAAI,WAHzB;AAIC,IAAA,KAAK,EAAGd,EAAE,CAAE,WAAF;AAJX,IAZF,EAmBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGU,KADH,CAnBD,EAsBGC,OAtBH,CADD,EA0BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGE,WAAW,IACZ;AAAG,IAAA,SAAS,EAAC;AAAb,KACGA,WADH,CAFF,EAMGD,OANH,CA1BD,CADD;AAqCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n} from '@wordpress/components';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { chevronRight, chevronLeft } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\n\tdescription,\n} ) {\n\tconst { dashboardLink } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\treturn {\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<VStack spacing={ 2 }>\n\t\t\t<HStack\n\t\t\t\tspacing={ 4 }\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__title-icon\"\n\t\t\t>\n\t\t\t\t{ ! isRoot ? (\n\t\t\t\t\t<NavigatorToParentButton\n\t\t\t\t\t\tas={ SidebarButton }\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Back' ) }\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\ticon={ isRTL() ? chevronRight : chevronLeft }\n\t\t\t\t\t\taria-label={ __( 'Navigate to the Dashboard' ) }\n\t\t\t\t\t\thref={ dashboardLink || 'index.php' }\n\t\t\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<h2 className=\"edit-site-sidebar-navigation-screen__title\">\n\t\t\t\t\t{ title }\n\t\t\t\t</h2>\n\t\t\t\t{ actions }\n\t\t\t</HStack>\n\n\t\t\t<nav className=\"edit-site-sidebar-navigation-screen__content\">\n\t\t\t\t{ description && (\n\t\t\t\t\t<p className=\"edit-site-sidebar-navigation-screen__description\">\n\t\t\t\t\t\t{ description }\n\t\t\t\t\t</p>\n\t\t\t\t) }\n\t\t\t\t{ content }\n\t\t\t</nav>\n\t\t</VStack>\n\t);\n}\n"]}
|
|
@@ -31,6 +31,7 @@ export default function SidebarNavigationScreenMain() {
|
|
|
31
31
|
return createElement(SidebarNavigationScreen, {
|
|
32
32
|
isRoot: true,
|
|
33
33
|
title: __('Design'),
|
|
34
|
+
description: __('Customize the appearance of your website using the block editor.'),
|
|
34
35
|
content: createElement(ItemGroup, null, !!navigationMenus && navigationMenus.length > 0 && createElement(NavigatorButton, {
|
|
35
36
|
as: SidebarNavigationItem,
|
|
36
37
|
path: "/navigation",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__","layout","symbolFilled","navigation","useSelect","store","coreStore","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","per_page","status","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,UAA/B,QAAiD,kBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsBN,SAAS,CAAIO,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEL,SAAF,CAAnC;AACA,WAAO;AACNI,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DC,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GARoC,CAArC;AAUA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGd,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,OAAO,EACN,cAAC,SAAD,QACG,CAAC,CAAEU,eAAH,IAAsBA,eAAe,CAACK,MAAhB,GAAyB,CAA/C,IACD,cAAC,eAAD;AACC,MAAA,EAAE,EAAGP,qBADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGH,EAAE,CAAE,YAAF,CANL,CAFF,EAWC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGP;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CAXD,EAmBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGN;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CAnBD;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalNavigatorButton","NavigatorButton","__","layout","symbolFilled","navigation","useSelect","store","coreStore","SidebarNavigationScreen","SidebarNavigationItem","SidebarNavigationScreenMain","navigationMenus","select","getEntityRecords","per_page","status","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,6BAA6B,IAAIC,eAFlC,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,YAAjB,EAA+BC,UAA/B,QAAiD,kBAAjD;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AAEA,eAAe,SAASC,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAsBN,SAAS,CAAIO,MAAF,IAAc;AACpD,UAAM;AAAEC,MAAAA;AAAF,QAAuBD,MAAM,CAAEL,SAAF,CAAnC;AACA,WAAO;AACNI,MAAAA,eAAe,EAAEE,gBAAgB,CAAE,UAAF,EAAc,eAAd,EAA+B;AAC/DC,QAAAA,QAAQ,EAAE,CAAC,CADoD;AAE/DC,QAAAA,MAAM,EAAE;AAFuD,OAA/B;AAD3B,KAAP;AAMA,GARoC,CAArC;AAUA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAGd,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,kEADe,CAHjB;AAMC,IAAA,OAAO,EACN,cAAC,SAAD,QACG,CAAC,CAAEU,eAAH,IAAsBA,eAAe,CAACK,MAAhB,GAAyB,CAA/C,IACD,cAAC,eAAD;AACC,MAAA,EAAE,EAAGP,qBADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGL;AAJR,OAMGH,EAAE,CAAE,YAAF,CANL,CAFF,EAWC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGP;AAJR,OAMGD,EAAE,CAAE,WAAF,CANL,CAXD,EAmBC,cAAC,eAAD;AACC,MAAA,EAAE,EAAGQ,qBADN;AAEC,MAAA,IAAI,EAAC,mBAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGN;AAJR,OAMGF,EAAE,CAAE,gBAAF,CANL,CAnBD;AAPF,IADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbolFilled, navigation } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { navigationMenus } = useSelect( ( select ) => {\n\t\tconst { getEntityRecords } = select( coreStore );\n\t\treturn {\n\t\t\tnavigationMenus: getEntityRecords( 'postType', 'wp_navigation', {\n\t\t\t\tper_page: -1,\n\t\t\t\tstatus: 'publish',\n\t\t\t} ),\n\t\t};\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t{ !! navigationMenus && navigationMenus.length > 0 && (\n\t\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\t\twithChevron\n\t\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t) }\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template_part\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbolFilled }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Template Parts' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
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 { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useDispatch
|
|
8
|
-
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
9
|
-
import {
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { __experimentalUseNavigator as useNavigator, ExternalLink } from '@wordpress/components';
|
|
9
|
+
import { useEntityRecord } from '@wordpress/core-data';
|
|
10
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
11
|
import { pencil } from '@wordpress/icons';
|
|
12
12
|
/**
|
|
@@ -18,7 +18,7 @@ import { unlock } from '../../private-apis';
|
|
|
18
18
|
import { store as editSiteStore } from '../../store';
|
|
19
19
|
import SidebarButton from '../sidebar-button';
|
|
20
20
|
export default function SidebarNavigationScreenNavigationItem() {
|
|
21
|
-
var
|
|
21
|
+
var _record$title, _record$description;
|
|
22
22
|
|
|
23
23
|
const {
|
|
24
24
|
setCanvasMode
|
|
@@ -30,25 +30,20 @@ export default function SidebarNavigationScreenNavigationItem() {
|
|
|
30
30
|
}
|
|
31
31
|
} = useNavigator();
|
|
32
32
|
const {
|
|
33
|
-
|
|
34
|
-
} =
|
|
35
|
-
const {
|
|
36
|
-
getEntityRecord
|
|
37
|
-
} = select(coreStore); // The currently selected entity to display.
|
|
38
|
-
// Typically template or template part in the site editor.
|
|
39
|
-
|
|
40
|
-
return {
|
|
41
|
-
post: postId && postType ? getEntityRecord('postType', postType, postId) : null
|
|
42
|
-
};
|
|
43
|
-
}, [postType, postId]);
|
|
33
|
+
record
|
|
34
|
+
} = useEntityRecord('postType', postType, postId);
|
|
44
35
|
return createElement(SidebarNavigationScreen, {
|
|
45
|
-
title:
|
|
36
|
+
title: record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$title = record.title) === null || _record$title === void 0 ? void 0 : _record$title.rendered) : null,
|
|
46
37
|
actions: createElement(SidebarButton, {
|
|
47
38
|
onClick: () => setCanvasMode('edit'),
|
|
48
39
|
label: __('Edit'),
|
|
49
40
|
icon: pencil
|
|
50
41
|
}),
|
|
51
|
-
|
|
42
|
+
description: postType === 'page' ? __('Pages are static and are not listed by date. Pages do not use tags or categories.') : __('Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'),
|
|
43
|
+
content: createElement(Fragment, null, record !== null && record !== void 0 && record.link ? createElement(ExternalLink, {
|
|
44
|
+
className: "edit-site-sidebar-navigation-screen__page-link",
|
|
45
|
+
href: record.link
|
|
46
|
+
}, record.link) : null, record ? decodeEntities(record === null || record === void 0 ? void 0 : (_record$description = record.description) === null || _record$description === void 0 ? void 0 : _record$description.rendered) : null)
|
|
52
47
|
});
|
|
53
48
|
}
|
|
54
49
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","__experimentalUseNavigator","useNavigator","ExternalLink","useEntityRecord","decodeEntities","pencil","SidebarNavigationScreen","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenNavigationItem","setCanvasMode","params","postType","postId","record","title","rendered","link","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SACCC,0BAA0B,IAAIC,YAD/B,EAECC,YAFD,QAGO,uBAHP;AAIA,SAASC,eAAT,QAAgC,sBAAhC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBL,MAAM,CAAER,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEFd,YAAY,EAFhB;AAGA,QAAM;AAAEe,IAAAA;AAAF,MAAab,eAAe,CAAE,UAAF,EAAcW,QAAd,EAAwBC,MAAxB,CAAlC;AAEA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGC,MAAM,GAAGZ,cAAc,CAAEY,MAAF,aAAEA,MAAF,wCAAEA,MAAM,CAAEC,KAAV,kDAAE,cAAeC,QAAjB,CAAjB,GAA+C,IAD9D;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMN,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGO;AAHR,MAHF;AASC,IAAA,WAAW,EACVS,QAAQ,KAAK,MAAb,GACGhB,EAAE,CACF,mFADE,CADL,GAIGA,EAAE,CACF,oGADE,CAdP;AAkBC,IAAA,OAAO,EACN,8BACGkB,MAAM,SAAN,IAAAA,MAAM,WAAN,IAAAA,MAAM,CAAEG,IAAR,GACD,cAAC,YAAD;AACC,MAAA,SAAS,EAAC,gDADX;AAEC,MAAA,IAAI,EAAGH,MAAM,CAACG;AAFf,OAIGH,MAAM,CAACG,IAJV,CADC,GAOE,IARL,EASGH,MAAM,GACLZ,cAAc,CAAEY,MAAF,aAAEA,MAAF,8CAAEA,MAAM,CAAEI,WAAV,wDAAE,oBAAqBF,QAAvB,CADT,GAEL,IAXJ;AAnBF,IADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tExternalLink,\n} from '@wordpress/components';\nimport { useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useNavigator();\n\tconst { record } = useEntityRecord( 'postType', postType, postId );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ record ? decodeEntities( record?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Pages are static and are not listed by date. Pages do not use tags or categories.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'\n\t\t\t\t\t )\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ record?.link ? (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\t\t\thref={ record.link }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ record.link }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) : null }\n\t\t\t\t\t{ record\n\t\t\t\t\t\t? decodeEntities( record?.description?.rendered )\n\t\t\t\t\t\t: null }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -4,19 +4,83 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useCallback } from '@wordpress/element';
|
|
7
|
+
import { useCallback, useMemo } from '@wordpress/element';
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
+
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
11
|
+
import { createBlock } from '@wordpress/blocks';
|
|
8
12
|
/**
|
|
9
13
|
* Internal dependencies
|
|
10
14
|
*/
|
|
11
15
|
|
|
12
16
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
|
-
import NavigationInspector from '../navigation-inspector';
|
|
14
17
|
import { useHistory } from '../routes';
|
|
18
|
+
import NavigationMenuContent from './navigation-menu-content';
|
|
19
|
+
import { NavigationMenuLoader } from './loader';
|
|
20
|
+
import { unlock } from '../../private-apis';
|
|
21
|
+
import { store as editSiteStore } from '../../store';
|
|
22
|
+
|
|
23
|
+
const noop = () => {};
|
|
24
|
+
|
|
25
|
+
const NAVIGATION_MENUS_QUERY = {
|
|
26
|
+
per_page: -1,
|
|
27
|
+
status: 'publish'
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function SidebarNavigationScreenWrapper(_ref) {
|
|
31
|
+
let {
|
|
32
|
+
children,
|
|
33
|
+
actions
|
|
34
|
+
} = _ref;
|
|
35
|
+
return createElement(SidebarNavigationScreen, {
|
|
36
|
+
title: __('Navigation'),
|
|
37
|
+
actions: actions,
|
|
38
|
+
description: __('Browse your site, edit pages, and manage your primary navigation menu.'),
|
|
39
|
+
content: children
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
15
43
|
export default function SidebarNavigationScreenNavigationMenus() {
|
|
44
|
+
var _orderedNavigationMen;
|
|
45
|
+
|
|
16
46
|
const history = useHistory();
|
|
47
|
+
const {
|
|
48
|
+
navigationMenus,
|
|
49
|
+
hasResolvedNavigationMenus,
|
|
50
|
+
storedSettings
|
|
51
|
+
} = useSelect(select => {
|
|
52
|
+
const {
|
|
53
|
+
getSettings
|
|
54
|
+
} = unlock(select(editSiteStore));
|
|
55
|
+
const {
|
|
56
|
+
getEntityRecords,
|
|
57
|
+
hasFinishedResolution
|
|
58
|
+
} = select(coreStore);
|
|
59
|
+
const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY];
|
|
60
|
+
return {
|
|
61
|
+
storedSettings: getSettings(false),
|
|
62
|
+
navigationMenus: getEntityRecords(...navigationMenusQuery),
|
|
63
|
+
hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
|
|
64
|
+
};
|
|
65
|
+
}, []); // Sort navigation menus by date.
|
|
66
|
+
|
|
67
|
+
const orderedNavigationMenus = useMemo(() => navigationMenus === null || navigationMenus === void 0 ? void 0 : navigationMenus.sort((menuA, menuB) => {
|
|
68
|
+
const menuADate = new Date(menuA.date);
|
|
69
|
+
const menuBDate = new Date(menuB.date);
|
|
70
|
+
return menuADate.getTime() > menuBDate.getTime();
|
|
71
|
+
}), [navigationMenus]);
|
|
72
|
+
const firstNavigationMenu = orderedNavigationMenus === null || orderedNavigationMenus === void 0 ? void 0 : (_orderedNavigationMen = orderedNavigationMenus[0]) === null || _orderedNavigationMen === void 0 ? void 0 : _orderedNavigationMen.id;
|
|
73
|
+
const blocks = useMemo(() => {
|
|
74
|
+
return [createBlock('core/navigation', {
|
|
75
|
+
ref: firstNavigationMenu
|
|
76
|
+
})];
|
|
77
|
+
}, [firstNavigationMenu]);
|
|
78
|
+
const isLoading = !hasResolvedNavigationMenus;
|
|
79
|
+
const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
|
|
17
80
|
const onSelect = useCallback(selectedBlock => {
|
|
18
81
|
const {
|
|
19
|
-
attributes
|
|
82
|
+
attributes,
|
|
83
|
+
name
|
|
20
84
|
} = selectedBlock;
|
|
21
85
|
|
|
22
86
|
if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
|
|
@@ -25,14 +89,33 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
25
89
|
postId: attributes.id
|
|
26
90
|
});
|
|
27
91
|
}
|
|
92
|
+
|
|
93
|
+
if (name === 'core/page-list-item' && attributes.id && history) {
|
|
94
|
+
history.push({
|
|
95
|
+
postType: 'page',
|
|
96
|
+
postId: attributes.id
|
|
97
|
+
});
|
|
98
|
+
}
|
|
28
99
|
}, [history]);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
100
|
+
|
|
101
|
+
if (hasResolvedNavigationMenus && !hasNavigationMenus) {
|
|
102
|
+
return createElement(SidebarNavigationScreenWrapper, null, __('There are no Navigation Menus.'));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (!hasResolvedNavigationMenus || isLoading) {
|
|
106
|
+
return createElement(SidebarNavigationScreenWrapper, null, createElement(NavigationMenuLoader, null));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return createElement(BlockEditorProvider, {
|
|
110
|
+
settings: storedSettings,
|
|
111
|
+
value: blocks,
|
|
112
|
+
onChange: noop,
|
|
113
|
+
onInput: noop
|
|
114
|
+
}, createElement(SidebarNavigationScreenWrapper, null, createElement("div", {
|
|
115
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
|
|
116
|
+
}, createElement(NavigationMenuContent, {
|
|
117
|
+
rootClientId: blocks[0].clientId,
|
|
118
|
+
onSelect: onSelect
|
|
119
|
+
}))));
|
|
37
120
|
}
|
|
38
121
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","useMemo","useSelect","store","coreStore","BlockEditorProvider","createBlock","SidebarNavigationScreen","useHistory","NavigationMenuContent","NavigationMenuLoader","unlock","editSiteStore","noop","NAVIGATION_MENUS_QUERY","per_page","status","SidebarNavigationScreenWrapper","children","actions","SidebarNavigationScreenNavigationMenus","history","navigationMenus","hasResolvedNavigationMenus","storedSettings","select","getSettings","getEntityRecords","hasFinishedResolution","navigationMenusQuery","orderedNavigationMenus","sort","menuA","menuB","menuADate","Date","date","menuBDate","getTime","firstNavigationMenu","id","blocks","ref","isLoading","hasNavigationMenus","length","onSelect","selectedBlock","attributes","name","kind","type","push","postType","postId","clientId"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useHistory } from '../routes';\nimport NavigationMenuContent from './navigation-menu-content';\nimport { NavigationMenuLoader } from './loader';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst noop = () => {};\nconst NAVIGATION_MENUS_QUERY = { per_page: -1, status: 'publish' };\n\nfunction SidebarNavigationScreenWrapper( { children, actions } ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ __(\n\t\t\t\t'Browse your site, edit pages, and manage your primary navigation menu.'\n\t\t\t) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst { navigationMenus, hasResolvedNavigationMenus, storedSettings } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst navigationMenusQuery = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tNAVIGATION_MENUS_QUERY,\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( false ),\n\t\t\t\tnavigationMenus: getEntityRecords( ...navigationMenusQuery ),\n\t\t\t\thasResolvedNavigationMenus: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tnavigationMenusQuery\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\t// Sort navigation menus by date.\n\tconst orderedNavigationMenus = useMemo(\n\t\t() =>\n\t\t\tnavigationMenus?.sort( ( menuA, menuB ) => {\n\t\t\t\tconst menuADate = new Date( menuA.date );\n\t\t\t\tconst menuBDate = new Date( menuB.date );\n\t\t\t\treturn menuADate.getTime() > menuBDate.getTime();\n\t\t\t} ),\n\t\t[ navigationMenus ]\n\t);\n\tconst firstNavigationMenu = orderedNavigationMenus?.[ 0 ]?.id;\n\tconst blocks = useMemo( () => {\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', { ref: firstNavigationMenu } ),\n\t\t];\n\t}, [ firstNavigationMenu ] );\n\n\tconst isLoading = ! hasResolvedNavigationMenus;\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: 'page',\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tif ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t{ __( 'There are no Navigation Menus.' ) }\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! hasResolvedNavigationMenus || isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<NavigationMenuLoader />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t\t<NavigationMenuContent\n\t\t\t\t\t\trootClientId={ blocks[ 0 ].clientId }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
export function NavigationMenuLoader() {
|
|
3
|
+
return createElement(Fragment, null, createElement("div", {
|
|
4
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
|
|
5
|
+
}), createElement("div", {
|
|
6
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
|
|
7
|
+
}), createElement("div", {
|
|
8
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
|
|
9
|
+
}));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/loader.js"],"names":["NavigationMenuLoader"],"mappings":";AAAA,OAAO,SAASA,oBAAT,GAAgC;AACtC,SACC,8BACC;AAAK,IAAA,SAAS,EAAC;AAAf,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,IAFD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,IAHD,CADD;AAOA","sourcesContent":["export function NavigationMenuLoader() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { privateApis as blockEditorPrivateApis, store as blockEditorStore, BlockList, BlockTools } from '@wordpress/block-editor';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { createBlock } from '@wordpress/blocks';
|
|
9
|
+
import { useCallback } from '@wordpress/element';
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { unlock } from '../../private-apis';
|
|
15
|
+
import { NavigationMenuLoader } from './loader';
|
|
16
|
+
export default function NavigationMenuContent(_ref) {
|
|
17
|
+
let {
|
|
18
|
+
rootClientId,
|
|
19
|
+
onSelect
|
|
20
|
+
} = _ref;
|
|
21
|
+
const {
|
|
22
|
+
clientIdsTree,
|
|
23
|
+
isLoading
|
|
24
|
+
} = useSelect(select => {
|
|
25
|
+
const {
|
|
26
|
+
__unstableGetClientIdsTree,
|
|
27
|
+
areInnerBlocksControlled
|
|
28
|
+
} = select(blockEditorStore);
|
|
29
|
+
return {
|
|
30
|
+
clientIdsTree: __unstableGetClientIdsTree(rootClientId),
|
|
31
|
+
// This is a small hack to wait for the navigation block
|
|
32
|
+
// to actually load its inner blocks.
|
|
33
|
+
isLoading: !areInnerBlocksControlled(rootClientId)
|
|
34
|
+
};
|
|
35
|
+
}, [rootClientId]);
|
|
36
|
+
const {
|
|
37
|
+
replaceBlock,
|
|
38
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
39
|
+
} = useDispatch(blockEditorStore);
|
|
40
|
+
const {
|
|
41
|
+
OffCanvasEditor,
|
|
42
|
+
LeafMoreMenu
|
|
43
|
+
} = unlock(blockEditorPrivateApis);
|
|
44
|
+
const offCanvasOnselect = useCallback(block => {
|
|
45
|
+
if (block.name === 'core/navigation-link' && !block.attributes.url) {
|
|
46
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
47
|
+
|
|
48
|
+
replaceBlock(block.clientId, createBlock('core/navigation-link', block.attributes));
|
|
49
|
+
} else {
|
|
50
|
+
onSelect(block);
|
|
51
|
+
}
|
|
52
|
+
}, [onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock]); // The hidden block is needed because it makes block edit side effects trigger.
|
|
53
|
+
// For example a navigation page list load its items has an effect on edit to load its items.
|
|
54
|
+
|
|
55
|
+
return createElement(Fragment, null, isLoading && createElement(NavigationMenuLoader, null), !isLoading && createElement(OffCanvasEditor, {
|
|
56
|
+
blocks: clientIdsTree,
|
|
57
|
+
onSelect: offCanvasOnselect,
|
|
58
|
+
LeafMoreMenu: LeafMoreMenu,
|
|
59
|
+
showAppender: false
|
|
60
|
+
}), createElement("div", {
|
|
61
|
+
style: {
|
|
62
|
+
visibility: 'hidden'
|
|
63
|
+
}
|
|
64
|
+
}, createElement(BlockTools, null, createElement(BlockList, null))));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=navigation-menu-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js"],"names":["privateApis","blockEditorPrivateApis","store","blockEditorStore","BlockList","BlockTools","useDispatch","useSelect","createBlock","useCallback","unlock","NavigationMenuLoader","NavigationMenuContent","rootClientId","onSelect","clientIdsTree","isLoading","select","__unstableGetClientIdsTree","areInnerBlocksControlled","replaceBlock","__unstableMarkNextChangeAsNotPersistent","OffCanvasEditor","LeafMoreMenu","offCanvasOnselect","block","name","attributes","url","clientId","visibility"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,WAAW,IAAIC,sBADhB,EAECC,KAAK,IAAIC,gBAFV,EAGCC,SAHD,EAICC,UAJD,QAKO,yBALP;AAMA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,WAAT,QAA4B,mBAA5B;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,oBAAT,QAAqC,UAArC;AAEA,eAAe,SAASC,qBAAT,OAA6D;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;AAC3E,QAAM;AAAEC,IAAAA,aAAF;AAAiBC,IAAAA;AAAjB,MAA+BT,SAAS,CAC3CU,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,0BAAF;AAA8BC,MAAAA;AAA9B,QACLF,MAAM,CAAEd,gBAAF,CADP;AAEA,WAAO;AACNY,MAAAA,aAAa,EAAEG,0BAA0B,CAAEL,YAAF,CADnC;AAGN;AACA;AACAG,MAAAA,SAAS,EAAE,CAAEG,wBAAwB,CAAEN,YAAF;AAL/B,KAAP;AAOA,GAX4C,EAY7C,CAAEA,YAAF,CAZ6C,CAA9C;AAcA,QAAM;AAAEO,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,MACLf,WAAW,CAAEH,gBAAF,CADZ;AAGA,QAAM;AAAEmB,IAAAA,eAAF;AAAmBC,IAAAA;AAAnB,MAAoCb,MAAM,CAAET,sBAAF,CAAhD;AAEA,QAAMuB,iBAAiB,GAAGf,WAAW,CAClCgB,KAAF,IAAa;AACZ,QACCA,KAAK,CAACC,IAAN,KAAe,sBAAf,IACA,CAAED,KAAK,CAACE,UAAN,CAAiBC,GAFpB,EAGE;AACDP,MAAAA,uCAAuC;;AACvCD,MAAAA,YAAY,CACXK,KAAK,CAACI,QADK,EAEXrB,WAAW,CAAE,sBAAF,EAA0BiB,KAAK,CAACE,UAAhC,CAFA,CAAZ;AAIA,KATD,MASO;AACNb,MAAAA,QAAQ,CAAEW,KAAF,CAAR;AACA;AACD,GAdmC,EAepC,CAAEX,QAAF,EAAYO,uCAAZ,EAAqDD,YAArD,CAfoC,CAArC,CApB2E,CAsC3E;AACA;;AACA,SACC,8BACGJ,SAAS,IAAI,cAAC,oBAAD,OADhB,EAEG,CAAEA,SAAF,IACD,cAAC,eAAD;AACC,IAAA,MAAM,EAAGD,aADV;AAEC,IAAA,QAAQ,EAAGS,iBAFZ;AAGC,IAAA,YAAY,EAAGD,YAHhB;AAIC,IAAA,YAAY,EAAG;AAJhB,IAHF,EAUC;AAAK,IAAA,KAAK,EAAG;AAAEO,MAAAA,UAAU,EAAE;AAAd;AAAb,KACC,cAAC,UAAD,QACC,cAAC,SAAD,OADD,CADD,CAVD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockList,\n\tBlockTools,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { NavigationMenuLoader } from './loader';\n\nexport default function NavigationMenuContent( { rootClientId, onSelect } ) {\n\tconst { clientIdsTree, isLoading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __unstableGetClientIdsTree, areInnerBlocksControlled } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tclientIdsTree: __unstableGetClientIdsTree( rootClientId ),\n\n\t\t\t\t// This is a small hack to wait for the navigation block\n\t\t\t\t// to actually load its inner blocks.\n\t\t\t\tisLoading: ! areInnerBlocksControlled( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );\n\n\tconst offCanvasOnselect = useCallback(\n\t\t( block ) => {\n\t\t\tif (\n\t\t\t\tblock.name === 'core/navigation-link' &&\n\t\t\t\t! block.attributes.url\n\t\t\t) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlock(\n\t\t\t\t\tblock.clientId,\n\t\t\t\t\tcreateBlock( 'core/navigation-link', block.attributes )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tonSelect( block );\n\t\t\t}\n\t\t},\n\t\t[ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]\n\t);\n\n\t// The hidden block is needed because it makes block edit side effects trigger.\n\t// For example a navigation page list load its items has an effect on edit to load its items.\n\treturn (\n\t\t<>\n\t\t\t{ isLoading && <NavigationMenuLoader /> }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<OffCanvasEditor\n\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\tonSelect={ offCanvasOnselect }\n\t\t\t\t\tLeafMoreMenu={ LeafMoreMenu }\n\t\t\t\t\tshowAppender={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div style={ { visibility: 'hidden' } }>\n\t\t\t\t<BlockTools>\n\t\t\t\t\t<BlockList />\n\t\t\t\t</BlockTools>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -3,9 +3,10 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
7
7
|
import { useDispatch } from '@wordpress/data';
|
|
8
8
|
import { pencil } from '@wordpress/icons';
|
|
9
|
+
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
11
12
|
*/
|
|
@@ -16,6 +17,13 @@ import { unlock } from '../../private-apis';
|
|
|
16
17
|
import { store as editSiteStore } from '../../store';
|
|
17
18
|
import SidebarButton from '../sidebar-button';
|
|
18
19
|
export default function SidebarNavigationScreenTemplate() {
|
|
20
|
+
const {
|
|
21
|
+
params
|
|
22
|
+
} = useNavigator();
|
|
23
|
+
const {
|
|
24
|
+
postType,
|
|
25
|
+
postId
|
|
26
|
+
} = params;
|
|
19
27
|
const {
|
|
20
28
|
setCanvasMode
|
|
21
29
|
} = unlock(useDispatch(editSiteStore));
|
|
@@ -23,11 +31,16 @@ export default function SidebarNavigationScreenTemplate() {
|
|
|
23
31
|
getDescription,
|
|
24
32
|
getTitle,
|
|
25
33
|
record
|
|
26
|
-
} = useEditedEntityRecord();
|
|
34
|
+
} = useEditedEntityRecord(postType, postId);
|
|
27
35
|
let description = getDescription();
|
|
28
36
|
|
|
29
|
-
if (!description
|
|
30
|
-
|
|
37
|
+
if (!description) {
|
|
38
|
+
if (record.type === 'wp_template' && record.is_custom) {
|
|
39
|
+
description = __('This is a custom template that can be applied manually to any Post or Page.');
|
|
40
|
+
} else if (record.type === 'wp_template_part') {
|
|
41
|
+
description = sprintf( // translators: %s: template part title e.g: "Header".
|
|
42
|
+
__('This is your %s template part.'), getTitle());
|
|
43
|
+
}
|
|
31
44
|
}
|
|
32
45
|
|
|
33
46
|
return createElement(SidebarNavigationScreen, {
|
|
@@ -37,7 +50,7 @@ export default function SidebarNavigationScreenTemplate() {
|
|
|
37
50
|
label: __('Edit'),
|
|
38
51
|
icon: pencil
|
|
39
52
|
}),
|
|
40
|
-
|
|
53
|
+
description: description
|
|
41
54
|
});
|
|
42
55
|
}
|
|
43
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","useDispatch","pencil","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenTemplate","setCanvasMode","getDescription","getTitle","record","description","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","sprintf","useDispatch","pencil","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","SidebarButton","SidebarNavigationScreenTemplate","params","postType","postId","setCanvasMode","getDescription","getTitle","record","description","type","is_custom"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,+BAAT,GAA2C;AACzD,QAAM;AAAEC,IAAAA;AAAF,MAAaR,YAAY,EAA/B;AACA,QAAM;AAAES,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAAuBF,MAA7B;AACA,QAAM;AAAEG,IAAAA;AAAF,MAAoBR,MAAM,CAAEN,WAAW,CAAEQ,aAAF,CAAb,CAAhC;AACA,QAAM;AAAEO,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCZ,qBAAqB,CACjEO,QADiE,EAEjEC,MAFiE,CAAlE;AAIA,MAAIK,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAP,EAAqB;AACpB,QAAKD,MAAM,CAACE,IAAP,KAAgB,aAAhB,IAAiCF,MAAM,CAACG,SAA7C,EAAyD;AACxDF,MAAAA,WAAW,GAAGpB,EAAE,CACf,6EADe,CAAhB;AAGA,KAJD,MAIO,IAAKmB,MAAM,CAACE,IAAP,KAAgB,kBAArB,EAA0C;AAChDD,MAAAA,WAAW,GAAGnB,OAAO,EACpB;AACAD,MAAAA,EAAE,CAAE,gCAAF,CAFkB,EAGpBkB,QAAQ,EAHY,CAArB;AAKA;AACD;;AAED,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGA,QAAQ,EADjB;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGhB,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGG;AAHR,MAHF;AASC,IAAA,WAAW,EAAGiB;AATf,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst { params } = useNavigator();\n\tconst { postType, postId } = params;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tlet description = getDescription();\n\tif ( ! description ) {\n\t\tif ( record.type === 'wp_template' && record.is_custom ) {\n\t\t\tdescription = __(\n\t\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t\t);\n\t\t} else if ( record.type === 'wp_template_part' ) {\n\t\t\tdescription = sprintf(\n\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t__( 'This is your %s template part.' ),\n\t\t\t\tgetTitle()\n\t\t\t);\n\t\t}\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ getTitle() }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -26,7 +26,8 @@ const config = {
|
|
|
26
26
|
title: __('Templates'),
|
|
27
27
|
loading: __('Loading templates'),
|
|
28
28
|
notFound: __('No templates found'),
|
|
29
|
-
manage: __('Manage all templates')
|
|
29
|
+
manage: __('Manage all templates'),
|
|
30
|
+
description: __('Express the layout of your site with templates.')
|
|
30
31
|
}
|
|
31
32
|
},
|
|
32
33
|
wp_template_part: {
|
|
@@ -34,7 +35,8 @@ const config = {
|
|
|
34
35
|
title: __('Template parts'),
|
|
35
36
|
loading: __('Loading template parts'),
|
|
36
37
|
notFound: __('No template parts found'),
|
|
37
|
-
manage: __('Manage all template parts')
|
|
38
|
+
manage: __('Manage all template parts'),
|
|
39
|
+
description: __('Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.')
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
};
|
|
@@ -78,6 +80,7 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
78
80
|
return createElement(SidebarNavigationScreen, {
|
|
79
81
|
isRoot: isTemplatePartsMode,
|
|
80
82
|
title: config[postType].labels.title,
|
|
83
|
+
description: config[postType].labels.description,
|
|
81
84
|
actions: canCreate && createElement(AddNewTemplate, {
|
|
82
85
|
templateType: postType,
|
|
83
86
|
toggleProps: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalUseNavigator","useNavigator","__","useEntityRecords","useSelect","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","store","editSiteStore","SidebarButton","config","wp_template","labels","title","loading","notFound","manage","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","slug","localeCompare","browseAllLink","path","canCreate","as","length","map","template","id","rendered"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,EAGCC,0BAA0B,IAAIC,YAH/B,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,gBAAT,QAAiC,sBAAjC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,cAAT,QAA+B,0BAA/B;AACA,SAASC,gBAAT,QAAiC,oBAAjC;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,OAAT,QAAwB,gBAAxB;AACA,OAAOC,qBAAP,MAAkC,4BAAlC;AACA,OAAOC,cAAP,MAA2B,qBAA3B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAEf,EAAE,CAAE,WAAF,CADF;AAEPgB,MAAAA,OAAO,EAAEhB,EAAE,CAAE,mBAAF,CAFJ;AAGPiB,MAAAA,QAAQ,EAAEjB,EAAE,CAAE,oBAAF,CAHL;AAIPkB,MAAAA,MAAM,EAAElB,EAAE,CAAE,sBAAF;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalUseNavigator","useNavigator","__","useEntityRecords","useSelect","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","store","editSiteStore","SidebarButton","config","wp_template","labels","title","loading","notFound","manage","description","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","slug","localeCompare","browseAllLink","path","canCreate","as","length","map","template","id","rendered"],"mappings":"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","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst config = {\n\twp_template: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t\tdescription: __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t\tdescription: __(\n\t\t\t\t'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.'\n\t\t\t),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );\n\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tdescription={ config[ postType ].labels.description }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\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\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -12,10 +12,12 @@ import { __experimentalUseNavigator as useNavigator } from '@wordpress/component
|
|
|
12
12
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
13
|
const config = {
|
|
14
14
|
wp_template: {
|
|
15
|
-
title: __('All templates')
|
|
15
|
+
title: __('All templates'),
|
|
16
|
+
description: __('Create new templates, or reset any customizations made to the templates supplied by your theme.')
|
|
16
17
|
},
|
|
17
18
|
wp_template_part: {
|
|
18
|
-
title: __('All template parts')
|
|
19
|
+
title: __('All template parts'),
|
|
20
|
+
description: __('Create new template parts, or reset any customisations made to the template parts supplied by your theme.')
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
23
|
export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
@@ -25,7 +27,8 @@ export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
|
25
27
|
}
|
|
26
28
|
} = useNavigator();
|
|
27
29
|
return createElement(SidebarNavigationScreen, {
|
|
28
|
-
title: config[postType].title
|
|
30
|
+
title: config[postType].title,
|
|
31
|
+
description: config[postType].description
|
|
29
32
|
});
|
|
30
33
|
}
|
|
31
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","config","wp_template","title","wp_template_part","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAEN,EAAE,CAAE,eAAF;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","__experimentalUseNavigator","useNavigator","SidebarNavigationScreen","config","wp_template","title","description","wp_template_part","SidebarNavigationScreenTemplatesBrowse","params","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,KAAK,EAAEN,EAAE,CAAE,eAAF,CADG;AAEZO,IAAAA,WAAW,EAAEP,EAAE,CACd,iGADc;AAFH,GADC;AAOdQ,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,KAAK,EAAEN,EAAE,CAAE,oBAAF,CADQ;AAEjBO,IAAAA,WAAW,EAAEP,EAAE,CACd,2GADc;AAFE;AAPJ,CAAf;AAeA,eAAe,SAASS,sCAAT,GAAkD;AAChE,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFT,YAAY,EAFhB;AAGA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGE,MAAM,CAAEO,QAAF,CAAN,CAAmBL,KAD5B;AAEC,IAAA,WAAW,EAAGF,MAAM,CAAEO,QAAF,CAAN,CAAmBJ;AAFlC,IADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\ttitle: __( 'All templates' ),\n\t\tdescription: __(\n\t\t\t'Create new templates, or reset any customizations made to the templates supplied by your theme.'\n\t\t),\n\t},\n\twp_template_part: {\n\t\ttitle: __( 'All template parts' ),\n\t\tdescription: __(\n\t\t\t'Create new template parts, or reset any customisations made to the template parts supplied by your theme.'\n\t\t),\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ config[ postType ].title }\n\t\t\tdescription={ config[ postType ].description }\n\t\t/>\n\t);\n}\n"]}
|