@wordpress/edit-site 5.3.3 → 5.3.5
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-part.js +3 -6
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +3 -6
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/global-styles/screen-border.js +1 -1
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/ui.js +1 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/list/table.js +0 -1
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +4 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +14 -33
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +4 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +8 -12
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +1 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +1 -14
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +8 -12
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +8 -7
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +34 -32
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +67 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +3 -6
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +3 -6
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +1 -1
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/list/table.js +0 -1
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +15 -32
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -8
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +9 -13
- 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 +1 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +1 -13
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +9 -13
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +7 -7
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +34 -32
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +67 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +19 -9
- package/build-style/style.css +19 -9
- package/package.json +21 -21
- package/src/components/add-new-template/new-template-part.js +3 -6
- package/src/components/add-new-template/new-template.js +3 -6
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/screen-border.js +1 -1
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/layout/style.scss +8 -1
- package/src/components/list/table.js +0 -4
- package/src/components/navigation-inspector/navigation-menu.js +8 -2
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +26 -27
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-screen/index.js +31 -37
- package/src/components/sidebar-navigation-screen/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-main/index.js +3 -3
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +21 -15
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +0 -2
- package/src/components/sidebar-navigation-screen-template/index.js +1 -13
- package/src/components/sidebar-navigation-screen-templates/index.js +6 -10
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -11
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +31 -22
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +78 -17
- package/src/utils/get-is-list-page.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["FlexItem","FlexBlock","Flex","Button","__","styles","seen","useSelect","useState","useEffect","DefaultSidebar","GlobalStylesUI","store","editSiteStore","GlobalStylesMenuSlot","GlobalStylesSidebar","isStyleBookOpened","setIsStyleBookOpened","editorMode","select","getEditorMode"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,IAA9B,EAAoCC,MAApC,QAAkD,uBAAlD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,kBAA7B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,oBAAT,QAAqC,qBAArC;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8CT,QAAQ,CAAE,KAAF,CAA5D;AACA,QAAMU,UAAU,GAAGX,SAAS,CACzBY,MAAF,IAAcA,MAAM,CAAEN,aAAF,CAAN,CAAwBO,aAAxB,EADa,EAE3B,EAF2B,CAA5B;AAKAX,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKS,UAAU,KAAK,QAApB,EAA+B;AAC9BD,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AACD,GAJQ,EAIN,CAAEC,UAAF,CAJM,CAAT;AAKA,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAGd,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,IAAI,EAAGC,MAJR;AAKC,IAAA,UAAU,EAAGD,EAAE,CAAE,sBAAF,CALhB;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,cAAC,IAAD,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/global-styles-sidebar.js"],"names":["FlexItem","FlexBlock","Flex","Button","__","styles","seen","useSelect","useState","useEffect","DefaultSidebar","GlobalStylesUI","store","editSiteStore","GlobalStylesMenuSlot","GlobalStylesSidebar","isStyleBookOpened","setIsStyleBookOpened","editorMode","select","getEditorMode","minWidth"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,EAAmBC,SAAnB,EAA8BC,IAA9B,EAAoCC,MAApC,QAAkD,uBAAlD;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,EAAiBC,IAAjB,QAA6B,kBAA7B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AAEA,SAASC,QAAT,EAAmBC,SAAnB,QAAoC,oBAApC;AAEA;AACA;AACA;;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SAASC,cAAT,QAA+B,kBAA/B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AACA,SAASC,oBAAT,QAAqC,qBAArC;AAEA,eAAe,SAASC,mBAAT,GAA+B;AAC7C,QAAM,CAAEC,iBAAF,EAAqBC,oBAArB,IAA8CT,QAAQ,CAAE,KAAF,CAA5D;AACA,QAAMU,UAAU,GAAGX,SAAS,CACzBY,MAAF,IAAcA,MAAM,CAAEN,aAAF,CAAN,CAAwBO,aAAxB,EADa,EAE3B,EAF2B,CAA5B;AAKAX,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAKS,UAAU,KAAK,QAApB,EAA+B;AAC9BD,MAAAA,oBAAoB,CAAE,KAAF,CAApB;AACA;AACD,GAJQ,EAIN,CAAEC,UAAF,CAJM,CAAT;AAKA,SACC,cAAC,cAAD;AACC,IAAA,SAAS,EAAC,iCADX;AAEC,IAAA,UAAU,EAAC,yBAFZ;AAGC,IAAA,KAAK,EAAGd,EAAE,CAAE,QAAF,CAHX;AAIC,IAAA,IAAI,EAAGC,MAJR;AAKC,IAAA,UAAU,EAAGD,EAAE,CAAE,sBAAF,CALhB;AAMC,IAAA,cAAc,EAAC,wCANhB;AAOC,IAAA,MAAM,EACL,cAAC,IAAD;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC,cAAC,SAAD;AAAW,MAAA,KAAK,EAAG;AAAEiB,QAAAA,QAAQ,EAAE;AAAZ;AAAnB,OACC,8BAAUjB,EAAE,CAAE,QAAF,CAAZ,CADD,CADD,EAIC,cAAC,QAAD,QACC,cAAC,MAAD;AACC,MAAA,IAAI,EAAGE,IADR;AAEC,MAAA,KAAK,EAAGF,EAAE,CAAE,YAAF,CAFX;AAGC,MAAA,SAAS,EAAGY,iBAHb;AAIC,MAAA,QAAQ,EAAGE,UAAU,KAAK,QAJ3B;AAKC,MAAA,OAAO,EAAG,MAAM;AACfD,QAAAA,oBAAoB,CAAE,CAAED,iBAAJ,CAApB;AACA;AAPF,MADD,CAJD,EAeC,cAAC,QAAD,QACC,cAAC,oBAAD,OADD,CAfD;AARF,KA6BC,cAAC,cAAD;AACC,IAAA,iBAAiB,EAAGA,iBADrB;AAEC,IAAA,gBAAgB,EAAG,MAAMC,oBAAoB,CAAE,KAAF;AAF9C,IA7BD,CADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { FlexItem, FlexBlock, Flex, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { styles, seen } from '@wordpress/icons';\nimport { useSelect } from '@wordpress/data';\n\nimport { useState, useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport DefaultSidebar from './default-sidebar';\nimport { GlobalStylesUI } from '../global-styles';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesMenuSlot } from '../global-styles/ui';\n\nexport default function GlobalStylesSidebar() {\n\tconst [ isStyleBookOpened, setIsStyleBookOpened ] = useState( false );\n\tconst editorMode = useSelect(\n\t\t( select ) => select( editSiteStore ).getEditorMode(),\n\t\t[]\n\t);\n\n\tuseEffect( () => {\n\t\tif ( editorMode !== 'visual' ) {\n\t\t\tsetIsStyleBookOpened( false );\n\t\t}\n\t}, [ editorMode ] );\n\treturn (\n\t\t<DefaultSidebar\n\t\t\tclassName=\"edit-site-global-styles-sidebar\"\n\t\t\tidentifier=\"edit-site/global-styles\"\n\t\t\ttitle={ __( 'Styles' ) }\n\t\t\ticon={ styles }\n\t\t\tcloseLabel={ __( 'Close Styles sidebar' ) }\n\t\t\tpanelClassName=\"edit-site-global-styles-sidebar__panel\"\n\t\t\theader={\n\t\t\t\t<Flex className=\"edit-site-global-styles-sidebar__header\">\n\t\t\t\t\t<FlexBlock style={ { minWidth: 'min-content' } }>\n\t\t\t\t\t\t<strong>{ __( 'Styles' ) }</strong>\n\t\t\t\t\t</FlexBlock>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\tdisabled={ editorMode !== 'visual' }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetIsStyleBookOpened( ! isStyleBookOpened );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FlexItem>\n\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t<GlobalStylesMenuSlot />\n\t\t\t\t\t</FlexItem>\n\t\t\t\t</Flex>\n\t\t\t}\n\t\t>\n\t\t\t<GlobalStylesUI\n\t\t\t\tisStyleBookOpened={ isStyleBookOpened }\n\t\t\t\tonCloseStyleBook={ () => setIsStyleBookOpened( false ) }\n\t\t\t/>\n\t\t</DefaultSidebar>\n\t);\n}\n"]}
|
|
@@ -3,7 +3,7 @@ import { createElement } from "@wordpress/element";
|
|
|
3
3
|
/**
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
|
-
import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalNavigatorToParentButton as NavigatorToParentButton, Button
|
|
6
|
+
import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalNavigatorToParentButton as NavigatorToParentButton, Button } from '@wordpress/components';
|
|
7
7
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
8
8
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
@@ -15,7 +15,7 @@ import { store as editSiteStore } from '../../store';
|
|
|
15
15
|
import { unlock } from '../../private-apis';
|
|
16
16
|
export default function SidebarNavigationScreen(_ref) {
|
|
17
17
|
let {
|
|
18
|
-
|
|
18
|
+
isRoot,
|
|
19
19
|
title,
|
|
20
20
|
actions,
|
|
21
21
|
content
|
|
@@ -30,16 +30,13 @@ export default function SidebarNavigationScreen(_ref) {
|
|
|
30
30
|
dashboardLink: getSettings().__experimentalDashboardLink
|
|
31
31
|
};
|
|
32
32
|
}, []);
|
|
33
|
-
return createElement(
|
|
34
|
-
className: "edit-site-sidebar-navigation-screen",
|
|
35
|
-
path: path
|
|
36
|
-
}, createElement(VStack, {
|
|
33
|
+
return createElement(VStack, {
|
|
37
34
|
spacing: 2
|
|
38
35
|
}, createElement(HStack, {
|
|
39
36
|
spacing: 4,
|
|
40
37
|
justify: "flex-start",
|
|
41
38
|
className: "edit-site-sidebar-navigation-screen__title-icon"
|
|
42
|
-
},
|
|
39
|
+
}, !isRoot ? createElement(NavigatorToParentButton, {
|
|
43
40
|
className: "edit-site-sidebar-navigation-screen__back",
|
|
44
41
|
icon: isRTL() ? chevronRight : chevronLeft,
|
|
45
42
|
"aria-label": __('Back')
|
|
@@ -53,6 +50,6 @@ export default function SidebarNavigationScreen(_ref) {
|
|
|
53
50
|
className: "edit-site-sidebar-navigation-screen__title"
|
|
54
51
|
}, title), actions), createElement("nav", {
|
|
55
52
|
className: "edit-site-sidebar-navigation-screen__content"
|
|
56
|
-
}, content))
|
|
53
|
+
}, content));
|
|
57
54
|
}
|
|
58
55
|
//# 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","Button","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen/index.js"],"names":["__experimentalHStack","HStack","__experimentalVStack","VStack","__experimentalNavigatorToParentButton","NavigatorToParentButton","Button","isRTL","__","chevronRight","chevronLeft","useSelect","store","editSiteStore","unlock","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,EAICC,MAJD,QAKO,uBALP;AAMA,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;AAEA,eAAe,SAASC,uBAAT,OAKX;AAAA,MAL6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBT,SAAS,CAAIU,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBR,MAAM,CAAEO,MAAM,CAAER,aAAF,CAAR,CAA9B;AACA,WAAO;AACNO,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,CAAEP,MAAF,GACD,cAAC,uBAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGT,KAAK,KAAKE,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,EAAE,CAAE,MAAF;AAHhB,IADC,GAOD,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,2CADX;AAEC,IAAA,IAAI,EAAGD,KAAK,KAAKE,YAAL,GAAoBC,WAFjC;AAGC,kBAAaF,EAAE,CAAE,2BAAF,CAHhB;AAIC,IAAA,IAAI,EAAGY,aAAa,IAAI,WAJzB;AAKC,IAAA,KAAK,EAAGZ,EAAE,CAAE,WAAF;AALX,IAZF,EAoBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGS,KADH,CApBD,EAuBGC,OAvBH,CADD,EA2BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CA3BD,CADD;AAiCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalNavigatorToParentButton as NavigatorToParentButton,\n\tButton,\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';\n\nexport default function SidebarNavigationScreen( {\n\tisRoot,\n\ttitle,\n\tactions,\n\tcontent,\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\tclassName=\"edit-site-sidebar-navigation-screen__back\"\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<Button\n\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__back\"\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{ content }\n\t\t\t</nav>\n\t\t</VStack>\n\t);\n}\n"]}
|
|
@@ -29,7 +29,7 @@ export default function SidebarNavigationScreenMain() {
|
|
|
29
29
|
};
|
|
30
30
|
});
|
|
31
31
|
return createElement(SidebarNavigationScreen, {
|
|
32
|
-
|
|
32
|
+
isRoot: true,
|
|
33
33
|
title: __('Design'),
|
|
34
34
|
content: createElement(ItemGroup, null, !!navigationMenus && navigationMenus.length > 0 && createElement(NavigatorButton, {
|
|
35
35
|
as: SidebarNavigationItem,
|
|
@@ -38,12 +38,12 @@ export default function SidebarNavigationScreenMain() {
|
|
|
38
38
|
icon: navigation
|
|
39
39
|
}, __('Navigation')), createElement(NavigatorButton, {
|
|
40
40
|
as: SidebarNavigationItem,
|
|
41
|
-
path: "/
|
|
41
|
+
path: "/wp_template",
|
|
42
42
|
withChevron: true,
|
|
43
43
|
icon: layout
|
|
44
44
|
}, __('Templates')), createElement(NavigatorButton, {
|
|
45
45
|
as: SidebarNavigationItem,
|
|
46
|
-
path: "/
|
|
46
|
+
path: "/wp_template_part",
|
|
47
47
|
withChevron: true,
|
|
48
48
|
icon: symbolFilled
|
|
49
49
|
}, __('Template Parts')))
|
|
@@ -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,
|
|
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;AAJF,IADD;AAoCA","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\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"]}
|
|
@@ -5,7 +5,7 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
-
import { Button } from '@wordpress/components';
|
|
8
|
+
import { Button, __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
9
9
|
import { store as coreStore } from '@wordpress/core-data';
|
|
10
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
11
|
/**
|
|
@@ -21,29 +21,25 @@ export default function SidebarNavigationScreenNavigationItem() {
|
|
|
21
21
|
const {
|
|
22
22
|
setCanvasMode
|
|
23
23
|
} = unlock(useDispatch(editSiteStore));
|
|
24
|
+
const {
|
|
25
|
+
params: {
|
|
26
|
+
postType,
|
|
27
|
+
postId
|
|
28
|
+
}
|
|
29
|
+
} = useNavigator();
|
|
24
30
|
const {
|
|
25
31
|
post
|
|
26
32
|
} = useSelect(select => {
|
|
27
|
-
var _getEditedPostContext;
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
getEditedPostContext
|
|
31
|
-
} = select(editSiteStore);
|
|
32
33
|
const {
|
|
33
34
|
getEntityRecord
|
|
34
|
-
} = select(coreStore);
|
|
35
|
-
const {
|
|
36
|
-
postType,
|
|
37
|
-
postId
|
|
38
|
-
} = (_getEditedPostContext = getEditedPostContext()) !== null && _getEditedPostContext !== void 0 ? _getEditedPostContext : {}; // The currently selected entity to display.
|
|
35
|
+
} = select(coreStore); // The currently selected entity to display.
|
|
39
36
|
// Typically template or template part in the site editor.
|
|
40
37
|
|
|
41
38
|
return {
|
|
42
39
|
post: postId && postType ? getEntityRecord('postType', postType, postId) : null
|
|
43
40
|
};
|
|
44
|
-
}, []);
|
|
41
|
+
}, [postType, postId]);
|
|
45
42
|
return createElement(SidebarNavigationScreen, {
|
|
46
|
-
path: "/navigation/single",
|
|
47
43
|
title: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$title = post.title) === null || _post$title === void 0 ? void 0 : _post$title.rendered) : null,
|
|
48
44
|
actions: createElement(Button, {
|
|
49
45
|
variant: "primary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","Button","store","coreStore","decodeEntities","SidebarNavigationScreen","unlock","editSiteStore","SidebarNavigationScreenNavigationItem","setCanvasMode","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","Button","__experimentalUseNavigator","useNavigator","store","coreStore","decodeEntities","SidebarNavigationScreen","unlock","editSiteStore","SidebarNavigationScreenNavigationItem","setCanvasMode","params","postType","postId","post","select","getEntityRecord","title","rendered","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,MADD,EAECC,0BAA0B,IAAIC,YAF/B,QAGO,uBAHP;AAIA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBH,MAAM,CAAET,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLG,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEFX,YAAY,EAFhB;AAIA,QAAM;AAAEY,IAAAA;AAAF,MAAWf,SAAS,CACvBgB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEX,SAAF,CAAlC,CADa,CAGb;AACA;;AACA,WAAO;AACNU,MAAAA,IAAI,EACHD,MAAM,IAAID,QAAV,GACGI,eAAe,CAAE,UAAF,EAAcJ,QAAd,EAAwBC,MAAxB,CADlB,GAEG;AAJE,KAAP;AAMA,GAZwB,EAazB,CAAED,QAAF,EAAYC,MAAZ,CAbyB,CAA1B;AAgBA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGC,IAAI,GAAGT,cAAc,CAAES,IAAF,aAAEA,IAAF,sCAAEA,IAAI,CAAEG,KAAR,gDAAE,YAAaC,QAAf,CAAjB,GAA6C,IAD1D;AAEC,IAAA,OAAO,EACN,cAAC,MAAD;AACC,MAAA,OAAO,EAAC,SADT;AAEC,MAAA,OAAO,EAAG,MAAMR,aAAa,CAAE,MAAF;AAF9B,OAIGb,EAAE,CAAE,MAAF,CAJL,CAHF;AAUC,IAAA,OAAO,EACNiB,IAAI,GAAGT,cAAc,CAAES,IAAF,aAAEA,IAAF,4CAAEA,IAAI,CAAEK,WAAR,sDAAE,kBAAmBD,QAArB,CAAjB,GAAmD;AAXzD,IADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst {\n\t\tparams: { postType, postId },\n\t} = useNavigator();\n\n\tconst { post } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\n\t\t\t// The currently selected entity to display.\n\t\t\t// Typically template or template part in the site editor.\n\t\t\treturn {\n\t\t\t\tpost:\n\t\t\t\t\tpostId && postType\n\t\t\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t\t\t: null,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ post ? decodeEntities( post?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\tpost ? decodeEntities( post?.description?.rendered ) : null\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -22,13 +22,11 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
22
22
|
if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
|
|
23
23
|
history.push({
|
|
24
24
|
postType: attributes.type,
|
|
25
|
-
postId: attributes.id
|
|
26
|
-
path: '/navigation/single'
|
|
25
|
+
postId: attributes.id
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
}, [history]);
|
|
30
29
|
return createElement(SidebarNavigationScreen, {
|
|
31
|
-
path: "/navigation",
|
|
32
30
|
title: __('Navigation'),
|
|
33
31
|
content: createElement("div", {
|
|
34
32
|
className: "edit-site-sidebar-navigation-screen-navigation-menus"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId"
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,WAA3B;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAMG,QAAQ,GAAGN,WAAW,CACzBO,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE;AAFN,OAAd;AAIA;AACD,GAd0B,EAe3B,CAAEL,OAAF,CAf2B,CAA5B;AAiBA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGN,EAAE,CAAE,YAAF,CADX;AAEC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAGO;AAAhC,MADD;AAHF,IADD;AAUA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = 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},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -14,18 +14,7 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
|
14
14
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
15
15
|
import { unlock } from '../../private-apis';
|
|
16
16
|
import { store as editSiteStore } from '../../store';
|
|
17
|
-
|
|
18
|
-
wp_template: {
|
|
19
|
-
path: '/templates/single'
|
|
20
|
-
},
|
|
21
|
-
wp_template_part: {
|
|
22
|
-
path: '/template-parts/single'
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
export default function SidebarNavigationScreenTemplate(_ref) {
|
|
26
|
-
let {
|
|
27
|
-
postType = 'wp_template'
|
|
28
|
-
} = _ref;
|
|
17
|
+
export default function SidebarNavigationScreenTemplate() {
|
|
29
18
|
const {
|
|
30
19
|
setCanvasMode
|
|
31
20
|
} = unlock(useDispatch(editSiteStore));
|
|
@@ -41,7 +30,6 @@ export default function SidebarNavigationScreenTemplate(_ref) {
|
|
|
41
30
|
}
|
|
42
31
|
|
|
43
32
|
return createElement(SidebarNavigationScreen, {
|
|
44
|
-
path: config[postType].path,
|
|
45
33
|
title: getTitle(),
|
|
46
34
|
actions: createElement(Button, {
|
|
47
35
|
variant: "primary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","useDispatch","Button","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","useDispatch","Button","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","SidebarNavigationScreenTemplate","setCanvasMode","getDescription","getTitle","record","description","is_custom","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;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;AAEA,eAAe,SAASC,+BAAT,GAA2C;AACzD,QAAM;AAAEC,IAAAA;AAAF,MAAoBJ,MAAM,CAAEJ,WAAW,CAAEM,aAAF,CAAb,CAAhC;AACA,QAAM;AAAEG,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCR,qBAAqB,EAAlE;AACA,MAAIS,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAF,IAAiBD,MAAM,CAACE,SAA7B,EAAyC;AACxCD,IAAAA,WAAW,GAAGb,EAAE,CACf,6EADe,CAAhB;AAGA;;AAED,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGW,QAAQ,EADjB;AAEC,IAAA,OAAO,EACN,cAAC,MAAD;AACC,MAAA,OAAO,EAAC,SADT;AAEC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF;AAF9B,OAIGT,EAAE,CAAE,MAAF,CAJL,CAHF;AAUC,IAAA,OAAO,EAAGa,WAAW,GAAG,yBAAKA,WAAL,CAAH,GAA4BE;AAVlD,IADD;AAcA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { Button } 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';\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord();\n\tlet description = getDescription();\n\tif ( ! description && record.is_custom ) {\n\t\tdescription = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\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<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={ description ? <p>{ description }</p> : undefined }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
/**
|
|
5
5
|
* WordPress dependencies
|
|
6
6
|
*/
|
|
7
|
-
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
|
|
7
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item, __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
9
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
10
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
@@ -19,7 +19,6 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
19
19
|
import AddNewTemplate from '../add-new-template';
|
|
20
20
|
const config = {
|
|
21
21
|
wp_template: {
|
|
22
|
-
path: '/templates',
|
|
23
22
|
labels: {
|
|
24
23
|
title: __('Templates'),
|
|
25
24
|
loading: __('Loading templates'),
|
|
@@ -28,7 +27,6 @@ const config = {
|
|
|
28
27
|
}
|
|
29
28
|
},
|
|
30
29
|
wp_template_part: {
|
|
31
|
-
path: '/template-parts',
|
|
32
30
|
labels: {
|
|
33
31
|
title: __('Template parts'),
|
|
34
32
|
loading: __('Loading template parts'),
|
|
@@ -46,16 +44,17 @@ const TemplateItem = _ref => {
|
|
|
46
44
|
} = _ref;
|
|
47
45
|
const linkInfo = useLink({
|
|
48
46
|
postType,
|
|
49
|
-
postId
|
|
50
|
-
path: config[postType].path + '/single'
|
|
47
|
+
postId
|
|
51
48
|
});
|
|
52
49
|
return createElement(SidebarNavigationItem, _extends({}, linkInfo, props));
|
|
53
50
|
};
|
|
54
51
|
|
|
55
|
-
export default function SidebarNavigationScreenTemplates(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
export default function SidebarNavigationScreenTemplates() {
|
|
53
|
+
const {
|
|
54
|
+
params: {
|
|
55
|
+
postType
|
|
56
|
+
}
|
|
57
|
+
} = useNavigator();
|
|
59
58
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
60
59
|
const {
|
|
61
60
|
records: templates,
|
|
@@ -64,12 +63,9 @@ export default function SidebarNavigationScreenTemplates(_ref2) {
|
|
|
64
63
|
per_page: -1
|
|
65
64
|
});
|
|
66
65
|
const browseAllLink = useLink({
|
|
67
|
-
postType
|
|
68
|
-
postId: undefined,
|
|
69
|
-
path: config[postType].path + '/all'
|
|
66
|
+
path: '/' + postType + '/all'
|
|
70
67
|
});
|
|
71
68
|
return createElement(SidebarNavigationScreen, {
|
|
72
|
-
path: config[postType].path,
|
|
73
69
|
title: config[postType].labels.title,
|
|
74
70
|
actions: !isMobileViewport && createElement(AddNewTemplate, {
|
|
75
71
|
templateType: postType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","config","wp_template","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__experimentalUseNavigator","useNavigator","__","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","config","wp_template","labels","title","loading","notFound","manage","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","records","templates","isResolving","isLoading","per_page","browseAllLink","path","className","length","map","template","id","rendered","slug"],"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,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;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAEX,EAAE,CAAE,WAAF,CADF;AAEPY,MAAAA,OAAO,EAAEZ,EAAE,CAAE,mBAAF,CAFJ;AAGPa,MAAAA,QAAQ,EAAEb,EAAE,CAAE,oBAAF,CAHL;AAIPc,MAAAA,MAAM,EAAEd,EAAE,CAAE,sBAAF;AAJH;AADI,GADC;AASde,EAAAA,gBAAgB,EAAE;AACjBL,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAEX,EAAE,CAAE,gBAAF,CADF;AAEPY,MAAAA,OAAO,EAAEZ,EAAE,CAAE,wBAAF,CAFJ;AAGPa,MAAAA,QAAQ,EAAEb,EAAE,CAAE,yBAAF,CAHL;AAIPc,MAAAA,MAAM,EAAEd,EAAE,CAAE,2BAAF;AAJH;AADS;AATJ,CAAf;;AAmBA,MAAMgB,YAAY,GAAG,QAAsC;AAAA,MAApC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,MAAZ;AAAoB,OAAGC;AAAvB,GAAoC;AAC1D,QAAMC,QAAQ,GAAGf,OAAO,CAAE;AACzBY,IAAAA,QADyB;AAEzBC,IAAAA;AAFyB,GAAF,CAAxB;AAIA,SAAO,cAAC,qBAAD,eAA4BE,QAA5B,EAA4CD,KAA5C,EAAP;AACA,CAND;;AAQA,eAAe,SAASE,gCAAT,GAA4C;AAC1D,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEL,MAAAA;AAAF;AADH,MAEFlB,YAAY,EAFhB;AAGA,QAAMwB,gBAAgB,GAAGpB,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAAzC;AAEA,QAAM;AAAEqB,IAAAA,OAAO,EAAEC,SAAX;AAAsBC,IAAAA,WAAW,EAAEC;AAAnC,MAAiD1B,gBAAgB,CACtE,UADsE,EAEtEgB,QAFsE,EAGtE;AACCW,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAHsE,CAAvE;AAQA,QAAMC,aAAa,GAAGxB,OAAO,CAAE;AAC9ByB,IAAAA,IAAI,EAAE,MAAMb,QAAN,GAAiB;AADO,GAAF,CAA7B;AAIA,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGT,MAAM,CAAES,QAAF,CAAN,CAAmBP,MAAnB,CAA0BC,KADnC;AAEC,IAAA,OAAO,EACN,CAAEY,gBAAF,IACC,cAAC,cAAD;AACC,MAAA,YAAY,EAAGN,QADhB;AAEC,MAAA,WAAW,EAAG;AACbc,QAAAA,SAAS,EACR;AAFY;AAFf,MAJH;AAaC,IAAA,OAAO,EACN,8BACGJ,SAAS,IAAInB,MAAM,CAAES,QAAF,CAAN,CAAmBP,MAAnB,CAA0BE,OAD1C,EAEG,CAAEe,SAAF,IACD,cAAC,SAAD,QACG,EAAEF,SAAF,aAAEA,SAAF,eAAEA,SAAS,CAAEO,MAAb,KACD,cAAC,IAAD,QACGxB,MAAM,CAAES,QAAF,CAAN,CAAmBP,MAAnB,CAA0BG,QAD7B,CAFF,EAMG,CAAEY,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAe,EAAf,EAAoBQ,GAApB,CAA2BC,QAAF;AAAA;;AAAA,aAC1B,cAAC,YAAD;AACC,QAAA,QAAQ,EAAGjB,QADZ;AAEC,QAAA,MAAM,EAAGiB,QAAQ,CAACC,EAFnB;AAGC,QAAA,GAAG,EAAGD,QAAQ,CAACC;AAHhB,SAKGjC,cAAc,CACf,oBAAAgC,QAAQ,CAACvB,KAAT,oEAAgByB,QAAhB,KACCF,QAAQ,CAACG,IAFK,CALjB,CAD0B;AAAA,KAAzB,CANH,EAkBG,CAAEd,gBAAF,IACD,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC;AADX,OAEMM,aAFN;AAGC,MAAA,QAAQ,EACPrB,MAAM,CAAES,QAAF,CAAN,CAAmBP,MAAnB,CAA0BI;AAJ5B,OAnBF,CAHF;AAdF,IADD;AAmDA","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 { 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';\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},\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},\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\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\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tactions={\n\t\t\t\t! isMobileViewport && (\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\tclassName:\n\t\t\t\t\t\t\t\t'edit-site-sidebar-navigation-screen-templates__add-button',\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{ ( templates ?? [] ).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"]}
|
|
@@ -4,6 +4,7 @@ import { createElement } from "@wordpress/element";
|
|
|
4
4
|
* WordPress dependencies
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
7
8
|
/**
|
|
8
9
|
* Internal dependencies
|
|
9
10
|
*/
|
|
@@ -11,20 +12,19 @@ import { __ } from '@wordpress/i18n';
|
|
|
11
12
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
13
|
const config = {
|
|
13
14
|
wp_template: {
|
|
14
|
-
path: '/templates/all',
|
|
15
15
|
title: __('All templates')
|
|
16
16
|
},
|
|
17
17
|
wp_template_part: {
|
|
18
|
-
path: '/template-parts/all',
|
|
19
18
|
title: __('All template parts')
|
|
20
19
|
}
|
|
21
20
|
};
|
|
22
|
-
export default function SidebarNavigationScreenTemplatesBrowse(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
22
|
+
const {
|
|
23
|
+
params: {
|
|
24
|
+
postType
|
|
25
|
+
}
|
|
26
|
+
} = useNavigator();
|
|
26
27
|
return createElement(SidebarNavigationScreen, {
|
|
27
|
-
path: config[postType].path,
|
|
28
28
|
title: config[postType].title
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","SidebarNavigationScreen","config","wp_template","
|
|
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;AADG,GADC;AAIdO,EAAAA,gBAAgB,EAAE;AACjBD,IAAAA,KAAK,EAAEN,EAAE,CAAE,oBAAF;AADQ;AAJJ,CAAf;AASA,eAAe,SAASQ,sCAAT,GAAkD;AAChE,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEFR,YAAY,EAFhB;AAGA,SAAO,cAAC,uBAAD;AAAyB,IAAA,KAAK,EAAGE,MAAM,CAAEM,QAAF,CAAN,CAAmBJ;AAApD,IAAP;AACA","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},\n\twp_template_part: {\n\t\ttitle: __( 'All template parts' ),\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\treturn <SidebarNavigationScreen title={ config[ postType ].title } />;\n}\n"]}
|
|
@@ -14,8 +14,7 @@ export default function useInitEditedEntityFromURL() {
|
|
|
14
14
|
const {
|
|
15
15
|
params: {
|
|
16
16
|
postId,
|
|
17
|
-
postType
|
|
18
|
-
path = '/'
|
|
17
|
+
postType
|
|
19
18
|
} = {}
|
|
20
19
|
} = useLocation();
|
|
21
20
|
const {
|
|
@@ -37,40 +36,43 @@ export default function useInitEditedEntityFromURL() {
|
|
|
37
36
|
setPage
|
|
38
37
|
} = useDispatch(editSiteStore);
|
|
39
38
|
useEffect(() => {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
if (postType && postId && // This is just a special case to support old WP versions that perform redirects.
|
|
40
|
+
// This code should be removed when we minimum WP version becomes 6.2.
|
|
41
|
+
postId !== 'none') {
|
|
42
|
+
switch (postType) {
|
|
43
|
+
case 'wp_template':
|
|
44
|
+
setTemplate(postId);
|
|
45
|
+
break;
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
case 'wp_template_part':
|
|
48
|
+
setTemplatePart(postId);
|
|
49
|
+
break;
|
|
48
50
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
default:
|
|
52
|
+
setPage({
|
|
53
|
+
context: {
|
|
54
|
+
postType,
|
|
55
|
+
postId
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
} else if (!isRequestingSite) {
|
|
68
|
-
setPage({
|
|
69
|
-
path: '/'
|
|
70
|
-
});
|
|
71
|
-
}
|
|
60
|
+
return;
|
|
61
|
+
} // In all other cases, we need to set the home page in the site editor view.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
if (homepageId) {
|
|
65
|
+
setPage({
|
|
66
|
+
context: {
|
|
67
|
+
postType: 'page',
|
|
68
|
+
postId: homepageId
|
|
72
69
|
}
|
|
70
|
+
});
|
|
71
|
+
} else if (!isRequestingSite) {
|
|
72
|
+
setPage({
|
|
73
|
+
path: '/'
|
|
74
|
+
});
|
|
73
75
|
}
|
|
74
|
-
}, [
|
|
76
|
+
}, [postId, postType, homepageId, isRequestingSite, setPage, setTemplate, setTemplatePart]);
|
|
75
77
|
}
|
|
76
78
|
//# sourceMappingURL=use-init-edited-entity-from-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"names":["useEffect","useSelect","useDispatch","store","coreDataStore","useLocation","editSiteStore","useInitEditedEntityFromURL","params","postId","postType","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"names":["useEffect","useSelect","useDispatch","store","coreDataStore","useLocation","editSiteStore","useInitEditedEntityFromURL","params","postId","postType","isRequestingSite","homepageId","select","getSite","siteData","show_on_front","page_on_front","setTemplate","setTemplatePart","setPage","context","path"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AAEA;AACA;AACA;;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,SAASF,KAAK,IAAIG,aAAlB,QAAuC,aAAvC;AAEA,eAAe,SAASC,0BAAT,GAAsC;AACpD,QAAM;AAAEC,IAAAA,MAAM,EAAE;AAAEC,MAAAA,MAAF;AAAUC,MAAAA;AAAV,QAAuB;AAAjC,MAAwCL,WAAW,EAAzD;AACA,QAAM;AAAEM,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAmCX,SAAS,CAAIY,MAAF,IAAc;AACjE,UAAM;AAAEC,MAAAA;AAAF,QAAcD,MAAM,CAAET,aAAF,CAA1B;AACA,UAAMW,QAAQ,GAAGD,OAAO,EAAxB;AAEA,WAAO;AACNH,MAAAA,gBAAgB,EAAE,CAAEI,QADd;AAENH,MAAAA,UAAU,EACT,CAAAG,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEC,aAAV,MAA4B,MAA5B,GACGD,QAAQ,CAACE,aADZ,GAEG;AALE,KAAP;AAOA,GAXiD,EAW/C,EAX+C,CAAlD;AAaA,QAAM;AAAEC,IAAAA,WAAF;AAAeC,IAAAA,eAAf;AAAgCC,IAAAA;AAAhC,MACLlB,WAAW,CAAEI,aAAF,CADZ;AAGAN,EAAAA,SAAS,CAAE,MAAM;AAChB,QACCU,QAAQ,IACRD,MADA,IAEA;AACA;AACAA,IAAAA,MAAM,KAAK,MALZ,EAME;AACD,cAASC,QAAT;AACC,aAAK,aAAL;AACCQ,UAAAA,WAAW,CAAET,MAAF,CAAX;AACA;;AACD,aAAK,kBAAL;AACCU,UAAAA,eAAe,CAAEV,MAAF,CAAf;AACA;;AACD;AACCW,UAAAA,OAAO,CAAE;AACRC,YAAAA,OAAO,EAAE;AAAEX,cAAAA,QAAF;AAAYD,cAAAA;AAAZ;AADD,WAAF,CAAP;AARF;;AAaA;AACA,KAtBe,CAwBhB;;;AACA,QAAKG,UAAL,EAAkB;AACjBQ,MAAAA,OAAO,CAAE;AACRC,QAAAA,OAAO,EAAE;AAAEX,UAAAA,QAAQ,EAAE,MAAZ;AAAoBD,UAAAA,MAAM,EAAEG;AAA5B;AADD,OAAF,CAAP;AAGA,KAJD,MAIO,IAAK,CAAED,gBAAP,EAA0B;AAChCS,MAAAA,OAAO,CAAE;AACRE,QAAAA,IAAI,EAAE;AADE,OAAF,CAAP;AAGA;AACD,GAlCQ,EAkCN,CACFb,MADE,EAEFC,QAFE,EAGFE,UAHE,EAIFD,gBAJE,EAKFS,OALE,EAMFF,WANE,EAOFC,eAPE,CAlCM,CAAT;AA2CA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useLocation } from '../routes';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params: { postId, postType } = {} } = useLocation();\n\tconst { isRequestingSite, homepageId } = useSelect( ( select ) => {\n\t\tconst { getSite } = select( coreDataStore );\n\t\tconst siteData = getSite();\n\n\t\treturn {\n\t\t\tisRequestingSite: ! siteData,\n\t\t\thomepageId:\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? siteData.page_on_front\n\t\t\t\t\t: null,\n\t\t};\n\t}, [] );\n\n\tconst { setTemplate, setTemplatePart, setPage } =\n\t\tuseDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif (\n\t\t\tpostType &&\n\t\t\tpostId &&\n\t\t\t// This is just a special case to support old WP versions that perform redirects.\n\t\t\t// This code should be removed when we minimum WP version becomes 6.2.\n\t\t\tpostId !== 'none'\n\t\t) {\n\t\t\tswitch ( postType ) {\n\t\t\t\tcase 'wp_template':\n\t\t\t\t\tsetTemplate( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'wp_template_part':\n\t\t\t\t\tsetTemplatePart( postId );\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tsetPage( {\n\t\t\t\t\t\tcontext: { postType, postId },\n\t\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// In all other cases, we need to set the home page in the site editor view.\n\t\tif ( homepageId ) {\n\t\t\tsetPage( {\n\t\t\t\tcontext: { postType: 'page', postId: homepageId },\n\t\t\t} );\n\t\t} else if ( ! isRequestingSite ) {\n\t\t\tsetPage( {\n\t\t\t\tpath: '/',\n\t\t\t} );\n\t\t}\n\t}, [\n\t\tpostId,\n\t\tpostType,\n\t\thomepageId,\n\t\tisRequestingSite,\n\t\tsetPage,\n\t\tsetTemplate,\n\t\tsetTemplatePart,\n\t] );\n}\n"]}
|