@wordpress/edit-site 6.2.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 +2 -0
- package/build/components/{add-new-page → add-new-post}/index.js +21 -17
- 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 +21 -3
- package/build/components/editor/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-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 +4 -4
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +4 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +14 -28
- 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 +43 -39
- package/build/components/page-patterns/index.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 +18 -19
- 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} +135 -40
- 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 +3 -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/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/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-page → add-new-post}/index.js +21 -17
- 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 +21 -3
- package/build-module/components/editor/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-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 +5 -5
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +4 -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 -29
- 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 +44 -40
- package/build-module/components/page-patterns/index.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 +18 -19
- 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} +134 -39
- 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 +96 -83
- 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 +3 -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/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/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 +112 -144
- package/build-style/style.css +112 -144
- package/package.json +41 -41
- package/src/components/{add-new-page → add-new-post}/index.js +28 -22
- package/src/components/block-editor/use-site-editor-settings.js +33 -28
- package/src/components/editor/index.js +21 -5
- package/src/components/global-styles/background-panel.js +0 -8
- 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/typography-elements.js +0 -4
- package/src/components/global-styles/variations/variation.js +5 -5
- package/src/components/global-styles/variations/variations-color.js +5 -3
- package/src/components/global-styles/variations/variations-typography.js +15 -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 +47 -56
- 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 +17 -19
- 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} +126 -39
- 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 +110 -97
- 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 +2 -1
- 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/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/posts.js +63 -2
- package/src/posts.scss +9 -0
- package/src/store/private-actions.js +7 -3
- package/src/style.scss +1 -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
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Button,
|
|
11
|
+
__experimentalHStack as HStack,
|
|
12
|
+
Icon,
|
|
13
|
+
} from '@wordpress/components';
|
|
5
14
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
15
|
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
7
16
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
@@ -17,6 +26,15 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
17
26
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
18
27
|
import { DataViews } from '@wordpress/dataviews';
|
|
19
28
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
29
|
+
import {
|
|
30
|
+
trash,
|
|
31
|
+
drafts,
|
|
32
|
+
published,
|
|
33
|
+
scheduled,
|
|
34
|
+
pending,
|
|
35
|
+
notAllowed,
|
|
36
|
+
commentAuthorAvatar as authorIcon,
|
|
37
|
+
} from '@wordpress/icons';
|
|
20
38
|
|
|
21
39
|
/**
|
|
22
40
|
* Internal dependencies
|
|
@@ -24,7 +42,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
24
42
|
import Page from '../page';
|
|
25
43
|
import { default as Link, useLink } from '../routes/link';
|
|
26
44
|
import {
|
|
27
|
-
|
|
45
|
+
useDefaultViews,
|
|
28
46
|
DEFAULT_CONFIG_PER_VIEW_TYPE,
|
|
29
47
|
} from '../sidebar-dataviews/default-views';
|
|
30
48
|
import {
|
|
@@ -35,7 +53,7 @@ import {
|
|
|
35
53
|
OPERATOR_IS_NONE,
|
|
36
54
|
} from '../../utils/constants';
|
|
37
55
|
|
|
38
|
-
import
|
|
56
|
+
import AddNewPostModal from '../add-new-post';
|
|
39
57
|
import Media from '../media';
|
|
40
58
|
import { unlock } from '../../lock-unlock';
|
|
41
59
|
import { useEditPostAction } from '../dataviews-actions';
|
|
@@ -56,6 +74,7 @@ function useView( postType ) {
|
|
|
56
74
|
params: { activeView = 'all', isCustom = 'false', layout },
|
|
57
75
|
} = useLocation();
|
|
58
76
|
const history = useHistory();
|
|
77
|
+
const DEFAULT_VIEWS = useDefaultViews( { postType } );
|
|
59
78
|
const selectedDefaultView = useMemo( () => {
|
|
60
79
|
const defaultView =
|
|
61
80
|
isCustom === 'false' &&
|
|
@@ -72,7 +91,7 @@ function useView( postType ) {
|
|
|
72
91
|
};
|
|
73
92
|
}
|
|
74
93
|
return defaultView;
|
|
75
|
-
}, [ isCustom, activeView, layout, postType ] );
|
|
94
|
+
}, [ isCustom, activeView, layout, postType, DEFAULT_VIEWS ] );
|
|
76
95
|
const [ view, setView ] = useState( selectedDefaultView );
|
|
77
96
|
|
|
78
97
|
useEffect( () => {
|
|
@@ -153,12 +172,12 @@ function useView( postType ) {
|
|
|
153
172
|
// See https://github.com/WordPress/gutenberg/issues/55886
|
|
154
173
|
// We do not support custom statutes at the moment.
|
|
155
174
|
const STATUSES = [
|
|
156
|
-
{ value: 'draft', label: __( 'Draft' ) },
|
|
157
|
-
{ value: 'future', label: __( 'Scheduled' ) },
|
|
158
|
-
{ value: 'pending', label: __( 'Pending Review' ) },
|
|
159
|
-
{ value: 'private', label: __( 'Private' ) },
|
|
160
|
-
{ value: 'publish', label: __( 'Published' ) },
|
|
161
|
-
{ value: 'trash', label: __( 'Trash' ) },
|
|
175
|
+
{ value: 'draft', label: __( 'Draft' ), icon: drafts },
|
|
176
|
+
{ value: 'future', label: __( 'Scheduled' ), icon: scheduled },
|
|
177
|
+
{ value: 'pending', label: __( 'Pending Review' ), icon: pending },
|
|
178
|
+
{ value: 'private', label: __( 'Private' ), icon: notAllowed },
|
|
179
|
+
{ value: 'publish', label: __( 'Published' ), icon: published },
|
|
180
|
+
{ value: 'trash', label: __( 'Trash' ), icon: trash },
|
|
162
181
|
];
|
|
163
182
|
const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.
|
|
164
183
|
|
|
@@ -176,7 +195,7 @@ function FeaturedImage( { item, viewType } ) {
|
|
|
176
195
|
: [ 'thumbnail', 'medium', 'large', 'full' ];
|
|
177
196
|
const media = hasMedia ? (
|
|
178
197
|
<Media
|
|
179
|
-
className="
|
|
198
|
+
className="posts-list-page__featured-image"
|
|
180
199
|
id={ item.featured_media }
|
|
181
200
|
size={ size }
|
|
182
201
|
/>
|
|
@@ -184,11 +203,11 @@ function FeaturedImage( { item, viewType } ) {
|
|
|
184
203
|
const renderButton = viewType !== LAYOUT_LIST && ! isDisabled;
|
|
185
204
|
return (
|
|
186
205
|
<div
|
|
187
|
-
className={ `
|
|
206
|
+
className={ `posts-list-page__featured-image-wrapper is-layout-${ viewType }` }
|
|
188
207
|
>
|
|
189
208
|
{ renderButton ? (
|
|
190
209
|
<button
|
|
191
|
-
className="page-
|
|
210
|
+
className="posts-list-page-preview-field__button"
|
|
192
211
|
type="button"
|
|
193
212
|
onClick={ onClick }
|
|
194
213
|
aria-label={ item.title?.rendered || __( '(no title)' ) }
|
|
@@ -206,15 +225,71 @@ function getItemId( item ) {
|
|
|
206
225
|
return item.id.toString();
|
|
207
226
|
}
|
|
208
227
|
|
|
209
|
-
|
|
210
|
-
const
|
|
228
|
+
function PostStatusField( { item } ) {
|
|
229
|
+
const status = STATUSES.find( ( { value } ) => value === item.status );
|
|
230
|
+
const label = status?.label || item.status;
|
|
231
|
+
const icon = status?.icon;
|
|
232
|
+
return (
|
|
233
|
+
<HStack alignment="left" spacing={ 1 }>
|
|
234
|
+
{ icon && (
|
|
235
|
+
<div className="posts-list-page-post-author-field__icon-container">
|
|
236
|
+
<Icon icon={ icon } />
|
|
237
|
+
</div>
|
|
238
|
+
) }
|
|
239
|
+
<span>{ label }</span>
|
|
240
|
+
</HStack>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function PostAuthorField( { item, viewType } ) {
|
|
245
|
+
const { text, icon, imageUrl } = useSelect(
|
|
246
|
+
( select ) => {
|
|
247
|
+
const { getUser } = select( coreStore );
|
|
248
|
+
const user = getUser( item.author );
|
|
249
|
+
return {
|
|
250
|
+
icon: authorIcon,
|
|
251
|
+
imageUrl: user?.avatar_urls?.[ 48 ],
|
|
252
|
+
text: user?.name,
|
|
253
|
+
};
|
|
254
|
+
},
|
|
255
|
+
[ item ]
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
const withAuthorImage = viewType !== LAYOUT_LIST && imageUrl;
|
|
259
|
+
const withAuthorIcon = viewType !== LAYOUT_LIST && ! imageUrl;
|
|
260
|
+
const [ isImageLoaded, setIsImageLoaded ] = useState( false );
|
|
261
|
+
return (
|
|
262
|
+
<HStack alignment="left" spacing={ 1 }>
|
|
263
|
+
{ withAuthorImage && (
|
|
264
|
+
<div
|
|
265
|
+
className={ clsx( 'page-templates-author-field__avatar', {
|
|
266
|
+
'is-loaded': isImageLoaded,
|
|
267
|
+
} ) }
|
|
268
|
+
>
|
|
269
|
+
<img
|
|
270
|
+
onLoad={ () => setIsImageLoaded( true ) }
|
|
271
|
+
alt={ __( 'Author avatar' ) }
|
|
272
|
+
src={ imageUrl }
|
|
273
|
+
/>
|
|
274
|
+
</div>
|
|
275
|
+
) }
|
|
276
|
+
{ withAuthorIcon && (
|
|
277
|
+
<div className="page-templates-author-field__icon">
|
|
278
|
+
<Icon icon={ icon } />
|
|
279
|
+
</div>
|
|
280
|
+
) }
|
|
281
|
+
<span className="page-templates-author-field__name">{ text }</span>
|
|
282
|
+
</HStack>
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
export default function PostsList( { postType } ) {
|
|
211
287
|
const [ view, setView ] = useView( postType );
|
|
212
288
|
const history = useHistory();
|
|
213
289
|
const {
|
|
214
290
|
params: { postId },
|
|
215
291
|
} = useLocation();
|
|
216
292
|
const [ selection, setSelection ] = useState( [ postId ] );
|
|
217
|
-
|
|
218
293
|
const onSelectionChange = useCallback(
|
|
219
294
|
( items ) => {
|
|
220
295
|
const { params } = history.getLocationWithParams();
|
|
@@ -269,13 +344,13 @@ export default function PagePages() {
|
|
|
269
344
|
};
|
|
270
345
|
}, [ view ] );
|
|
271
346
|
const {
|
|
272
|
-
records
|
|
273
|
-
isResolving:
|
|
347
|
+
records,
|
|
348
|
+
isResolving: isLoadingMainEntities,
|
|
274
349
|
totalItems,
|
|
275
350
|
totalPages,
|
|
276
351
|
} = useEntityRecords( 'postType', postType, queryArgs );
|
|
277
352
|
|
|
278
|
-
const ids =
|
|
353
|
+
const ids = records?.map( ( record ) => getItemId( record ) ) ?? [];
|
|
279
354
|
const prevIds = usePrevious( ids ) ?? [];
|
|
280
355
|
const deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );
|
|
281
356
|
const postIdWasDeleted = deletedIds.includes( postId );
|
|
@@ -300,20 +375,26 @@ export default function PagePages() {
|
|
|
300
375
|
[ totalItems, totalPages ]
|
|
301
376
|
);
|
|
302
377
|
|
|
303
|
-
const { frontPageId, postsPageId,
|
|
378
|
+
const { frontPageId, postsPageId, labels, canCreateRecord } = useSelect(
|
|
304
379
|
( select ) => {
|
|
305
380
|
const { getEntityRecord, getPostType, canUser } =
|
|
306
381
|
select( coreStore );
|
|
307
382
|
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
383
|
+
const postTypeObject = getPostType( postType );
|
|
308
384
|
return {
|
|
309
385
|
frontPageId: siteSettings?.page_on_front,
|
|
310
386
|
postsPageId: siteSettings?.page_for_posts,
|
|
311
|
-
|
|
312
|
-
|
|
387
|
+
labels: getPostType( postType )?.labels,
|
|
388
|
+
canCreateRecord: canUser(
|
|
389
|
+
'create',
|
|
390
|
+
postTypeObject?.rest_base || 'posts'
|
|
391
|
+
),
|
|
313
392
|
};
|
|
314
|
-
}
|
|
393
|
+
},
|
|
394
|
+
[ postType ]
|
|
315
395
|
);
|
|
316
396
|
|
|
397
|
+
// TODO: this should be abstracted into a hook similar to `usePostActions`.
|
|
317
398
|
const fields = useMemo(
|
|
318
399
|
() => [
|
|
319
400
|
{
|
|
@@ -355,13 +436,13 @@ export default function PagePages() {
|
|
|
355
436
|
let suffix = '';
|
|
356
437
|
if ( item.id === frontPageId ) {
|
|
357
438
|
suffix = (
|
|
358
|
-
<span className="
|
|
439
|
+
<span className="posts-list-page-title-badge">
|
|
359
440
|
{ __( 'Front Page' ) }
|
|
360
441
|
</span>
|
|
361
442
|
);
|
|
362
443
|
} else if ( item.id === postsPageId ) {
|
|
363
444
|
suffix = (
|
|
364
|
-
<span className="
|
|
445
|
+
<span className="posts-list-page-title-badge">
|
|
365
446
|
{ __( 'Posts Page' ) }
|
|
366
447
|
</span>
|
|
367
448
|
);
|
|
@@ -369,7 +450,7 @@ export default function PagePages() {
|
|
|
369
450
|
|
|
370
451
|
return (
|
|
371
452
|
<HStack
|
|
372
|
-
className="
|
|
453
|
+
className="posts-list-page-title"
|
|
373
454
|
alignment="center"
|
|
374
455
|
justify="flex-start"
|
|
375
456
|
>
|
|
@@ -390,6 +471,11 @@ export default function PagePages() {
|
|
|
390
471
|
value: id,
|
|
391
472
|
label: name,
|
|
392
473
|
} ) ) || [],
|
|
474
|
+
render: ( { item } ) => {
|
|
475
|
+
return (
|
|
476
|
+
<PostAuthorField viewType={ view.type } item={ item } />
|
|
477
|
+
);
|
|
478
|
+
},
|
|
393
479
|
},
|
|
394
480
|
{
|
|
395
481
|
header: __( 'Status' ),
|
|
@@ -398,6 +484,7 @@ export default function PagePages() {
|
|
|
398
484
|
STATUSES.find( ( { value } ) => value === item.status )
|
|
399
485
|
?.label ?? item.status,
|
|
400
486
|
elements: STATUSES,
|
|
487
|
+
render: PostStatusField,
|
|
401
488
|
enableSorting: false,
|
|
402
489
|
filterBy: {
|
|
403
490
|
operators: [ OPERATOR_IS_ANY ],
|
|
@@ -482,9 +569,8 @@ export default function PagePages() {
|
|
|
482
569
|
],
|
|
483
570
|
[ authors, view.type, frontPageId, postsPageId ]
|
|
484
571
|
);
|
|
485
|
-
|
|
486
572
|
const postTypeActions = usePostActions( {
|
|
487
|
-
postType
|
|
573
|
+
postType,
|
|
488
574
|
context: 'list',
|
|
489
575
|
} );
|
|
490
576
|
const editAction = useEditPostAction();
|
|
@@ -509,10 +595,10 @@ export default function PagePages() {
|
|
|
509
595
|
[ view.type, setView ]
|
|
510
596
|
);
|
|
511
597
|
|
|
512
|
-
const [
|
|
598
|
+
const [ showAddPostModal, setShowAddPostModal ] = useState( false );
|
|
513
599
|
|
|
514
|
-
const openModal = () =>
|
|
515
|
-
const closeModal = () =>
|
|
600
|
+
const openModal = () => setShowAddPostModal( true );
|
|
601
|
+
const closeModal = () => setShowAddPostModal( false );
|
|
516
602
|
const handleNewPage = ( { type, id } ) => {
|
|
517
603
|
history.push( {
|
|
518
604
|
postId: id,
|
|
@@ -524,20 +610,21 @@ export default function PagePages() {
|
|
|
524
610
|
|
|
525
611
|
return (
|
|
526
612
|
<Page
|
|
527
|
-
title={
|
|
613
|
+
title={ labels?.name }
|
|
528
614
|
actions={
|
|
529
|
-
|
|
530
|
-
|
|
615
|
+
labels?.add_new_item &&
|
|
616
|
+
canCreateRecord && (
|
|
531
617
|
<>
|
|
532
618
|
<Button
|
|
533
619
|
variant="primary"
|
|
534
620
|
onClick={ openModal }
|
|
535
621
|
__next40pxDefaultSize
|
|
536
622
|
>
|
|
537
|
-
{
|
|
623
|
+
{ labels.add_new_item }
|
|
538
624
|
</Button>
|
|
539
|
-
{
|
|
540
|
-
<
|
|
625
|
+
{ showAddPostModal && (
|
|
626
|
+
<AddNewPostModal
|
|
627
|
+
postType={ postType }
|
|
541
628
|
onSave={ handleNewPage }
|
|
542
629
|
onClose={ closeModal }
|
|
543
630
|
/>
|
|
@@ -550,8 +637,8 @@ export default function PagePages() {
|
|
|
550
637
|
paginationInfo={ paginationInfo }
|
|
551
638
|
fields={ fields }
|
|
552
639
|
actions={ actions }
|
|
553
|
-
data={
|
|
554
|
-
isLoading={
|
|
640
|
+
data={ records || EMPTY_ARRAY }
|
|
641
|
+
isLoading={ isLoadingMainEntities || isLoadingAuthors }
|
|
555
642
|
view={ view }
|
|
556
643
|
onChangeView={ onChangeView }
|
|
557
644
|
selection={ selection }
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
5
|
+
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Internal dependencies
|
|
10
|
+
*/
|
|
11
|
+
import { unlock } from '../../lock-unlock';
|
|
12
|
+
import Editor from '../editor';
|
|
13
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
14
|
+
import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';
|
|
15
|
+
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
16
|
+
import PostsList from '../posts-app/posts-list';
|
|
17
|
+
|
|
18
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
19
|
+
|
|
20
|
+
export default function useLayoutAreas() {
|
|
21
|
+
const { params = {} } = useLocation();
|
|
22
|
+
const { postType, layout, canvas } = params;
|
|
23
|
+
const labels = useSelect(
|
|
24
|
+
( select ) => {
|
|
25
|
+
return select( coreStore ).getPostType( postType )?.labels;
|
|
26
|
+
},
|
|
27
|
+
[ postType ]
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// Posts list.
|
|
31
|
+
if ( [ 'post' ].includes( postType ) ) {
|
|
32
|
+
const isListLayout = layout === 'list' || ! layout;
|
|
33
|
+
return {
|
|
34
|
+
key: 'posts-list',
|
|
35
|
+
areas: {
|
|
36
|
+
sidebar: (
|
|
37
|
+
<SidebarNavigationScreen
|
|
38
|
+
title={ labels?.name }
|
|
39
|
+
isRoot
|
|
40
|
+
content={ <DataViewsSidebarContent /> }
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
content: <PostsList postType={ postType } />,
|
|
44
|
+
preview: ( isListLayout || canvas === 'edit' ) && (
|
|
45
|
+
<Editor isPostsList />
|
|
46
|
+
),
|
|
47
|
+
mobile:
|
|
48
|
+
canvas === 'edit' ? (
|
|
49
|
+
<Editor isPostsList />
|
|
50
|
+
) : (
|
|
51
|
+
<PostsList postType={ postType } />
|
|
52
|
+
),
|
|
53
|
+
},
|
|
54
|
+
widths: {
|
|
55
|
+
content: isListLayout ? 380 : undefined,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Fallback shows the home page preview
|
|
61
|
+
return {
|
|
62
|
+
key: 'default',
|
|
63
|
+
areas: {
|
|
64
|
+
sidebar: <SidebarNavigationScreenMain />,
|
|
65
|
+
preview: <Editor isPostsList />,
|
|
66
|
+
mobile: canvas === 'edit' && <Editor isPostsList />,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
.
|
|
1
|
+
.posts-list-page__featured-image {
|
|
2
2
|
height: 100%;
|
|
3
3
|
object-fit: cover;
|
|
4
4
|
width: 100%;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
.
|
|
7
|
+
.posts-list-page__featured-image-wrapper {
|
|
8
8
|
height: 100%;
|
|
9
9
|
width: 100%;
|
|
10
10
|
border-radius: $grid-unit-05;
|
|
11
11
|
|
|
12
|
-
&.is-layout-table:not(:has(.page-
|
|
13
|
-
&.is-layout-table .page-
|
|
12
|
+
&.is-layout-table:not(:has(.posts-list-page-preview-field__button)),
|
|
13
|
+
&.is-layout-table .posts-list-page-preview-field__button {
|
|
14
14
|
width: $grid-unit-40;
|
|
15
15
|
height: $grid-unit-40;
|
|
16
16
|
display: block;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
.page-
|
|
36
|
+
.posts-list-page-preview-field__button {
|
|
37
37
|
box-shadow: none;
|
|
38
38
|
border: none;
|
|
39
39
|
padding: 0;
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
overflow: hidden;
|
|
44
44
|
height: 100%;
|
|
45
45
|
width: 100%;
|
|
46
|
-
border-radius:
|
|
46
|
+
border-radius: $grid-unit-05;
|
|
47
47
|
|
|
48
48
|
&:focus-visible {
|
|
49
49
|
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
@@ -52,12 +52,19 @@
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
.
|
|
55
|
+
.dataviews-view-grid__card.is-selected {
|
|
56
|
+
.posts-list-page-preview-field__button::after {
|
|
57
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
58
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.posts-list-page-title span {
|
|
56
63
|
text-overflow: ellipsis;
|
|
57
64
|
overflow: hidden;
|
|
58
65
|
}
|
|
59
66
|
|
|
60
|
-
.
|
|
67
|
+
.posts-list-page-title-badge {
|
|
61
68
|
background: $gray-100;
|
|
62
69
|
color: $gray-700;
|
|
63
70
|
padding: 0 $grid-unit-05;
|
|
@@ -66,3 +73,10 @@
|
|
|
66
73
|
font-weight: 400;
|
|
67
74
|
flex-shrink: 0;
|
|
68
75
|
}
|
|
76
|
+
|
|
77
|
+
.posts-list-page-post-author-field__icon-container {
|
|
78
|
+
height: $grid-unit-30;
|
|
79
|
+
svg {
|
|
80
|
+
fill: currentColor;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -25,6 +25,7 @@ const {
|
|
|
25
25
|
ExperimentalBlockEditorProvider,
|
|
26
26
|
GlobalStylesContext,
|
|
27
27
|
useGlobalStylesOutputWithConfig,
|
|
28
|
+
__unstableBlockStyleVariationOverridesWithConfig,
|
|
28
29
|
} = unlock( blockEditorPrivateApis );
|
|
29
30
|
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );
|
|
30
31
|
|
|
@@ -74,7 +75,6 @@ function Revisions( { userConfig, blocks } ) {
|
|
|
74
75
|
name="revisions"
|
|
75
76
|
tabIndex={ 0 }
|
|
76
77
|
>
|
|
77
|
-
<EditorStyles styles={ editorStyles } />
|
|
78
78
|
<style>
|
|
79
79
|
{
|
|
80
80
|
// Forming a "block formatting context" to prevent margin collapsing.
|
|
@@ -88,6 +88,14 @@ function Revisions( { userConfig, blocks } ) {
|
|
|
88
88
|
settings={ settings }
|
|
89
89
|
>
|
|
90
90
|
<BlockList renderAppender={ false } />
|
|
91
|
+
{ /*
|
|
92
|
+
* Styles are printed inside the block editor provider,
|
|
93
|
+
* so they can access any registered style overrides.
|
|
94
|
+
*/ }
|
|
95
|
+
<EditorStyles styles={ editorStyles } />
|
|
96
|
+
<__unstableBlockStyleVariationOverridesWithConfig
|
|
97
|
+
config={ mergedConfig }
|
|
98
|
+
/>
|
|
91
99
|
</ExperimentalBlockEditorProvider>
|
|
92
100
|
</Disabled>
|
|
93
101
|
</Iframe>
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
.edit-site-sidebar__content {
|
|
2
2
|
flex-grow: 1;
|
|
3
3
|
overflow-y: auto;
|
|
4
|
+
// Prevents horizontal overflow while animating screen transitions
|
|
5
|
+
overflow-x: hidden;
|
|
6
|
+
// Mark this section of the DOM as isolated, providing performance benefits
|
|
7
|
+
// by limiting calculations of layout, style and paint to a DOM subtree rather
|
|
8
|
+
// than the entire page.
|
|
9
|
+
contain: content;
|
|
4
10
|
}
|
|
5
11
|
|
|
6
12
|
@keyframes local--slide-from-right {
|
|
@@ -19,7 +19,7 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
21
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
22
|
-
import {
|
|
22
|
+
import { useDefaultViews } from './default-views';
|
|
23
23
|
import { unlock } from '../../lock-unlock';
|
|
24
24
|
|
|
25
25
|
const { useHistory } = unlock( routerPrivateApis );
|
|
@@ -29,6 +29,7 @@ function AddNewItemModalContent( { type, setIsAdding } ) {
|
|
|
29
29
|
const { saveEntityRecord } = useDispatch( coreStore );
|
|
30
30
|
const [ title, setTitle ] = useState( '' );
|
|
31
31
|
const [ isSaving, setIsSaving ] = useState( false );
|
|
32
|
+
const DEFAULT_VIEWS = useDefaultViews( { postType: type } );
|
|
32
33
|
return (
|
|
33
34
|
<form
|
|
34
35
|
onSubmit={ async ( event ) => {
|
|
@@ -61,6 +61,7 @@ function RenameItemModalContent( { dataviewId, currentTitle, setIsRenaming } ) {
|
|
|
61
61
|
<HStack justify="right">
|
|
62
62
|
<Button
|
|
63
63
|
variant="tertiary"
|
|
64
|
+
__next40pxDefaultSize
|
|
64
65
|
onClick={ () => {
|
|
65
66
|
setIsRenaming( false );
|
|
66
67
|
} }
|
|
@@ -71,8 +72,9 @@ function RenameItemModalContent( { dataviewId, currentTitle, setIsRenaming } ) {
|
|
|
71
72
|
variant="primary"
|
|
72
73
|
type="submit"
|
|
73
74
|
aria-disabled={ ! title }
|
|
75
|
+
__next40pxDefaultSize
|
|
74
76
|
>
|
|
75
|
-
{ __( '
|
|
77
|
+
{ __( 'Save' ) }
|
|
76
78
|
</Button>
|
|
77
79
|
</HStack>
|
|
78
80
|
</VStack>
|
|
@@ -160,10 +162,12 @@ function CustomDataViewItem( { dataviewId, isActive } ) {
|
|
|
160
162
|
/>
|
|
161
163
|
{ isRenaming && (
|
|
162
164
|
<Modal
|
|
163
|
-
title={ __( 'Rename
|
|
165
|
+
title={ __( 'Rename' ) }
|
|
164
166
|
onRequestClose={ () => {
|
|
165
167
|
setIsRenaming( false );
|
|
166
168
|
} }
|
|
169
|
+
focusOnMount="firstContentElement"
|
|
170
|
+
size="small"
|
|
167
171
|
>
|
|
168
172
|
<RenameItemModalContent
|
|
169
173
|
dataviewId={ dataviewId }
|