@wordpress/edit-site 5.12.5 → 5.12.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/add-new-template/new-template.js +1 -1
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +7 -7
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/page/index.js +3 -1
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-main/index.js +8 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/{page-library → page-patterns}/grid-item.js +52 -27
- package/build/components/page-patterns/grid-item.js.map +1 -0
- package/build/components/{page-library → page-patterns}/grid.js +1 -1
- package/build/components/page-patterns/grid.js.map +1 -0
- package/build/components/{page-library → page-patterns}/index.js +6 -6
- package/build/components/page-patterns/index.js.map +1 -0
- package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build/components/page-patterns/no-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/patterns-list.js +6 -6
- package/build/components/page-patterns/patterns-list.js.map +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -0
- package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build/components/{page-library → page-patterns}/use-patterns.js +12 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/utils.js +3 -3
- package/build/components/page-patterns/utils.js.map +1 -0
- package/build/components/page-template-parts/index.js +102 -0
- package/build/components/page-template-parts/index.js.map +1 -0
- package/build/components/sidebar/index.js +6 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +20 -8
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +2 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -0
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +55 -15
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +70 -0
- package/build/components/welcome-guide/page.js.map +1 -0
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +71 -0
- package/build/components/welcome-guide/template.js.map +1 -0
- package/build/hooks/commands/use-common-commands.js +17 -2
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +2 -1
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -2
- package/build/store/actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +2 -2
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +2 -2
- 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/create-pattern-modal/index.js +7 -7
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/page/index.js +2 -1
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-main/index.js +6 -3
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/{page-library → page-patterns}/grid-item.js +56 -29
- package/build-module/components/page-patterns/grid-item.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
- package/build-module/components/page-patterns/grid.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build-module/components/page-patterns/no-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/patterns-list.js +6 -6
- package/build-module/components/page-patterns/patterns-list.js.map +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -0
- package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/use-patterns.js +12 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
- package/build-module/components/page-patterns/utils.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +81 -0
- package/build-module/components/page-template-parts/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +5 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -8
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +2 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +15 -5
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +21 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +54 -16
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +59 -0
- package/build-module/components/welcome-guide/page.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +60 -0
- package/build-module/components/welcome-guide/template.js.map +1 -0
- package/build-module/hooks/commands/use-common-commands.js +16 -2
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +2 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +2 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +2 -2
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +43 -26
- package/build-style/style.css +43 -26
- package/package.json +19 -19
- package/src/components/add-new-template/new-template.js +2 -2
- package/src/components/block-editor/editor-canvas.js +3 -1
- package/src/components/create-pattern-modal/index.js +10 -11
- package/src/components/header-edit-mode/document-actions/index.js +9 -1
- package/src/components/page/index.js +5 -1
- package/src/components/page-main/index.js +6 -3
- package/src/components/{page-library → page-patterns}/grid-item.js +74 -24
- package/src/components/{page-library → page-patterns}/grid.js +1 -1
- package/src/components/{page-library → page-patterns}/index.js +5 -5
- package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/src/components/{page-library → page-patterns}/patterns-list.js +6 -6
- package/src/components/{page-library → page-patterns}/style.scss +16 -12
- package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
- package/src/components/{page-library → page-patterns}/use-patterns.js +11 -2
- package/src/components/{page-library → page-patterns}/utils.js +3 -3
- package/src/components/page-template-parts/index.js +105 -0
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +26 -15
- package/src/components/sidebar-navigation-screen-main/index.js +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +2 -6
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +12 -4
- package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
- package/src/components/sidebar-navigation-screen-pattern/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +43 -1
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +3 -3
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +75 -22
- package/src/components/sidebar-navigation-screen-patterns/style.scss +3 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/index.js +4 -0
- package/src/components/welcome-guide/page.js +75 -0
- package/src/components/welcome-guide/style.scss +15 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/components/welcome-guide/template.js +82 -0
- package/src/hooks/commands/use-common-commands.js +13 -1
- package/src/hooks/commands/use-edit-mode-commands.js +5 -1
- package/src/index.js +2 -0
- package/src/store/actions.js +8 -1
- package/src/style.scss +2 -2
- package/src/utils/get-is-list-page.js +4 -3
- package/build/components/page-library/grid-item.js.map +0 -1
- package/build/components/page-library/grid.js.map +0 -1
- package/build/components/page-library/index.js.map +0 -1
- package/build/components/page-library/no-patterns.js.map +0 -1
- package/build/components/page-library/patterns-list.js.map +0 -1
- package/build/components/page-library/search-items.js.map +0 -1
- package/build/components/page-library/use-library-settings.js.map +0 -1
- package/build/components/page-library/use-patterns.js.map +0 -1
- package/build/components/page-library/utils.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/build-module/components/page-library/grid-item.js.map +0 -1
- package/build-module/components/page-library/grid.js.map +0 -1
- package/build-module/components/page-library/index.js.map +0 -1
- package/build-module/components/page-library/no-patterns.js.map +0 -1
- package/build-module/components/page-library/patterns-list.js.map +0 -1
- package/build-module/components/page-library/search-items.js.map +0 -1
- package/build-module/components/page-library/use-library-settings.js.map +0 -1
- package/build-module/components/page-library/use-patterns.js.map +0 -1
- package/build-module/components/page-library/utils.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -3
- /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
- /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
- /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
|
@@ -16,6 +16,7 @@ import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
|
16
16
|
import { humanTimeDiff } from '@wordpress/date';
|
|
17
17
|
import { useCallback } from '@wordpress/element';
|
|
18
18
|
import { store as noticesStore } from '@wordpress/notices';
|
|
19
|
+
import { store as preferencesStore } from '@wordpress/preferences';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
@@ -32,14 +33,21 @@ import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-glob
|
|
|
32
33
|
const noop = () => {};
|
|
33
34
|
|
|
34
35
|
export function SidebarNavigationItemGlobalStyles( props ) {
|
|
35
|
-
const { openGeneralSidebar
|
|
36
|
+
const { openGeneralSidebar } = useDispatch( editSiteStore );
|
|
36
37
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
37
38
|
const { createNotice } = useDispatch( noticesStore );
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
const { set: setPreference } = useDispatch( preferencesStore );
|
|
40
|
+
const { hasGlobalStyleVariations, isDistractionFree } = useSelect(
|
|
41
|
+
( select ) => ( {
|
|
42
|
+
hasGlobalStyleVariations:
|
|
43
|
+
!! select(
|
|
44
|
+
coreStore
|
|
45
|
+
).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,
|
|
46
|
+
isDistractionFree: select( preferencesStore ).get(
|
|
47
|
+
editSiteStore.name,
|
|
48
|
+
'distractionFree'
|
|
49
|
+
),
|
|
50
|
+
} ),
|
|
43
51
|
[]
|
|
44
52
|
);
|
|
45
53
|
if ( hasGlobalStyleVariations ) {
|
|
@@ -56,15 +64,18 @@ export function SidebarNavigationItemGlobalStyles( props ) {
|
|
|
56
64
|
{ ...props }
|
|
57
65
|
onClick={ () => {
|
|
58
66
|
// Disable distraction free mode.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
if ( isDistractionFree ) {
|
|
68
|
+
setPreference(
|
|
69
|
+
editSiteStore.name,
|
|
70
|
+
'distractionFree',
|
|
71
|
+
false
|
|
72
|
+
);
|
|
73
|
+
createNotice(
|
|
74
|
+
'info',
|
|
75
|
+
__( 'Distraction free mode turned off.' ),
|
|
76
|
+
{ type: 'snackbar' }
|
|
77
|
+
);
|
|
78
|
+
}
|
|
68
79
|
// Switch to edit mode.
|
|
69
80
|
setCanvasMode( 'edit' );
|
|
70
81
|
// Open global styles sidebar.
|
|
@@ -75,11 +75,11 @@ export default function SidebarNavigationScreenMain() {
|
|
|
75
75
|
</NavigatorButton>
|
|
76
76
|
<NavigatorButton
|
|
77
77
|
as={ SidebarNavigationItem }
|
|
78
|
-
path="/
|
|
78
|
+
path="/patterns"
|
|
79
79
|
withChevron
|
|
80
80
|
icon={ symbol }
|
|
81
81
|
>
|
|
82
|
-
{ __( '
|
|
82
|
+
{ __( 'Patterns' ) }
|
|
83
83
|
</NavigatorButton>
|
|
84
84
|
</ItemGroup>
|
|
85
85
|
}
|
|
@@ -33,11 +33,8 @@ export default function SidebarNavigationScreenNavigationMenu() {
|
|
|
33
33
|
|
|
34
34
|
const { isSaving, isDeleting } = useSelect(
|
|
35
35
|
( select ) => {
|
|
36
|
-
const {
|
|
37
|
-
|
|
38
|
-
isDeletingEntityRecord,
|
|
39
|
-
getEditedEntityRecord: getEditedEntityRecordSelector,
|
|
40
|
-
} = select( coreStore );
|
|
36
|
+
const { isSavingEntityRecord, isDeletingEntityRecord } =
|
|
37
|
+
select( coreStore );
|
|
41
38
|
|
|
42
39
|
return {
|
|
43
40
|
isSaving: isSavingEntityRecord( 'postType', postType, postId ),
|
|
@@ -46,7 +43,6 @@ export default function SidebarNavigationScreenNavigationMenu() {
|
|
|
46
43
|
postType,
|
|
47
44
|
postId
|
|
48
45
|
),
|
|
49
|
-
getEditedEntityRecord: getEditedEntityRecordSelector,
|
|
50
46
|
};
|
|
51
47
|
},
|
|
52
48
|
[ postId ]
|
|
@@ -21,6 +21,7 @@ import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
|
|
|
21
21
|
import { useLink } from '../routes/link';
|
|
22
22
|
import SingleNavigationMenu from '../sidebar-navigation-screen-navigation-menu/single-navigation-menu';
|
|
23
23
|
import useNavigationMenuHandlers from '../sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers';
|
|
24
|
+
import { unlock } from '../../lock-unlock';
|
|
24
25
|
|
|
25
26
|
// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
|
|
26
27
|
function buildMenuLabel( title, id, status ) {
|
|
@@ -41,6 +42,9 @@ function buildMenuLabel( title, id, status ) {
|
|
|
41
42
|
);
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
// Save a boolean to prevent us creating a fallback more than once per session.
|
|
46
|
+
let hasCreatedFallback = false;
|
|
47
|
+
|
|
44
48
|
export default function SidebarNavigationScreenNavigationMenus() {
|
|
45
49
|
const {
|
|
46
50
|
records: navigationMenus,
|
|
@@ -55,18 +59,22 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
55
59
|
const isLoading =
|
|
56
60
|
isResolvingNavigationMenus && ! hasResolvedNavigationMenus;
|
|
57
61
|
|
|
58
|
-
const getNavigationFallbackId = useSelect(
|
|
59
|
-
( select ) => select( coreStore ).getNavigationFallbackId
|
|
60
|
-
);
|
|
62
|
+
const { getNavigationFallbackId } = unlock( useSelect( coreStore ) );
|
|
61
63
|
|
|
62
64
|
const firstNavigationMenu = navigationMenus?.[ 0 ];
|
|
63
65
|
|
|
66
|
+
// Save a boolean to prevent us creating a fallback more than once per session.
|
|
67
|
+
if ( firstNavigationMenu ) {
|
|
68
|
+
hasCreatedFallback = true;
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
// If there is no navigation menu found
|
|
65
72
|
// then trigger fallback algorithm to create one.
|
|
66
73
|
if (
|
|
67
74
|
! firstNavigationMenu &&
|
|
68
75
|
! isResolvingNavigationMenus &&
|
|
69
|
-
hasResolvedNavigationMenus
|
|
76
|
+
hasResolvedNavigationMenus &&
|
|
77
|
+
! hasCreatedFallback
|
|
70
78
|
) {
|
|
71
79
|
getNavigationFallbackId();
|
|
72
80
|
}
|
|
@@ -12,7 +12,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
12
12
|
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
14
14
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
15
|
-
import { layout, page, home,
|
|
15
|
+
import { layout, page, home, verse, plus } from '@wordpress/icons';
|
|
16
16
|
import { useSelect } from '@wordpress/data';
|
|
17
17
|
|
|
18
18
|
/**
|
|
@@ -159,7 +159,7 @@ export default function SidebarNavigationScreenPages() {
|
|
|
159
159
|
itemIcon = home;
|
|
160
160
|
break;
|
|
161
161
|
case postsPage:
|
|
162
|
-
itemIcon =
|
|
162
|
+
itemIcon = verse;
|
|
163
163
|
break;
|
|
164
164
|
default:
|
|
165
165
|
itemIcon = page;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { __experimentalUseNavigator as useNavigator } from '@wordpress/components';
|
|
5
5
|
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
6
7
|
import { pencil } from '@wordpress/icons';
|
|
7
|
-
import {
|
|
8
|
+
import { getQueryArgs } from '@wordpress/url';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* Internal dependencies
|
|
@@ -13,19 +14,26 @@ import SidebarButton from '../sidebar-button';
|
|
|
13
14
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
14
15
|
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
|
|
15
16
|
import usePatternDetails from './use-pattern-details';
|
|
16
|
-
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
17
17
|
import { store as editSiteStore } from '../../store';
|
|
18
18
|
import { unlock } from '../../lock-unlock';
|
|
19
19
|
|
|
20
20
|
export default function SidebarNavigationScreenPattern() {
|
|
21
21
|
const { params } = useNavigator();
|
|
22
|
+
const { categoryType } = getQueryArgs( window.location.href );
|
|
22
23
|
const { postType, postId } = params;
|
|
23
24
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
24
25
|
|
|
25
26
|
useInitEditedEntityFromURL();
|
|
26
27
|
|
|
27
28
|
const patternDetails = usePatternDetails( postType, postId );
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
// The absence of a category type in the query params for template parts
|
|
31
|
+
// indicates the user has arrived at the template part via the "manage all"
|
|
32
|
+
// page and the back button should return them to that list page.
|
|
33
|
+
const backPath =
|
|
34
|
+
! categoryType && postType === 'wp_template_part'
|
|
35
|
+
? '/wp_template_part/all'
|
|
36
|
+
: '/patterns';
|
|
29
37
|
|
|
30
38
|
return (
|
|
31
39
|
<SidebarNavigationScreen
|
|
@@ -36,8 +44,7 @@ export default function SidebarNavigationScreenPattern() {
|
|
|
36
44
|
icon={ pencil }
|
|
37
45
|
/>
|
|
38
46
|
}
|
|
39
|
-
backPath={
|
|
40
|
-
content={ content }
|
|
47
|
+
backPath={ backPath }
|
|
41
48
|
{ ...patternDetails }
|
|
42
49
|
/>
|
|
43
50
|
);
|
|
@@ -11,7 +11,14 @@ import { Icon } from '@wordpress/components';
|
|
|
11
11
|
*/
|
|
12
12
|
import { useAddedBy } from '../list/added-by';
|
|
13
13
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
14
|
+
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
14
15
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
16
|
+
import {
|
|
17
|
+
SidebarNavigationScreenDetailsPanel,
|
|
18
|
+
SidebarNavigationScreenDetailsPanelRow,
|
|
19
|
+
SidebarNavigationScreenDetailsPanelLabel,
|
|
20
|
+
SidebarNavigationScreenDetailsPanelValue,
|
|
21
|
+
} from '../sidebar-navigation-screen-details-panel';
|
|
15
22
|
|
|
16
23
|
export default function usePatternDetails( postType, postId ) {
|
|
17
24
|
const { getDescription, getTitle, record } = useEditedEntityRecord(
|
|
@@ -82,5 +89,40 @@ export default function usePatternDetails( postType, postId ) {
|
|
|
82
89
|
/>
|
|
83
90
|
) : null;
|
|
84
91
|
|
|
85
|
-
|
|
92
|
+
const details = [];
|
|
93
|
+
|
|
94
|
+
if ( postType === 'wp_block' ) {
|
|
95
|
+
details.push( {
|
|
96
|
+
label: __( 'Syncing' ),
|
|
97
|
+
value:
|
|
98
|
+
record.meta?.sync_status === 'unsynced'
|
|
99
|
+
? __( 'Not synced' )
|
|
100
|
+
: __( 'Fully synced' ),
|
|
101
|
+
} );
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const content = (
|
|
105
|
+
<>
|
|
106
|
+
{ !! details.length && (
|
|
107
|
+
<SidebarNavigationScreenDetailsPanel
|
|
108
|
+
spacing={ 5 }
|
|
109
|
+
title={ __( 'Details' ) }
|
|
110
|
+
>
|
|
111
|
+
{ details.map( ( { label, value } ) => (
|
|
112
|
+
<SidebarNavigationScreenDetailsPanelRow key={ label }>
|
|
113
|
+
<SidebarNavigationScreenDetailsPanelLabel>
|
|
114
|
+
{ label }
|
|
115
|
+
</SidebarNavigationScreenDetailsPanelLabel>
|
|
116
|
+
<SidebarNavigationScreenDetailsPanelValue>
|
|
117
|
+
{ value }
|
|
118
|
+
</SidebarNavigationScreenDetailsPanelValue>
|
|
119
|
+
</SidebarNavigationScreenDetailsPanelRow>
|
|
120
|
+
) ) }
|
|
121
|
+
</SidebarNavigationScreenDetailsPanel>
|
|
122
|
+
) }
|
|
123
|
+
{ useNavigationMenuContent( postType, postId ) }
|
|
124
|
+
</>
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
return { title, description, content, footer };
|
|
86
128
|
}
|
|
@@ -14,15 +14,15 @@ export default function CategoryItem( {
|
|
|
14
14
|
} ) {
|
|
15
15
|
const linkInfo = useLink(
|
|
16
16
|
{
|
|
17
|
-
path: '/
|
|
17
|
+
path: '/patterns',
|
|
18
18
|
categoryType: type,
|
|
19
19
|
categoryId: id,
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
// Keep a record of where we came from in state so we can
|
|
23
|
-
// use the browser's back button to go back to
|
|
23
|
+
// use the browser's back button to go back to Patterns.
|
|
24
24
|
// See the implementation of the back button in patterns-list.
|
|
25
|
-
backPath: '/
|
|
25
|
+
backPath: '/patterns',
|
|
26
26
|
}
|
|
27
27
|
);
|
|
28
28
|
|
|
@@ -4,13 +4,16 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
6
|
__experimentalItem as Item,
|
|
7
|
+
Flex,
|
|
8
|
+
Icon,
|
|
9
|
+
Tooltip,
|
|
7
10
|
} from '@wordpress/components';
|
|
8
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
9
12
|
import { useSelect } from '@wordpress/data';
|
|
10
13
|
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
11
14
|
import { __ } from '@wordpress/i18n';
|
|
12
15
|
import { getQueryArgs } from '@wordpress/url';
|
|
13
|
-
import { file } from '@wordpress/icons';
|
|
16
|
+
import { file, starFilled, lockSmall } from '@wordpress/icons';
|
|
14
17
|
|
|
15
18
|
/**
|
|
16
19
|
* Internal dependencies
|
|
@@ -19,9 +22,11 @@ import AddNewPattern from '../add-new-pattern';
|
|
|
19
22
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
20
23
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
21
24
|
import CategoryItem from './category-item';
|
|
22
|
-
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-
|
|
25
|
+
import { DEFAULT_CATEGORY, DEFAULT_TYPE } from '../page-patterns/utils';
|
|
23
26
|
import { store as editSiteStore } from '../../store';
|
|
27
|
+
import { useLink } from '../routes/link';
|
|
24
28
|
import usePatternCategories from './use-pattern-categories';
|
|
29
|
+
import useMyPatterns from './use-my-patterns';
|
|
25
30
|
import useTemplatePartAreas from './use-template-part-areas';
|
|
26
31
|
|
|
27
32
|
const templatePartAreaLabels = {
|
|
@@ -31,7 +36,7 @@ const templatePartAreaLabels = {
|
|
|
31
36
|
uncategorized: __( 'Uncategorized' ),
|
|
32
37
|
};
|
|
33
38
|
|
|
34
|
-
export default function
|
|
39
|
+
export default function SidebarNavigationScreenPatterns() {
|
|
35
40
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
36
41
|
const { categoryType, categoryId } = getQueryArgs( window.location.href );
|
|
37
42
|
const currentCategory = categoryId || DEFAULT_CATEGORY;
|
|
@@ -40,40 +45,45 @@ export default function SidebarNavigationScreenLibrary() {
|
|
|
40
45
|
const { templatePartAreas, hasTemplateParts, isLoading } =
|
|
41
46
|
useTemplatePartAreas();
|
|
42
47
|
const { patternCategories, hasPatterns } = usePatternCategories();
|
|
48
|
+
const { myPatterns, hasPatterns: hasMyPatterns } = useMyPatterns();
|
|
43
49
|
|
|
44
50
|
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
45
51
|
const settings = select( editSiteStore ).getSettings();
|
|
46
52
|
return !! settings.supportsTemplatePartsMode;
|
|
47
53
|
}, [] );
|
|
48
54
|
|
|
55
|
+
const templatePartsLink = useLink( { path: '/wp_template_part/all' } );
|
|
56
|
+
const footer = ! isMobileViewport ? (
|
|
57
|
+
<ItemGroup>
|
|
58
|
+
<SidebarNavigationItem withChevron { ...templatePartsLink }>
|
|
59
|
+
{ __( 'Manage all template parts' ) }
|
|
60
|
+
</SidebarNavigationItem>
|
|
61
|
+
<SidebarNavigationItem
|
|
62
|
+
as="a"
|
|
63
|
+
href="edit.php?post_type=wp_block"
|
|
64
|
+
withChevron
|
|
65
|
+
>
|
|
66
|
+
{ __( 'Manage all of my patterns' ) }
|
|
67
|
+
</SidebarNavigationItem>
|
|
68
|
+
</ItemGroup>
|
|
69
|
+
) : undefined;
|
|
70
|
+
|
|
49
71
|
return (
|
|
50
72
|
<SidebarNavigationScreen
|
|
51
73
|
isRoot={ isTemplatePartsMode }
|
|
52
|
-
title={ __( '
|
|
74
|
+
title={ __( 'Patterns' ) }
|
|
53
75
|
description={ __(
|
|
54
76
|
'Manage what patterns are available when editing your site.'
|
|
55
77
|
) }
|
|
56
78
|
actions={ <AddNewPattern /> }
|
|
57
|
-
footer={
|
|
58
|
-
<ItemGroup>
|
|
59
|
-
{ ! isMobileViewport && (
|
|
60
|
-
<SidebarNavigationItem
|
|
61
|
-
as="a"
|
|
62
|
-
href="edit.php?post_type=wp_block"
|
|
63
|
-
withChevron
|
|
64
|
-
>
|
|
65
|
-
{ __( 'Manage all custom patterns' ) }
|
|
66
|
-
</SidebarNavigationItem>
|
|
67
|
-
) }
|
|
68
|
-
</ItemGroup>
|
|
69
|
-
}
|
|
79
|
+
footer={ footer }
|
|
70
80
|
content={
|
|
71
81
|
<>
|
|
72
|
-
{ isLoading && __( 'Loading
|
|
82
|
+
{ isLoading && __( 'Loading patterns' ) }
|
|
73
83
|
{ ! isLoading && (
|
|
74
84
|
<>
|
|
75
85
|
{ ! hasTemplateParts && ! hasPatterns && (
|
|
76
|
-
<ItemGroup className="edit-site-sidebar-navigation-screen-
|
|
86
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
77
87
|
<Item>
|
|
78
88
|
{ __(
|
|
79
89
|
'No template parts or patterns found'
|
|
@@ -81,8 +91,25 @@ export default function SidebarNavigationScreenLibrary() {
|
|
|
81
91
|
</Item>
|
|
82
92
|
</ItemGroup>
|
|
83
93
|
) }
|
|
94
|
+
{ hasMyPatterns && (
|
|
95
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
96
|
+
<CategoryItem
|
|
97
|
+
key={ myPatterns.name }
|
|
98
|
+
count={ myPatterns.count }
|
|
99
|
+
label={ myPatterns.label }
|
|
100
|
+
icon={ starFilled }
|
|
101
|
+
id={ myPatterns.name }
|
|
102
|
+
type="wp_block"
|
|
103
|
+
isActive={
|
|
104
|
+
currentCategory ===
|
|
105
|
+
`${ myPatterns.name }` &&
|
|
106
|
+
currentType === 'wp_block'
|
|
107
|
+
}
|
|
108
|
+
/>
|
|
109
|
+
</ItemGroup>
|
|
110
|
+
) }
|
|
84
111
|
{ hasTemplateParts && (
|
|
85
|
-
<ItemGroup className="edit-site-sidebar-navigation-screen-
|
|
112
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
86
113
|
{ Object.entries( templatePartAreas ).map(
|
|
87
114
|
( [ area, parts ] ) => (
|
|
88
115
|
<CategoryItem
|
|
@@ -109,12 +136,38 @@ export default function SidebarNavigationScreenLibrary() {
|
|
|
109
136
|
</ItemGroup>
|
|
110
137
|
) }
|
|
111
138
|
{ hasPatterns && (
|
|
112
|
-
<ItemGroup className="edit-site-sidebar-navigation-screen-
|
|
139
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
113
140
|
{ patternCategories.map( ( category ) => (
|
|
114
141
|
<CategoryItem
|
|
115
142
|
key={ category.name }
|
|
116
143
|
count={ category.count }
|
|
117
|
-
label={
|
|
144
|
+
label={
|
|
145
|
+
<Flex
|
|
146
|
+
justify="left"
|
|
147
|
+
align="center"
|
|
148
|
+
gap={ 0 }
|
|
149
|
+
>
|
|
150
|
+
{ category.label }
|
|
151
|
+
<Tooltip
|
|
152
|
+
position="top center"
|
|
153
|
+
text={ __(
|
|
154
|
+
'Theme patterns cannot be edited.'
|
|
155
|
+
) }
|
|
156
|
+
>
|
|
157
|
+
<span className="edit-site-sidebar-navigation-screen-pattern__lock-icon">
|
|
158
|
+
<Icon
|
|
159
|
+
style={ {
|
|
160
|
+
fill: 'currentcolor',
|
|
161
|
+
} }
|
|
162
|
+
icon={
|
|
163
|
+
lockSmall
|
|
164
|
+
}
|
|
165
|
+
size={ 24 }
|
|
166
|
+
/>
|
|
167
|
+
</span>
|
|
168
|
+
</Tooltip>
|
|
169
|
+
</Flex>
|
|
170
|
+
}
|
|
118
171
|
icon={ file }
|
|
119
172
|
id={ category.name }
|
|
120
173
|
type="pattern"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
|
|
8
|
+
export default function useMyPatterns() {
|
|
9
|
+
const myPatterns = useSelect( ( select ) =>
|
|
10
|
+
select( coreStore ).getEntityRecords( 'postType', 'wp_block', {
|
|
11
|
+
per_page: -1,
|
|
12
|
+
} )
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
myPatterns: {
|
|
17
|
+
count: myPatterns?.length || 0,
|
|
18
|
+
name: 'my-patterns',
|
|
19
|
+
label: __( 'My patterns' ),
|
|
20
|
+
},
|
|
21
|
+
hasPatterns: !! myPatterns?.length,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
4
|
import { useMemo } from '@wordpress/element';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
5
|
|
|
9
6
|
/**
|
|
10
7
|
* Internal dependencies
|
|
@@ -15,11 +12,6 @@ import useThemePatterns from './use-theme-patterns';
|
|
|
15
12
|
export default function usePatternCategories() {
|
|
16
13
|
const defaultCategories = useDefaultPatternCategories();
|
|
17
14
|
const themePatterns = useThemePatterns();
|
|
18
|
-
const userPatterns = useSelect( ( select ) =>
|
|
19
|
-
select( coreStore ).getEntityRecords( 'postType', 'wp_block', {
|
|
20
|
-
per_page: -1,
|
|
21
|
-
} )
|
|
22
|
-
);
|
|
23
15
|
|
|
24
16
|
const patternCategories = useMemo( () => {
|
|
25
17
|
const categoryMap = {};
|
|
@@ -48,17 +40,8 @@ export default function usePatternCategories() {
|
|
|
48
40
|
}
|
|
49
41
|
} );
|
|
50
42
|
|
|
51
|
-
// Add "Your Patterns" category for user patterns if there are any.
|
|
52
|
-
if ( userPatterns?.length ) {
|
|
53
|
-
categoriesWithCounts.push( {
|
|
54
|
-
count: userPatterns.length || 0,
|
|
55
|
-
name: 'custom-patterns',
|
|
56
|
-
label: __( 'Custom patterns' ),
|
|
57
|
-
} );
|
|
58
|
-
}
|
|
59
|
-
|
|
60
43
|
return categoriesWithCounts;
|
|
61
|
-
}, [ defaultCategories, themePatterns
|
|
44
|
+
}, [ defaultCategories, themePatterns ] );
|
|
62
45
|
|
|
63
46
|
return { patternCategories, hasPatterns: !! patternCategories.length };
|
|
64
47
|
}
|
|
@@ -11,7 +11,7 @@ import { useMemo } from '@wordpress/element';
|
|
|
11
11
|
import {
|
|
12
12
|
CORE_PATTERN_SOURCES,
|
|
13
13
|
filterOutDuplicatesByName,
|
|
14
|
-
} from '../page-
|
|
14
|
+
} from '../page-patterns/utils';
|
|
15
15
|
import { unlock } from '../../lock-unlock';
|
|
16
16
|
import { store as editSiteStore } from '../../store';
|
|
17
17
|
|