@wordpress/edit-site 5.3.6 → 5.3.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template.js +16 -10
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +2 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/layout/index.js +6 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +2 -5
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/sidebar/index.js +2 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +5 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +100 -11
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +18 -4
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +134 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +0 -3
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +18 -11
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +2 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/layout/index.js +6 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -5
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +2 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +94 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +18 -5
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +135 -22
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +9 -7
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +0 -3
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +96 -111
- package/build-style/style.css +96 -111
- package/package.json +10 -10
- package/src/components/add-new-template/new-template.js +57 -32
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/layout/index.js +14 -0
- package/src/components/layout/style.scss +1 -3
- package/src/components/list/index.js +3 -1
- package/src/components/routes/link.js +9 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/style.scss +2 -1
- package/src/components/sidebar-navigation-item/style.scss +0 -20
- package/src/components/sidebar-navigation-screen/index.js +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +3 -0
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +104 -10
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +59 -4
- package/src/components/sidebar-navigation-screen-template/index.js +21 -7
- package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/index.js +209 -54
- package/src/components/style-book/style.scss +1 -45
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
- package/src/components/template-details/index.js +0 -3
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/index.js +5 -1
- package/src/style.scss +1 -1
- package/src/utils/history.js +13 -9
- package/build/components/navigation-inspector/index.js +0 -190
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -62
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -173
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/navigation-inspector/index.js +0 -223
- package/src/components/navigation-inspector/navigation-menu.js +0 -66
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -2,20 +2,84 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useCallback } from '@wordpress/element';
|
|
5
|
+
import { useCallback, useMemo } from '@wordpress/element';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
9
|
+
import { createBlock } from '@wordpress/blocks';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Internal dependencies
|
|
9
13
|
*/
|
|
10
14
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
11
|
-
import NavigationInspector from '../navigation-inspector';
|
|
12
15
|
import { useHistory } from '../routes';
|
|
16
|
+
import NavigationMenuContent from './navigation-menu-content';
|
|
17
|
+
import { NavigationMenuLoader } from './loader';
|
|
18
|
+
import { unlock } from '../../private-apis';
|
|
19
|
+
import { store as editSiteStore } from '../../store';
|
|
20
|
+
|
|
21
|
+
const noop = () => {};
|
|
22
|
+
const NAVIGATION_MENUS_QUERY = { per_page: -1, status: 'publish' };
|
|
23
|
+
|
|
24
|
+
function SidebarNavigationScreenWrapper( { children, actions } ) {
|
|
25
|
+
return (
|
|
26
|
+
<SidebarNavigationScreen
|
|
27
|
+
title={ __( 'Navigation' ) }
|
|
28
|
+
actions={ actions }
|
|
29
|
+
description={ __(
|
|
30
|
+
'Browse your site, edit pages, and manage your primary navigation menu.'
|
|
31
|
+
) }
|
|
32
|
+
content={ children }
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
13
36
|
|
|
14
37
|
export default function SidebarNavigationScreenNavigationMenus() {
|
|
15
38
|
const history = useHistory();
|
|
39
|
+
const { navigationMenus, hasResolvedNavigationMenus, storedSettings } =
|
|
40
|
+
useSelect( ( select ) => {
|
|
41
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
42
|
+
const { getEntityRecords, hasFinishedResolution } =
|
|
43
|
+
select( coreStore );
|
|
44
|
+
|
|
45
|
+
const navigationMenusQuery = [
|
|
46
|
+
'postType',
|
|
47
|
+
'wp_navigation',
|
|
48
|
+
NAVIGATION_MENUS_QUERY,
|
|
49
|
+
];
|
|
50
|
+
return {
|
|
51
|
+
storedSettings: getSettings( false ),
|
|
52
|
+
navigationMenus: getEntityRecords( ...navigationMenusQuery ),
|
|
53
|
+
hasResolvedNavigationMenus: hasFinishedResolution(
|
|
54
|
+
'getEntityRecords',
|
|
55
|
+
navigationMenusQuery
|
|
56
|
+
),
|
|
57
|
+
};
|
|
58
|
+
}, [] );
|
|
59
|
+
|
|
60
|
+
// Sort navigation menus by date.
|
|
61
|
+
const orderedNavigationMenus = useMemo(
|
|
62
|
+
() =>
|
|
63
|
+
navigationMenus?.sort( ( menuA, menuB ) => {
|
|
64
|
+
const menuADate = new Date( menuA.date );
|
|
65
|
+
const menuBDate = new Date( menuB.date );
|
|
66
|
+
return menuADate.getTime() > menuBDate.getTime();
|
|
67
|
+
} ),
|
|
68
|
+
[ navigationMenus ]
|
|
69
|
+
);
|
|
70
|
+
const firstNavigationMenu = orderedNavigationMenus?.[ 0 ]?.id;
|
|
71
|
+
const blocks = useMemo( () => {
|
|
72
|
+
return [
|
|
73
|
+
createBlock( 'core/navigation', { ref: firstNavigationMenu } ),
|
|
74
|
+
];
|
|
75
|
+
}, [ firstNavigationMenu ] );
|
|
76
|
+
|
|
77
|
+
const isLoading = ! hasResolvedNavigationMenus;
|
|
78
|
+
const hasNavigationMenus = !! navigationMenus?.length;
|
|
79
|
+
|
|
16
80
|
const onSelect = useCallback(
|
|
17
81
|
( selectedBlock ) => {
|
|
18
|
-
const { attributes } = selectedBlock;
|
|
82
|
+
const { attributes, name } = selectedBlock;
|
|
19
83
|
if (
|
|
20
84
|
attributes.kind === 'post-type' &&
|
|
21
85
|
attributes.id &&
|
|
@@ -27,17 +91,47 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
27
91
|
postId: attributes.id,
|
|
28
92
|
} );
|
|
29
93
|
}
|
|
94
|
+
if ( name === 'core/page-list-item' && attributes.id && history ) {
|
|
95
|
+
history.push( {
|
|
96
|
+
postType: 'page',
|
|
97
|
+
postId: attributes.id,
|
|
98
|
+
} );
|
|
99
|
+
}
|
|
30
100
|
},
|
|
31
101
|
[ history ]
|
|
32
102
|
);
|
|
103
|
+
|
|
104
|
+
if ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {
|
|
105
|
+
return (
|
|
106
|
+
<SidebarNavigationScreenWrapper>
|
|
107
|
+
{ __( 'There are no Navigation Menus.' ) }
|
|
108
|
+
</SidebarNavigationScreenWrapper>
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if ( ! hasResolvedNavigationMenus || isLoading ) {
|
|
113
|
+
return (
|
|
114
|
+
<SidebarNavigationScreenWrapper>
|
|
115
|
+
<NavigationMenuLoader />
|
|
116
|
+
</SidebarNavigationScreenWrapper>
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
33
120
|
return (
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
121
|
+
<BlockEditorProvider
|
|
122
|
+
settings={ storedSettings }
|
|
123
|
+
value={ blocks }
|
|
124
|
+
onChange={ noop }
|
|
125
|
+
onInput={ noop }
|
|
126
|
+
>
|
|
127
|
+
<SidebarNavigationScreenWrapper>
|
|
128
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__content">
|
|
129
|
+
<NavigationMenuContent
|
|
130
|
+
rootClientId={ blocks[ 0 ].clientId }
|
|
131
|
+
onSelect={ onSelect }
|
|
132
|
+
/>
|
|
39
133
|
</div>
|
|
40
|
-
|
|
41
|
-
|
|
134
|
+
</SidebarNavigationScreenWrapper>
|
|
135
|
+
</BlockEditorProvider>
|
|
42
136
|
);
|
|
43
137
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function NavigationMenuLoader() {
|
|
2
|
+
return (
|
|
3
|
+
<>
|
|
4
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
|
|
5
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
|
|
6
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
|
|
7
|
+
</>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
privateApis as blockEditorPrivateApis,
|
|
6
|
+
store as blockEditorStore,
|
|
7
|
+
BlockList,
|
|
8
|
+
BlockTools,
|
|
9
|
+
} from '@wordpress/block-editor';
|
|
10
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
+
import { createBlock } from '@wordpress/blocks';
|
|
12
|
+
import { useCallback } from '@wordpress/element';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { unlock } from '../../private-apis';
|
|
18
|
+
import { NavigationMenuLoader } from './loader';
|
|
19
|
+
|
|
20
|
+
export default function NavigationMenuContent( { rootClientId, onSelect } ) {
|
|
21
|
+
const { clientIdsTree, isLoading } = useSelect(
|
|
22
|
+
( select ) => {
|
|
23
|
+
const { __unstableGetClientIdsTree, areInnerBlocksControlled } =
|
|
24
|
+
select( blockEditorStore );
|
|
25
|
+
return {
|
|
26
|
+
clientIdsTree: __unstableGetClientIdsTree( rootClientId ),
|
|
27
|
+
|
|
28
|
+
// This is a small hack to wait for the navigation block
|
|
29
|
+
// to actually load its inner blocks.
|
|
30
|
+
isLoading: ! areInnerBlocksControlled( rootClientId ),
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
[ rootClientId ]
|
|
34
|
+
);
|
|
35
|
+
const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =
|
|
36
|
+
useDispatch( blockEditorStore );
|
|
37
|
+
|
|
38
|
+
const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );
|
|
39
|
+
|
|
40
|
+
const offCanvasOnselect = useCallback(
|
|
41
|
+
( block ) => {
|
|
42
|
+
if (
|
|
43
|
+
block.name === 'core/navigation-link' &&
|
|
44
|
+
! block.attributes.url
|
|
45
|
+
) {
|
|
46
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
47
|
+
replaceBlock(
|
|
48
|
+
block.clientId,
|
|
49
|
+
createBlock( 'core/navigation-link', block.attributes )
|
|
50
|
+
);
|
|
51
|
+
} else {
|
|
52
|
+
onSelect( block );
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// The hidden block is needed because it makes block edit side effects trigger.
|
|
59
|
+
// For example a navigation page list load its items has an effect on edit to load its items.
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
{ isLoading && <NavigationMenuLoader /> }
|
|
63
|
+
{ ! isLoading && (
|
|
64
|
+
<OffCanvasEditor
|
|
65
|
+
blocks={ clientIdsTree }
|
|
66
|
+
onSelect={ offCanvasOnselect }
|
|
67
|
+
LeafMoreMenu={ LeafMoreMenu }
|
|
68
|
+
showAppender={ false }
|
|
69
|
+
/>
|
|
70
|
+
) }
|
|
71
|
+
<div style={ { visibility: 'hidden' } }>
|
|
72
|
+
<BlockTools>
|
|
73
|
+
<BlockList />
|
|
74
|
+
</BlockTools>
|
|
75
|
+
</div>
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -1,12 +1,67 @@
|
|
|
1
|
-
.edit-site-sidebar-navigation-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
.edit-site-sidebar-navigation-screen__description {
|
|
2
|
+
margin: 0 0 $grid-unit-40 $grid-unit-20;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.edit-site-sidebar-navigation-screen-navigation-menus__placeholder {
|
|
6
|
+
padding: $grid-unit-10;
|
|
7
|
+
margin: $grid-unit-10;
|
|
8
|
+
background-color: $gray-100;
|
|
9
|
+
animation: loadingpulse 1s linear infinite;
|
|
10
|
+
animation-delay: 0.5s; // avoid animating for fast network responses
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@keyframes loadingpulse {
|
|
14
|
+
0% {
|
|
15
|
+
opacity: 1;
|
|
16
|
+
}
|
|
17
|
+
50% {
|
|
18
|
+
opacity: 0.5;
|
|
5
19
|
}
|
|
20
|
+
100% {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.edit-site-sidebar-navigation-screen-navigation-menus__content {
|
|
6
26
|
.offcanvas-editor-list-view-leaf {
|
|
7
27
|
max-width: calc(100% - #{ $grid-unit-05 });
|
|
28
|
+
border-radius: $radius-block-ui;
|
|
29
|
+
&:hover,
|
|
30
|
+
&:focus,
|
|
31
|
+
&[aria-current] {
|
|
32
|
+
background: $gray-800;
|
|
33
|
+
}
|
|
34
|
+
.block-editor-list-view-block__menu {
|
|
35
|
+
margin-left: -$grid-unit-10;
|
|
36
|
+
}
|
|
8
37
|
}
|
|
38
|
+
|
|
9
39
|
.block-editor-list-view-leaf .block-editor-list-view-block__contents-cell {
|
|
10
40
|
width: 100%;
|
|
11
41
|
}
|
|
42
|
+
|
|
43
|
+
.block-editor-list-view-leaf .block-editor-list-view-block-contents {
|
|
44
|
+
white-space: normal;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.block-editor-list-view-block__title {
|
|
48
|
+
margin-top: 3px;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.block-editor-list-view-block__menu-cell {
|
|
52
|
+
padding-right: 0;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.components-button {
|
|
56
|
+
color: $gray-600;
|
|
57
|
+
&:hover,
|
|
58
|
+
&:focus,
|
|
59
|
+
&[aria-current] {
|
|
60
|
+
color: $white;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.edit-site-sidebar-navigation-screen-navigation-menus__content .popover-slot .wp-block-navigation-submenu {
|
|
66
|
+
display: none;
|
|
12
67
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { useDispatch } from '@wordpress/data';
|
|
6
6
|
import { pencil } from '@wordpress/icons';
|
|
7
|
+
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Internal dependencies
|
|
@@ -15,13 +16,26 @@ import { store as editSiteStore } from '../../store';
|
|
|
15
16
|
import SidebarButton from '../sidebar-button';
|
|
16
17
|
|
|
17
18
|
export default function SidebarNavigationScreenTemplate() {
|
|
19
|
+
const { params } = useNavigator();
|
|
20
|
+
const { postType, postId } = params;
|
|
18
21
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
19
|
-
const { getDescription, getTitle, record } = useEditedEntityRecord(
|
|
22
|
+
const { getDescription, getTitle, record } = useEditedEntityRecord(
|
|
23
|
+
postType,
|
|
24
|
+
postId
|
|
25
|
+
);
|
|
20
26
|
let description = getDescription();
|
|
21
|
-
if ( ! description
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
if ( ! description ) {
|
|
28
|
+
if ( record.type === 'wp_template' && record.is_custom ) {
|
|
29
|
+
description = __(
|
|
30
|
+
'This is a custom template that can be applied manually to any Post or Page.'
|
|
31
|
+
);
|
|
32
|
+
} else if ( record.type === 'wp_template_part' ) {
|
|
33
|
+
description = sprintf(
|
|
34
|
+
// translators: %s: template part title e.g: "Header".
|
|
35
|
+
__( 'This is your %s template part.' ),
|
|
36
|
+
getTitle()
|
|
37
|
+
);
|
|
38
|
+
}
|
|
25
39
|
}
|
|
26
40
|
|
|
27
41
|
return (
|
|
@@ -34,7 +48,7 @@ export default function SidebarNavigationScreenTemplate() {
|
|
|
34
48
|
icon={ pencil }
|
|
35
49
|
/>
|
|
36
50
|
}
|
|
37
|
-
|
|
51
|
+
description={ description }
|
|
38
52
|
/>
|
|
39
53
|
);
|
|
40
54
|
}
|
|
@@ -29,6 +29,9 @@ const config = {
|
|
|
29
29
|
loading: __( 'Loading templates' ),
|
|
30
30
|
notFound: __( 'No templates found' ),
|
|
31
31
|
manage: __( 'Manage all templates' ),
|
|
32
|
+
description: __(
|
|
33
|
+
'Express the layout of your site with templates.'
|
|
34
|
+
),
|
|
32
35
|
},
|
|
33
36
|
},
|
|
34
37
|
wp_template_part: {
|
|
@@ -37,6 +40,9 @@ const config = {
|
|
|
37
40
|
loading: __( 'Loading template parts' ),
|
|
38
41
|
notFound: __( 'No template parts found' ),
|
|
39
42
|
manage: __( 'Manage all template parts' ),
|
|
43
|
+
description: __(
|
|
44
|
+
'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.'
|
|
45
|
+
),
|
|
40
46
|
},
|
|
41
47
|
},
|
|
42
48
|
};
|
|
@@ -80,6 +86,7 @@ export default function SidebarNavigationScreenTemplates() {
|
|
|
80
86
|
<SidebarNavigationScreen
|
|
81
87
|
isRoot={ isTemplatePartsMode }
|
|
82
88
|
title={ config[ postType ].labels.title }
|
|
89
|
+
description={ config[ postType ].labels.description }
|
|
83
90
|
actions={
|
|
84
91
|
canCreate && (
|
|
85
92
|
<AddNewTemplate
|
|
@@ -12,9 +12,15 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
|
12
12
|
const config = {
|
|
13
13
|
wp_template: {
|
|
14
14
|
title: __( 'All templates' ),
|
|
15
|
+
description: __(
|
|
16
|
+
'Create new templates, or reset any customizations made to the templates supplied by your theme.'
|
|
17
|
+
),
|
|
15
18
|
},
|
|
16
19
|
wp_template_part: {
|
|
17
20
|
title: __( 'All template parts' ),
|
|
21
|
+
description: __(
|
|
22
|
+
'Create new template parts, or reset any customisations made to the template parts supplied by your theme.'
|
|
23
|
+
),
|
|
18
24
|
},
|
|
19
25
|
};
|
|
20
26
|
|
|
@@ -22,5 +28,10 @@ export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
|
22
28
|
const {
|
|
23
29
|
params: { postType },
|
|
24
30
|
} = useNavigator();
|
|
25
|
-
return
|
|
31
|
+
return (
|
|
32
|
+
<SidebarNavigationScreen
|
|
33
|
+
title={ config[ postType ].title }
|
|
34
|
+
description={ config[ postType ].description }
|
|
35
|
+
/>
|
|
36
|
+
);
|
|
26
37
|
}
|