@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
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
|
-
import { Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
9
|
+
import { Button, __experimentalHStack as HStack, Icon } from '@wordpress/components';
|
|
5
10
|
import { __, sprintf } from '@wordpress/i18n';
|
|
6
11
|
import { useEntityRecords, store as coreStore } from '@wordpress/core-data';
|
|
7
12
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
@@ -11,18 +16,20 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
11
16
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
17
|
import { DataViews } from '@wordpress/dataviews';
|
|
13
18
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
19
|
+
import { trash, drafts, published, scheduled, pending, notAllowed, commentAuthorAvatar as authorIcon } from '@wordpress/icons';
|
|
14
20
|
|
|
15
21
|
/**
|
|
16
22
|
* Internal dependencies
|
|
17
23
|
*/
|
|
18
24
|
import Page from '../page';
|
|
19
25
|
import { default as Link, useLink } from '../routes/link';
|
|
20
|
-
import {
|
|
26
|
+
import { useDefaultViews, DEFAULT_CONFIG_PER_VIEW_TYPE } from '../sidebar-dataviews/default-views';
|
|
21
27
|
import { LAYOUT_GRID, LAYOUT_TABLE, LAYOUT_LIST, OPERATOR_IS_ANY, OPERATOR_IS_NONE } from '../../utils/constants';
|
|
22
|
-
import
|
|
28
|
+
import AddNewPostModal from '../add-new-post';
|
|
23
29
|
import Media from '../media';
|
|
24
30
|
import { unlock } from '../../lock-unlock';
|
|
25
31
|
import { useEditPostAction } from '../dataviews-actions';
|
|
32
|
+
import { usePrevious } from '@wordpress/compose';
|
|
26
33
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
34
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
35
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -44,6 +51,9 @@ function useView(postType) {
|
|
|
44
51
|
}
|
|
45
52
|
} = useLocation();
|
|
46
53
|
const history = useHistory();
|
|
54
|
+
const DEFAULT_VIEWS = useDefaultViews({
|
|
55
|
+
postType
|
|
56
|
+
});
|
|
47
57
|
const selectedDefaultView = useMemo(() => {
|
|
48
58
|
const defaultView = isCustom === 'false' && DEFAULT_VIEWS[postType].find(({
|
|
49
59
|
slug
|
|
@@ -58,7 +68,7 @@ function useView(postType) {
|
|
|
58
68
|
};
|
|
59
69
|
}
|
|
60
70
|
return defaultView;
|
|
61
|
-
}, [isCustom, activeView, layout, postType]);
|
|
71
|
+
}, [isCustom, activeView, layout, postType, DEFAULT_VIEWS]);
|
|
62
72
|
const [view, setView] = useState(selectedDefaultView);
|
|
63
73
|
useEffect(() => {
|
|
64
74
|
if (selectedDefaultView) {
|
|
@@ -120,22 +130,28 @@ function useView(postType) {
|
|
|
120
130
|
// We do not support custom statutes at the moment.
|
|
121
131
|
const STATUSES = [{
|
|
122
132
|
value: 'draft',
|
|
123
|
-
label: __('Draft')
|
|
133
|
+
label: __('Draft'),
|
|
134
|
+
icon: drafts
|
|
124
135
|
}, {
|
|
125
136
|
value: 'future',
|
|
126
|
-
label: __('Scheduled')
|
|
137
|
+
label: __('Scheduled'),
|
|
138
|
+
icon: scheduled
|
|
127
139
|
}, {
|
|
128
140
|
value: 'pending',
|
|
129
|
-
label: __('Pending Review')
|
|
141
|
+
label: __('Pending Review'),
|
|
142
|
+
icon: pending
|
|
130
143
|
}, {
|
|
131
144
|
value: 'private',
|
|
132
|
-
label: __('Private')
|
|
145
|
+
label: __('Private'),
|
|
146
|
+
icon: notAllowed
|
|
133
147
|
}, {
|
|
134
148
|
value: 'publish',
|
|
135
|
-
label: __('Published')
|
|
149
|
+
label: __('Published'),
|
|
150
|
+
icon: published
|
|
136
151
|
}, {
|
|
137
152
|
value: 'trash',
|
|
138
|
-
label: __('Trash')
|
|
153
|
+
label: __('Trash'),
|
|
154
|
+
icon: trash
|
|
139
155
|
}];
|
|
140
156
|
const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.
|
|
141
157
|
|
|
@@ -154,15 +170,15 @@ function FeaturedImage({
|
|
|
154
170
|
const hasMedia = !!item.featured_media;
|
|
155
171
|
const size = viewType === LAYOUT_GRID ? ['large', 'full', 'medium', 'thumbnail'] : ['thumbnail', 'medium', 'large', 'full'];
|
|
156
172
|
const media = hasMedia ? /*#__PURE__*/_jsx(Media, {
|
|
157
|
-
className: "
|
|
173
|
+
className: "posts-list-page__featured-image",
|
|
158
174
|
id: item.featured_media,
|
|
159
175
|
size: size
|
|
160
176
|
}) : null;
|
|
161
177
|
const renderButton = viewType !== LAYOUT_LIST && !isDisabled;
|
|
162
178
|
return /*#__PURE__*/_jsx("div", {
|
|
163
|
-
className: `
|
|
179
|
+
className: `posts-list-page__featured-image-wrapper is-layout-${viewType}`,
|
|
164
180
|
children: renderButton ? /*#__PURE__*/_jsx("button", {
|
|
165
|
-
className: "page-
|
|
181
|
+
className: "posts-list-page-preview-field__button",
|
|
166
182
|
type: "button",
|
|
167
183
|
onClick: onClick,
|
|
168
184
|
"aria-label": item.title?.rendered || __('(no title)'),
|
|
@@ -170,10 +186,87 @@ function FeaturedImage({
|
|
|
170
186
|
}) : media
|
|
171
187
|
});
|
|
172
188
|
}
|
|
173
|
-
|
|
174
|
-
|
|
189
|
+
function getItemId(item) {
|
|
190
|
+
return item.id.toString();
|
|
191
|
+
}
|
|
192
|
+
function PostStatusField({
|
|
193
|
+
item
|
|
194
|
+
}) {
|
|
195
|
+
const status = STATUSES.find(({
|
|
196
|
+
value
|
|
197
|
+
}) => value === item.status);
|
|
198
|
+
const label = status?.label || item.status;
|
|
199
|
+
const icon = status?.icon;
|
|
200
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
201
|
+
alignment: "left",
|
|
202
|
+
spacing: 1,
|
|
203
|
+
children: [icon && /*#__PURE__*/_jsx("div", {
|
|
204
|
+
className: "posts-list-page-post-author-field__icon-container",
|
|
205
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
206
|
+
icon: icon
|
|
207
|
+
})
|
|
208
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
209
|
+
children: label
|
|
210
|
+
})]
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
function PostAuthorField({
|
|
214
|
+
item,
|
|
215
|
+
viewType
|
|
216
|
+
}) {
|
|
217
|
+
const {
|
|
218
|
+
text,
|
|
219
|
+
icon,
|
|
220
|
+
imageUrl
|
|
221
|
+
} = useSelect(select => {
|
|
222
|
+
const {
|
|
223
|
+
getUser
|
|
224
|
+
} = select(coreStore);
|
|
225
|
+
const user = getUser(item.author);
|
|
226
|
+
return {
|
|
227
|
+
icon: authorIcon,
|
|
228
|
+
imageUrl: user?.avatar_urls?.[48],
|
|
229
|
+
text: user?.name
|
|
230
|
+
};
|
|
231
|
+
}, [item]);
|
|
232
|
+
const withAuthorImage = viewType !== LAYOUT_LIST && imageUrl;
|
|
233
|
+
const withAuthorIcon = viewType !== LAYOUT_LIST && !imageUrl;
|
|
234
|
+
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
235
|
+
return /*#__PURE__*/_jsxs(HStack, {
|
|
236
|
+
alignment: "left",
|
|
237
|
+
spacing: 1,
|
|
238
|
+
children: [withAuthorImage && /*#__PURE__*/_jsx("div", {
|
|
239
|
+
className: clsx('page-templates-author-field__avatar', {
|
|
240
|
+
'is-loaded': isImageLoaded
|
|
241
|
+
}),
|
|
242
|
+
children: /*#__PURE__*/_jsx("img", {
|
|
243
|
+
onLoad: () => setIsImageLoaded(true),
|
|
244
|
+
alt: __('Author avatar'),
|
|
245
|
+
src: imageUrl
|
|
246
|
+
})
|
|
247
|
+
}), withAuthorIcon && /*#__PURE__*/_jsx("div", {
|
|
248
|
+
className: "page-templates-author-field__icon",
|
|
249
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
250
|
+
icon: icon
|
|
251
|
+
})
|
|
252
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
253
|
+
className: "page-templates-author-field__name",
|
|
254
|
+
children: text
|
|
255
|
+
})]
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
export default function PostsList({
|
|
259
|
+
postType
|
|
260
|
+
}) {
|
|
261
|
+
var _records$map, _usePrevious;
|
|
175
262
|
const [view, setView] = useView(postType);
|
|
176
263
|
const history = useHistory();
|
|
264
|
+
const {
|
|
265
|
+
params: {
|
|
266
|
+
postId
|
|
267
|
+
}
|
|
268
|
+
} = useLocation();
|
|
269
|
+
const [selection, setSelection] = useState([postId]);
|
|
177
270
|
const onSelectionChange = useCallback(items => {
|
|
178
271
|
var _params$isCustom;
|
|
179
272
|
const {
|
|
@@ -214,11 +307,23 @@ export default function PagePages() {
|
|
|
214
307
|
};
|
|
215
308
|
}, [view]);
|
|
216
309
|
const {
|
|
217
|
-
records
|
|
218
|
-
isResolving:
|
|
310
|
+
records,
|
|
311
|
+
isResolving: isLoadingMainEntities,
|
|
219
312
|
totalItems,
|
|
220
313
|
totalPages
|
|
221
314
|
} = useEntityRecords('postType', postType, queryArgs);
|
|
315
|
+
const ids = (_records$map = records?.map(record => getItemId(record))) !== null && _records$map !== void 0 ? _records$map : [];
|
|
316
|
+
const prevIds = (_usePrevious = usePrevious(ids)) !== null && _usePrevious !== void 0 ? _usePrevious : [];
|
|
317
|
+
const deletedIds = prevIds.filter(id => !ids.includes(id));
|
|
318
|
+
const postIdWasDeleted = deletedIds.includes(postId);
|
|
319
|
+
useEffect(() => {
|
|
320
|
+
if (postIdWasDeleted) {
|
|
321
|
+
history.push({
|
|
322
|
+
...history.getLocationWithParams().params,
|
|
323
|
+
postId: undefined
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}, [postIdWasDeleted, history]);
|
|
222
327
|
const {
|
|
223
328
|
records: authors,
|
|
224
329
|
isResolving: isLoadingAuthors
|
|
@@ -232,19 +337,25 @@ export default function PagePages() {
|
|
|
232
337
|
const {
|
|
233
338
|
frontPageId,
|
|
234
339
|
postsPageId,
|
|
235
|
-
|
|
340
|
+
labels,
|
|
341
|
+
canCreateRecord
|
|
236
342
|
} = useSelect(select => {
|
|
237
343
|
const {
|
|
238
344
|
getEntityRecord,
|
|
239
|
-
getPostType
|
|
345
|
+
getPostType,
|
|
346
|
+
canUser
|
|
240
347
|
} = select(coreStore);
|
|
241
348
|
const siteSettings = getEntityRecord('root', 'site');
|
|
349
|
+
const postTypeObject = getPostType(postType);
|
|
242
350
|
return {
|
|
243
351
|
frontPageId: siteSettings?.page_on_front,
|
|
244
352
|
postsPageId: siteSettings?.page_for_posts,
|
|
245
|
-
|
|
353
|
+
labels: getPostType(postType)?.labels,
|
|
354
|
+
canCreateRecord: canUser('create', postTypeObject?.rest_base || 'posts')
|
|
246
355
|
};
|
|
247
|
-
});
|
|
356
|
+
}, [postType]);
|
|
357
|
+
|
|
358
|
+
// TODO: this should be abstracted into a hook similar to `usePostActions`.
|
|
248
359
|
const fields = useMemo(() => [{
|
|
249
360
|
id: 'featured-image',
|
|
250
361
|
header: __('Featured Image'),
|
|
@@ -282,17 +393,17 @@ export default function PagePages() {
|
|
|
282
393
|
let suffix = '';
|
|
283
394
|
if (item.id === frontPageId) {
|
|
284
395
|
suffix = /*#__PURE__*/_jsx("span", {
|
|
285
|
-
className: "
|
|
396
|
+
className: "posts-list-page-title-badge",
|
|
286
397
|
children: __('Front Page')
|
|
287
398
|
});
|
|
288
399
|
} else if (item.id === postsPageId) {
|
|
289
400
|
suffix = /*#__PURE__*/_jsx("span", {
|
|
290
|
-
className: "
|
|
401
|
+
className: "posts-list-page-title-badge",
|
|
291
402
|
children: __('Posts Page')
|
|
292
403
|
});
|
|
293
404
|
}
|
|
294
405
|
return /*#__PURE__*/_jsxs(HStack, {
|
|
295
|
-
className: "
|
|
406
|
+
className: "posts-list-page-title",
|
|
296
407
|
alignment: "center",
|
|
297
408
|
justify: "flex-start",
|
|
298
409
|
children: [title, suffix]
|
|
@@ -312,7 +423,15 @@ export default function PagePages() {
|
|
|
312
423
|
}) => ({
|
|
313
424
|
value: id,
|
|
314
425
|
label: name
|
|
315
|
-
})) || []
|
|
426
|
+
})) || [],
|
|
427
|
+
render: ({
|
|
428
|
+
item
|
|
429
|
+
}) => {
|
|
430
|
+
return /*#__PURE__*/_jsx(PostAuthorField, {
|
|
431
|
+
viewType: view.type,
|
|
432
|
+
item: item
|
|
433
|
+
});
|
|
434
|
+
}
|
|
316
435
|
}, {
|
|
317
436
|
header: __('Status'),
|
|
318
437
|
id: 'status',
|
|
@@ -325,6 +444,7 @@ export default function PagePages() {
|
|
|
325
444
|
}) => value === item.status)?.label) !== null && _STATUSES$find$label !== void 0 ? _STATUSES$find$label : item.status;
|
|
326
445
|
},
|
|
327
446
|
elements: STATUSES,
|
|
447
|
+
render: PostStatusField,
|
|
328
448
|
enableSorting: false,
|
|
329
449
|
filterBy: {
|
|
330
450
|
operators: [OPERATOR_IS_ANY]
|
|
@@ -377,7 +497,10 @@ export default function PagePages() {
|
|
|
377
497
|
});
|
|
378
498
|
}
|
|
379
499
|
}], [authors, view.type, frontPageId, postsPageId]);
|
|
380
|
-
const postTypeActions = usePostActions(
|
|
500
|
+
const postTypeActions = usePostActions({
|
|
501
|
+
postType,
|
|
502
|
+
context: 'list'
|
|
503
|
+
});
|
|
381
504
|
const editAction = useEditPostAction();
|
|
382
505
|
const actions = useMemo(() => [editAction, ...postTypeActions], [postTypeActions, editAction]);
|
|
383
506
|
const onChangeView = useCallback(newView => {
|
|
@@ -391,9 +514,9 @@ export default function PagePages() {
|
|
|
391
514
|
}
|
|
392
515
|
setView(newView);
|
|
393
516
|
}, [view.type, setView]);
|
|
394
|
-
const [
|
|
395
|
-
const openModal = () =>
|
|
396
|
-
const closeModal = () =>
|
|
517
|
+
const [showAddPostModal, setShowAddPostModal] = useState(false);
|
|
518
|
+
const openModal = () => setShowAddPostModal(true);
|
|
519
|
+
const closeModal = () => setShowAddPostModal(false);
|
|
397
520
|
const handleNewPage = ({
|
|
398
521
|
type,
|
|
399
522
|
id
|
|
@@ -406,14 +529,15 @@ export default function PagePages() {
|
|
|
406
529
|
closeModal();
|
|
407
530
|
};
|
|
408
531
|
return /*#__PURE__*/_jsx(Page, {
|
|
409
|
-
title:
|
|
410
|
-
actions:
|
|
532
|
+
title: labels?.name,
|
|
533
|
+
actions: labels?.add_new_item && canCreateRecord && /*#__PURE__*/_jsxs(_Fragment, {
|
|
411
534
|
children: [/*#__PURE__*/_jsx(Button, {
|
|
412
535
|
variant: "primary",
|
|
413
536
|
onClick: openModal,
|
|
414
537
|
__next40pxDefaultSize: true,
|
|
415
|
-
children:
|
|
416
|
-
}),
|
|
538
|
+
children: labels.add_new_item
|
|
539
|
+
}), showAddPostModal && /*#__PURE__*/_jsx(AddNewPostModal, {
|
|
540
|
+
postType: postType,
|
|
417
541
|
onSave: handleNewPage,
|
|
418
542
|
onClose: closeModal
|
|
419
543
|
})]
|
|
@@ -422,12 +546,15 @@ export default function PagePages() {
|
|
|
422
546
|
paginationInfo: paginationInfo,
|
|
423
547
|
fields: fields,
|
|
424
548
|
actions: actions,
|
|
425
|
-
data:
|
|
426
|
-
isLoading:
|
|
549
|
+
data: records || EMPTY_ARRAY,
|
|
550
|
+
isLoading: isLoadingMainEntities || isLoadingAuthors,
|
|
427
551
|
view: view,
|
|
428
552
|
onChangeView: onChangeView,
|
|
429
|
-
|
|
553
|
+
selection: selection,
|
|
554
|
+
setSelection: setSelection,
|
|
555
|
+
onSelectionChange: onSelectionChange,
|
|
556
|
+
getItemId: getItemId
|
|
430
557
|
})
|
|
431
558
|
});
|
|
432
559
|
}
|
|
433
|
-
//# sourceMappingURL=
|
|
560
|
+
//# sourceMappingURL=posts-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["clsx","Button","__experimentalHStack","HStack","Icon","__","sprintf","useEntityRecords","store","coreStore","decodeEntities","createInterpolateElement","useState","useMemo","useCallback","useEffect","dateI18n","getDate","getSettings","privateApis","routerPrivateApis","useSelect","useDispatch","DataViews","editorPrivateApis","trash","drafts","published","scheduled","pending","notAllowed","commentAuthorAvatar","authorIcon","Page","default","Link","useLink","useDefaultViews","DEFAULT_CONFIG_PER_VIEW_TYPE","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","OPERATOR_IS_ANY","OPERATOR_IS_NONE","AddNewPostModal","Media","unlock","useEditPostAction","usePrevious","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","usePostActions","useLocation","useHistory","EMPTY_ARRAY","getFormattedDate","dateToDisplay","formats","datetimeAbbreviated","useView","postType","params","activeView","isCustom","layout","history","DEFAULT_VIEWS","selectedDefaultView","defaultView","find","slug","view","type","setView","editedViewRecord","select","getEditedEntityRecord","dataviewRecord","Number","editEntityRecord","customView","storedView","content","JSON","parse","setCustomView","viewToSet","id","stringify","setDefaultViewAndUpdateUrl","getLocationWithParams","push","STATUSES","value","label","icon","DEFAULT_STATUSES","FeaturedImage","item","viewType","isDisabled","status","onClick","postId","canvas","hasMedia","featured_media","size","media","className","renderButton","children","title","rendered","getItemId","toString","PostStatusField","alignment","spacing","PostAuthorField","text","imageUrl","getUser","user","author","avatar_urls","name","withAuthorImage","withAuthorIcon","isImageLoaded","setIsImageLoaded","onLoad","alt","src","PostsList","_records$map","_usePrevious","selection","setSelection","onSelectionChange","items","_params$isCustom","length","undefined","queryArgs","filters","forEach","filter","field","operator","author_exclude","per_page","perPage","page","_embed","order","sort","direction","orderby","search","records","isResolving","isLoadingMainEntities","totalItems","totalPages","ids","map","record","prevIds","deletedIds","includes","postIdWasDeleted","authors","isLoadingAuthors","paginationInfo","frontPageId","postsPageId","labels","canCreateRecord","getEntityRecord","getPostType","canUser","siteSettings","postTypeObject","page_on_front","page_for_posts","rest_base","fields","header","getValue","render","enableSorting","width","addLink","suffix","justify","maxWidth","enableHiding","_embedded","elements","_STATUSES$find$label","filterBy","operators","isDraftOrPrivate","date","span","time","isScheduled","modified","isPending","isPublished","postTypeActions","context","editAction","actions","onChangeView","newView","showAddPostModal","setShowAddPostModal","openModal","closeModal","handleNewPage","add_new_item","variant","__next40pxDefaultSize","onSave","onClose","data","isLoading"],"sources":["@wordpress/edit-site/src/components/posts-app/posts-list.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\tIcon,\n} from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useEntityRecords, store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport {\n\tcreateInterpolateElement,\n\tuseState,\n\tuseMemo,\n\tuseCallback,\n\tuseEffect,\n} from '@wordpress/element';\nimport { dateI18n, getDate, getSettings } from '@wordpress/date';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { DataViews } from '@wordpress/dataviews';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport {\n\ttrash,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n\tcommentAuthorAvatar as authorIcon,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport Page from '../page';\nimport { default as Link, useLink } from '../routes/link';\nimport {\n\tuseDefaultViews,\n\tDEFAULT_CONFIG_PER_VIEW_TYPE,\n} from '../sidebar-dataviews/default-views';\nimport {\n\tLAYOUT_GRID,\n\tLAYOUT_TABLE,\n\tLAYOUT_LIST,\n\tOPERATOR_IS_ANY,\n\tOPERATOR_IS_NONE,\n} from '../../utils/constants';\n\nimport AddNewPostModal from '../add-new-post';\nimport Media from '../media';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { usePrevious } from '@wordpress/compose';\n\nconst { usePostActions } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst EMPTY_ARRAY = [];\n\nconst getFormattedDate = ( dateToDisplay ) =>\n\tdateI18n(\n\t\tgetSettings().formats.datetimeAbbreviated,\n\t\tgetDate( dateToDisplay )\n\t);\n\nfunction useView( postType ) {\n\tconst {\n\t\tparams: { activeView = 'all', isCustom = 'false', layout },\n\t} = useLocation();\n\tconst history = useHistory();\n\tconst DEFAULT_VIEWS = useDefaultViews( { postType } );\n\tconst selectedDefaultView = useMemo( () => {\n\t\tconst defaultView =\n\t\t\tisCustom === 'false' &&\n\t\t\tDEFAULT_VIEWS[ postType ].find(\n\t\t\t\t( { slug } ) => slug === activeView\n\t\t\t)?.view;\n\t\tif ( isCustom === 'false' && layout ) {\n\t\t\treturn {\n\t\t\t\t...defaultView,\n\t\t\t\ttype: layout,\n\t\t\t\tlayout: {\n\t\t\t\t\t...( DEFAULT_CONFIG_PER_VIEW_TYPE[ layout ] || {} ),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t\treturn defaultView;\n\t}, [ isCustom, activeView, layout, postType, DEFAULT_VIEWS ] );\n\tconst [ view, setView ] = useState( selectedDefaultView );\n\n\tuseEffect( () => {\n\t\tif ( selectedDefaultView ) {\n\t\t\tsetView( selectedDefaultView );\n\t\t}\n\t}, [ selectedDefaultView ] );\n\tconst editedViewRecord = useSelect(\n\t\t( select ) => {\n\t\t\tif ( isCustom !== 'true' ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst dataviewRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\tNumber( activeView )\n\t\t\t);\n\t\t\treturn dataviewRecord;\n\t\t},\n\t\t[ activeView, isCustom ]\n\t);\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tconst customView = useMemo( () => {\n\t\tconst storedView =\n\t\t\teditedViewRecord?.content &&\n\t\t\tJSON.parse( editedViewRecord?.content );\n\t\tif ( ! storedView ) {\n\t\t\treturn storedView;\n\t\t}\n\n\t\treturn {\n\t\t\t...storedView,\n\t\t\tlayout: {\n\t\t\t\t...( DEFAULT_CONFIG_PER_VIEW_TYPE[ storedView?.type ] || {} ),\n\t\t\t},\n\t\t};\n\t}, [ editedViewRecord?.content ] );\n\n\tconst setCustomView = useCallback(\n\t\t( viewToSet ) => {\n\t\t\teditEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_dataviews',\n\t\t\t\teditedViewRecord?.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: JSON.stringify( viewToSet ),\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t\t[ editEntityRecord, editedViewRecord?.id ]\n\t);\n\n\tconst setDefaultViewAndUpdateUrl = useCallback(\n\t\t( viewToSet ) => {\n\t\t\tif ( viewToSet.type !== view?.type ) {\n\t\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tlayout: viewToSet.type,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tsetView( viewToSet );\n\t\t},\n\t\t[ history, view?.type ]\n\t);\n\n\tif ( isCustom === 'false' ) {\n\t\treturn [ view, setDefaultViewAndUpdateUrl ];\n\t} else if ( isCustom === 'true' && customView ) {\n\t\treturn [ customView, setCustomView ];\n\t}\n\t// Loading state where no the view was not found on custom views or default views.\n\treturn [ DEFAULT_VIEWS[ postType ][ 0 ].view, setDefaultViewAndUpdateUrl ];\n}\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{ value: 'draft', label: __( 'Draft' ), icon: drafts },\n\t{ value: 'future', label: __( 'Scheduled' ), icon: scheduled },\n\t{ value: 'pending', label: __( 'Pending Review' ), icon: pending },\n\t{ value: 'private', label: __( 'Private' ), icon: notAllowed },\n\t{ value: 'publish', label: __( 'Published' ), icon: published },\n\t{ value: 'trash', label: __( 'Trash' ), icon: trash },\n];\nconst DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All but 'trash'.\n\nfunction FeaturedImage( { item, viewType } ) {\n\tconst isDisabled = item.status === 'trash';\n\tconst { onClick } = useLink( {\n\t\tpostId: item.id,\n\t\tpostType: item.type,\n\t\tcanvas: 'edit',\n\t} );\n\tconst hasMedia = !! item.featured_media;\n\tconst size =\n\t\tviewType === LAYOUT_GRID\n\t\t\t? [ 'large', 'full', 'medium', 'thumbnail' ]\n\t\t\t: [ 'thumbnail', 'medium', 'large', 'full' ];\n\tconst media = hasMedia ? (\n\t\t<Media\n\t\t\tclassName=\"posts-list-page__featured-image\"\n\t\t\tid={ item.featured_media }\n\t\t\tsize={ size }\n\t\t/>\n\t) : null;\n\tconst renderButton = viewType !== LAYOUT_LIST && ! isDisabled;\n\treturn (\n\t\t<div\n\t\t\tclassName={ `posts-list-page__featured-image-wrapper is-layout-${ viewType }` }\n\t\t>\n\t\t\t{ renderButton ? (\n\t\t\t\t<button\n\t\t\t\t\tclassName=\"posts-list-page-preview-field__button\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\taria-label={ item.title?.rendered || __( '(no title)' ) }\n\t\t\t\t>\n\t\t\t\t\t{ media }\n\t\t\t\t</button>\n\t\t\t) : (\n\t\t\t\tmedia\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction getItemId( item ) {\n\treturn item.id.toString();\n}\n\nfunction PostStatusField( { item } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"posts-list-page-post-author-field__icon-container\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction PostAuthorField( { item, viewType } ) {\n\tconst { text, icon, imageUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getUser } = select( coreStore );\n\t\t\tconst user = getUser( item.author );\n\t\t\treturn {\n\t\t\t\ticon: authorIcon,\n\t\t\t\timageUrl: user?.avatar_urls?.[ 48 ],\n\t\t\t\ttext: user?.name,\n\t\t\t};\n\t\t},\n\t\t[ item ]\n\t);\n\n\tconst withAuthorImage = viewType !== LAYOUT_LIST && imageUrl;\n\tconst withAuthorIcon = viewType !== LAYOUT_LIST && ! imageUrl;\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 1 }>\n\t\t\t{ withAuthorImage && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={ clsx( 'page-templates-author-field__avatar', {\n\t\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<img\n\t\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\t\talt={ __( 'Author avatar' ) }\n\t\t\t\t\t\tsrc={ imageUrl }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t{ withAuthorIcon && (\n\t\t\t\t<div className=\"page-templates-author-field__icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span className=\"page-templates-author-field__name\">{ text }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default function PostsList( { postType } ) {\n\tconst [ view, setView ] = useView( postType );\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\tconst onSelectionChange = useCallback(\n\t\t( items ) => {\n\t\t\tconst { params } = history.getLocationWithParams();\n\t\t\tif (\n\t\t\t\t( params.isCustom ?? 'false' ) === 'false' &&\n\t\t\t\tview?.type === LAYOUT_LIST\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\t...params,\n\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ].id : undefined,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history, view?.type ]\n\t);\n\n\tconst queryArgs = useMemo( () => {\n\t\tconst filters = {};\n\t\tview.filters.forEach( ( filter ) => {\n\t\t\tif (\n\t\t\t\tfilter.field === 'status' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.status = filter.value;\n\t\t\t}\n\t\t\tif (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_ANY\n\t\t\t) {\n\t\t\t\tfilters.author = filter.value;\n\t\t\t} else if (\n\t\t\t\tfilter.field === 'author' &&\n\t\t\t\tfilter.operator === OPERATOR_IS_NONE\n\t\t\t) {\n\t\t\t\tfilters.author_exclude = filter.value;\n\t\t\t}\n\t\t} );\n\t\t// We want to provide a different default item for the status filter\n\t\t// than the REST API provides.\n\t\tif ( ! filters.status || filters.status === '' ) {\n\t\t\tfilters.status = DEFAULT_STATUSES;\n\t\t}\n\n\t\treturn {\n\t\t\tper_page: view.perPage,\n\t\t\tpage: view.page,\n\t\t\t_embed: 'author',\n\t\t\torder: view.sort?.direction,\n\t\t\torderby: view.sort?.field,\n\t\t\tsearch: view.search,\n\t\t\t...filters,\n\t\t};\n\t}, [ view ] );\n\tconst {\n\t\trecords,\n\t\tisResolving: isLoadingMainEntities,\n\t\ttotalItems,\n\t\ttotalPages,\n\t} = useEntityRecords( 'postType', postType, queryArgs );\n\n\tconst ids = records?.map( ( record ) => getItemId( record ) ) ?? [];\n\tconst prevIds = usePrevious( ids ) ?? [];\n\tconst deletedIds = prevIds.filter( ( id ) => ! ids.includes( id ) );\n\tconst postIdWasDeleted = deletedIds.includes( postId );\n\n\tuseEffect( () => {\n\t\tif ( postIdWasDeleted ) {\n\t\t\thistory.push( {\n\t\t\t\t...history.getLocationWithParams().params,\n\t\t\t\tpostId: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ postIdWasDeleted, history ] );\n\n\tconst { records: authors, isResolving: isLoadingAuthors } =\n\t\tuseEntityRecords( 'root', 'user', { per_page: -1 } );\n\n\tconst paginationInfo = useMemo(\n\t\t() => ( {\n\t\t\ttotalItems,\n\t\t\ttotalPages,\n\t\t} ),\n\t\t[ totalItems, totalPages ]\n\t);\n\n\tconst { frontPageId, postsPageId, labels, canCreateRecord } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getPostType, canUser } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\t\t\tconst postTypeObject = getPostType( postType );\n\t\t\treturn {\n\t\t\t\tfrontPageId: siteSettings?.page_on_front,\n\t\t\t\tpostsPageId: siteSettings?.page_for_posts,\n\t\t\t\tlabels: getPostType( postType )?.labels,\n\t\t\t\tcanCreateRecord: canUser(\n\t\t\t\t\t'create',\n\t\t\t\t\tpostTypeObject?.rest_base || 'posts'\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// TODO: this should be abstracted into a hook similar to `usePostActions`.\n\tconst fields = useMemo(\n\t\t() => [\n\t\t\t{\n\t\t\t\tid: 'featured-image',\n\t\t\t\theader: __( 'Featured Image' ),\n\t\t\t\tgetValue: ( { item } ) => item.featured_media,\n\t\t\t\trender: ( { item } ) => (\n\t\t\t\t\t<FeaturedImage item={ item } viewType={ view.type } />\n\t\t\t\t),\n\t\t\t\tenableSorting: false,\n\t\t\t\twidth: '1%',\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Title' ),\n\t\t\t\tid: 'title',\n\t\t\t\tgetValue: ( { item } ) => item.title?.rendered,\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst addLink =\n\t\t\t\t\t\t[ LAYOUT_TABLE, LAYOUT_GRID ].includes( view.type ) &&\n\t\t\t\t\t\titem.status !== 'trash';\n\t\t\t\t\tconst title = addLink ? (\n\t\t\t\t\t\t<Link\n\t\t\t\t\t\t\tparams={ {\n\t\t\t\t\t\t\t\tpostId: item.id,\n\t\t\t\t\t\t\t\tpostType: item.type,\n\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( item.title?.rendered ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</Link>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{ decodeEntities( item.title?.rendered ) ||\n\t\t\t\t\t\t\t\t__( '(no title)' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t);\n\n\t\t\t\t\tlet suffix = '';\n\t\t\t\t\tif ( item.id === frontPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"posts-list-page-title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Front Page' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t} else if ( item.id === postsPageId ) {\n\t\t\t\t\t\tsuffix = (\n\t\t\t\t\t\t\t<span className=\"posts-list-page-title-badge\">\n\t\t\t\t\t\t\t\t{ __( 'Posts Page' ) }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tclassName=\"posts-list-page-title\"\n\t\t\t\t\t\t\talignment=\"center\"\n\t\t\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t{ suffix }\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmaxWidth: 300,\n\t\t\t\tenableHiding: false,\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Author' ),\n\t\t\t\tid: 'author',\n\t\t\t\tgetValue: ( { item } ) => item._embedded?.author[ 0 ]?.name,\n\t\t\t\telements:\n\t\t\t\t\tauthors?.map( ( { id, name } ) => ( {\n\t\t\t\t\t\tvalue: id,\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t} ) ) || [],\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<PostAuthorField viewType={ view.type } item={ item } />\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Status' ),\n\t\t\t\tid: 'status',\n\t\t\t\tgetValue: ( { item } ) =>\n\t\t\t\t\tSTATUSES.find( ( { value } ) => value === item.status )\n\t\t\t\t\t\t?.label ?? item.status,\n\t\t\t\telements: STATUSES,\n\t\t\t\trender: PostStatusField,\n\t\t\t\tenableSorting: false,\n\t\t\t\tfilterBy: {\n\t\t\t\t\toperators: [ OPERATOR_IS_ANY ],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\theader: __( 'Date' ),\n\t\t\t\tid: 'date',\n\t\t\t\trender: ( { item } ) => {\n\t\t\t\t\tconst isDraftOrPrivate = [ 'draft', 'private' ].includes(\n\t\t\t\t\t\titem.status\n\t\t\t\t\t);\n\t\t\t\t\tif ( isDraftOrPrivate ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isScheduled = item.status === 'future';\n\t\t\t\t\tif ( isScheduled ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: page creation date */\n\t\t\t\t\t\t\t\t__( '<span>Scheduled: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( item.date )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Pending & Published posts show the modified date if it's newer.\n\t\t\t\t\tconst dateToDisplay =\n\t\t\t\t\t\tgetDate( item.modified ) > getDate( item.date )\n\t\t\t\t\t\t\t? item.modified\n\t\t\t\t\t\t\t: item.date;\n\n\t\t\t\t\tconst isPending = item.status === 'pending';\n\t\t\t\t\tif ( isPending ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the newest of created or modified date for the page */\n\t\t\t\t\t\t\t\t__( '<span>Modified: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( dateToDisplay )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst isPublished = item.status === 'publish';\n\t\t\t\t\tif ( isPublished ) {\n\t\t\t\t\t\treturn createInterpolateElement(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: the newest of created or modified date for the page */\n\t\t\t\t\t\t\t\t__( '<span>Published: <time>%s</time></span>' ),\n\t\t\t\t\t\t\t\tgetFormattedDate( dateToDisplay )\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tspan: <span />,\n\t\t\t\t\t\t\t\ttime: <time />,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\t// Unknow status.\n\t\t\t\t\treturn <time>{ getFormattedDate( item.date ) }</time>;\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\t[ authors, view.type, frontPageId, postsPageId ]\n\t);\n\tconst postTypeActions = usePostActions( {\n\t\tpostType,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst onChangeView = useCallback(\n\t\t( newView ) => {\n\t\t\tif ( newView.type !== view.type ) {\n\t\t\t\tnewView = {\n\t\t\t\t\t...newView,\n\t\t\t\t\tlayout: {\n\t\t\t\t\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ newView.type ],\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t}\n\n\t\t\tsetView( newView );\n\t\t},\n\t\t[ view.type, setView ]\n\t);\n\n\tconst [ showAddPostModal, setShowAddPostModal ] = useState( false );\n\n\tconst openModal = () => setShowAddPostModal( true );\n\tconst closeModal = () => setShowAddPostModal( false );\n\tconst handleNewPage = ( { type, id } ) => {\n\t\thistory.push( {\n\t\t\tpostId: id,\n\t\t\tpostType: type,\n\t\t\tcanvas: 'edit',\n\t\t} );\n\t\tcloseModal();\n\t};\n\n\treturn (\n\t\t<Page\n\t\t\ttitle={ labels?.name }\n\t\t\tactions={\n\t\t\t\tlabels?.add_new_item &&\n\t\t\t\tcanCreateRecord && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\tonClick={ openModal }\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ labels.add_new_item }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t{ showAddPostModal && (\n\t\t\t\t\t\t\t<AddNewPostModal\n\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\tonSave={ handleNewPage }\n\t\t\t\t\t\t\t\tonClose={ closeModal }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t)\n\t\t\t}\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ records || EMPTY_ARRAY }\n\t\t\t\tisLoading={ isLoadingMainEntities || isLoadingAuthors }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tselection={ selection }\n\t\t\t\tsetSelection={ setSelection }\n\t\t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B,iBACjB3K,IAAA,CAACN,eAAe;QACfoB,QAAQ,EAAGA,QAAU;QACrBqK,MAAM,EAAGJ,aAAe;QACxBK,OAAO,EAAGN;MAAY,CACtB,CACD;IAAA,CACA,CAEH;IAAA7G,QAAA,eAEDjE,IAAA,CAAC3B,SAAS;MACT2J,cAAc,EAAGA,cAAgB;MACjCa,MAAM,EAAGA,MAAQ;MACjB2B,OAAO,EAAGA,OAAS;MACnBa,IAAI,EAAGnE,OAAO,IAAI1G,WAAa;MAC/B8K,SAAS,EAAGlE,qBAAqB,IAAIW,gBAAkB;MACvDtG,IAAI,EAAGA,IAAM;MACbgJ,YAAY,EAAGA,YAAc;MAC7B9E,SAAS,EAAGA,SAAW;MACvBC,YAAY,EAAGA,YAAc;MAC7BC,iBAAiB,EAAGA,iBAAmB;MACvCzB,SAAS,EAAGA;IAAW,CACvB;EAAC,CACG,CAAC;AAET","ignoreList":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
const {
|
|
19
|
+
useLocation
|
|
20
|
+
} = unlock(routerPrivateApis);
|
|
21
|
+
export default function useLayoutAreas() {
|
|
22
|
+
const {
|
|
23
|
+
params = {}
|
|
24
|
+
} = useLocation();
|
|
25
|
+
const {
|
|
26
|
+
postType,
|
|
27
|
+
layout,
|
|
28
|
+
canvas
|
|
29
|
+
} = params;
|
|
30
|
+
const labels = useSelect(select => {
|
|
31
|
+
return select(coreStore).getPostType(postType)?.labels;
|
|
32
|
+
}, [postType]);
|
|
33
|
+
|
|
34
|
+
// Posts list.
|
|
35
|
+
if (['post'].includes(postType)) {
|
|
36
|
+
const isListLayout = layout === 'list' || !layout;
|
|
37
|
+
return {
|
|
38
|
+
key: 'posts-list',
|
|
39
|
+
areas: {
|
|
40
|
+
sidebar: /*#__PURE__*/_jsx(SidebarNavigationScreen, {
|
|
41
|
+
title: labels?.name,
|
|
42
|
+
isRoot: true,
|
|
43
|
+
content: /*#__PURE__*/_jsx(DataViewsSidebarContent, {})
|
|
44
|
+
}),
|
|
45
|
+
content: /*#__PURE__*/_jsx(PostsList, {
|
|
46
|
+
postType: postType
|
|
47
|
+
}),
|
|
48
|
+
preview: (isListLayout || canvas === 'edit') && /*#__PURE__*/_jsx(Editor, {
|
|
49
|
+
isPostsList: true
|
|
50
|
+
}),
|
|
51
|
+
mobile: canvas === 'edit' ? /*#__PURE__*/_jsx(Editor, {
|
|
52
|
+
isPostsList: true
|
|
53
|
+
}) : /*#__PURE__*/_jsx(PostsList, {
|
|
54
|
+
postType: postType
|
|
55
|
+
})
|
|
56
|
+
},
|
|
57
|
+
widths: {
|
|
58
|
+
content: isListLayout ? 380 : undefined
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Fallback shows the home page preview
|
|
64
|
+
return {
|
|
65
|
+
key: 'default',
|
|
66
|
+
areas: {
|
|
67
|
+
sidebar: /*#__PURE__*/_jsx(SidebarNavigationScreenMain, {}),
|
|
68
|
+
preview: /*#__PURE__*/_jsx(Editor, {
|
|
69
|
+
isPostsList: true
|
|
70
|
+
}),
|
|
71
|
+
mobile: canvas === 'edit' && /*#__PURE__*/_jsx(Editor, {
|
|
72
|
+
isPostsList: true
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=router.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["privateApis","routerPrivateApis","useSelect","store","coreStore","unlock","Editor","SidebarNavigationScreen","SidebarNavigationScreenMain","DataViewsSidebarContent","PostsList","jsx","_jsx","useLocation","useLayoutAreas","params","postType","layout","canvas","labels","select","getPostType","includes","isListLayout","key","areas","sidebar","title","name","isRoot","content","preview","isPostsList","mobile","widths","undefined"],"sources":["@wordpress/edit-site/src/components/posts-app/router.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport Editor from '../editor';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationScreenMain from '../sidebar-navigation-screen-main';\nimport DataViewsSidebarContent from '../sidebar-dataviews';\nimport PostsList from '../posts-app/posts-list';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useLayoutAreas() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, layout, canvas } = params;\n\tconst labels = useSelect(\n\t\t( select ) => {\n\t\t\treturn select( coreStore ).getPostType( postType )?.labels;\n\t\t},\n\t\t[ postType ]\n\t);\n\n\t// Posts list.\n\tif ( [ 'post' ].includes( postType ) ) {\n\t\tconst isListLayout = layout === 'list' || ! layout;\n\t\treturn {\n\t\t\tkey: 'posts-list',\n\t\t\tareas: {\n\t\t\t\tsidebar: (\n\t\t\t\t\t<SidebarNavigationScreen\n\t\t\t\t\t\ttitle={ labels?.name }\n\t\t\t\t\t\tisRoot\n\t\t\t\t\t\tcontent={ <DataViewsSidebarContent /> }\n\t\t\t\t\t/>\n\t\t\t\t),\n\t\t\t\tcontent: <PostsList postType={ postType } />,\n\t\t\t\tpreview: ( isListLayout || canvas === 'edit' ) && (\n\t\t\t\t\t<Editor isPostsList />\n\t\t\t\t),\n\t\t\t\tmobile:\n\t\t\t\t\tcanvas === 'edit' ? (\n\t\t\t\t\t\t<Editor isPostsList />\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<PostsList postType={ postType } />\n\t\t\t\t\t),\n\t\t\t},\n\t\t\twidths: {\n\t\t\t\tcontent: isListLayout ? 380 : undefined,\n\t\t\t},\n\t\t};\n\t}\n\n\t// Fallback shows the home page preview\n\treturn {\n\t\tkey: 'default',\n\t\tareas: {\n\t\t\tsidebar: <SidebarNavigationScreenMain />,\n\t\t\tpreview: <Editor isPostsList />,\n\t\t\tmobile: canvas === 'edit' && <Editor isPostsList />,\n\t\t},\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;;AAEzD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,MAAM,MAAM,WAAW;AAC9B,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,uBAAuB,MAAM,sBAAsB;AAC1D,OAAOC,SAAS,MAAM,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,MAAM;EAAEC;AAAY,CAAC,GAAGR,MAAM,CAAEJ,iBAAkB,CAAC;AAEnD,eAAe,SAASa,cAAcA,CAAA,EAAG;EACxC,MAAM;IAAEC,MAAM,GAAG,CAAC;EAAE,CAAC,GAAGF,WAAW,CAAC,CAAC;EACrC,MAAM;IAAEG,QAAQ;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGH,MAAM;EAC3C,MAAMI,MAAM,GAAGjB,SAAS,CACrBkB,MAAM,IAAM;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reList":[]}
|
|
@@ -19,7 +19,8 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
const {
|
|
20
20
|
ExperimentalBlockEditorProvider,
|
|
21
21
|
GlobalStylesContext,
|
|
22
|
-
useGlobalStylesOutputWithConfig
|
|
22
|
+
useGlobalStylesOutputWithConfig,
|
|
23
|
+
__unstableBlockStyleVariationOverridesWithConfig
|
|
23
24
|
} = unlock(blockEditorPrivateApis);
|
|
24
25
|
const {
|
|
25
26
|
mergeBaseAndUserConfigs
|
|
@@ -56,21 +57,23 @@ function Revisions({
|
|
|
56
57
|
className: "edit-site-revisions__iframe",
|
|
57
58
|
name: "revisions",
|
|
58
59
|
tabIndex: 0,
|
|
59
|
-
children: [/*#__PURE__*/_jsx(
|
|
60
|
-
styles: editorStyles
|
|
61
|
-
}), /*#__PURE__*/_jsx("style", {
|
|
60
|
+
children: [/*#__PURE__*/_jsx("style", {
|
|
62
61
|
children:
|
|
63
62
|
// Forming a "block formatting context" to prevent margin collapsing.
|
|
64
63
|
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
65
64
|
`.is-root-container { display: flow-root; }`
|
|
66
65
|
}), /*#__PURE__*/_jsx(Disabled, {
|
|
67
66
|
className: "edit-site-revisions__example-preview__content",
|
|
68
|
-
children: /*#__PURE__*/
|
|
67
|
+
children: /*#__PURE__*/_jsxs(ExperimentalBlockEditorProvider, {
|
|
69
68
|
value: renderedBlocksArray,
|
|
70
69
|
settings: settings,
|
|
71
|
-
children: /*#__PURE__*/_jsx(BlockList, {
|
|
70
|
+
children: [/*#__PURE__*/_jsx(BlockList, {
|
|
72
71
|
renderAppender: false
|
|
73
|
-
})
|
|
72
|
+
}), /*#__PURE__*/_jsx(EditorStyles, {
|
|
73
|
+
styles: editorStyles
|
|
74
|
+
}), /*#__PURE__*/_jsx(__unstableBlockStyleVariationOverridesWithConfig, {
|
|
75
|
+
config: mergedConfig
|
|
76
|
+
})]
|
|
74
77
|
})
|
|
75
78
|
})]
|
|
76
79
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","editorPrivateApis","useSelect","useContext","useMemo","unlock","EditorCanvasContainer","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","GlobalStylesContext","useGlobalStylesOutputWithConfig","mergeBaseAndUserConfigs","isObjectEmpty","object","Object","keys","length","Revisions","userConfig","blocks","base","baseConfig","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","select","getSettings","settings","__unstableIsPreviewMode","globalStyles","editorStyles","styles","title","closeButtonLabel","enableResizing","children","className","name","tabIndex","value","renderAppender"],"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n} = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction Revisions( { userConfig, blocks } ) {\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\tenableResizing\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tclassName=\"edit-site-revisions__iframe\"\n\t\t\t\tname=\"revisions\"\n\t\t\t\ttabIndex={ 0 }\n\t\t\t>\n\t\t\t\t<
|
|
1
|
+
{"version":3,"names":["Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","editorPrivateApis","useSelect","useContext","useMemo","unlock","EditorCanvasContainer","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","GlobalStylesContext","useGlobalStylesOutputWithConfig","__unstableBlockStyleVariationOverridesWithConfig","mergeBaseAndUserConfigs","isObjectEmpty","object","Object","keys","length","Revisions","userConfig","blocks","base","baseConfig","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","select","getSettings","settings","__unstableIsPreviewMode","globalStyles","editorStyles","styles","title","closeButtonLabel","enableResizing","children","className","name","tabIndex","value","renderAppender","config"],"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n} = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction Revisions( { userConfig, blocks } ) {\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\tenableResizing\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tclassName=\"edit-site-revisions__iframe\"\n\t\t\t\tname=\"revisions\"\n\t\t\t\ttabIndex={ 0 }\n\t\t\t>\n\t\t\t\t<style>\n\t\t\t\t\t{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t<Disabled className=\"edit-site-revisions__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocksArray }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t * Styles are printed inside the block editor provider,\n\t\t\t\t\t\t * so they can access any registered style overrides.\n\t\t\t\t\t\t */ }\n\t\t\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t\t\t<__unstableBlockStyleVariationOverridesWithConfig\n\t\t\t\t\t\t\tconfig={ mergedConfig }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</Iframe>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nexport default Revisions;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,WAAW,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,EACzBC,sBAAsB,IAAIC,YAAY,EACtCC,gBAAgB,IAA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a,CAAC;AAE1B;AAEA,eAAeL,SAAS","ignoreList":[]}
|
|
@@ -131,7 +131,7 @@ export default function SavePanel() {
|
|
|
131
131
|
onClick: () => setIsSaveViewOpened(true),
|
|
132
132
|
"aria-haspopup": "dialog",
|
|
133
133
|
disabled: disabled,
|
|
134
|
-
|
|
134
|
+
accessibleWhenDisabled: true,
|
|
135
135
|
children: __('Open save panel')
|
|
136
136
|
})
|
|
137
137
|
}), isSaveViewOpen && /*#__PURE__*/_jsx(_EntitiesSavedStates, {
|