@wordpress/edit-site 6.12.0 → 6.12.1-next.082ed6819.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/build/components/add-new-template/utils.js +1 -2
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +0 -3
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +4 -12
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +18 -27
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +13 -5
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/editor/use-resolve-edited-entity.js +133 -0
- package/build/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +8 -10
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/screen-block.js +18 -5
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +11 -5
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +17 -1
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/page-patterns/header.js +2 -2
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +4 -8
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/post-edit/index.js +10 -12
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-list/index.js +3 -3
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js +3 -4
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app-routes/home.js +48 -0
- package/build/components/posts-app-routes/home.js.map +1 -0
- package/build/components/posts-app-routes/index.js +37 -0
- package/build/components/posts-app-routes/index.js.map +1 -0
- package/build/components/posts-app-routes/posts-edit.js +44 -0
- package/build/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js +63 -0
- package/build/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-list-view.js +48 -0
- package/build/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js +60 -0
- package/build/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build/components/posts-app-routes/posts-view.js +41 -0
- package/build/components/posts-app-routes/posts-view.js.map +1 -0
- package/build/components/sidebar-navigation-screen-details-footer/index.js +17 -23
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +2 -3
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build/components/site-editor-routes/index.js +1 -2
- package/build/components/site-editor-routes/index.js.map +1 -1
- package/build/components/style-book/examples.js +24 -2
- package/build/components/style-book/examples.js.map +1 -1
- package/build/index.js +0 -9
- package/build/index.js.map +1 -1
- package/build/store/actions.js +13 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +21 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +1 -2
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +0 -3
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +4 -12
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +18 -27
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +13 -5
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/editor/use-resolve-edited-entity.js +125 -0
- package/build-module/components/editor/use-resolve-edited-entity.js.map +1 -0
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +8 -10
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +18 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +11 -5
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/ui.js +1 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +18 -2
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/page-patterns/header.js +2 -2
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +4 -8
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/post-edit/index.js +9 -11
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-list/index.js +2 -2
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +3 -4
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app-routes/home.js +40 -0
- package/build-module/components/posts-app-routes/home.js.map +1 -0
- package/build-module/components/posts-app-routes/index.js +30 -0
- package/build-module/components/posts-app-routes/index.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-edit.js +36 -0
- package/build-module/components/posts-app-routes/posts-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js +55 -0
- package/build-module/components/posts-app-routes/posts-list-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-list-view.js +40 -0
- package/build-module/components/posts-app-routes/posts-list-view.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js +52 -0
- package/build-module/components/posts-app-routes/posts-view-quick-edit.js.map +1 -0
- package/build-module/components/posts-app-routes/posts-view.js +33 -0
- package/build-module/components/posts-app-routes/posts-view.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +20 -26
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -18
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +3 -4
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -1
- package/build-module/components/site-editor-routes/index.js +1 -2
- package/build-module/components/site-editor-routes/index.js.map +1 -1
- package/build-module/components/style-book/examples.js +24 -2
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/index.js +1 -10
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +13 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/posts-rtl.css +59 -18
- package/build-style/posts.css +59 -18
- package/build-style/style-rtl.css +74 -57
- package/build-style/style.css +74 -57
- package/package.json +38 -38
- package/src/components/add-new-template/utils.js +2 -2
- package/src/components/app/index.js +0 -3
- package/src/components/block-editor/use-site-editor-settings.js +7 -21
- package/src/components/editor/index.js +22 -33
- package/src/components/editor/use-editor-title.js +17 -4
- package/src/components/editor/use-resolve-edited-entity.js +132 -0
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/global-styles/block-preview-panel.js +10 -10
- package/src/components/global-styles/screen-block.js +26 -8
- package/src/components/global-styles/screen-style-variations.js +14 -5
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/global-styles-sidebar/index.js +16 -2
- package/src/components/page-patterns/header.js +3 -2
- package/src/components/page-patterns/use-patterns.js +9 -7
- package/src/components/page-templates/style.scss +1 -0
- package/src/components/post-edit/index.js +10 -13
- package/src/components/post-list/index.js +1 -2
- package/src/components/posts-app/index.js +3 -4
- package/src/components/posts-app-routes/home.js +36 -0
- package/src/components/posts-app-routes/index.js +36 -0
- package/src/components/posts-app-routes/posts-edit.js +31 -0
- package/src/components/posts-app-routes/posts-list-view-quick-edit.js +52 -0
- package/src/components/posts-app-routes/posts-list-view.js +40 -0
- package/src/components/posts-app-routes/posts-view-quick-edit.js +49 -0
- package/src/components/posts-app-routes/posts-view.js +35 -0
- package/src/components/sidebar-navigation-screen/style.scss +7 -2
- package/src/components/sidebar-navigation-screen-details-footer/index.js +27 -38
- package/src/components/sidebar-navigation-screen-details-footer/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-global-styles/index.js +8 -17
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -0
- package/src/components/sidebar-navigation-screen-patterns/use-pattern-categories.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/use-template-part-areas.js +4 -4
- package/src/components/site-editor-routes/README.md +2 -2
- package/src/components/site-editor-routes/index.js +0 -2
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/examples.tsx +24 -2
- package/src/index.js +1 -13
- package/src/store/actions.js +15 -0
- package/src/store/selectors.js +24 -1
- package/src/style.scss +0 -2
- package/build/components/post-fields/index.js +0 -96
- package/build/components/post-fields/index.js.map +0 -1
- package/build/components/posts-app/router.js +0 -85
- package/build/components/posts-app/router.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/index.js +0 -54
- package/build/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -33
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -21
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build/components/site-editor-routes/styles-edit.js +0 -33
- package/build/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -219
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/build-module/components/post-fields/index.js +0 -88
- package/build-module/components/post-fields/index.js.map +0 -1
- package/build-module/components/posts-app/router.js +0 -77
- package/build-module/components/posts-app/router.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js +0 -29
- package/build-module/components/sidebar-navigation-screen-details-panel/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -25
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js.map +0 -1
- package/build-module/components/site-editor-routes/styles-edit.js +0 -25
- package/build-module/components/site-editor-routes/styles-edit.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -212
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +0 -1
- package/src/components/post-fields/index.js +0 -107
- package/src/components/post-fields/style.scss +0 -3
- package/src/components/posts-app/router.js +0 -69
- package/src/components/sidebar-navigation-screen-details-panel/index.js +0 -40
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-label.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +0 -31
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-value.js +0 -14
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +0 -26
- package/src/components/site-editor-routes/styles-edit.js +0 -26
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -257
- package/src/store/test/actions.js +0 -83
- package/src/store/test/reducer.js +0 -69
- package/src/store/test/selectors.js +0 -41
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import Editor from '../editor';
|
|
10
|
+
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
|
|
13
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
14
|
+
|
|
15
|
+
function HomeMobileView() {
|
|
16
|
+
const { params = {} } = useLocation();
|
|
17
|
+
const { canvas = 'view' } = params;
|
|
18
|
+
|
|
19
|
+
return canvas === 'edit' ? (
|
|
20
|
+
<Editor isPostsList />
|
|
21
|
+
) : (
|
|
22
|
+
<SidebarNavigationScreenMain />
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const homeRoute = {
|
|
27
|
+
name: 'home',
|
|
28
|
+
match: () => {
|
|
29
|
+
return true;
|
|
30
|
+
},
|
|
31
|
+
areas: {
|
|
32
|
+
sidebar: <SidebarNavigationScreenMain />,
|
|
33
|
+
preview: <Editor isPostsList />,
|
|
34
|
+
mobile: HomeMobileView,
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useRegistry, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { useEffect } from '@wordpress/element';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import { unlock } from '../../lock-unlock';
|
|
11
|
+
import { store as siteEditorStore } from '../../store';
|
|
12
|
+
import { homeRoute } from './home';
|
|
13
|
+
import { postsListViewQuickEditRoute } from './posts-list-view-quick-edit';
|
|
14
|
+
import { postsListViewRoute } from './posts-list-view';
|
|
15
|
+
import { postsViewQuickEditRoute } from './posts-view-quick-edit';
|
|
16
|
+
import { postsViewRoute } from './posts-view';
|
|
17
|
+
import { postsEditRoute } from './posts-edit';
|
|
18
|
+
|
|
19
|
+
const routes = [
|
|
20
|
+
postsListViewQuickEditRoute,
|
|
21
|
+
postsListViewRoute,
|
|
22
|
+
postsViewQuickEditRoute,
|
|
23
|
+
postsViewRoute,
|
|
24
|
+
postsEditRoute,
|
|
25
|
+
homeRoute,
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
export function useRegisterPostsAppRoutes() {
|
|
29
|
+
const registry = useRegistry();
|
|
30
|
+
const { registerRoute } = unlock( useDispatch( siteEditorStore ) );
|
|
31
|
+
useEffect( () => {
|
|
32
|
+
registry.batch( () => {
|
|
33
|
+
routes.forEach( registerRoute );
|
|
34
|
+
} );
|
|
35
|
+
}, [ registry, registerRoute ] );
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostList from '../post-list';
|
|
10
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import Editor from '../editor';
|
|
13
|
+
|
|
14
|
+
export const postsEditRoute = {
|
|
15
|
+
name: 'posts-edit',
|
|
16
|
+
match: ( params ) => {
|
|
17
|
+
return params.postType === 'post' && params.canvas === 'edit';
|
|
18
|
+
},
|
|
19
|
+
areas: {
|
|
20
|
+
sidebar: (
|
|
21
|
+
<SidebarNavigationScreen
|
|
22
|
+
title={ __( 'Posts' ) }
|
|
23
|
+
isRoot
|
|
24
|
+
content={ <DataViewsSidebarContent /> }
|
|
25
|
+
/>
|
|
26
|
+
),
|
|
27
|
+
content: <PostList postType="post" />,
|
|
28
|
+
mobile: <Editor isPostsList />,
|
|
29
|
+
preview: <Editor isPostsList />,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import PostList from '../post-list';
|
|
11
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
12
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { PostEdit } from '../post-edit';
|
|
15
|
+
import Editor from '../editor';
|
|
16
|
+
|
|
17
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
18
|
+
|
|
19
|
+
function PostQuickEdit() {
|
|
20
|
+
const { params } = useLocation();
|
|
21
|
+
return <PostEdit postType="post" postId={ params.postId } />;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const postsListViewQuickEditRoute = {
|
|
25
|
+
name: 'posts-list-view-quick-edit',
|
|
26
|
+
match: ( params ) => {
|
|
27
|
+
return (
|
|
28
|
+
params.isCustom !== 'true' &&
|
|
29
|
+
( params.layout ?? 'list' ) === 'list' &&
|
|
30
|
+
!! params.quickEdit &&
|
|
31
|
+
params.postType === 'post' &&
|
|
32
|
+
params.canvas !== 'edit'
|
|
33
|
+
);
|
|
34
|
+
},
|
|
35
|
+
areas: {
|
|
36
|
+
sidebar: (
|
|
37
|
+
<SidebarNavigationScreen
|
|
38
|
+
title={ __( 'Posts' ) }
|
|
39
|
+
isRoot
|
|
40
|
+
content={ <DataViewsSidebarContent /> }
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
content: <PostList postType="post" />,
|
|
44
|
+
mobile: <PostList postType="post" />,
|
|
45
|
+
preview: <Editor />,
|
|
46
|
+
edit: <PostQuickEdit />,
|
|
47
|
+
},
|
|
48
|
+
widths: {
|
|
49
|
+
content: 380,
|
|
50
|
+
edit: 380,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostList from '../post-list';
|
|
10
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
import Editor from '../editor';
|
|
13
|
+
|
|
14
|
+
export const postsListViewRoute = {
|
|
15
|
+
name: 'posts-list-view',
|
|
16
|
+
match: ( params ) => {
|
|
17
|
+
return (
|
|
18
|
+
params.isCustom !== 'true' &&
|
|
19
|
+
( params.layout ?? 'list' ) === 'list' &&
|
|
20
|
+
! params.quickEdit &&
|
|
21
|
+
params.postType === 'post' &&
|
|
22
|
+
params.canvas !== 'edit'
|
|
23
|
+
);
|
|
24
|
+
},
|
|
25
|
+
areas: {
|
|
26
|
+
sidebar: (
|
|
27
|
+
<SidebarNavigationScreen
|
|
28
|
+
title={ __( 'Posts' ) }
|
|
29
|
+
isRoot
|
|
30
|
+
content={ <DataViewsSidebarContent /> }
|
|
31
|
+
/>
|
|
32
|
+
),
|
|
33
|
+
content: <PostList postType="post" />,
|
|
34
|
+
preview: <Editor isPostsList />,
|
|
35
|
+
mobile: <PostList postType="post" />,
|
|
36
|
+
},
|
|
37
|
+
widths: {
|
|
38
|
+
content: 380,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
import PostList from '../post-list';
|
|
11
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
12
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
13
|
+
import { unlock } from '../../lock-unlock';
|
|
14
|
+
import { PostEdit } from '../post-edit';
|
|
15
|
+
|
|
16
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
17
|
+
|
|
18
|
+
function PostQuickEdit() {
|
|
19
|
+
const { params } = useLocation();
|
|
20
|
+
return <PostEdit postType="post" postId={ params.postId } />;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const postsViewQuickEditRoute = {
|
|
24
|
+
name: 'posts-view-quick-edit',
|
|
25
|
+
match: ( params ) => {
|
|
26
|
+
return (
|
|
27
|
+
( params.isCustom === 'true' ||
|
|
28
|
+
( params.layout ?? 'list' ) !== 'list' ) &&
|
|
29
|
+
!! params.quickEdit &&
|
|
30
|
+
params.postType === 'post' &&
|
|
31
|
+
params.canvas !== 'edit'
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
areas: {
|
|
35
|
+
sidebar: (
|
|
36
|
+
<SidebarNavigationScreen
|
|
37
|
+
title={ __( 'Posts' ) }
|
|
38
|
+
isRoot
|
|
39
|
+
content={ <DataViewsSidebarContent /> }
|
|
40
|
+
/>
|
|
41
|
+
),
|
|
42
|
+
content: <PostList postType="post" />,
|
|
43
|
+
mobile: <PostList postType="post" />,
|
|
44
|
+
edit: <PostQuickEdit />,
|
|
45
|
+
},
|
|
46
|
+
widths: {
|
|
47
|
+
edit: 380,
|
|
48
|
+
},
|
|
49
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { __ } from '@wordpress/i18n';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Internal dependencies
|
|
8
|
+
*/
|
|
9
|
+
import PostList from '../post-list';
|
|
10
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
|
|
13
|
+
export const postsViewRoute = {
|
|
14
|
+
name: 'posts-view',
|
|
15
|
+
match: ( params ) => {
|
|
16
|
+
return (
|
|
17
|
+
( params.isCustom === 'true' ||
|
|
18
|
+
( params.layout ?? 'list' ) !== 'list' ) &&
|
|
19
|
+
! params.quickEdit &&
|
|
20
|
+
params.postType === 'post' &&
|
|
21
|
+
params.canvas !== 'edit'
|
|
22
|
+
);
|
|
23
|
+
},
|
|
24
|
+
areas: {
|
|
25
|
+
sidebar: (
|
|
26
|
+
<SidebarNavigationScreen
|
|
27
|
+
title={ __( 'Posts' ) }
|
|
28
|
+
isRoot
|
|
29
|
+
content={ <DataViewsSidebarContent /> }
|
|
30
|
+
/>
|
|
31
|
+
),
|
|
32
|
+
content: <PostList postType="post" />,
|
|
33
|
+
mobile: <PostList postType="post" />,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
.edit-site-sidebar-navigation-screen__content {
|
|
19
19
|
padding: 0 $grid-unit-20;
|
|
20
20
|
|
|
21
|
-
.
|
|
21
|
+
.edit-site-sidebar-navigation-screen-details-footer {
|
|
22
22
|
margin-left: -$grid-unit-20;
|
|
23
23
|
margin-right: -$grid-unit-20;
|
|
24
24
|
}
|
|
@@ -127,9 +127,14 @@
|
|
|
127
127
|
bottom: 0;
|
|
128
128
|
background-color: $gray-900;
|
|
129
129
|
gap: 0;
|
|
130
|
-
padding: $grid-unit-20
|
|
130
|
+
padding: $grid-unit-10 $grid-unit-20;
|
|
131
131
|
margin: $grid-unit-20 0 0;
|
|
132
132
|
border-top: 1px solid $gray-800;
|
|
133
|
+
|
|
134
|
+
.components-item-group {
|
|
135
|
+
margin-left: -$grid-unit-20;
|
|
136
|
+
margin-right: -$grid-unit-20;
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
/* In general style overrides are discouraged.
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
6
|
-
import { createInterpolateElement } from '@wordpress/element';
|
|
4
|
+
import { _n, sprintf } from '@wordpress/i18n';
|
|
7
5
|
import { addQueryArgs } from '@wordpress/url';
|
|
8
|
-
import {
|
|
9
|
-
Icon,
|
|
10
|
-
__experimentalItemGroup as ItemGroup,
|
|
11
|
-
} from '@wordpress/components';
|
|
6
|
+
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
12
7
|
import { backup } from '@wordpress/icons';
|
|
13
8
|
|
|
14
9
|
/**
|
|
15
10
|
* Internal dependencies
|
|
16
11
|
*/
|
|
17
|
-
import {
|
|
18
|
-
SidebarNavigationScreenDetailsPanelRow,
|
|
19
|
-
SidebarNavigationScreenDetailsPanelLabel,
|
|
20
|
-
SidebarNavigationScreenDetailsPanelValue,
|
|
21
|
-
} from '../sidebar-navigation-screen-details-panel';
|
|
22
12
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
23
13
|
|
|
24
14
|
export default function SidebarNavigationScreenDetailsFooter( {
|
|
25
15
|
record,
|
|
16
|
+
revisionsCount,
|
|
26
17
|
...otherProps
|
|
27
18
|
} ) {
|
|
28
19
|
/*
|
|
@@ -34,9 +25,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
|
|
|
34
25
|
const hrefProps = {};
|
|
35
26
|
const lastRevisionId =
|
|
36
27
|
record?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
28
|
+
|
|
29
|
+
// Use incoming prop first, then the record's version history, if available.
|
|
30
|
+
revisionsCount =
|
|
31
|
+
revisionsCount ||
|
|
32
|
+
record?._links?.[ 'version-history' ]?.[ 0 ]?.count ||
|
|
33
|
+
0;
|
|
34
|
+
|
|
35
|
+
/*
|
|
36
|
+
* Enable the revisions link if there is a last revision and there is more than one revision.
|
|
37
|
+
* This link is used for theme assets, e.g., templates, which have no database record until they're edited.
|
|
38
|
+
* For these files there's only a "revision" after they're edited twice,
|
|
39
|
+
* which means the revision.php page won't display a proper diff.
|
|
40
|
+
* See: https://github.com/WordPress/gutenberg/issues/49164.
|
|
41
|
+
*/
|
|
40
42
|
if ( lastRevisionId && revisionsCount > 1 ) {
|
|
41
43
|
hrefProps.href = addQueryArgs( 'revision.php', {
|
|
42
44
|
revision: record?._links[ 'predecessor-version' ][ 0 ].id,
|
|
@@ -44,33 +46,20 @@ export default function SidebarNavigationScreenDetailsFooter( {
|
|
|
44
46
|
hrefProps.as = 'a';
|
|
45
47
|
}
|
|
46
48
|
return (
|
|
47
|
-
<ItemGroup
|
|
49
|
+
<ItemGroup
|
|
50
|
+
size="large"
|
|
51
|
+
className="edit-site-sidebar-navigation-screen-details-footer"
|
|
52
|
+
>
|
|
48
53
|
<SidebarNavigationItem
|
|
49
|
-
|
|
54
|
+
icon={ backup }
|
|
50
55
|
{ ...hrefProps }
|
|
51
56
|
{ ...otherProps }
|
|
52
57
|
>
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
{ createInterpolateElement(
|
|
59
|
-
sprintf(
|
|
60
|
-
/* translators: %s: is the relative time when the post was last modified. */
|
|
61
|
-
__( '<time>%s</time>' ),
|
|
62
|
-
humanTimeDiff( record.modified )
|
|
63
|
-
),
|
|
64
|
-
{
|
|
65
|
-
time: <time dateTime={ record.modified } />,
|
|
66
|
-
}
|
|
67
|
-
) }
|
|
68
|
-
</SidebarNavigationScreenDetailsPanelValue>
|
|
69
|
-
<Icon
|
|
70
|
-
className="edit-site-sidebar-navigation-screen-details-footer__icon"
|
|
71
|
-
icon={ backup }
|
|
72
|
-
/>
|
|
73
|
-
</SidebarNavigationScreenDetailsPanelRow>
|
|
58
|
+
{ sprintf(
|
|
59
|
+
/* translators: %d: Number of Styles revisions. */
|
|
60
|
+
_n( '%d Revision', '%d Revisions', revisionsCount ),
|
|
61
|
+
revisionsCount
|
|
62
|
+
) }
|
|
74
63
|
</SidebarNavigationItem>
|
|
75
64
|
</ItemGroup>
|
|
76
65
|
);
|
|
@@ -48,24 +48,15 @@ export function SidebarNavigationItemGlobalStyles( props ) {
|
|
|
48
48
|
export default function SidebarNavigationScreenGlobalStyles() {
|
|
49
49
|
const history = useHistory();
|
|
50
50
|
const { params } = useLocation();
|
|
51
|
-
const {
|
|
52
|
-
|
|
51
|
+
const {
|
|
52
|
+
revisions,
|
|
53
|
+
isLoading: isLoadingRevisions,
|
|
54
|
+
revisionsCount,
|
|
55
|
+
} = useGlobalStylesRevisions();
|
|
53
56
|
const { openGeneralSidebar } = useDispatch( editSiteStore );
|
|
54
57
|
const { setEditorCanvasContainerView } = unlock(
|
|
55
58
|
useDispatch( editSiteStore )
|
|
56
59
|
);
|
|
57
|
-
const { revisionsCount } = useSelect( ( select ) => {
|
|
58
|
-
const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
|
|
59
|
-
select( coreStore );
|
|
60
|
-
const globalStylesId = __experimentalGetCurrentGlobalStylesId();
|
|
61
|
-
const globalStyles = globalStylesId
|
|
62
|
-
? getEntityRecord( 'root', 'globalStyles', globalStylesId )
|
|
63
|
-
: undefined;
|
|
64
|
-
return {
|
|
65
|
-
revisionsCount:
|
|
66
|
-
globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,
|
|
67
|
-
};
|
|
68
|
-
}, [] );
|
|
69
60
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
70
61
|
|
|
71
62
|
const openGlobalStyles = useCallback( async () => {
|
|
@@ -95,10 +86,9 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
95
86
|
}, [ openGlobalStyles, setEditorCanvasContainerView ] );
|
|
96
87
|
|
|
97
88
|
// If there are no revisions, do not render a footer.
|
|
98
|
-
const hasRevisions = revisionsCount > 0;
|
|
99
|
-
const modifiedDateTime = revisions?.[ 0 ]?.modified;
|
|
100
89
|
const shouldShowGlobalStylesFooter =
|
|
101
|
-
|
|
90
|
+
!! revisionsCount && ! isLoadingRevisions;
|
|
91
|
+
|
|
102
92
|
return (
|
|
103
93
|
<>
|
|
104
94
|
<SidebarNavigationScreen
|
|
@@ -114,6 +104,7 @@ export default function SidebarNavigationScreenGlobalStyles() {
|
|
|
114
104
|
shouldShowGlobalStylesFooter && (
|
|
115
105
|
<SidebarNavigationScreenDetailsFooter
|
|
116
106
|
record={ revisions?.[ 0 ] }
|
|
107
|
+
revisionsCount={ revisionsCount }
|
|
117
108
|
onClick={ openRevisions }
|
|
118
109
|
/>
|
|
119
110
|
)
|
|
@@ -69,7 +69,7 @@ export default function usePatternCategories() {
|
|
|
69
69
|
// If the pattern has no categories, add it to uncategorized.
|
|
70
70
|
if (
|
|
71
71
|
! pattern.wp_pattern_category?.length ||
|
|
72
|
-
! pattern.wp_pattern_category
|
|
72
|
+
! pattern.wp_pattern_category?.some( ( catId ) =>
|
|
73
73
|
userPatternCategories.find( ( cat ) => cat.id === catId )
|
|
74
74
|
)
|
|
75
75
|
) {
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useEntityRecords } from '@wordpress/core-data';
|
|
4
|
+
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
5
5
|
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
@@ -18,7 +17,8 @@ const useTemplatePartsGroupedByArea = ( items ) => {
|
|
|
18
17
|
|
|
19
18
|
const templatePartAreas = useSelect(
|
|
20
19
|
( select ) =>
|
|
21
|
-
select(
|
|
20
|
+
select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
|
|
21
|
+
?.default_template_part_areas || [],
|
|
22
22
|
[]
|
|
23
23
|
);
|
|
24
24
|
|
|
@@ -43,7 +43,7 @@ const useTemplatePartsGroupedByArea = ( items ) => {
|
|
|
43
43
|
const key = accumulator[ item.area ]
|
|
44
44
|
? item.area
|
|
45
45
|
: TEMPLATE_PART_AREA_DEFAULT_CATEGORY;
|
|
46
|
-
accumulator[ key ]
|
|
46
|
+
accumulator[ key ]?.templateParts?.push( item );
|
|
47
47
|
return accumulator;
|
|
48
48
|
}, knownAreas );
|
|
49
49
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Areas
|
|
4
4
|
|
|
5
|
-
When `canvasMode` is not `edit`, the areas
|
|
5
|
+
When `canvasMode` is not `edit`, the areas available to use are:
|
|
6
6
|
|
|
7
7
|
| Area | Non-mobile viewport | Mobile viewport |
|
|
8
8
|
| --- | --- | --- |
|
|
@@ -12,7 +12,7 @@ When `canvasMode` is not `edit`, the areas avaliable to use are:
|
|
|
12
12
|
| `edit` | Rendered if provided. | Not rendered. |
|
|
13
13
|
| `mobile` | Not rendered | Rendered as full-screen, if provided. |
|
|
14
14
|
|
|
15
|
-
When `canvasMode` is `edit`, the areas
|
|
15
|
+
When `canvasMode` is `edit`, the areas available to use are:
|
|
16
16
|
|
|
17
17
|
| Area | Non-mobile viewport | Mobile viewport |
|
|
18
18
|
| --- | --- | --- |
|
|
@@ -15,7 +15,6 @@ import { navigationViewRoute } from './navigation-view';
|
|
|
15
15
|
import { navigationEditRoute } from './navigation-edit';
|
|
16
16
|
import { navigationItemEditRoute } from './navigation-item-edit';
|
|
17
17
|
import { navigationItemViewRoute } from './navigation-item-view';
|
|
18
|
-
import { stylesEditRoute } from './styles-edit';
|
|
19
18
|
import { stylesViewRoute } from './styles-view';
|
|
20
19
|
import { patternsEditRoute } from './patterns-edit';
|
|
21
20
|
import { patternsViewRoute } from './patterns-view';
|
|
@@ -40,7 +39,6 @@ const routes = [
|
|
|
40
39
|
patternsViewRoute,
|
|
41
40
|
patternsEditRoute,
|
|
42
41
|
stylesViewRoute,
|
|
43
|
-
stylesEditRoute,
|
|
44
42
|
navigationItemViewRoute,
|
|
45
43
|
navigationItemEditRoute,
|
|
46
44
|
navigationViewRoute,
|
|
@@ -150,7 +150,18 @@ function getOverviewBlockExamples(
|
|
|
150
150
|
name: blockName,
|
|
151
151
|
title: blockType.title,
|
|
152
152
|
category: 'overview',
|
|
153
|
-
|
|
153
|
+
/*
|
|
154
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
155
|
+
* so remove the style attribute from the example to ensure the example
|
|
156
|
+
* demonstrates changes to global styles.
|
|
157
|
+
*/
|
|
158
|
+
blocks: getBlockFromExample( blockName, {
|
|
159
|
+
...blockType.example,
|
|
160
|
+
attributes: {
|
|
161
|
+
...blockType.example.attributes,
|
|
162
|
+
style: undefined,
|
|
163
|
+
},
|
|
164
|
+
} ),
|
|
154
165
|
};
|
|
155
166
|
examples.push( blockExample );
|
|
156
167
|
}
|
|
@@ -179,7 +190,18 @@ export function getExamples( colors: MultiOriginPalettes ): BlockExample[] {
|
|
|
179
190
|
name: blockType.name,
|
|
180
191
|
title: blockType.title,
|
|
181
192
|
category: blockType.category,
|
|
182
|
-
|
|
193
|
+
/*
|
|
194
|
+
* CSS generated from style attributes will take precedence over global styles CSS,
|
|
195
|
+
* so remove the style attribute from the example to ensure the example
|
|
196
|
+
* demonstrates changes to global styles.
|
|
197
|
+
*/
|
|
198
|
+
blocks: getBlockFromExample( blockType.name, {
|
|
199
|
+
...blockType.example,
|
|
200
|
+
attributes: {
|
|
201
|
+
...blockType.example.attributes,
|
|
202
|
+
style: undefined,
|
|
203
|
+
},
|
|
204
|
+
} ),
|
|
183
205
|
} ) );
|
|
184
206
|
const isHeadingBlockRegistered = !! getBlockType( 'core/heading' );
|
|
185
207
|
|
package/src/index.js
CHANGED
|
@@ -10,10 +10,7 @@ import {
|
|
|
10
10
|
import { dispatch } from '@wordpress/data';
|
|
11
11
|
import deprecated from '@wordpress/deprecated';
|
|
12
12
|
import { createRoot, StrictMode } from '@wordpress/element';
|
|
13
|
-
import {
|
|
14
|
-
store as editorStore,
|
|
15
|
-
privateApis as editorPrivateApis,
|
|
16
|
-
} from '@wordpress/editor';
|
|
13
|
+
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
17
14
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
18
15
|
import {
|
|
19
16
|
registerLegacyWidgetBlock,
|
|
@@ -88,15 +85,6 @@ export function initializeEditor( id, settings ) {
|
|
|
88
85
|
|
|
89
86
|
dispatch( editSiteStore ).updateSettings( settings );
|
|
90
87
|
|
|
91
|
-
// Keep the defaultTemplateTypes in the core/editor settings too,
|
|
92
|
-
// so that they can be selected with core/editor selectors in any editor.
|
|
93
|
-
// This is needed because edit-site doesn't initialize with EditorProvider,
|
|
94
|
-
// which internally uses updateEditorSettings as well.
|
|
95
|
-
dispatch( editorStore ).updateEditorSettings( {
|
|
96
|
-
defaultTemplateTypes: settings.defaultTemplateTypes,
|
|
97
|
-
defaultTemplatePartAreas: settings.defaultTemplatePartAreas,
|
|
98
|
-
} );
|
|
99
|
-
|
|
100
88
|
// Prevent the default browser action for files dropped outside of dropzones.
|
|
101
89
|
window.addEventListener( 'dragover', ( e ) => e.preventDefault(), false );
|
|
102
90
|
window.addEventListener( 'drop', ( e ) => e.preventDefault(), false );
|