@wordpress/edit-site 5.3.4 → 5.3.6
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/add-custom-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- 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/editor/index.js +3 -3
- package/build/components/editor/index.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/screen-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.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/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +5 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +41 -42
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/table.js +3 -2
- 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-button/index.js +5 -2
- package/build/components/save-button/index.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 +28 -35
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- 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 +10 -10
- 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 +17 -16
- 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 +9 -19
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +25 -15
- 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/style-book/index.js +17 -2
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- 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 +65 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +7 -9
- package/build/components/template-details/index.js.map +1 -1
- package/build/index.js +10 -22
- package/build/index.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/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- 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/editor/index.js +3 -3
- package/build-module/components/editor/index.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/screen-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.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/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +3 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +43 -44
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/table.js +3 -2
- 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-button/index.js +5 -2
- package/build-module/components/save-button/index.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 +25 -35
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- 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 +8 -11
- 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 +16 -17
- 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 +8 -18
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +23 -16
- 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/style-book/index.js +17 -3
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- 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 +63 -18
- 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 +7 -8
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/index.js +12 -22
- package/build-module/index.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 +41 -38
- package/build-style/style.css +41 -38
- package/package.json +21 -21
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +3 -6
- package/src/components/add-new-template/style.scss +0 -5
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +4 -3
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/screen-border.js +1 -1
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +4 -0
- package/src/components/layout/style.scss +8 -1
- package/src/components/list/added-by.js +48 -55
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +4 -5
- package/src/components/navigation-inspector/navigation-menu.js +8 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +34 -29
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +23 -0
- 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 -38
- package/src/components/sidebar-navigation-screen/style.scss +1 -9
- package/src/components/sidebar-navigation-screen-main/index.js +3 -3
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +24 -20
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +0 -2
- package/src/components/sidebar-navigation-screen-template/index.js +7 -19
- package/src/components/sidebar-navigation-screen-templates/index.js +22 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +6 -11
- package/src/components/style-book/index.js +25 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +72 -17
- package/src/components/template-details/index.js +5 -6
- package/src/index.js +6 -21
- package/src/style.scss +1 -0
- 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
|
|
6
|
+
import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalNavigatorToParentButton as NavigatorToParentButton } 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';
|
|
@@ -13,9 +13,10 @@ import { useSelect } from '@wordpress/data';
|
|
|
13
13
|
|
|
14
14
|
import { store as editSiteStore } from '../../store';
|
|
15
15
|
import { unlock } from '../../private-apis';
|
|
16
|
+
import SidebarButton from '../sidebar-button';
|
|
16
17
|
export default function SidebarNavigationScreen(_ref) {
|
|
17
18
|
let {
|
|
18
|
-
|
|
19
|
+
isRoot,
|
|
19
20
|
title,
|
|
20
21
|
actions,
|
|
21
22
|
content
|
|
@@ -30,21 +31,17 @@ export default function SidebarNavigationScreen(_ref) {
|
|
|
30
31
|
dashboardLink: getSettings().__experimentalDashboardLink
|
|
31
32
|
};
|
|
32
33
|
}, []);
|
|
33
|
-
return createElement(
|
|
34
|
-
className: "edit-site-sidebar-navigation-screen",
|
|
35
|
-
path: path
|
|
36
|
-
}, createElement(VStack, {
|
|
34
|
+
return createElement(VStack, {
|
|
37
35
|
spacing: 2
|
|
38
36
|
}, createElement(HStack, {
|
|
39
37
|
spacing: 4,
|
|
40
38
|
justify: "flex-start",
|
|
41
39
|
className: "edit-site-sidebar-navigation-screen__title-icon"
|
|
42
|
-
},
|
|
43
|
-
|
|
40
|
+
}, !isRoot ? createElement(NavigatorToParentButton, {
|
|
41
|
+
as: SidebarButton,
|
|
44
42
|
icon: isRTL() ? chevronRight : chevronLeft,
|
|
45
43
|
"aria-label": __('Back')
|
|
46
|
-
}) : createElement(
|
|
47
|
-
className: "edit-site-sidebar-navigation-screen__back",
|
|
44
|
+
}) : createElement(SidebarButton, {
|
|
48
45
|
icon: isRTL() ? chevronRight : chevronLeft,
|
|
49
46
|
"aria-label": __('Navigate to the Dashboard'),
|
|
50
47
|
href: dashboardLink || 'index.php',
|
|
@@ -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","
|
|
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,OAKX;AAAA,MAL6C;AAChDC,IAAAA,MADgD;AAEhDC,IAAAA,KAFgD;AAGhDC,IAAAA,OAHgD;AAIhDC,IAAAA;AAJgD,GAK7C;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBV,SAAS,CAAIW,MAAF,IAAc;AAClD,UAAM;AAAEC,MAAAA;AAAF,QAAkBT,MAAM,CAAEQ,MAAM,CAAET,aAAF,CAAR,CAA9B;AACA,WAAO;AACNQ,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,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,EAAGa,aAAa,IAAI,WAHzB;AAIC,IAAA,KAAK,EAAGb,EAAE,CAAE,WAAF;AAJX,IAZF,EAmBC;AAAI,IAAA,SAAS,EAAC;AAAd,KACGU,KADH,CAnBD,EAsBGC,OAtBH,CADD,EA0BC;AAAK,IAAA,SAAS,EAAC;AAAf,KACGC,OADH,CA1BD,CADD;AAgCA","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} ) {\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{ 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,9 +5,10 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
-
import {
|
|
8
|
+
import { __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
|
+
import { pencil } from '@wordpress/icons';
|
|
11
12
|
/**
|
|
12
13
|
* Internal dependencies
|
|
13
14
|
*/
|
|
@@ -15,40 +16,38 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
15
16
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
16
17
|
import { unlock } from '../../private-apis';
|
|
17
18
|
import { store as editSiteStore } from '../../store';
|
|
19
|
+
import SidebarButton from '../sidebar-button';
|
|
18
20
|
export default function SidebarNavigationScreenNavigationItem() {
|
|
19
21
|
var _post$title, _post$description;
|
|
20
22
|
|
|
21
23
|
const {
|
|
22
24
|
setCanvasMode
|
|
23
25
|
} = unlock(useDispatch(editSiteStore));
|
|
26
|
+
const {
|
|
27
|
+
params: {
|
|
28
|
+
postType,
|
|
29
|
+
postId
|
|
30
|
+
}
|
|
31
|
+
} = useNavigator();
|
|
24
32
|
const {
|
|
25
33
|
post
|
|
26
34
|
} = useSelect(select => {
|
|
27
|
-
var _getEditedPostContext;
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
getEditedPostContext
|
|
31
|
-
} = select(editSiteStore);
|
|
32
35
|
const {
|
|
33
36
|
getEntityRecord
|
|
34
|
-
} = select(coreStore);
|
|
35
|
-
const {
|
|
36
|
-
postType,
|
|
37
|
-
postId
|
|
38
|
-
} = (_getEditedPostContext = getEditedPostContext()) !== null && _getEditedPostContext !== void 0 ? _getEditedPostContext : {}; // The currently selected entity to display.
|
|
37
|
+
} = select(coreStore); // The currently selected entity to display.
|
|
39
38
|
// Typically template or template part in the site editor.
|
|
40
39
|
|
|
41
40
|
return {
|
|
42
41
|
post: postId && postType ? getEntityRecord('postType', postType, postId) : null
|
|
43
42
|
};
|
|
44
|
-
}, []);
|
|
43
|
+
}, [postType, postId]);
|
|
45
44
|
return createElement(SidebarNavigationScreen, {
|
|
46
|
-
path: "/navigation/single",
|
|
47
45
|
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
|
-
actions: createElement(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
actions: createElement(SidebarButton, {
|
|
47
|
+
onClick: () => setCanvasMode('edit'),
|
|
48
|
+
label: __('Edit'),
|
|
49
|
+
icon: pencil
|
|
50
|
+
}),
|
|
52
51
|
content: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$description = post.description) === null || _post$description === void 0 ? void 0 : _post$description.rendered) : null
|
|
53
52
|
});
|
|
54
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","__experimentalUseNavigator","useNavigator","store","coreStore","decodeEntities","pencil","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","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,SAASC,0BAA0B,IAAIC,YAAvC,QAA2D,uBAA3D;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;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,SAASL,KAAK,IAAIM,aAAlB,QAAuC,aAAvC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AAEA,eAAe,SAASC,qCAAT,GAAiD;AAAA;;AAC/D,QAAM;AAAEC,IAAAA;AAAF,MAAoBJ,MAAM,CAAET,WAAW,CAAEU,aAAF,CAAb,CAAhC;AACA,QAAM;AACLI,IAAAA,MAAM,EAAE;AAAEC,MAAAA,QAAF;AAAYC,MAAAA;AAAZ;AADH,MAEFb,YAAY,EAFhB;AAIA,QAAM;AAAEc,IAAAA;AAAF,MAAWhB,SAAS,CACvBiB,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA;AAAF,QAAsBD,MAAM,CAAEb,SAAF,CAAlC,CADa,CAGb;AACA;;AACA,WAAO;AACNY,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,GAAGX,cAAc,CAAEW,IAAF,aAAEA,IAAF,sCAAEA,IAAI,CAAEG,KAAR,gDAAE,YAAaC,QAAf,CAAjB,GAA6C,IAD1D;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMR,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGd,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGQ;AAHR,MAHF;AASC,IAAA,OAAO,EACNU,IAAI,GAAGX,cAAc,CAAEW,IAAF,aAAEA,IAAF,4CAAEA,IAAI,CAAEK,WAAR,sDAAE,kBAAmBD,QAArB,CAAjB,GAAmD;AAVzD,IADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { store as coreStore } 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\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<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\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"]}
|
|
@@ -5,7 +5,7 @@ import { createElement } from "@wordpress/element";
|
|
|
5
5
|
*/
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { useDispatch } from '@wordpress/data';
|
|
8
|
-
import {
|
|
8
|
+
import { pencil } from '@wordpress/icons';
|
|
9
9
|
/**
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
@@ -14,18 +14,8 @@ 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
|
-
|
|
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
|
+
import SidebarButton from '../sidebar-button';
|
|
18
|
+
export default function SidebarNavigationScreenTemplate() {
|
|
29
19
|
const {
|
|
30
20
|
setCanvasMode
|
|
31
21
|
} = unlock(useDispatch(editSiteStore));
|
|
@@ -41,12 +31,12 @@ export default function SidebarNavigationScreenTemplate(_ref) {
|
|
|
41
31
|
}
|
|
42
32
|
|
|
43
33
|
return createElement(SidebarNavigationScreen, {
|
|
44
|
-
path: config[postType].path,
|
|
45
34
|
title: getTitle(),
|
|
46
|
-
actions: createElement(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
actions: createElement(SidebarButton, {
|
|
36
|
+
onClick: () => setCanvasMode('edit'),
|
|
37
|
+
label: __('Edit'),
|
|
38
|
+
icon: pencil
|
|
39
|
+
}),
|
|
50
40
|
content: description ? createElement("p", null, description) : undefined
|
|
51
41
|
});
|
|
52
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","useDispatch","
|
|
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","is_custom","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,kBAAvB;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,MAAoBL,MAAM,CAAEJ,WAAW,CAAEM,aAAF,CAAb,CAAhC;AACA,QAAM;AAAEI,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCT,qBAAqB,EAAlE;AACA,MAAIU,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAF,IAAiBD,MAAM,CAACE,SAA7B,EAAyC;AACxCD,IAAAA,WAAW,GAAGd,EAAE,CACf,6EADe,CAAhB;AAGA;;AAED,SACC,cAAC,uBAAD;AACC,IAAA,KAAK,EAAGY,QAAQ,EADjB;AAEC,IAAA,OAAO,EACN,cAAC,aAAD;AACC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAGV,EAAE,CAAE,MAAF,CAFX;AAGC,MAAA,IAAI,EAAGE;AAHR,MAHF;AASC,IAAA,OAAO,EAAGY,WAAW,GAAG,yBAAKA,WAAL,CAAH,GAA4BE;AATlD,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\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 { 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<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\tcontent={ description ? <p>{ description }</p> : undefined }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -4,9 +4,10 @@ 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
|
+
import { useSelect } from '@wordpress/data';
|
|
10
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
12
13
|
/**
|
|
@@ -17,9 +18,10 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
|
17
18
|
import { useLink } from '../routes/link';
|
|
18
19
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
20
|
import AddNewTemplate from '../add-new-template';
|
|
21
|
+
import { store as editSiteStore } from '../../store';
|
|
22
|
+
import SidebarButton from '../sidebar-button';
|
|
20
23
|
const config = {
|
|
21
24
|
wp_template: {
|
|
22
|
-
path: '/templates',
|
|
23
25
|
labels: {
|
|
24
26
|
title: __('Templates'),
|
|
25
27
|
loading: __('Loading templates'),
|
|
@@ -28,7 +30,6 @@ const config = {
|
|
|
28
30
|
}
|
|
29
31
|
},
|
|
30
32
|
wp_template_part: {
|
|
31
|
-
path: '/template-parts',
|
|
32
33
|
labels: {
|
|
33
34
|
title: __('Template parts'),
|
|
34
35
|
loading: __('Loading template parts'),
|
|
@@ -46,38 +47,44 @@ const TemplateItem = _ref => {
|
|
|
46
47
|
} = _ref;
|
|
47
48
|
const linkInfo = useLink({
|
|
48
49
|
postType,
|
|
49
|
-
postId
|
|
50
|
-
path: config[postType].path + '/single'
|
|
50
|
+
postId
|
|
51
51
|
});
|
|
52
52
|
return createElement(SidebarNavigationItem, _extends({}, linkInfo, props));
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
export default function SidebarNavigationScreenTemplates(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
export default function SidebarNavigationScreenTemplates() {
|
|
56
|
+
const {
|
|
57
|
+
params: {
|
|
58
|
+
postType
|
|
59
|
+
}
|
|
60
|
+
} = useNavigator();
|
|
59
61
|
const isMobileViewport = useViewportMatch('medium', '<');
|
|
62
|
+
const isTemplatePartsMode = useSelect(select => {
|
|
63
|
+
const settings = select(editSiteStore).getSettings();
|
|
64
|
+
return !!settings.supportsTemplatePartsMode;
|
|
65
|
+
}, []);
|
|
60
66
|
const {
|
|
61
67
|
records: templates,
|
|
62
68
|
isResolving: isLoading
|
|
63
69
|
} = useEntityRecords('postType', postType, {
|
|
64
70
|
per_page: -1
|
|
65
71
|
});
|
|
72
|
+
const sortedTemplates = templates ? [...templates] : [];
|
|
73
|
+
sortedTemplates.sort((a, b) => a.slug.localeCompare(b.slug));
|
|
66
74
|
const browseAllLink = useLink({
|
|
67
|
-
postType
|
|
68
|
-
postId: undefined,
|
|
69
|
-
path: config[postType].path + '/all'
|
|
75
|
+
path: '/' + postType + '/all'
|
|
70
76
|
});
|
|
77
|
+
const canCreate = !isMobileViewport && !isTemplatePartsMode;
|
|
71
78
|
return createElement(SidebarNavigationScreen, {
|
|
72
|
-
|
|
79
|
+
isRoot: isTemplatePartsMode,
|
|
73
80
|
title: config[postType].labels.title,
|
|
74
|
-
actions:
|
|
81
|
+
actions: canCreate && createElement(AddNewTemplate, {
|
|
75
82
|
templateType: postType,
|
|
76
83
|
toggleProps: {
|
|
77
|
-
|
|
84
|
+
as: SidebarButton
|
|
78
85
|
}
|
|
79
86
|
}),
|
|
80
|
-
content: createElement(Fragment, null, isLoading && config[postType].labels.loading, !isLoading && createElement(ItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && createElement(Item, null, config[postType].labels.notFound),
|
|
87
|
+
content: createElement(Fragment, null, isLoading && config[postType].labels.loading, !isLoading && createElement(ItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && createElement(Item, null, config[postType].labels.notFound), sortedTemplates.map(template => {
|
|
81
88
|
var _template$title;
|
|
82
89
|
|
|
83
90
|
return createElement(TemplateItem, {
|
|
@@ -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","
|
|
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;AAJH;AADI,GADC;AASdmB,EAAAA,gBAAgB,EAAE;AACjBL,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAEf,EAAE,CAAE,gBAAF,CADF;AAEPgB,MAAAA,OAAO,EAAEhB,EAAE,CAAE,wBAAF,CAFJ;AAGPiB,MAAAA,QAAQ,EAAEjB,EAAE,CAAE,yBAAF,CAHL;AAIPkB,MAAAA,MAAM,EAAElB,EAAE,CAAE,2BAAF;AAJH;AADS;AATJ,CAAf;;AAmBA,MAAMoB,YAAY,GAAG,QAAsC;AAAA,MAApC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,MAAZ;AAAoB,OAAGC;AAAvB,GAAoC;AAC1D,QAAMC,QAAQ,GAAGlB,OAAO,CAAE;AACzBe,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,MAEFtB,YAAY,EAFhB;AAGA,QAAM4B,gBAAgB,GAAGvB,gBAAgB,CAAE,QAAF,EAAY,GAAZ,CAAzC;AACA,QAAMwB,mBAAmB,GAAG1B,SAAS,CAAI2B,MAAF,IAAc;AACpD,UAAMC,QAAQ,GAAGD,MAAM,CAAEnB,aAAF,CAAN,CAAwBqB,WAAxB,EAAjB;AAEA,WAAO,CAAC,CAAED,QAAQ,CAACE,yBAAnB;AACA,GAJoC,EAIlC,EAJkC,CAArC;AAMA,QAAM;AAAEC,IAAAA,OAAO,EAAEC,SAAX;AAAsBC,IAAAA,WAAW,EAAEC;AAAnC,MAAiDnC,gBAAgB,CACtE,UADsE,EAEtEoB,QAFsE,EAGtE;AACCgB,IAAAA,QAAQ,EAAE,CAAC;AADZ,GAHsE,CAAvE;AAOA,QAAMC,eAAe,GAAGJ,SAAS,GAAG,CAAE,GAAGA,SAAL,CAAH,GAAsB,EAAvD;AACAI,EAAAA,eAAe,CAACC,IAAhB,CAAsB,CAAEC,CAAF,EAAKC,CAAL,KAAYD,CAAC,CAACE,IAAF,CAAOC,aAAP,CAAsBF,CAAC,CAACC,IAAxB,CAAlC;AAEA,QAAME,aAAa,GAAGtC,OAAO,CAAE;AAC9BuC,IAAAA,IAAI,EAAE,MAAMxB,QAAN,GAAiB;AADO,GAAF,CAA7B;AAIA,QAAMyB,SAAS,GAAG,CAAEnB,gBAAF,IAAsB,CAAEC,mBAA1C;AAEA,SACC,cAAC,uBAAD;AACC,IAAA,MAAM,EAAGA,mBADV;AAEC,IAAA,KAAK,EAAGhB,MAAM,CAAES,QAAF,CAAN,CAAmBP,MAAnB,CAA0BC,KAFnC;AAGC,IAAA,OAAO,EACN+B,SAAS,IACR,cAAC,cAAD;AACC,MAAA,YAAY,EAAGzB,QADhB;AAEC,MAAA,WAAW,EAAG;AACb0B,QAAAA,EAAE,EAAEpC;AADS;AAFf,MALH;AAaC,IAAA,OAAO,EACN,8BACGyB,SAAS,IAAIxB,MAAM,CAAES,QAAF,CAAN,CAAmBP,MAAnB,CAA0BE,OAD1C,EAEG,CAAEoB,SAAF,IACD,cAAC,SAAD,QACG,EAAEF,SAAF,aAAEA,SAAF,eAAEA,SAAS,CAAEc,MAAb,KACD,cAAC,IAAD,QACGpC,MAAM,CAAES,QAAF,CAAN,CAAmBP,MAAnB,CAA0BG,QAD7B,CAFF,EAMGqB,eAAe,CAACW,GAAhB,CAAuBC,QAAF;AAAA;;AAAA,aACtB,cAAC,YAAD;AACC,QAAA,QAAQ,EAAG7B,QADZ;AAEC,QAAA,MAAM,EAAG6B,QAAQ,CAACC,EAFnB;AAGC,QAAA,GAAG,EAAGD,QAAQ,CAACC;AAHhB,SAKGhD,cAAc,CACf,oBAAA+C,QAAQ,CAACnC,KAAT,oEAAgBqC,QAAhB,KACCF,QAAQ,CAACR,IAFK,CALjB,CADsB;AAAA,KAArB,CANH,EAkBG,CAAEf,gBAAF,IACD,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC;AADX,OAEMiB,aAFN;AAGC,MAAA,QAAQ,EACPhC,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 { 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},\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\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\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"]}
|
|
@@ -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"]}
|
|
@@ -13,8 +13,9 @@ import { __, sprintf } from '@wordpress/i18n';
|
|
|
13
13
|
import { getCategories, getBlockTypes, getBlockFromExample, createBlock } from '@wordpress/blocks';
|
|
14
14
|
import { BlockPreview, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
15
15
|
import { closeSmall } from '@wordpress/icons';
|
|
16
|
-
import { useResizeObserver } from '@wordpress/compose';
|
|
16
|
+
import { useResizeObserver, useFocusOnMount, useFocusReturn, useMergeRefs } from '@wordpress/compose';
|
|
17
17
|
import { useMemo, memo } from '@wordpress/element';
|
|
18
|
+
import { ESCAPE } from '@wordpress/keycodes';
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
20
21
|
*/
|
|
@@ -76,6 +77,8 @@ function StyleBook(_ref) {
|
|
|
76
77
|
onClose
|
|
77
78
|
} = _ref;
|
|
78
79
|
const [resizeObserver, sizes] = useResizeObserver();
|
|
80
|
+
const focusOnMountRef = useFocusOnMount('firstElement');
|
|
81
|
+
const sectionFocusReturnRef = useFocusReturn();
|
|
79
82
|
const [textColor] = useGlobalStyle('color.text');
|
|
80
83
|
const [backgroundColor] = useGlobalStyle('color.background');
|
|
81
84
|
const examples = useMemo(getExamples, []);
|
|
@@ -84,6 +87,14 @@ function StyleBook(_ref) {
|
|
|
84
87
|
title: category.title,
|
|
85
88
|
icon: category.icon
|
|
86
89
|
})), [examples]);
|
|
90
|
+
|
|
91
|
+
function closeOnEscape(event) {
|
|
92
|
+
if (event.keyCode === ESCAPE && !event.defaultPrevented) {
|
|
93
|
+
event.preventDefault();
|
|
94
|
+
onClose();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
87
98
|
return createElement(StyleBookFill, null, createElement("section", {
|
|
88
99
|
className: classnames('edit-site-style-book', {
|
|
89
100
|
'is-wide': sizes.width > 600
|
|
@@ -92,12 +103,15 @@ function StyleBook(_ref) {
|
|
|
92
103
|
color: textColor,
|
|
93
104
|
background: backgroundColor
|
|
94
105
|
},
|
|
95
|
-
"aria-label": __('Style Book')
|
|
106
|
+
"aria-label": __('Style Book'),
|
|
107
|
+
onKeyDown: closeOnEscape,
|
|
108
|
+
ref: useMergeRefs([sectionFocusReturnRef, focusOnMountRef])
|
|
96
109
|
}, resizeObserver, createElement(Button, {
|
|
97
110
|
className: "edit-site-style-book__close-button",
|
|
98
111
|
icon: closeSmall,
|
|
99
112
|
label: __('Close Style Book'),
|
|
100
|
-
onClick: onClose
|
|
113
|
+
onClick: onClose,
|
|
114
|
+
showTooltip: false
|
|
101
115
|
}), createElement(TabPanel, {
|
|
102
116
|
className: "edit-site-style-book__tab-panel",
|
|
103
117
|
tabs: tabs
|