@wordpress/edit-site 3.0.19 → 3.0.24
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/block-editor/index.js +1 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/resizable-editor.js +37 -7
- package/build/components/block-editor/resizable-editor.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/constants.js +1 -11
- package/build/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build/plugins/site-export.js +1 -1
- package/build/plugins/site-export.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -2
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/resizable-editor.js +37 -7
- package/build-module/components/block-editor/resizable-editor.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js +0 -5
- package/build-module/components/navigation-sidebar/navigation-panel/constants.js.map +1 -1
- package/build-module/plugins/site-export.js +2 -2
- package/build-module/plugins/site-export.js.map +1 -1
- package/build-style/style-rtl.css +11 -4
- package/build-style/style.css +11 -4
- package/package.json +8 -8
- package/src/components/block-editor/index.js +2 -2
- package/src/components/block-editor/resizable-editor.js +52 -12
- package/src/components/block-editor/style.scss +8 -0
- package/src/components/editor/style.scss +0 -1
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/navigation-sidebar/navigation-panel/constants.js +0 -15
- package/src/components/navigation-sidebar/navigation-toggle/style.scss +8 -4
- package/src/plugins/site-export.js +2 -2
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -101
- package/build/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -82
- package/build/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -107
- package/build/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js +0 -57
- package/build/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -48
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -100
- package/build/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -62
- package/build/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -143
- package/build/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -76
- package/build/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -125
- package/build/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/search-results.js +0 -132
- package/build/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -86
- package/build/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js +0 -46
- package/build/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/build/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build/components/navigation-sidebar/navigation-panel/utils.js +0 -21
- package/build/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build/utils/get-closest-available-template.js +0 -48
- package/build/utils/get-closest-available-template.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -86
- package/build-module/components/navigation-sidebar/navigation-panel/content-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-categories.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-pages.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -90
- package/build-module/components/navigation-sidebar/navigation-panel/menus/content-posts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js +0 -40
- package/build-module/components/navigation-sidebar/navigation-panel/menus/index.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -35
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -84
- package/build-module/components/navigation-sidebar/navigation-panel/menus/template-parts.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -50
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates-sub.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -124
- package/build-module/components/navigation-sidebar/navigation-panel/menus/templates.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -65
- package/build-module/components/navigation-sidebar/navigation-panel/navigation-entity-items.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -106
- package/build-module/components/navigation-sidebar/navigation-panel/new-template-dropdown.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js +0 -116
- package/build-module/components/navigation-sidebar/navigation-panel/search-results.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -71
- package/build-module/components/navigation-sidebar/navigation-panel/template-navigation-item.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js +0 -38
- package/build-module/components/navigation-sidebar/navigation-panel/template-preview.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -37
- package/build-module/components/navigation-sidebar/navigation-panel/use-debounced-search.js.map +0 -1
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js +0 -8
- package/build-module/components/navigation-sidebar/navigation-panel/utils.js.map +0 -1
- package/build-module/utils/get-closest-available-template.js +0 -40
- package/build-module/utils/get-closest-available-template.js.map +0 -1
- package/src/components/navigation-sidebar/navigation-panel/content-navigation-item.js +0 -89
- package/src/components/navigation-sidebar/navigation-panel/menus/content-categories.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-pages.js +0 -85
- package/src/components/navigation-sidebar/navigation-panel/menus/content-posts.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/menus/index.js +0 -61
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts-sub.js +0 -34
- package/src/components/navigation-sidebar/navigation-panel/menus/template-parts.js +0 -94
- package/src/components/navigation-sidebar/navigation-panel/menus/templates-sub.js +0 -42
- package/src/components/navigation-sidebar/navigation-panel/menus/templates.js +0 -147
- package/src/components/navigation-sidebar/navigation-panel/navigation-entity-items.js +0 -53
- package/src/components/navigation-sidebar/navigation-panel/new-template-dropdown.js +0 -110
- package/src/components/navigation-sidebar/navigation-panel/search-results.js +0 -117
- package/src/components/navigation-sidebar/navigation-panel/template-navigation-item.js +0 -83
- package/src/components/navigation-sidebar/navigation-panel/template-preview.js +0 -32
- package/src/components/navigation-sidebar/navigation-panel/use-debounced-search.js +0 -47
- package/src/components/navigation-sidebar/navigation-panel/utils.js +0 -11
- package/src/utils/get-closest-available-template.js +0 -31
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { deburr } from 'lodash'; // @see packages/block-editor/src/components/inserter/search-items.js
|
|
5
|
-
|
|
6
|
-
export const normalizeInput = input => deburr(input).replace(/^\//, '').toLowerCase();
|
|
7
|
-
export const normalizedSearch = (title, search) => -1 !== normalizeInput(title).indexOf(normalizeInput(search));
|
|
8
|
-
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/navigation-sidebar/navigation-panel/utils.js"],"names":["deburr","normalizeInput","input","replace","toLowerCase","normalizedSearch","title","search","indexOf"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB,C,CAEA;;AACA,OAAO,MAAMC,cAAc,GAAKC,KAAF,IAC7BF,MAAM,CAAEE,KAAF,CAAN,CAAgBC,OAAhB,CAAyB,KAAzB,EAAgC,EAAhC,EAAqCC,WAArC,EADM;AAGP,OAAO,MAAMC,gBAAgB,GAAG,CAAEC,KAAF,EAASC,MAAT,KAC/B,CAAC,CAAD,KAAON,cAAc,CAAEK,KAAF,CAAd,CAAwBE,OAAxB,CAAiCP,cAAc,CAAEM,MAAF,CAA/C,CADD","sourcesContent":["/**\n * External dependencies\n */\nimport { deburr } from 'lodash';\n\n// @see packages/block-editor/src/components/inserter/search-items.js\nexport const normalizeInput = ( input ) =>\n\tdeburr( input ).replace( /^\\//, '' ).toLowerCase();\n\nexport const normalizedSearch = ( title, search ) =>\n\t-1 !== normalizeInput( title ).indexOf( normalizeInput( search ) );\n"]}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
export default function getClosestAvailableTemplate(slug, templates) {
|
|
6
|
-
const template = find(templates, {
|
|
7
|
-
slug
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
if (template) {
|
|
11
|
-
return template;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
switch (slug) {
|
|
15
|
-
case 'single':
|
|
16
|
-
case 'page':
|
|
17
|
-
return getClosestAvailableTemplate('singular', templates);
|
|
18
|
-
|
|
19
|
-
case 'author':
|
|
20
|
-
case 'category':
|
|
21
|
-
case 'taxonomy':
|
|
22
|
-
case 'date':
|
|
23
|
-
case 'tag':
|
|
24
|
-
return getClosestAvailableTemplate('archive', templates);
|
|
25
|
-
|
|
26
|
-
case 'front-page':
|
|
27
|
-
return getClosestAvailableTemplate('home', templates);
|
|
28
|
-
|
|
29
|
-
case 'attachment':
|
|
30
|
-
return getClosestAvailableTemplate('single', templates);
|
|
31
|
-
|
|
32
|
-
case 'privacy-policy':
|
|
33
|
-
return getClosestAvailableTemplate('page', templates);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return find(templates, {
|
|
37
|
-
slug: 'index'
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=get-closest-available-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/utils/get-closest-available-template.js"],"names":["find","getClosestAvailableTemplate","slug","templates","template"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,IAAT,QAAqB,QAArB;AAEA,eAAe,SAASC,2BAAT,CAAsCC,IAAtC,EAA4CC,SAA5C,EAAwD;AACtE,QAAMC,QAAQ,GAAGJ,IAAI,CAAEG,SAAF,EAAa;AAAED,IAAAA;AAAF,GAAb,CAArB;;AACA,MAAKE,QAAL,EAAgB;AACf,WAAOA,QAAP;AACA;;AAED,UAASF,IAAT;AACC,SAAK,QAAL;AACA,SAAK,MAAL;AACC,aAAOD,2BAA2B,CAAE,UAAF,EAAcE,SAAd,CAAlC;;AACD,SAAK,QAAL;AACA,SAAK,UAAL;AACA,SAAK,UAAL;AACA,SAAK,MAAL;AACA,SAAK,KAAL;AACC,aAAOF,2BAA2B,CAAE,SAAF,EAAaE,SAAb,CAAlC;;AACD,SAAK,YAAL;AACC,aAAOF,2BAA2B,CAAE,MAAF,EAAUE,SAAV,CAAlC;;AACD,SAAK,YAAL;AACC,aAAOF,2BAA2B,CAAE,QAAF,EAAYE,SAAZ,CAAlC;;AACD,SAAK,gBAAL;AACC,aAAOF,2BAA2B,CAAE,MAAF,EAAUE,SAAV,CAAlC;AAfF;;AAkBA,SAAOH,IAAI,CAAEG,SAAF,EAAa;AAAED,IAAAA,IAAI,EAAE;AAAR,GAAb,CAAX;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { find } from 'lodash';\n\nexport default function getClosestAvailableTemplate( slug, templates ) {\n\tconst template = find( templates, { slug } );\n\tif ( template ) {\n\t\treturn template;\n\t}\n\n\tswitch ( slug ) {\n\t\tcase 'single':\n\t\tcase 'page':\n\t\t\treturn getClosestAvailableTemplate( 'singular', templates );\n\t\tcase 'author':\n\t\tcase 'category':\n\t\tcase 'taxonomy':\n\t\tcase 'date':\n\t\tcase 'tag':\n\t\t\treturn getClosestAvailableTemplate( 'archive', templates );\n\t\tcase 'front-page':\n\t\t\treturn getClosestAvailableTemplate( 'home', templates );\n\t\tcase 'attachment':\n\t\t\treturn getClosestAvailableTemplate( 'single', templates );\n\t\tcase 'privacy-policy':\n\t\t\treturn getClosestAvailableTemplate( 'page', templates );\n\t}\n\n\treturn find( templates, { slug: 'index' } );\n}\n"]}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __experimentalNavigationItem as NavigationItem } from '@wordpress/components';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { useCallback, useState } from '@wordpress/element';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
import { getPathAndQueryString } from '@wordpress/url';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { NavigationPanelPreviewFill } from '..';
|
|
15
|
-
import TemplatePreview from './template-preview';
|
|
16
|
-
import { store as editSiteStore } from '../../../store';
|
|
17
|
-
|
|
18
|
-
const getTitle = ( entity ) => {
|
|
19
|
-
const title = entity.taxonomy ? entity.name : entity?.title?.rendered;
|
|
20
|
-
|
|
21
|
-
// Make sure encoded characters are displayed as the characters they represent.
|
|
22
|
-
const titleElement = document.createElement( 'div' );
|
|
23
|
-
titleElement.innerHTML = title;
|
|
24
|
-
|
|
25
|
-
return titleElement.textContent || titleElement.innerText || '';
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export default function ContentNavigationItem( { item } ) {
|
|
29
|
-
const [ isPreviewVisible, setIsPreviewVisible ] = useState( false );
|
|
30
|
-
const previewContent = useSelect(
|
|
31
|
-
( select ) => {
|
|
32
|
-
if ( ! isPreviewVisible ) {
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const template = select(
|
|
37
|
-
coreStore
|
|
38
|
-
).__experimentalGetTemplateForLink( item.link );
|
|
39
|
-
return template?.content;
|
|
40
|
-
},
|
|
41
|
-
[ isPreviewVisible ]
|
|
42
|
-
);
|
|
43
|
-
const { setPage, setIsNavigationPanelOpened } = useDispatch(
|
|
44
|
-
editSiteStore
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const onActivateItem = useCallback( () => {
|
|
48
|
-
const { type, slug, link, id } = item;
|
|
49
|
-
setPage( {
|
|
50
|
-
type,
|
|
51
|
-
slug,
|
|
52
|
-
path: getPathAndQueryString( link ),
|
|
53
|
-
context: {
|
|
54
|
-
postType: type,
|
|
55
|
-
postId: id,
|
|
56
|
-
},
|
|
57
|
-
} );
|
|
58
|
-
setIsNavigationPanelOpened( false );
|
|
59
|
-
}, [ setPage, item ] );
|
|
60
|
-
|
|
61
|
-
if ( ! item ) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return (
|
|
66
|
-
<>
|
|
67
|
-
<NavigationItem
|
|
68
|
-
className="edit-site-navigation-panel__content-item"
|
|
69
|
-
item={ `${ item.taxonomy || item.type }-${ item.id }` }
|
|
70
|
-
title={ getTitle( item ) || __( '(no title)' ) }
|
|
71
|
-
onClick={ onActivateItem }
|
|
72
|
-
onMouseEnter={ () => setIsPreviewVisible( true ) }
|
|
73
|
-
onMouseLeave={ () => setIsPreviewVisible( false ) }
|
|
74
|
-
/>
|
|
75
|
-
|
|
76
|
-
{ isPreviewVisible && previewContent && (
|
|
77
|
-
<NavigationPanelPreviewFill>
|
|
78
|
-
<TemplatePreview
|
|
79
|
-
rawContent={ previewContent }
|
|
80
|
-
blockContext={ {
|
|
81
|
-
postType: item.type,
|
|
82
|
-
postId: item.id,
|
|
83
|
-
} }
|
|
84
|
-
/>
|
|
85
|
-
</NavigationPanelPreviewFill>
|
|
86
|
-
) }
|
|
87
|
-
</>
|
|
88
|
-
);
|
|
89
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { MENU_CONTENT_CATEGORIES, MENU_ROOT } from '../constants';
|
|
16
|
-
import ContentNavigationItem from '../content-navigation-item';
|
|
17
|
-
import SearchResults from '../search-results';
|
|
18
|
-
import useDebouncedSearch from '../use-debounced-search';
|
|
19
|
-
|
|
20
|
-
export default function ContentCategoriesMenu() {
|
|
21
|
-
const {
|
|
22
|
-
search,
|
|
23
|
-
searchQuery,
|
|
24
|
-
onSearch,
|
|
25
|
-
isDebouncing,
|
|
26
|
-
} = useDebouncedSearch();
|
|
27
|
-
|
|
28
|
-
const { categories, isResolved } = useSelect(
|
|
29
|
-
( select ) => {
|
|
30
|
-
const { getEntityRecords, hasFinishedResolution } = select(
|
|
31
|
-
coreStore
|
|
32
|
-
);
|
|
33
|
-
const query = searchQuery
|
|
34
|
-
? {
|
|
35
|
-
search: searchQuery,
|
|
36
|
-
}
|
|
37
|
-
: undefined;
|
|
38
|
-
const getEntityRecordsArgs = [ 'taxonomy', 'category', query ];
|
|
39
|
-
const hasResolvedPosts = hasFinishedResolution(
|
|
40
|
-
'getEntityRecords',
|
|
41
|
-
getEntityRecordsArgs
|
|
42
|
-
);
|
|
43
|
-
return {
|
|
44
|
-
categories: getEntityRecords( ...getEntityRecordsArgs ),
|
|
45
|
-
isResolved: hasResolvedPosts,
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
[ searchQuery ]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
52
|
-
const showLoading = ! isResolved || shouldShowLoadingForDebouncing;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<NavigationMenu
|
|
56
|
-
menu={ MENU_CONTENT_CATEGORIES }
|
|
57
|
-
title={ __( 'Categories' ) }
|
|
58
|
-
parentMenu={ MENU_ROOT }
|
|
59
|
-
hasSearch={ true }
|
|
60
|
-
onSearch={ onSearch }
|
|
61
|
-
search={ search }
|
|
62
|
-
isSearchDebouncing={ isDebouncing || ! isResolved }
|
|
63
|
-
>
|
|
64
|
-
{ search && ! isDebouncing && (
|
|
65
|
-
<SearchResults
|
|
66
|
-
items={ categories }
|
|
67
|
-
search={ search }
|
|
68
|
-
disableFilter
|
|
69
|
-
/>
|
|
70
|
-
) }
|
|
71
|
-
|
|
72
|
-
{ ! search &&
|
|
73
|
-
categories?.map( ( category ) => (
|
|
74
|
-
<ContentNavigationItem
|
|
75
|
-
item={ category }
|
|
76
|
-
key={ `${ category.taxonomy }-${ category.id }` }
|
|
77
|
-
/>
|
|
78
|
-
) ) }
|
|
79
|
-
|
|
80
|
-
{ showLoading && (
|
|
81
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
82
|
-
) }
|
|
83
|
-
</NavigationMenu>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { MENU_CONTENT_PAGES, MENU_ROOT } from '../constants';
|
|
16
|
-
import ContentNavigationItem from '../content-navigation-item';
|
|
17
|
-
import SearchResults from '../search-results';
|
|
18
|
-
import useDebouncedSearch from '../use-debounced-search';
|
|
19
|
-
|
|
20
|
-
export default function ContentPagesMenu() {
|
|
21
|
-
const {
|
|
22
|
-
search,
|
|
23
|
-
searchQuery,
|
|
24
|
-
onSearch,
|
|
25
|
-
isDebouncing,
|
|
26
|
-
} = useDebouncedSearch();
|
|
27
|
-
|
|
28
|
-
const { pages, isResolved } = useSelect(
|
|
29
|
-
( select ) => {
|
|
30
|
-
const { getEntityRecords, hasFinishedResolution } = select(
|
|
31
|
-
coreStore
|
|
32
|
-
);
|
|
33
|
-
const query = searchQuery
|
|
34
|
-
? {
|
|
35
|
-
search: searchQuery,
|
|
36
|
-
}
|
|
37
|
-
: undefined;
|
|
38
|
-
const getEntityRecordsArgs = [ 'postType', 'page', query ];
|
|
39
|
-
const hasResolvedPosts = hasFinishedResolution(
|
|
40
|
-
'getEntityRecords',
|
|
41
|
-
getEntityRecordsArgs
|
|
42
|
-
);
|
|
43
|
-
return {
|
|
44
|
-
pages: getEntityRecords( ...getEntityRecordsArgs ),
|
|
45
|
-
isResolved: hasResolvedPosts,
|
|
46
|
-
};
|
|
47
|
-
},
|
|
48
|
-
[ searchQuery ]
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
52
|
-
const showLoading = ! isResolved || shouldShowLoadingForDebouncing;
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<NavigationMenu
|
|
56
|
-
menu={ MENU_CONTENT_PAGES }
|
|
57
|
-
title={ __( 'Pages' ) }
|
|
58
|
-
parentMenu={ MENU_ROOT }
|
|
59
|
-
hasSearch={ true }
|
|
60
|
-
onSearch={ onSearch }
|
|
61
|
-
search={ search }
|
|
62
|
-
isSearchDebouncing={ isDebouncing || ! isResolved }
|
|
63
|
-
>
|
|
64
|
-
{ search && ! isDebouncing && (
|
|
65
|
-
<SearchResults
|
|
66
|
-
items={ pages }
|
|
67
|
-
search={ search }
|
|
68
|
-
disableFilter
|
|
69
|
-
/>
|
|
70
|
-
) }
|
|
71
|
-
|
|
72
|
-
{ ! search &&
|
|
73
|
-
pages?.map( ( page ) => (
|
|
74
|
-
<ContentNavigationItem
|
|
75
|
-
item={ page }
|
|
76
|
-
key={ `${ page.type }-${ page.id }` }
|
|
77
|
-
/>
|
|
78
|
-
) ) }
|
|
79
|
-
|
|
80
|
-
{ showLoading && (
|
|
81
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
82
|
-
) }
|
|
83
|
-
</NavigationMenu>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useCallback } from '@wordpress/element';
|
|
10
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
|
-
import { MENU_CONTENT_POSTS, MENU_ROOT } from '../constants';
|
|
17
|
-
import ContentNavigationItem from '../content-navigation-item';
|
|
18
|
-
import SearchResults from '../search-results';
|
|
19
|
-
import useDebouncedSearch from '../use-debounced-search';
|
|
20
|
-
import { store as editSiteStore } from '../../../../store';
|
|
21
|
-
|
|
22
|
-
export default function ContentPostsMenu() {
|
|
23
|
-
const {
|
|
24
|
-
search,
|
|
25
|
-
searchQuery,
|
|
26
|
-
onSearch,
|
|
27
|
-
isDebouncing,
|
|
28
|
-
} = useDebouncedSearch();
|
|
29
|
-
|
|
30
|
-
const { posts, showOnFront, isResolved } = useSelect(
|
|
31
|
-
( select ) => {
|
|
32
|
-
const {
|
|
33
|
-
getEntityRecords,
|
|
34
|
-
getEditedEntityRecord,
|
|
35
|
-
hasFinishedResolution,
|
|
36
|
-
} = select( coreStore );
|
|
37
|
-
const query = searchQuery
|
|
38
|
-
? {
|
|
39
|
-
search: searchQuery,
|
|
40
|
-
}
|
|
41
|
-
: undefined;
|
|
42
|
-
const getEntityRecodsArgs = [ 'postType', 'post', query ];
|
|
43
|
-
const hasResolvedPosts = hasFinishedResolution(
|
|
44
|
-
'getEntityRecords',
|
|
45
|
-
getEntityRecodsArgs
|
|
46
|
-
);
|
|
47
|
-
return {
|
|
48
|
-
posts: getEntityRecords( ...getEntityRecodsArgs ),
|
|
49
|
-
isResolved: hasResolvedPosts,
|
|
50
|
-
showOnFront: getEditedEntityRecord( 'root', 'site' )
|
|
51
|
-
.show_on_front,
|
|
52
|
-
};
|
|
53
|
-
},
|
|
54
|
-
[ searchQuery ]
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
const { setPage, setIsNavigationPanelOpened } = useDispatch(
|
|
58
|
-
editSiteStore
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
const onActivateFrontItem = useCallback( () => {
|
|
62
|
-
setPage( {
|
|
63
|
-
type: 'page',
|
|
64
|
-
path: '/',
|
|
65
|
-
context: {
|
|
66
|
-
queryContext: { page: 1 },
|
|
67
|
-
},
|
|
68
|
-
} );
|
|
69
|
-
setIsNavigationPanelOpened( false );
|
|
70
|
-
}, [ setPage, setIsNavigationPanelOpened ] );
|
|
71
|
-
|
|
72
|
-
const shouldShowLoadingForDebouncing = search && isDebouncing;
|
|
73
|
-
const showLoading = ! isResolved || shouldShowLoadingForDebouncing;
|
|
74
|
-
|
|
75
|
-
return (
|
|
76
|
-
<NavigationMenu
|
|
77
|
-
menu={ MENU_CONTENT_POSTS }
|
|
78
|
-
title={ __( 'Posts' ) }
|
|
79
|
-
parentMenu={ MENU_ROOT }
|
|
80
|
-
hasSearch={ true }
|
|
81
|
-
onSearch={ onSearch }
|
|
82
|
-
search={ search }
|
|
83
|
-
isSearchDebouncing={ isDebouncing || ! isResolved }
|
|
84
|
-
>
|
|
85
|
-
{ search && ! isDebouncing && (
|
|
86
|
-
<SearchResults
|
|
87
|
-
items={ posts }
|
|
88
|
-
search={ search }
|
|
89
|
-
disableFilter
|
|
90
|
-
/>
|
|
91
|
-
) }
|
|
92
|
-
|
|
93
|
-
{ ! search && (
|
|
94
|
-
<>
|
|
95
|
-
{ showOnFront === 'posts' && (
|
|
96
|
-
<NavigationItem
|
|
97
|
-
item={ 'post-/' }
|
|
98
|
-
title={ __( 'All Posts' ) }
|
|
99
|
-
onClick={ onActivateFrontItem }
|
|
100
|
-
/>
|
|
101
|
-
) }
|
|
102
|
-
|
|
103
|
-
{ posts?.map( ( post ) => (
|
|
104
|
-
<ContentNavigationItem
|
|
105
|
-
item={ post }
|
|
106
|
-
key={ `${ post.type }-${ post.id }` }
|
|
107
|
-
/>
|
|
108
|
-
) ) }
|
|
109
|
-
</>
|
|
110
|
-
) }
|
|
111
|
-
|
|
112
|
-
{ showLoading && (
|
|
113
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
114
|
-
) }
|
|
115
|
-
</NavigationMenu>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalNavigationGroup as NavigationGroup,
|
|
6
|
-
__experimentalNavigationItem as NavigationItem,
|
|
7
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
8
|
-
} from '@wordpress/components';
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import {
|
|
15
|
-
MENU_TEMPLATES,
|
|
16
|
-
MENU_TEMPLATE_PARTS,
|
|
17
|
-
MENU_CONTENT_CATEGORIES,
|
|
18
|
-
MENU_CONTENT_PAGES,
|
|
19
|
-
MENU_CONTENT_POSTS,
|
|
20
|
-
} from '../constants';
|
|
21
|
-
import ContentPagesMenu from './content-pages';
|
|
22
|
-
import ContentCategoriesMenu from './content-categories';
|
|
23
|
-
import ContentPostsMenu from './content-posts';
|
|
24
|
-
import TemplatesMenu from './templates';
|
|
25
|
-
import TemplatePartsMenu from './template-parts';
|
|
26
|
-
|
|
27
|
-
export default function SiteMenu() {
|
|
28
|
-
return (
|
|
29
|
-
<NavigationMenu>
|
|
30
|
-
<NavigationGroup title={ __( 'Theme' ) }>
|
|
31
|
-
<NavigationItem
|
|
32
|
-
title={ __( 'Templates' ) }
|
|
33
|
-
navigateToMenu={ MENU_TEMPLATES }
|
|
34
|
-
/>
|
|
35
|
-
<NavigationItem
|
|
36
|
-
title={ __( 'Template Parts' ) }
|
|
37
|
-
navigateToMenu={ MENU_TEMPLATE_PARTS }
|
|
38
|
-
/>
|
|
39
|
-
</NavigationGroup>
|
|
40
|
-
<NavigationGroup title={ __( 'Content' ) }>
|
|
41
|
-
<NavigationItem
|
|
42
|
-
title={ __( 'Pages' ) }
|
|
43
|
-
navigateToMenu={ MENU_CONTENT_PAGES }
|
|
44
|
-
/>
|
|
45
|
-
<NavigationItem
|
|
46
|
-
title={ __( 'Categories' ) }
|
|
47
|
-
navigateToMenu={ MENU_CONTENT_CATEGORIES }
|
|
48
|
-
/>
|
|
49
|
-
<NavigationItem
|
|
50
|
-
title={ __( 'Posts' ) }
|
|
51
|
-
navigateToMenu={ MENU_CONTENT_POSTS }
|
|
52
|
-
/>
|
|
53
|
-
</NavigationGroup>
|
|
54
|
-
<TemplatesMenu />
|
|
55
|
-
<TemplatePartsMenu />
|
|
56
|
-
<ContentPagesMenu />
|
|
57
|
-
<ContentCategoriesMenu />
|
|
58
|
-
<ContentPostsMenu />
|
|
59
|
-
</NavigationMenu>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { map } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __experimentalNavigationMenu as NavigationMenu } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import TemplateNavigationItem from '../template-navigation-item';
|
|
15
|
-
import { MENU_TEMPLATE_PARTS } from '../constants';
|
|
16
|
-
|
|
17
|
-
export default function TemplatePartsSubMenu( { menu, title, templateParts } ) {
|
|
18
|
-
return (
|
|
19
|
-
<NavigationMenu
|
|
20
|
-
className="edit-site-navigation-panel__template-parts"
|
|
21
|
-
menu={ menu }
|
|
22
|
-
title={ title }
|
|
23
|
-
parentMenu={ MENU_TEMPLATE_PARTS }
|
|
24
|
-
isEmpty={ ! templateParts || templateParts.length === 0 }
|
|
25
|
-
>
|
|
26
|
-
{ map( templateParts, ( templatePart ) => (
|
|
27
|
-
<TemplateNavigationItem
|
|
28
|
-
item={ templatePart }
|
|
29
|
-
key={ `wp_template_part-${ templatePart.id }` }
|
|
30
|
-
/>
|
|
31
|
-
) ) }
|
|
32
|
-
</NavigationMenu>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { groupBy } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import { useSelect } from '@wordpress/data';
|
|
11
|
-
import {
|
|
12
|
-
__experimentalNavigationMenu as NavigationMenu,
|
|
13
|
-
__experimentalNavigationItem as NavigationItem,
|
|
14
|
-
} from '@wordpress/components';
|
|
15
|
-
import { useState, useCallback } from '@wordpress/element';
|
|
16
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
|
-
import {
|
|
22
|
-
MENU_ROOT,
|
|
23
|
-
MENU_TEMPLATE_PARTS,
|
|
24
|
-
TEMPLATE_PARTS_SUB_MENUS,
|
|
25
|
-
} from '../constants';
|
|
26
|
-
import SearchResults from '../search-results';
|
|
27
|
-
import TemplatePartsSubMenu from './template-parts-sub';
|
|
28
|
-
|
|
29
|
-
export default function TemplatePartsMenu() {
|
|
30
|
-
const [ search, setSearch ] = useState( '' );
|
|
31
|
-
const onSearch = useCallback( ( value ) => {
|
|
32
|
-
setSearch( value );
|
|
33
|
-
} );
|
|
34
|
-
|
|
35
|
-
const { isLoading, templateParts, templatePartsByArea } = useSelect(
|
|
36
|
-
( select ) => {
|
|
37
|
-
const templatePartRecords = select( coreStore ).getEntityRecords(
|
|
38
|
-
'postType',
|
|
39
|
-
'wp_template_part'
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
const _templateParts = templatePartRecords || [];
|
|
43
|
-
const _templatePartsByArea = groupBy( _templateParts, 'area' );
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
isLoading: templatePartRecords === null,
|
|
47
|
-
templateParts: _templateParts,
|
|
48
|
-
templatePartsByArea: _templatePartsByArea,
|
|
49
|
-
};
|
|
50
|
-
},
|
|
51
|
-
[]
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<>
|
|
56
|
-
<NavigationMenu
|
|
57
|
-
menu={ MENU_TEMPLATE_PARTS }
|
|
58
|
-
title={ __( 'Template Parts' ) }
|
|
59
|
-
parentMenu={ MENU_ROOT }
|
|
60
|
-
hasSearch={ true }
|
|
61
|
-
onSearch={ onSearch }
|
|
62
|
-
search={ search }
|
|
63
|
-
>
|
|
64
|
-
{ search && (
|
|
65
|
-
<SearchResults items={ templateParts } search={ search } />
|
|
66
|
-
) }
|
|
67
|
-
|
|
68
|
-
{ ! search &&
|
|
69
|
-
TEMPLATE_PARTS_SUB_MENUS.map( ( { title, menu } ) => (
|
|
70
|
-
<NavigationItem
|
|
71
|
-
key={ `template-parts-navigate-to-${ menu }` }
|
|
72
|
-
className="edit-site-navigation-panel__template-part-item"
|
|
73
|
-
navigateToMenu={ menu }
|
|
74
|
-
title={ title }
|
|
75
|
-
hideIfTargetMenuEmpty
|
|
76
|
-
/>
|
|
77
|
-
) ) }
|
|
78
|
-
|
|
79
|
-
{ ! search && isLoading && (
|
|
80
|
-
<NavigationItem title={ __( 'Loading…' ) } isText />
|
|
81
|
-
) }
|
|
82
|
-
</NavigationMenu>
|
|
83
|
-
|
|
84
|
-
{ TEMPLATE_PARTS_SUB_MENUS.map( ( { area, menu, title } ) => (
|
|
85
|
-
<TemplatePartsSubMenu
|
|
86
|
-
key={ `template-parts-menu-${ menu }` }
|
|
87
|
-
menu={ menu }
|
|
88
|
-
title={ title }
|
|
89
|
-
templateParts={ templatePartsByArea[ area ] }
|
|
90
|
-
/>
|
|
91
|
-
) ) }
|
|
92
|
-
</>
|
|
93
|
-
);
|
|
94
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { map } from 'lodash';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { __experimentalNavigationMenu as NavigationMenu } from '@wordpress/components';
|
|
10
|
-
import { useMemo } from '@wordpress/element';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import TemplateNavigationItem from '../template-navigation-item';
|
|
16
|
-
import { MENU_TEMPLATES } from '../constants';
|
|
17
|
-
|
|
18
|
-
export default function TemplatesSubMenu( { menu, title, templates } ) {
|
|
19
|
-
const templatesFiltered = useMemo(
|
|
20
|
-
() =>
|
|
21
|
-
templates
|
|
22
|
-
?.filter( ( { location } ) => location === menu )
|
|
23
|
-
?.map( ( { template } ) => template ) ?? [],
|
|
24
|
-
[ menu, templates ]
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<NavigationMenu
|
|
29
|
-
menu={ menu }
|
|
30
|
-
title={ title }
|
|
31
|
-
parentMenu={ MENU_TEMPLATES }
|
|
32
|
-
isEmpty={ templatesFiltered.length === 0 }
|
|
33
|
-
>
|
|
34
|
-
{ map( templatesFiltered, ( template ) => (
|
|
35
|
-
<TemplateNavigationItem
|
|
36
|
-
item={ template }
|
|
37
|
-
key={ `wp_template-${ template.id }` }
|
|
38
|
-
/>
|
|
39
|
-
) ) }
|
|
40
|
-
</NavigationMenu>
|
|
41
|
-
);
|
|
42
|
-
}
|