@wordpress/edit-site 5.3.2 → 5.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -0
- package/build/components/add-new-template/new-template-part.js +8 -5
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +8 -5
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +3 -3
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +3 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +25 -23
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -2
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +2 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/custom-css.js +2 -2
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +2 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +2 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +1 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +1 -1
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +2 -2
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +2 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +2 -2
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +2 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +2 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +5 -5
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +2 -2
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +2 -2
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -2
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +2 -2
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +2 -2
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +2 -2
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +3 -10
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +2 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -3
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js +10 -23
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +1 -1
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/table.js +1 -0
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +2 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-panel/index.js +4 -3
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +17 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +28 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +72 -0
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +70 -0
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +32 -82
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +43 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build/components/site-hub/index.js +14 -49
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +10 -3
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -20
- 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-canvas-mode-with-url.js +3 -3
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +12 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +6 -2
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/{experiments.js → private-apis.js} +3 -3
- package/build/private-apis.js.map +1 -0
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/utils/get-is-list-page.js +5 -6
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +7 -4
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +7 -4
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +3 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +25 -24
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +3 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +3 -3
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -3
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +3 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +2 -2
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +3 -3
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +3 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -3
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +3 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +5 -5
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +3 -3
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +3 -3
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +3 -3
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +3 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -3
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +3 -3
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +3 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +3 -3
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -11
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +3 -3
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -3
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +10 -23
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +1 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/table.js +1 -0
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +3 -3
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-panel/index.js +3 -2
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +14 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +27 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +55 -0
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +53 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +34 -81
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +14 -46
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +11 -4
- 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 +55 -21
- 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-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +11 -11
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +6 -2
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/{experiments.js → private-apis.js} +2 -2
- package/build-module/private-apis.js.map +1 -0
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +5 -6
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +18 -37
- package/build-style/style.css +18 -37
- package/package.json +20 -20
- package/src/components/add-new-template/new-template-part.js +7 -4
- package/src/components/add-new-template/new-template.js +8 -6
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/index.js +3 -3
- package/src/components/editor/index.js +29 -28
- package/src/components/global-styles/border-panel.js +3 -3
- package/src/components/global-styles/color-palette-panel.js +3 -3
- package/src/components/global-styles/custom-css.js +3 -3
- package/src/components/global-styles/dimensions-panel.js +3 -3
- package/src/components/global-styles/global-styles-provider.js +3 -3
- package/src/components/global-styles/gradients-palette-panel.js +3 -3
- package/src/components/global-styles/header.js +2 -2
- package/src/components/global-styles/hooks.js +3 -3
- package/src/components/global-styles/navigation-button.js +4 -2
- package/src/components/global-styles/palette.js +3 -3
- package/src/components/global-styles/preview.js +3 -3
- package/src/components/global-styles/screen-background-color.js +3 -3
- package/src/components/global-styles/screen-button-color.js +3 -3
- package/src/components/global-styles/screen-colors.js +3 -3
- package/src/components/global-styles/screen-css.js +14 -7
- package/src/components/global-styles/screen-heading-color.js +3 -3
- package/src/components/global-styles/screen-link-color.js +3 -3
- package/src/components/global-styles/screen-root.js +3 -3
- package/src/components/global-styles/screen-style-variations.js +3 -3
- package/src/components/global-styles/screen-text-color.js +3 -3
- package/src/components/global-styles/screen-typography.js +3 -3
- package/src/components/global-styles/shadow-panel.js +3 -3
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/global-styles/typography-panel.js +3 -3
- package/src/components/global-styles/typography-preview.js +3 -3
- package/src/components/global-styles/ui.js +3 -8
- package/src/components/global-styles-renderer/index.js +3 -3
- package/src/components/header-edit-mode/index.js +6 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/src/components/layout/index.js +35 -48
- package/src/components/layout/style.scss +11 -23
- package/src/components/list/actions/rename-menu-item.js +1 -1
- package/src/components/list/table.js +4 -0
- package/src/components/navigation-inspector/navigation-menu.js +3 -3
- package/src/components/save-panel/index.js +4 -1
- package/src/components/sidebar/index.js +10 -2
- package/src/components/sidebar-navigation-screen/index.js +27 -11
- package/src/components/sidebar-navigation-screen/style.scss +4 -6
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +52 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +1 -1
- package/src/components/sidebar-navigation-screen-template/index.js +52 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +49 -83
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/src/components/site-hub/index.js +67 -122
- package/src/components/site-hub/style.scss +1 -11
- package/src/components/style-book/index.js +11 -7
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +48 -14
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/src/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +10 -10
- package/src/components/use-edited-entity-record/index.js +6 -2
- package/src/hooks/push-changes-to-global-styles/index.js +3 -3
- package/src/{experiments.js → private-apis.js} +1 -1
- package/src/store/index.js +1 -1
- package/src/utils/get-is-list-page.js +5 -5
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build/experiments.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build-module/experiments.js.map +0 -1
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
useResizeObserver,
|
|
20
20
|
} from '@wordpress/compose';
|
|
21
21
|
import { __ } from '@wordpress/i18n';
|
|
22
|
-
import { useState,
|
|
22
|
+
import { useState, useRef } from '@wordpress/element';
|
|
23
23
|
import { NavigableRegion } from '@wordpress/interface';
|
|
24
24
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
25
25
|
|
|
@@ -38,7 +38,7 @@ import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-e
|
|
|
38
38
|
import SiteHub from '../site-hub';
|
|
39
39
|
import ResizeHandle from '../block-editor/resize-handle';
|
|
40
40
|
import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
|
|
41
|
-
import { unlock } from '../../
|
|
41
|
+
import { unlock } from '../../private-apis';
|
|
42
42
|
import SavePanel from '../save-panel';
|
|
43
43
|
|
|
44
44
|
const ANIMATION_DURATION = 0.5;
|
|
@@ -87,21 +87,20 @@ export default function Layout() {
|
|
|
87
87
|
} );
|
|
88
88
|
const disableMotion = useReducedMotion();
|
|
89
89
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
90
|
-
const [ isMobileCanvasVisible, setIsMobileCanvasVisible ] =
|
|
91
|
-
useState( false );
|
|
92
90
|
const canvasPadding = isMobileViewport ? 0 : 24;
|
|
93
91
|
const showSidebar =
|
|
94
|
-
( isMobileViewport && !
|
|
92
|
+
( isMobileViewport && ! isListPage ) ||
|
|
95
93
|
( ! isMobileViewport && ( canvasMode === 'view' || ! isEditorPage ) );
|
|
96
94
|
const showCanvas =
|
|
97
|
-
( isMobileViewport &&
|
|
95
|
+
( isMobileViewport && isEditorPage && canvasMode === 'edit' ) ||
|
|
96
|
+
! isMobileViewport ||
|
|
97
|
+
! isEditorPage;
|
|
98
98
|
const showFrame =
|
|
99
|
-
! isEditorPage
|
|
100
|
-
|
|
99
|
+
( ! isEditorPage && ! isMobileViewport ) ||
|
|
100
|
+
( ! isMobileViewport && isEditorPage && canvasMode === 'view' );
|
|
101
101
|
const isFullCanvas =
|
|
102
|
-
(
|
|
103
|
-
|
|
104
|
-
// Ideally this effect could be removed if we move the "isMobileCanvasVisible" into the store.
|
|
102
|
+
( isMobileViewport && isListPage ) ||
|
|
103
|
+
( isEditorPage && canvasMode === 'edit' );
|
|
105
104
|
const [ canvasResizer, canvasSize ] = useResizeObserver();
|
|
106
105
|
const [ fullResizer, fullSize ] = useResizeObserver();
|
|
107
106
|
const [ forcedWidth, setForcedWidth ] = useState( null );
|
|
@@ -112,15 +111,6 @@ export default function Layout() {
|
|
|
112
111
|
if ( showFrame && ! isResizing ) {
|
|
113
112
|
canvasWidth = canvasSize.width - canvasPadding;
|
|
114
113
|
}
|
|
115
|
-
useEffect( () => {
|
|
116
|
-
if ( canvasMode === 'view' && isMobileViewport ) {
|
|
117
|
-
setIsMobileCanvasVisible( false );
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if ( canvasMode === 'edit' && isMobileViewport ) {
|
|
121
|
-
setIsMobileCanvasVisible( true );
|
|
122
|
-
}
|
|
123
|
-
}, [ canvasMode, isMobileViewport ] );
|
|
124
114
|
|
|
125
115
|
// Synchronizing the URL with the store value of canvasMode happens in an effect
|
|
126
116
|
// This condition ensures the component is only rendered after the synchronization happens
|
|
@@ -153,37 +143,34 @@ export default function Layout() {
|
|
|
153
143
|
? forcedWidth - 48
|
|
154
144
|
: undefined,
|
|
155
145
|
} }
|
|
156
|
-
isMobileCanvasVisible={ isMobileCanvasVisible }
|
|
157
|
-
setIsMobileCanvasVisible={ setIsMobileCanvasVisible }
|
|
158
146
|
/>
|
|
159
147
|
|
|
160
148
|
<AnimatePresence initial={ false }>
|
|
161
|
-
{ isEditorPage &&
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
) }
|
|
149
|
+
{ isEditorPage && canvasMode === 'edit' && (
|
|
150
|
+
<NavigableRegion
|
|
151
|
+
className="edit-site-layout__header"
|
|
152
|
+
ariaLabel={ __( 'Editor top bar' ) }
|
|
153
|
+
as={ motion.div }
|
|
154
|
+
animate={ {
|
|
155
|
+
y: 0,
|
|
156
|
+
} }
|
|
157
|
+
initial={ {
|
|
158
|
+
y: '-100%',
|
|
159
|
+
} }
|
|
160
|
+
exit={ {
|
|
161
|
+
y: '-100%',
|
|
162
|
+
} }
|
|
163
|
+
transition={ {
|
|
164
|
+
type: 'tween',
|
|
165
|
+
duration: disableMotion
|
|
166
|
+
? 0
|
|
167
|
+
: ANIMATION_DURATION,
|
|
168
|
+
ease: 'easeOut',
|
|
169
|
+
} }
|
|
170
|
+
>
|
|
171
|
+
{ canvasMode === 'edit' && <Header /> }
|
|
172
|
+
</NavigableRegion>
|
|
173
|
+
) }
|
|
187
174
|
</AnimatePresence>
|
|
188
175
|
|
|
189
176
|
<div className="edit-site-layout__content">
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
$hub-height: $grid-unit-20 * 2 + $button-size;
|
|
2
|
-
|
|
3
1
|
.edit-site-layout {
|
|
4
2
|
height: 100%;
|
|
5
3
|
background: $gray-900;
|
|
@@ -10,24 +8,23 @@ $hub-height: $grid-unit-20 * 2 + $button-size;
|
|
|
10
8
|
|
|
11
9
|
.edit-site-layout__hub {
|
|
12
10
|
position: fixed;
|
|
13
|
-
top:
|
|
14
|
-
left:
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
15
13
|
width: calc(100vw - #{$canvas-padding * 2});
|
|
16
|
-
height: $
|
|
14
|
+
height: $header-height;
|
|
17
15
|
z-index: z-index(".edit-site-layout__hub");
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
.edit-site-layout.is-full-canvas.is-edit-mode & {
|
|
18
|
+
width: auto;
|
|
19
|
+
padding-right: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@include break-medium {
|
|
23
|
+
width: calc(#{$nav-sidebar-width} - #{$canvas-padding * 2});
|
|
24
|
+
}
|
|
24
25
|
|
|
25
26
|
.edit-site-layout.is-full-canvas & {
|
|
26
|
-
top: 0;
|
|
27
|
-
left: 0;
|
|
28
|
-
padding: 0;
|
|
29
27
|
padding-right: $grid-unit-20;
|
|
30
|
-
height: $header-height;
|
|
31
28
|
border-radius: 0;
|
|
32
29
|
width: 100vw;
|
|
33
30
|
box-shadow: none;
|
|
@@ -37,15 +34,6 @@ $hub-height: $grid-unit-20 * 2 + $button-size;
|
|
|
37
34
|
padding-right: 0;
|
|
38
35
|
}
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
.edit-site-layout.is-full-canvas.is-edit-mode & {
|
|
42
|
-
width: auto;
|
|
43
|
-
padding-right: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
@include break-medium {
|
|
47
|
-
width: calc(#{$nav-sidebar-width} - #{$canvas-padding * 2});
|
|
48
|
-
}
|
|
49
37
|
}
|
|
50
38
|
|
|
51
39
|
.edit-site-layout__header {
|
|
@@ -24,7 +24,7 @@ export default function RenameMenuItem( { template, onClose } ) {
|
|
|
24
24
|
const { createSuccessNotice, createErrorNotice } =
|
|
25
25
|
useDispatch( noticesStore );
|
|
26
26
|
|
|
27
|
-
if ( ! template.is_custom ) {
|
|
27
|
+
if ( template.type === 'wp_template' && ! template.is_custom ) {
|
|
28
28
|
return null;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -84,6 +84,10 @@ export default function Table( { templateType } ) {
|
|
|
84
84
|
<Heading level={ 4 }>
|
|
85
85
|
<Link
|
|
86
86
|
params={ {
|
|
87
|
+
path:
|
|
88
|
+
template.type === 'wp_template'
|
|
89
|
+
? '/templates/single'
|
|
90
|
+
: '/template-parts/single',
|
|
87
91
|
postId: template.id,
|
|
88
92
|
postType: template.type,
|
|
89
93
|
} }
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
privateApis as blockEditorPrivateApis,
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
} from '@wordpress/block-editor';
|
|
8
8
|
import { useEffect } from '@wordpress/element';
|
|
@@ -11,7 +11,7 @@ import { useDispatch } from '@wordpress/data';
|
|
|
11
11
|
/**
|
|
12
12
|
* Internal dependencies
|
|
13
13
|
*/
|
|
14
|
-
import { unlock } from '../../
|
|
14
|
+
import { unlock } from '../../private-apis';
|
|
15
15
|
|
|
16
16
|
const ALLOWED_BLOCKS = {
|
|
17
17
|
'core/navigation': [
|
|
@@ -39,7 +39,7 @@ const ALLOWED_BLOCKS = {
|
|
|
39
39
|
export default function NavigationMenu( { innerBlocks, onSelect } ) {
|
|
40
40
|
const { updateBlockListSettings } = useDispatch( blockEditorStore );
|
|
41
41
|
|
|
42
|
-
const { OffCanvasEditor } = unlock(
|
|
42
|
+
const { OffCanvasEditor } = unlock( blockEditorPrivateApis );
|
|
43
43
|
|
|
44
44
|
//TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList
|
|
45
45
|
//Think through a better way of doing this, possible with adding allowed blocks to block library metadata
|
|
@@ -11,7 +11,7 @@ import { NavigableRegion } from '@wordpress/interface';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import { store as editSiteStore } from '../../store';
|
|
14
|
-
import { unlock } from '../../
|
|
14
|
+
import { unlock } from '../../private-apis';
|
|
15
15
|
|
|
16
16
|
export default function SavePanel() {
|
|
17
17
|
const { isSaveViewOpen, canvasMode } = useSelect( ( select ) => {
|
|
@@ -35,6 +35,9 @@ export default function SavePanel() {
|
|
|
35
35
|
className="edit-site-save-panel__modal"
|
|
36
36
|
onRequestClose={ onClose }
|
|
37
37
|
__experimentalHideHeader
|
|
38
|
+
contentLabel={ __(
|
|
39
|
+
'Save site, content, and template changes'
|
|
40
|
+
) }
|
|
38
41
|
>
|
|
39
42
|
<EntitiesSavedStates close={ onClose } />
|
|
40
43
|
</Modal>
|
|
@@ -11,19 +11,27 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
11
11
|
*/
|
|
12
12
|
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
|
|
13
13
|
import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates';
|
|
14
|
-
import
|
|
14
|
+
import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template';
|
|
15
|
+
import useSyncPathWithURL from '../sync-state-with-url/use-sync-path-with-url';
|
|
15
16
|
import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
|
|
17
|
+
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
|
|
16
18
|
import SaveButton from '../save-button';
|
|
19
|
+
import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';
|
|
17
20
|
|
|
18
21
|
function SidebarScreens() {
|
|
19
|
-
|
|
22
|
+
useSyncPathWithURL();
|
|
20
23
|
|
|
21
24
|
return (
|
|
22
25
|
<>
|
|
23
26
|
<SidebarNavigationScreenMain />
|
|
24
27
|
<SidebarNavigationScreenNavigationMenus />
|
|
28
|
+
<SidebarNavigationScreenNavigationItem />
|
|
25
29
|
<SidebarNavigationScreenTemplates postType="wp_template" />
|
|
26
30
|
<SidebarNavigationScreenTemplates postType="wp_template_part" />
|
|
31
|
+
<SidebarNavigationScreenTemplate postType="wp_template" />
|
|
32
|
+
<SidebarNavigationScreenTemplate postType="wp_template_part" />
|
|
33
|
+
<SidebarNavigationScreenTemplatesBrowse postType="wp_template" />
|
|
34
|
+
<SidebarNavigationScreenTemplatesBrowse postType="wp_template_part" />
|
|
27
35
|
</>
|
|
28
36
|
);
|
|
29
37
|
}
|
|
@@ -4,19 +4,33 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__experimentalHStack as HStack,
|
|
6
6
|
__experimentalVStack as VStack,
|
|
7
|
-
|
|
7
|
+
__experimentalNavigatorToParentButton as NavigatorToParentButton,
|
|
8
|
+
Button,
|
|
8
9
|
__experimentalNavigatorScreen as NavigatorScreen,
|
|
9
10
|
} from '@wordpress/components';
|
|
10
|
-
import { isRTL, __
|
|
11
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
11
12
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
13
|
+
import { useSelect } from '@wordpress/data';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Internal dependencies
|
|
17
|
+
*/
|
|
18
|
+
import { store as editSiteStore } from '../../store';
|
|
19
|
+
import { unlock } from '../../private-apis';
|
|
12
20
|
|
|
13
21
|
export default function SidebarNavigationScreen( {
|
|
14
22
|
path,
|
|
15
|
-
parentTitle,
|
|
16
23
|
title,
|
|
17
24
|
actions,
|
|
18
25
|
content,
|
|
19
26
|
} ) {
|
|
27
|
+
const { dashboardLink } = useSelect( ( select ) => {
|
|
28
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
29
|
+
return {
|
|
30
|
+
dashboardLink: getSettings().__experimentalDashboardLink,
|
|
31
|
+
};
|
|
32
|
+
}, [] );
|
|
33
|
+
|
|
20
34
|
return (
|
|
21
35
|
<NavigatorScreen
|
|
22
36
|
className="edit-site-sidebar-navigation-screen"
|
|
@@ -28,18 +42,20 @@ export default function SidebarNavigationScreen( {
|
|
|
28
42
|
justify="flex-start"
|
|
29
43
|
className="edit-site-sidebar-navigation-screen__title-icon"
|
|
30
44
|
>
|
|
31
|
-
{
|
|
32
|
-
<
|
|
45
|
+
{ path !== '/' ? (
|
|
46
|
+
<NavigatorToParentButton
|
|
33
47
|
className="edit-site-sidebar-navigation-screen__back"
|
|
34
48
|
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
35
|
-
aria-label={
|
|
36
|
-
/* translators: %s: previous page. */
|
|
37
|
-
__( 'Navigate to the previous view: %s' ),
|
|
38
|
-
parentTitle
|
|
39
|
-
) }
|
|
49
|
+
aria-label={ __( 'Back' ) }
|
|
40
50
|
/>
|
|
41
51
|
) : (
|
|
42
|
-
<
|
|
52
|
+
<Button
|
|
53
|
+
className="edit-site-sidebar-navigation-screen__back"
|
|
54
|
+
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
55
|
+
aria-label={ __( 'Navigate to the Dashboard' ) }
|
|
56
|
+
href={ dashboardLink || 'index.php' }
|
|
57
|
+
label={ __( 'Dashboard' ) }
|
|
58
|
+
/>
|
|
43
59
|
) }
|
|
44
60
|
<h2 className="edit-site-sidebar-navigation-screen__title">
|
|
45
61
|
{ title }
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
.edit-site-sidebar-navigation-screen__content {
|
|
9
9
|
margin: 0 $grid-unit-20 $grid-unit-20 $button-size;
|
|
10
|
+
color: $gray-600;
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
.edit-site-sidebar-navigation-screen__title-icon {
|
|
13
14
|
position: sticky;
|
|
14
15
|
top: 0;
|
|
15
16
|
background: $gray-900;
|
|
16
|
-
padding-top: $grid-unit-60 + $
|
|
17
|
+
padding-top: $grid-unit-60 + $header-height;
|
|
17
18
|
box-shadow: 0 $grid-unit-10 $grid-unit-20 $gray-900;
|
|
18
19
|
margin-bottom: $grid-unit-10;
|
|
19
20
|
padding-bottom: $grid-unit-10;
|
|
@@ -31,11 +32,8 @@
|
|
|
31
32
|
.edit-site-sidebar-navigation-screen__back {
|
|
32
33
|
color: $gray-200;
|
|
33
34
|
|
|
34
|
-
&:hover
|
|
35
|
+
&:hover,
|
|
36
|
+
&:not([aria-disabled="true"]):active {
|
|
35
37
|
color: $white;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
|
|
39
|
-
.edit-site-sidebar-navigation-screen__icon-placeholder {
|
|
40
|
-
width: $button-size;
|
|
41
|
-
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
+
import { Button } from '@wordpress/components';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Internal dependencies
|
|
12
|
+
*/
|
|
13
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
14
|
+
import { unlock } from '../../private-apis';
|
|
15
|
+
import { store as editSiteStore } from '../../store';
|
|
16
|
+
|
|
17
|
+
export default function SidebarNavigationScreenNavigationItem() {
|
|
18
|
+
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
19
|
+
|
|
20
|
+
const { post } = useSelect( ( select ) => {
|
|
21
|
+
const { getEditedPostContext } = select( editSiteStore );
|
|
22
|
+
const { getEntityRecord } = select( coreStore );
|
|
23
|
+
const { postType, postId } = getEditedPostContext() ?? {};
|
|
24
|
+
|
|
25
|
+
// The currently selected entity to display.
|
|
26
|
+
// Typically template or template part in the site editor.
|
|
27
|
+
return {
|
|
28
|
+
post:
|
|
29
|
+
postId && postType
|
|
30
|
+
? getEntityRecord( 'postType', postType, postId )
|
|
31
|
+
: null,
|
|
32
|
+
};
|
|
33
|
+
}, [] );
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<SidebarNavigationScreen
|
|
37
|
+
path="/navigation/single"
|
|
38
|
+
title={ post ? decodeEntities( post?.title?.rendered ) : null }
|
|
39
|
+
actions={
|
|
40
|
+
<Button
|
|
41
|
+
variant="primary"
|
|
42
|
+
onClick={ () => setCanvasMode( 'edit' ) }
|
|
43
|
+
>
|
|
44
|
+
{ __( 'Edit' ) }
|
|
45
|
+
</Button>
|
|
46
|
+
}
|
|
47
|
+
content={
|
|
48
|
+
post ? decodeEntities( post?.description?.rendered ) : null
|
|
49
|
+
}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -25,6 +25,7 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
25
25
|
history.push( {
|
|
26
26
|
postType: attributes.type,
|
|
27
27
|
postId: attributes.id,
|
|
28
|
+
path: '/navigation/single',
|
|
28
29
|
} );
|
|
29
30
|
}
|
|
30
31
|
},
|
|
@@ -33,7 +34,6 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
33
34
|
return (
|
|
34
35
|
<SidebarNavigationScreen
|
|
35
36
|
path="/navigation"
|
|
36
|
-
parentTitle={ __( 'Design' ) }
|
|
37
37
|
title={ __( 'Navigation' ) }
|
|
38
38
|
content={
|
|
39
39
|
<div className="edit-site-sidebar-navigation-screen-navigation-menus">
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import { Button } from '@wordpress/components';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
13
|
+
import { unlock } from '../../private-apis';
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
|
|
16
|
+
const config = {
|
|
17
|
+
wp_template: {
|
|
18
|
+
path: '/templates/single',
|
|
19
|
+
},
|
|
20
|
+
wp_template_part: {
|
|
21
|
+
path: '/template-parts/single',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default function SidebarNavigationScreenTemplate( {
|
|
26
|
+
postType = 'wp_template',
|
|
27
|
+
} ) {
|
|
28
|
+
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
29
|
+
const { getDescription, getTitle, record } = useEditedEntityRecord();
|
|
30
|
+
let description = getDescription();
|
|
31
|
+
if ( ! description && record.is_custom ) {
|
|
32
|
+
description = __(
|
|
33
|
+
'This is a custom template that can be applied manually to any Post or Page.'
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<SidebarNavigationScreen
|
|
39
|
+
path={ config[ postType ].path }
|
|
40
|
+
title={ getTitle() }
|
|
41
|
+
actions={
|
|
42
|
+
<Button
|
|
43
|
+
variant="primary"
|
|
44
|
+
onClick={ () => setCanvasMode( 'edit' ) }
|
|
45
|
+
>
|
|
46
|
+
{ __( 'Edit' ) }
|
|
47
|
+
</Button>
|
|
48
|
+
}
|
|
49
|
+
content={ description ? <p>{ description }</p> : undefined }
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
__experimentalItemGroup as ItemGroup,
|
|
6
|
+
__experimentalItem as Item,
|
|
7
|
+
} from '@wordpress/components';
|
|
5
8
|
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
7
9
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
8
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -14,24 +16,8 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
14
16
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
15
17
|
import { useLink } from '../routes/link';
|
|
16
18
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
17
|
-
import { useLocation } from '../routes';
|
|
18
|
-
import { store as editSiteStore } from '../../store';
|
|
19
19
|
import AddNewTemplate from '../add-new-template';
|
|
20
20
|
|
|
21
|
-
function omit( object, keys ) {
|
|
22
|
-
return Object.fromEntries(
|
|
23
|
-
Object.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) )
|
|
24
|
-
);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const Item = ( { item } ) => {
|
|
28
|
-
const linkInfo = useLink( item.params );
|
|
29
|
-
const props = item.params
|
|
30
|
-
? { ...omit( item, 'params' ), ...linkInfo }
|
|
31
|
-
: item;
|
|
32
|
-
return <SidebarNavigationItem { ...props } />;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
21
|
const config = {
|
|
36
22
|
wp_template: {
|
|
37
23
|
path: '/templates',
|
|
@@ -53,23 +39,20 @@ const config = {
|
|
|
53
39
|
},
|
|
54
40
|
};
|
|
55
41
|
|
|
42
|
+
const TemplateItem = ( { postType, postId, ...props } ) => {
|
|
43
|
+
const linkInfo = useLink( {
|
|
44
|
+
postType,
|
|
45
|
+
postId,
|
|
46
|
+
path: config[ postType ].path + '/single',
|
|
47
|
+
} );
|
|
48
|
+
return <SidebarNavigationItem { ...linkInfo } { ...props } />;
|
|
49
|
+
};
|
|
50
|
+
|
|
56
51
|
export default function SidebarNavigationScreenTemplates( {
|
|
57
52
|
postType = 'wp_template',
|
|
58
53
|
} ) {
|
|
59
|
-
const { params } = useLocation();
|
|
60
54
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
61
55
|
|
|
62
|
-
// Ideally the URL params would be enough.
|
|
63
|
-
// Loading the editor should ideally redirect to the home page
|
|
64
|
-
// instead of fetching the edited entity here.
|
|
65
|
-
const { editedPostId, editedPostType } = useSelect( ( select ) => {
|
|
66
|
-
const { getEditedPostType, getEditedPostId } = select( editSiteStore );
|
|
67
|
-
return {
|
|
68
|
-
editedPostId: getEditedPostId(),
|
|
69
|
-
editedPostType: getEditedPostType(),
|
|
70
|
-
};
|
|
71
|
-
}, [] );
|
|
72
|
-
|
|
73
56
|
const { records: templates, isResolving: isLoading } = useEntityRecords(
|
|
74
57
|
'postType',
|
|
75
58
|
postType,
|
|
@@ -78,44 +61,15 @@ export default function SidebarNavigationScreenTemplates( {
|
|
|
78
61
|
}
|
|
79
62
|
);
|
|
80
63
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
},
|
|
87
|
-
];
|
|
88
|
-
} else if ( ! templates && ! isLoading ) {
|
|
89
|
-
items = [
|
|
90
|
-
{
|
|
91
|
-
children: config[ postType ].labels.notFound,
|
|
92
|
-
},
|
|
93
|
-
];
|
|
94
|
-
} else {
|
|
95
|
-
items = templates?.map( ( template ) => ( {
|
|
96
|
-
params: {
|
|
97
|
-
postType,
|
|
98
|
-
postId: template.id,
|
|
99
|
-
},
|
|
100
|
-
children: decodeEntities(
|
|
101
|
-
template.title?.rendered || template.slug
|
|
102
|
-
),
|
|
103
|
-
'aria-current':
|
|
104
|
-
( params.postType === postType &&
|
|
105
|
-
params.postId === template.id ) ||
|
|
106
|
-
// This is a special case for the home page.
|
|
107
|
-
( editedPostId === template.id &&
|
|
108
|
-
editedPostType === postType &&
|
|
109
|
-
!! params.postId )
|
|
110
|
-
? 'page'
|
|
111
|
-
: undefined,
|
|
112
|
-
} ) );
|
|
113
|
-
}
|
|
64
|
+
const browseAllLink = useLink( {
|
|
65
|
+
postType,
|
|
66
|
+
postId: undefined,
|
|
67
|
+
path: config[ postType ].path + '/all',
|
|
68
|
+
} );
|
|
114
69
|
|
|
115
70
|
return (
|
|
116
71
|
<SidebarNavigationScreen
|
|
117
72
|
path={ config[ postType ].path }
|
|
118
|
-
parentTitle={ __( 'Design' ) }
|
|
119
73
|
title={ config[ postType ].labels.title }
|
|
120
74
|
actions={
|
|
121
75
|
! isMobileViewport && (
|
|
@@ -130,25 +84,37 @@ export default function SidebarNavigationScreenTemplates( {
|
|
|
130
84
|
}
|
|
131
85
|
content={
|
|
132
86
|
<>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
87
|
+
{ isLoading && config[ postType ].labels.loading }
|
|
88
|
+
{ ! isLoading && (
|
|
89
|
+
<ItemGroup>
|
|
90
|
+
{ ! templates?.length && (
|
|
91
|
+
<Item>
|
|
92
|
+
{ config[ postType ].labels.notFound }
|
|
93
|
+
</Item>
|
|
94
|
+
) }
|
|
95
|
+
{ ( templates ?? [] ).map( ( template ) => (
|
|
96
|
+
<TemplateItem
|
|
97
|
+
postType={ postType }
|
|
98
|
+
postId={ template.id }
|
|
99
|
+
key={ template.id }
|
|
100
|
+
>
|
|
101
|
+
{ decodeEntities(
|
|
102
|
+
template.title?.rendered ||
|
|
103
|
+
template.slug
|
|
104
|
+
) }
|
|
105
|
+
</TemplateItem>
|
|
106
|
+
) ) }
|
|
107
|
+
{ ! isMobileViewport && (
|
|
108
|
+
<SidebarNavigationItem
|
|
109
|
+
className="edit-site-sidebar-navigation-screen-templates__see-all"
|
|
110
|
+
{ ...browseAllLink }
|
|
111
|
+
children={
|
|
112
|
+
config[ postType ].labels.manage
|
|
113
|
+
}
|
|
114
|
+
/>
|
|
115
|
+
) }
|
|
116
|
+
</ItemGroup>
|
|
117
|
+
) }
|
|
152
118
|
</>
|
|
153
119
|
}
|
|
154
120
|
/>
|