@wordpress/edit-site 6.1.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -6
- package/build/components/add-new-pattern/index.js +31 -16
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/{add-new-page → add-new-post}/index.js +28 -16
- package/build/components/add-new-post/index.js.map +1 -0
- package/build/components/block-editor/use-site-editor-settings.js +5 -3
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +32 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +18 -7
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +0 -5
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +17 -17
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +2 -2
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +13 -30
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/hooks.js +0 -40
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-typography.js +47 -0
- package/build/components/global-styles/preview-typography.js.map +1 -0
- package/build/components/global-styles/screen-block.js +14 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +5 -1
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +1 -2
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -5
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +0 -2
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +28 -22
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +5 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +14 -27
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -2
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -8
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +20 -41
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/index.js +51 -41
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/search-items.js +29 -4
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +22 -55
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/index.js +27 -21
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +4 -4
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/posts-app/index.js +11 -17
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/{page-pages/index.js → posts-app/posts-list.js} +165 -38
- package/build/components/posts-app/posts-list.js.map +1 -0
- package/build/components/posts-app/router.js +85 -0
- package/build/components/posts-app/router.js.map +1 -0
- package/build/components/revisions/index.js +10 -7
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +1 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +98 -84
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/site-hub/index.js +81 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/deprecated.js +11 -0
- package/build/deprecated.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +11 -0
- package/build/hooks/commands/use-set-command-context.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +65 -42
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +6 -0
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/posts.js +57 -2
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +7 -2
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +31 -16
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/{add-new-page → add-new-post}/index.js +28 -16
- package/build-module/components/add-new-post/index.js.map +1 -0
- package/build-module/components/block-editor/use-site-editor-settings.js +5 -3
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +33 -8
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +19 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +0 -5
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +18 -18
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +2 -2
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +14 -31
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +0 -38
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-typography.js +39 -0
- package/build-module/components/global-styles/preview-typography.js.map +1 -0
- package/build-module/components/global-styles/screen-block.js +15 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +5 -1
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +1 -2
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +6 -6
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +0 -2
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +29 -23
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +5 -3
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +16 -28
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +14 -8
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +20 -41
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/index.js +52 -42
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
- package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +28 -4
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +23 -56
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/index.js +27 -21
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +4 -4
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +11 -17
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/{page-pages/index.js → posts-app/posts-list.js} +164 -37
- package/build-module/components/posts-app/posts-list.js.map +1 -0
- package/build-module/components/posts-app/router.js +77 -0
- package/build-module/components/posts-app/router.js.map +1 -0
- package/build-module/components/revisions/index.js +10 -7
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +1 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +4 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +97 -84
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +5 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +3 -3
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +5 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/site-hub/index.js +81 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/deprecated.js +11 -0
- package/build-module/deprecated.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +11 -0
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +61 -38
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +7 -2
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/posts.js +57 -2
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +7 -2
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/posts-rtl.css +108 -28
- package/build-style/posts.css +108 -28
- package/build-style/style-rtl.css +127 -157
- package/build-style/style.css +127 -157
- package/lib/inflate.js +3188 -3937
- package/lib/lib-font.browser.js +32 -2
- package/lib/unbrotli.js +1818 -2458
- package/package.json +41 -41
- package/src/components/add-new-pattern/index.js +38 -23
- package/src/components/{add-new-page → add-new-post}/index.js +42 -18
- package/src/components/block-editor/style.scss +0 -11
- package/src/components/block-editor/use-site-editor-settings.js +33 -28
- package/src/components/editor/index.js +34 -20
- package/src/components/editor-canvas-container/index.js +20 -8
- package/src/components/global-styles/background-panel.js +0 -8
- package/src/components/global-styles/font-families.js +28 -19
- package/src/components/global-styles/font-library-modal/context.js +2 -2
- package/src/components/global-styles/font-library-modal/font-collection.js +17 -32
- package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -2
- package/src/components/global-styles/font-library-modal/style.scss +17 -10
- package/src/components/global-styles/hooks.js +0 -41
- package/src/components/global-styles/preview-typography.js +39 -0
- package/src/components/global-styles/screen-block.js +22 -0
- package/src/components/global-styles/screen-layout.js +5 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/shadows-edit-panel.js +1 -2
- package/src/components/global-styles/style-variations-container.js +10 -7
- package/src/components/global-styles/style.scss +2 -1
- package/src/components/global-styles/typography-elements.js +0 -4
- package/src/components/global-styles/variations/variation.js +41 -26
- package/src/components/global-styles/variations/variations-color.js +6 -3
- package/src/components/global-styles/variations/variations-typography.js +16 -32
- package/src/components/global-styles-sidebar/index.js +2 -2
- package/src/components/layout/index.js +13 -4
- package/src/components/layout/router.js +20 -36
- package/src/components/layout/style.scss +12 -0
- package/src/components/page-patterns/index.js +55 -58
- package/src/components/page-patterns/rename-category-menu-item.js +2 -0
- package/src/components/page-patterns/search-items.js +37 -3
- package/src/components/page-patterns/style.scss +1 -8
- package/src/components/page-patterns/use-patterns.js +43 -82
- package/src/components/page-templates/index.js +26 -21
- package/src/components/page-templates/style.scss +1 -6
- package/src/components/pagination/index.js +4 -4
- package/src/components/posts-app/index.js +9 -11
- package/src/components/{page-pages/index.js → posts-app/posts-list.js} +163 -42
- package/src/components/posts-app/router.js +69 -0
- package/src/components/{page-pages → posts-app}/style.scss +22 -8
- package/src/components/revisions/index.js +9 -1
- package/src/components/save-panel/index.js +1 -1
- package/src/components/sidebar/style.scss +6 -0
- package/src/components/sidebar-dataviews/add-new-view.js +2 -1
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +6 -2
- package/src/components/sidebar-dataviews/default-views.js +119 -98
- package/src/components/sidebar-dataviews/index.js +3 -3
- package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -6
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +8 -2
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +10 -2
- package/src/components/site-hub/index.js +84 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -2
- package/src/deprecated.js +14 -0
- package/src/hooks/commands/use-set-command-context.js +12 -0
- package/src/hooks/push-changes-to-global-styles/index.js +1 -1
- package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +28 -24
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +72 -47
- package/src/index.js +8 -1
- package/src/lock-unlock.js +1 -1
- package/src/posts.js +63 -2
- package/src/posts.scss +9 -0
- package/src/store/private-actions.js +7 -3
- package/src/style.scss +14 -2
- package/build/components/add-new-page/index.js.map +0 -1
- package/build/components/page-pages/index.js.map +0 -1
- package/build/components/table/index.js +0 -35
- package/build/components/table/index.js.map +0 -1
- package/build-module/components/add-new-page/index.js.map +0 -1
- package/build-module/components/page-pages/index.js.map +0 -1
- package/build-module/components/table/index.js +0 -30
- package/build-module/components/table/index.js.map +0 -1
- package/src/components/table/index.js +0 -33
- package/src/components/table/style.scss +0 -38
|
@@ -2,7 +2,19 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
trash,
|
|
8
|
+
pages,
|
|
9
|
+
drafts,
|
|
10
|
+
published,
|
|
11
|
+
scheduled,
|
|
12
|
+
pending,
|
|
13
|
+
notAllowed,
|
|
14
|
+
} from '@wordpress/icons';
|
|
15
|
+
import { useSelect } from '@wordpress/data';
|
|
16
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
17
|
+
import { useMemo } from '@wordpress/element';
|
|
6
18
|
|
|
7
19
|
/**
|
|
8
20
|
* Internal dependencies
|
|
@@ -28,7 +40,7 @@ export const DEFAULT_CONFIG_PER_VIEW_TYPE = {
|
|
|
28
40
|
},
|
|
29
41
|
};
|
|
30
42
|
|
|
31
|
-
const
|
|
43
|
+
const DEFAULT_POST_BASE = {
|
|
32
44
|
type: LAYOUT_LIST,
|
|
33
45
|
search: '',
|
|
34
46
|
filters: [],
|
|
@@ -38,111 +50,120 @@ const DEFAULT_PAGE_BASE = {
|
|
|
38
50
|
field: 'date',
|
|
39
51
|
direction: 'desc',
|
|
40
52
|
},
|
|
41
|
-
|
|
42
|
-
// better to keep track of the hidden ones.
|
|
43
|
-
hiddenFields: [ 'date', 'featured-image' ],
|
|
53
|
+
fields: [ 'title', 'author', 'status' ],
|
|
44
54
|
layout: {
|
|
45
55
|
...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_LIST ],
|
|
46
56
|
},
|
|
47
57
|
};
|
|
48
58
|
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
{
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
icon: pages,
|
|
55
|
-
view: DEFAULT_PAGE_BASE,
|
|
59
|
+
export function useDefaultViews( { postType } ) {
|
|
60
|
+
const labels = useSelect(
|
|
61
|
+
( select ) => {
|
|
62
|
+
const { getPostType } = select( coreStore );
|
|
63
|
+
return getPostType( postType )?.labels;
|
|
56
64
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
[ postType ]
|
|
66
|
+
);
|
|
67
|
+
return useMemo( () => {
|
|
68
|
+
return {
|
|
69
|
+
[ postType ]: [
|
|
70
|
+
{
|
|
71
|
+
title: labels?.all_items || __( 'All items' ),
|
|
72
|
+
slug: 'all',
|
|
73
|
+
icon: pages,
|
|
74
|
+
view: DEFAULT_POST_BASE,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
title: __( 'Published' ),
|
|
78
|
+
slug: 'published',
|
|
79
|
+
icon: published,
|
|
80
|
+
view: {
|
|
81
|
+
...DEFAULT_POST_BASE,
|
|
82
|
+
filters: [
|
|
83
|
+
{
|
|
84
|
+
field: 'status',
|
|
85
|
+
operator: OPERATOR_IS_ANY,
|
|
86
|
+
value: 'publish',
|
|
87
|
+
},
|
|
88
|
+
],
|
|
68
89
|
},
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
title: __( 'Scheduled' ),
|
|
93
|
+
slug: 'future',
|
|
94
|
+
icon: scheduled,
|
|
95
|
+
view: {
|
|
96
|
+
...DEFAULT_POST_BASE,
|
|
97
|
+
filters: [
|
|
98
|
+
{
|
|
99
|
+
field: 'status',
|
|
100
|
+
operator: OPERATOR_IS_ANY,
|
|
101
|
+
value: 'future',
|
|
102
|
+
},
|
|
103
|
+
],
|
|
83
104
|
},
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
title: __( 'Drafts' ),
|
|
108
|
+
slug: 'drafts',
|
|
109
|
+
icon: drafts,
|
|
110
|
+
view: {
|
|
111
|
+
...DEFAULT_POST_BASE,
|
|
112
|
+
filters: [
|
|
113
|
+
{
|
|
114
|
+
field: 'status',
|
|
115
|
+
operator: OPERATOR_IS_ANY,
|
|
116
|
+
value: 'draft',
|
|
117
|
+
},
|
|
118
|
+
],
|
|
98
119
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: __( 'Pending' ),
|
|
123
|
+
slug: 'pending',
|
|
124
|
+
icon: pending,
|
|
125
|
+
view: {
|
|
126
|
+
...DEFAULT_POST_BASE,
|
|
127
|
+
filters: [
|
|
128
|
+
{
|
|
129
|
+
field: 'status',
|
|
130
|
+
operator: OPERATOR_IS_ANY,
|
|
131
|
+
value: 'pending',
|
|
132
|
+
},
|
|
133
|
+
],
|
|
113
134
|
},
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
title: __( 'Private' ),
|
|
138
|
+
slug: 'private',
|
|
139
|
+
icon: notAllowed,
|
|
140
|
+
view: {
|
|
141
|
+
...DEFAULT_POST_BASE,
|
|
142
|
+
filters: [
|
|
143
|
+
{
|
|
144
|
+
field: 'status',
|
|
145
|
+
operator: OPERATOR_IS_ANY,
|
|
146
|
+
value: 'private',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
128
149
|
},
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
title: __( 'Trash' ),
|
|
153
|
+
slug: 'trash',
|
|
154
|
+
icon: trash,
|
|
155
|
+
view: {
|
|
156
|
+
...DEFAULT_POST_BASE,
|
|
157
|
+
filters: [
|
|
158
|
+
{
|
|
159
|
+
field: 'status',
|
|
160
|
+
operator: OPERATOR_IS_ANY,
|
|
161
|
+
value: 'trash',
|
|
162
|
+
},
|
|
163
|
+
],
|
|
143
164
|
},
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
}
|
|
147
|
-
]
|
|
148
|
-
}
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
};
|
|
168
|
+
}, [ labels, postType ] );
|
|
169
|
+
}
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
5
|
-
|
|
6
5
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
import { DEFAULT_VIEWS } from './default-views';
|
|
10
|
+
import { useDefaultViews } from './default-views';
|
|
12
11
|
import { unlock } from '../../lock-unlock';
|
|
13
12
|
const { useLocation } = unlock( routerPrivateApis );
|
|
14
13
|
import DataViewItem from './dataview-item';
|
|
@@ -18,6 +17,7 @@ export default function DataViewsSidebarContent() {
|
|
|
18
17
|
const {
|
|
19
18
|
params: { postType, activeView = 'all', isCustom = 'false' },
|
|
20
19
|
} = useLocation();
|
|
20
|
+
const DEFAULT_VIEWS = useDefaultViews( { postType } );
|
|
21
21
|
if ( ! postType ) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
@@ -26,10 +26,7 @@ import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-glob
|
|
|
26
26
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
27
27
|
import ColorVariations from '../global-styles/variations/variations-color';
|
|
28
28
|
import TypographyVariations from '../global-styles/variations/variations-typography';
|
|
29
|
-
import {
|
|
30
|
-
useColorVariations,
|
|
31
|
-
useTypographyVariations,
|
|
32
|
-
} from '../global-styles/hooks';
|
|
29
|
+
import { useCurrentMergeThemeStyleVariationsWithUserConfig } from '../../hooks/use-theme-style-variations/use-theme-style-variations-by-property';
|
|
33
30
|
|
|
34
31
|
const noop = () => {};
|
|
35
32
|
|
|
@@ -75,8 +72,12 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
75
72
|
};
|
|
76
73
|
}, [] );
|
|
77
74
|
|
|
78
|
-
const colorVariations =
|
|
79
|
-
|
|
75
|
+
const colorVariations = useCurrentMergeThemeStyleVariationsWithUserConfig( [
|
|
76
|
+
'color',
|
|
77
|
+
] );
|
|
78
|
+
const typographyVariations =
|
|
79
|
+
useCurrentMergeThemeStyleVariationsWithUserConfig( [ 'typography' ] );
|
|
80
|
+
|
|
80
81
|
const gap = 3;
|
|
81
82
|
|
|
82
83
|
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
|
|
@@ -22,7 +22,12 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
|
|
|
22
22
|
titleHasChanged && notEmptyString( editedMenuTitle );
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<Modal
|
|
25
|
+
<Modal
|
|
26
|
+
title={ __( 'Rename' ) }
|
|
27
|
+
onRequestClose={ onClose }
|
|
28
|
+
focusOnMount="firstContentElement"
|
|
29
|
+
size="small"
|
|
30
|
+
>
|
|
26
31
|
<form className="sidebar-navigation__rename-modal-form">
|
|
27
32
|
<VStack spacing="3">
|
|
28
33
|
<TextControl
|
|
@@ -31,6 +36,7 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
|
|
|
31
36
|
value={ editedMenuTitle }
|
|
32
37
|
placeholder={ __( 'Navigation title' ) }
|
|
33
38
|
onChange={ setEditedMenuTitle }
|
|
39
|
+
label={ __( 'Name' ) }
|
|
34
40
|
/>
|
|
35
41
|
<HStack justify="right">
|
|
36
42
|
<Button
|
|
@@ -43,7 +49,7 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
|
|
|
43
49
|
|
|
44
50
|
<Button
|
|
45
51
|
__next40pxDefaultSize
|
|
46
|
-
|
|
52
|
+
accessibleWhenDisabled
|
|
47
53
|
disabled={ ! isEditedMenuTitleValid }
|
|
48
54
|
variant="primary"
|
|
49
55
|
type="submit"
|
|
@@ -58,13 +58,21 @@ export default function usePatternCategories() {
|
|
|
58
58
|
|
|
59
59
|
// Update the category counts to reflect user registered patterns.
|
|
60
60
|
userPatterns.forEach( ( pattern ) => {
|
|
61
|
-
pattern.
|
|
61
|
+
pattern.wp_pattern_category?.forEach( ( catId ) => {
|
|
62
|
+
const category = userPatternCategories.find(
|
|
63
|
+
( cat ) => cat.id === catId
|
|
64
|
+
)?.name;
|
|
62
65
|
if ( categoryMap[ category ] ) {
|
|
63
66
|
categoryMap[ category ].count += 1;
|
|
64
67
|
}
|
|
65
68
|
} );
|
|
66
69
|
// If the pattern has no categories, add it to uncategorized.
|
|
67
|
-
if (
|
|
70
|
+
if (
|
|
71
|
+
! pattern.wp_pattern_category?.length ||
|
|
72
|
+
! pattern.wp_pattern_category.some( ( catId ) =>
|
|
73
|
+
userPatternCategories.find( ( cat ) => cat.id === catId )
|
|
74
|
+
)
|
|
75
|
+
) {
|
|
68
76
|
categoryMap.uncategorized.count += 1;
|
|
69
77
|
}
|
|
70
78
|
} );
|
|
@@ -11,11 +11,12 @@ import { Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
|
11
11
|
import { __ } from '@wordpress/i18n';
|
|
12
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
13
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
14
|
-
import { memo, forwardRef } from '@wordpress/element';
|
|
14
|
+
import { memo, forwardRef, useContext } from '@wordpress/element';
|
|
15
15
|
import { search } from '@wordpress/icons';
|
|
16
16
|
import { store as commandsStore } from '@wordpress/commands';
|
|
17
17
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
18
18
|
import { filterURLForDisplay } from '@wordpress/url';
|
|
19
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
@@ -23,6 +24,8 @@ import { filterURLForDisplay } from '@wordpress/url';
|
|
|
23
24
|
import { store as editSiteStore } from '../../store';
|
|
24
25
|
import SiteIcon from '../site-icon';
|
|
25
26
|
import { unlock } from '../../lock-unlock';
|
|
27
|
+
const { useHistory } = unlock( routerPrivateApis );
|
|
28
|
+
import { SidebarNavigationContext } from '../sidebar';
|
|
26
29
|
|
|
27
30
|
const SiteHub = memo(
|
|
28
31
|
forwardRef( ( { isTransparent }, ref ) => {
|
|
@@ -103,3 +106,83 @@ const SiteHub = memo(
|
|
|
103
106
|
);
|
|
104
107
|
|
|
105
108
|
export default SiteHub;
|
|
109
|
+
|
|
110
|
+
export const SiteHubMobile = memo(
|
|
111
|
+
forwardRef( ( { isTransparent }, ref ) => {
|
|
112
|
+
const history = useHistory();
|
|
113
|
+
const { navigate } = useContext( SidebarNavigationContext );
|
|
114
|
+
|
|
115
|
+
const { homeUrl, siteTitle } = useSelect( ( select ) => {
|
|
116
|
+
const {
|
|
117
|
+
getSite,
|
|
118
|
+
getUnstableBase, // Site index.
|
|
119
|
+
} = select( coreStore );
|
|
120
|
+
const _site = getSite();
|
|
121
|
+
return {
|
|
122
|
+
homeUrl: getUnstableBase()?.home,
|
|
123
|
+
siteTitle:
|
|
124
|
+
! _site?.title && !! _site?.url
|
|
125
|
+
? filterURLForDisplay( _site?.url )
|
|
126
|
+
: _site?.title,
|
|
127
|
+
};
|
|
128
|
+
}, [] );
|
|
129
|
+
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<div className="edit-site-site-hub">
|
|
133
|
+
<HStack justify="flex-start" spacing="0">
|
|
134
|
+
<div
|
|
135
|
+
className={ clsx(
|
|
136
|
+
'edit-site-site-hub__view-mode-toggle-container',
|
|
137
|
+
{
|
|
138
|
+
'has-transparent-background': isTransparent,
|
|
139
|
+
}
|
|
140
|
+
) }
|
|
141
|
+
>
|
|
142
|
+
<Button
|
|
143
|
+
ref={ ref }
|
|
144
|
+
label={ __( 'Go to Site Editor' ) }
|
|
145
|
+
className="edit-site-layout__view-mode-toggle"
|
|
146
|
+
style={ {
|
|
147
|
+
transform: 'scale(0.5)',
|
|
148
|
+
borderRadius: 4,
|
|
149
|
+
} }
|
|
150
|
+
onClick={ () => {
|
|
151
|
+
history.push( {} );
|
|
152
|
+
navigate( 'back' );
|
|
153
|
+
} }
|
|
154
|
+
>
|
|
155
|
+
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
156
|
+
</Button>
|
|
157
|
+
</div>
|
|
158
|
+
|
|
159
|
+
<HStack>
|
|
160
|
+
<div className="edit-site-site-hub__title">
|
|
161
|
+
<Button
|
|
162
|
+
variant="link"
|
|
163
|
+
href={ homeUrl }
|
|
164
|
+
target="_blank"
|
|
165
|
+
label={ __( 'View site (opens in a new tab)' ) }
|
|
166
|
+
>
|
|
167
|
+
{ decodeEntities( siteTitle ) }
|
|
168
|
+
</Button>
|
|
169
|
+
</div>
|
|
170
|
+
<HStack
|
|
171
|
+
spacing={ 0 }
|
|
172
|
+
expanded={ false }
|
|
173
|
+
className="edit-site-site-hub__actions"
|
|
174
|
+
>
|
|
175
|
+
<Button
|
|
176
|
+
className="edit-site-site-hub_toggle-command-center"
|
|
177
|
+
icon={ search }
|
|
178
|
+
onClick={ () => openCommandCenter() }
|
|
179
|
+
label={ __( 'Open command palette' ) }
|
|
180
|
+
shortcut={ displayShortcut.primary( 'k' ) }
|
|
181
|
+
/>
|
|
182
|
+
</HStack>
|
|
183
|
+
</HStack>
|
|
184
|
+
</HStack>
|
|
185
|
+
</div>
|
|
186
|
+
);
|
|
187
|
+
} )
|
|
188
|
+
);
|
|
@@ -27,7 +27,7 @@ const postTypesWithoutParentTemplate = [
|
|
|
27
27
|
PATTERN_TYPES.user,
|
|
28
28
|
];
|
|
29
29
|
|
|
30
|
-
const authorizedPostTypes = [ 'page' ];
|
|
30
|
+
const authorizedPostTypes = [ 'page', 'post' ];
|
|
31
31
|
|
|
32
32
|
function useResolveEditedEntityAndContext( { postId, postType } ) {
|
|
33
33
|
const {
|
|
@@ -213,7 +213,8 @@ function useResolveEditedEntityAndContext( { postId, postType } ) {
|
|
|
213
213
|
if ( postType && postId && authorizedPostTypes.includes( postType ) ) {
|
|
214
214
|
return { postType, postId };
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
// TODO: for post types lists we should probably not render the front page, but maybe a placeholder
|
|
217
|
+
// with a message like "Select a page" or something similar.
|
|
217
218
|
if ( homepageId ) {
|
|
218
219
|
return { postType: 'page', postId: homepageId };
|
|
219
220
|
}
|
package/src/deprecated.js
CHANGED
|
@@ -6,8 +6,13 @@ import {
|
|
|
6
6
|
PluginSidebar as EditorPluginSidebar,
|
|
7
7
|
PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
|
|
8
8
|
} from '@wordpress/editor';
|
|
9
|
+
import { getPath } from '@wordpress/url';
|
|
9
10
|
import deprecated from '@wordpress/deprecated';
|
|
10
11
|
|
|
12
|
+
const isSiteEditor = getPath( window.location.href )?.includes(
|
|
13
|
+
'site-editor.php'
|
|
14
|
+
);
|
|
15
|
+
|
|
11
16
|
const deprecateSlot = ( name ) => {
|
|
12
17
|
deprecated( `wp.editPost.${ name }`, {
|
|
13
18
|
since: '6.6',
|
|
@@ -20,6 +25,9 @@ const deprecateSlot = ( name ) => {
|
|
|
20
25
|
* @see PluginMoreMenuItem in @wordpress/editor package.
|
|
21
26
|
*/
|
|
22
27
|
export function PluginMoreMenuItem( props ) {
|
|
28
|
+
if ( ! isSiteEditor ) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
23
31
|
deprecateSlot( 'PluginMoreMenuItem' );
|
|
24
32
|
return <EditorPluginMoreMenuItem { ...props } />;
|
|
25
33
|
}
|
|
@@ -28,6 +36,9 @@ export function PluginMoreMenuItem( props ) {
|
|
|
28
36
|
* @see PluginSidebar in @wordpress/editor package.
|
|
29
37
|
*/
|
|
30
38
|
export function PluginSidebar( props ) {
|
|
39
|
+
if ( ! isSiteEditor ) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
31
42
|
deprecateSlot( 'PluginSidebar' );
|
|
32
43
|
return <EditorPluginSidebar { ...props } />;
|
|
33
44
|
}
|
|
@@ -36,6 +47,9 @@ export function PluginSidebar( props ) {
|
|
|
36
47
|
* @see PluginSidebarMoreMenuItem in @wordpress/editor package.
|
|
37
48
|
*/
|
|
38
49
|
export function PluginSidebarMoreMenuItem( props ) {
|
|
50
|
+
if ( ! isSiteEditor ) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
39
53
|
deprecateSlot( 'PluginSidebarMoreMenuItem' );
|
|
40
54
|
return <EditorPluginSidebarMoreMenuItem { ...props } />;
|
|
41
55
|
}
|
|
@@ -10,6 +10,7 @@ import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
|
10
10
|
*/
|
|
11
11
|
import { store as editSiteStore } from '../../store';
|
|
12
12
|
import { unlock } from '../../lock-unlock';
|
|
13
|
+
import { useHasEditorCanvasContainer } from '../../components/editor-canvas-container';
|
|
13
14
|
|
|
14
15
|
const { useCommandContext } = unlock( commandsPrivateApis );
|
|
15
16
|
|
|
@@ -25,6 +26,9 @@ export default function useSetCommandContext() {
|
|
|
25
26
|
hasBlockSelected: getBlockSelectionStart(),
|
|
26
27
|
};
|
|
27
28
|
}, [] );
|
|
29
|
+
|
|
30
|
+
const hasEditorCanvasContainer = useHasEditorCanvasContainer();
|
|
31
|
+
|
|
28
32
|
// Sets the right context for the command palette
|
|
29
33
|
let commandContext = 'site-editor';
|
|
30
34
|
if ( canvasMode === 'edit' ) {
|
|
@@ -33,5 +37,13 @@ export default function useSetCommandContext() {
|
|
|
33
37
|
if ( hasBlockSelected ) {
|
|
34
38
|
commandContext = 'block-selection-edit';
|
|
35
39
|
}
|
|
40
|
+
if ( hasEditorCanvasContainer ) {
|
|
41
|
+
/*
|
|
42
|
+
* The editor canvas overlay will likely be deprecated in the future, so for now we clear the command context
|
|
43
|
+
* to remove the suggested commands that may not make sense with Style Book or Style Revisions open.
|
|
44
|
+
* See https://github.com/WordPress/gutenberg/issues/62216.
|
|
45
|
+
*/
|
|
46
|
+
commandContext = '';
|
|
47
|
+
}
|
|
36
48
|
useCommandContext( commandContext );
|
|
37
49
|
}
|