@wordpress/edit-site 5.33.0 → 5.34.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/index.js +3 -0
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +8 -7
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build/components/block-editor/resize-handle.js +20 -5
- package/build/components/block-editor/resize-handle.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +3 -0
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +28 -5
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +9 -3
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +7 -2
- 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 +22 -20
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +8 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/header-edit-mode/index.js +33 -49
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +3 -97
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +0 -49
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +7 -4
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +9 -38
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +4 -3
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/header.js +3 -1
- package/build/components/page-patterns/header.js.map +1 -1
- package/build/components/page-patterns/index.js +20 -49
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -0
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/hooks.js.map +1 -0
- package/build/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build/components/page-templates/index.js.map +1 -0
- package/build/components/pattern-modal/duplicate.js +7 -5
- package/build/components/pattern-modal/duplicate.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +9 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +9 -6
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +40 -9
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +24 -17
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +2 -5
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +39 -8
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +34 -28
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-actions/index.js +1 -1
- package/build/components/template-actions/index.js.map +1 -1
- package/build/deprecated.js +55 -0
- package/build/deprecated.js.map +1 -0
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +35 -4
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/index.js +18 -18
- package/build/index.js.map +1 -1
- package/build/utils/constants.js +1 -2
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/add-new-page/index.js +3 -0
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -7
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -1
- package/build-module/components/block-editor/resize-handle.js +21 -6
- package/build-module/components/block-editor/resize-handle.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -0
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +28 -5
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +9 -3
- 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 +7 -2
- 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 +22 -20
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/build-module/components/global-styles/font-library-modal/utils/sort-font-faces.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +8 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +39 -55
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +5 -99
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -49
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +7 -4
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +9 -38
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +5 -4
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -7
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/header.js +3 -1
- package/build-module/components/page-patterns/header.js.map +1 -1
- package/build-module/components/page-patterns/index.js +22 -51
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -0
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/hooks.js.map +1 -0
- package/build-module/components/{page-templates-template-parts → page-templates}/index.js +67 -80
- package/build-module/components/page-templates/index.js.map +1 -0
- package/build-module/components/pattern-modal/duplicate.js +7 -5
- package/build-module/components/pattern-modal/duplicate.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +8 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +9 -6
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -3
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +43 -12
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +25 -17
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +3 -6
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +40 -9
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +6 -13
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +3 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +35 -29
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +5 -35
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -8
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +1 -1
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/deprecated.js +45 -0
- package/build-module/deprecated.js.map +1 -0
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +34 -4
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/index.js +2 -4
- package/build-module/index.js.map +1 -1
- package/build-module/utils/constants.js +0 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +79 -125
- package/build-style/style.css +79 -125
- package/package.json +42 -42
- package/src/components/add-new-page/index.js +7 -1
- package/src/components/add-new-pattern/index.js +15 -12
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +3 -0
- package/src/components/add-new-template/add-custom-template-modal-content.js +3 -1
- package/src/components/block-editor/resize-handle.js +30 -11
- package/src/components/block-editor/style.scss +10 -15
- package/src/components/create-template-part-modal/index.js +3 -0
- package/src/components/editor/index.js +42 -3
- package/src/components/editor/style.scss +6 -1
- package/src/components/global-styles/font-library-modal/context.js +9 -3
- package/src/components/global-styles/font-library-modal/font-collection.js +31 -12
- package/src/components/global-styles/font-library-modal/installed-fonts.js +82 -54
- package/src/components/global-styles/font-library-modal/style.scss +17 -0
- package/src/components/global-styles/font-library-modal/utils/sort-font-faces.js +6 -2
- package/src/components/global-styles/style-variations-container.js +11 -2
- package/src/components/header-edit-mode/index.js +56 -76
- package/src/components/header-edit-mode/more-menu/index.js +8 -145
- package/src/components/header-edit-mode/style.scss +13 -85
- package/src/components/keyboard-shortcuts/register.js +0 -58
- package/src/components/layout/index.js +11 -2
- package/src/components/layout/router.js +9 -49
- package/src/components/page-pages/index.js +14 -4
- package/src/components/page-pages/style.scss +11 -0
- package/src/components/page-patterns/dataviews-pattern-actions.js +8 -9
- package/src/components/page-patterns/header.js +3 -1
- package/src/components/page-patterns/index.js +17 -76
- package/src/components/page-patterns/style.scss +14 -1
- package/src/components/page-patterns/use-patterns.js +1 -0
- package/src/components/{page-templates-template-parts → page-templates}/index.js +23 -46
- package/src/components/{page-templates-template-parts → page-templates}/style.scss +2 -2
- package/src/components/pattern-modal/duplicate.js +4 -3
- package/src/components/plugin-template-setting-panel/index.js +8 -0
- package/src/components/resizable-frame/index.js +4 -3
- package/src/components/sidebar-edit-mode/index.js +13 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +49 -21
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +31 -19
- package/src/components/sidebar-edit-mode/template-panel/index.js +2 -12
- package/src/components/sidebar-navigation-screen-page/index.js +48 -9
- package/src/components/sidebar-navigation-screen-pattern/index.js +6 -11
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +1 -1
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +30 -38
- package/src/components/sidebar-navigation-screen-template/index.js +1 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +3 -3
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +7 -39
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +0 -4
- package/src/components/template-actions/index.js +1 -1
- package/src/deprecated.js +42 -0
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +69 -16
- package/src/index.js +2 -9
- package/src/style.scss +1 -5
- package/src/utils/constants.js +1 -1
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -59
- package/build/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build/components/header-edit-mode/tools-more-menu-group/index.js +0 -23
- package/build/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +0 -56
- package/build/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build/components/page-templates-template-parts/add-new-template-part.js +0 -65
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build/components/page-templates-template-parts/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +0 -188
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -52
- package/build-module/components/header-edit-mode/more-menu/copy-content-menu-item.js.map +0 -1
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/build-module/components/header-edit-mode/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +0 -49
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +0 -1
- package/build-module/components/page-templates-template-parts/add-new-template-part.js +0 -57
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-templates-template-parts/hooks.js.map +0 -1
- package/build-module/components/page-templates-template-parts/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +0 -180
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +0 -1
- package/src/components/header-edit-mode/more-menu/copy-content-menu-item.js +0 -51
- package/src/components/header-edit-mode/tools-more-menu-group/index.js +0 -16
- package/src/components/keyboard-shortcuts/edit-mode.js +0 -59
- package/src/components/page-templates-template-parts/add-new-template-part.js +0 -62
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +0 -249
- package/src/components/sidebar-edit-mode/page-panels/style.scss +0 -34
- /package/build/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/build-module/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
- /package/src/components/{page-templates-template-parts → page-templates}/hooks.js +0 -0
|
@@ -3,12 +3,13 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { PanelBody } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
7
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
import {
|
|
9
|
+
import { PluginDocumentSettingPanel, store as editorStore, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
10
10
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
11
11
|
import { useCallback } from '@wordpress/element';
|
|
12
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
@@ -57,17 +58,47 @@ export default function PagePanels() {
|
|
|
57
58
|
renderingMode: getRenderingMode()
|
|
58
59
|
};
|
|
59
60
|
}, []);
|
|
61
|
+
const {
|
|
62
|
+
createSuccessNotice
|
|
63
|
+
} = useDispatch(noticesStore);
|
|
60
64
|
const history = useHistory();
|
|
61
65
|
const onActionPerformed = useCallback((actionId, items) => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
switch (actionId) {
|
|
67
|
+
case 'move-to-trash':
|
|
68
|
+
{
|
|
69
|
+
history.push({
|
|
70
|
+
path: '/' + items[0].type,
|
|
71
|
+
postId: undefined,
|
|
72
|
+
postType: undefined,
|
|
73
|
+
canvas: 'view'
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
break;
|
|
77
|
+
case 'duplicate-post':
|
|
78
|
+
{
|
|
79
|
+
const newItem = items[0];
|
|
80
|
+
const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
81
|
+
createSuccessNotice(sprintf(
|
|
82
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
83
|
+
__('"%s" successfully created.'), title), {
|
|
84
|
+
type: 'snackbar',
|
|
85
|
+
id: 'duplicate-post-action',
|
|
86
|
+
actions: [{
|
|
87
|
+
label: __('Edit'),
|
|
88
|
+
onClick: () => {
|
|
89
|
+
history.push({
|
|
90
|
+
path: undefined,
|
|
91
|
+
postId: newItem.id,
|
|
92
|
+
postType: newItem.type,
|
|
93
|
+
canvas: 'edit'
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
69
100
|
}
|
|
70
|
-
}, [history]);
|
|
101
|
+
}, [history, createSuccessNotice]);
|
|
71
102
|
if (!hasResolved) {
|
|
72
103
|
return null;
|
|
73
104
|
}
|
|
@@ -85,6 +116,6 @@ export default function PagePanels() {
|
|
|
85
116
|
postType: type
|
|
86
117
|
})), createElement(PluginDocumentSettingPanel.Slot, null), renderingMode !== 'post-only' && createElement(PanelBody, {
|
|
87
118
|
title: __('Content')
|
|
88
|
-
}, createElement(PageContent, null))
|
|
119
|
+
}, createElement(PageContent, null)));
|
|
89
120
|
}
|
|
90
121
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["PanelBody","__","
|
|
1
|
+
{"version":3,"names":["PanelBody","__","sprintf","useSelect","useDispatch","store","coreStore","PluginDocumentSettingPanel","editorStore","privateApis","editorPrivateApis","routerPrivateApis","useCallback","noticesStore","editSiteStore","PageContent","PageSummary","unlock","PostCardPanel","PostActions","useHistory","PagePanels","id","type","hasResolved","status","date","password","renderingMode","select","getEditedPostContext","getEditedEntityRecord","hasFinishedResolution","getRenderingMode","context","queryArgs","postType","postId","page","createSuccessNotice","history","onActionPerformed","actionId","items","push","path","undefined","canvas","newItem","title","rendered","actions","label","onClick","createElement","Fragment","Slot"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { PanelBody } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tPluginDocumentSettingPanel,\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport PageContent from './page-content';\nimport PageSummary from './page-summary';\n\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostCardPanel, PostActions } = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport default function PagePanels() {\n\tconst { id, type, hasResolved, status, date, password, renderingMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostContext } = select( editSiteStore );\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { getRenderingMode } = select( editorStore );\n\t\t\tconst context = getEditedPostContext();\n\t\t\tconst queryArgs = [ 'postType', context.postType, context.postId ];\n\t\t\tconst page = getEditedEntityRecord( ...queryArgs );\n\t\t\treturn {\n\t\t\t\thasResolved: hasFinishedResolution(\n\t\t\t\t\t'getEditedEntityRecord',\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\tid: page?.id,\n\t\t\t\ttype: page?.type,\n\t\t\t\tstatus: page?.status,\n\t\t\t\tdate: page?.date,\n\t\t\t\tpassword: page?.password,\n\t\t\t\trenderingMode: getRenderingMode(),\n\t\t\t};\n\t\t}, [] );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst history = useHistory();\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpath: '/' + items[ 0 ].type,\n\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\tpostType: undefined,\n\t\t\t\t\t\t\tcanvas: 'view',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpath: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tif ( ! hasResolved ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<PostCardPanel\n\t\t\t\tactions={\n\t\t\t\t\t<PostActions onActionPerformed={ onActionPerformed } />\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<PanelBody title={ __( 'Summary' ) }>\n\t\t\t\t<PageSummary\n\t\t\t\t\tstatus={ status }\n\t\t\t\t\tdate={ date }\n\t\t\t\t\tpassword={ password }\n\t\t\t\t\tpostId={ id }\n\t\t\t\t\tpostType={ type }\n\t\t\t\t/>\n\t\t\t</PanelBody>\n\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t{ renderingMode !== 'post-only' && (\n\t\t\t\t<PanelBody title={ __( 'Content' ) }>\n\t\t\t\t\t<PageContent />\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,uBAAuB;AACjD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,0BAA0B,EAC1BF,KAAK,IAAIG,WAAW,EACpBC,WAAW,IAAIC,iBAAiB,QAC1B,mBAAmB;AAC1B,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASP,KAAK,IAAIQ,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASR,KAAK,IAAIS,aAAa,QAAQ,gBAAgB;AACvD,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,WAAW,MAAM,gBAAgB;AAExC,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,MAAM;EAAEC,aAAa;EAAEC;AAAY,C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AACiD,KAAK,EAAGhD,EAAE,CAAE,SAAU;EAAG,GACnCqD,aAAA,CAACtC,WAAW;IACXS,MAAM,EAAGA,MAAQ;IACjBC,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBU,MAAM,EAAGf,EAAI;IACbc,QAAQ,EAAGb;EAAM,CACjB,CACS,CAAC,EACZ+B,aAAA,CAAC/C,0BAA0B,CAACiD,IAAI,MAAE,CAAC,EACjC5B,aAAa,KAAK,WAAW,IAC9B0B,aAAA,CAACtD,SAAS;IAACiD,KAAK,EAAGhD,EAAE,CAAE,SAAU;EAAG,GACnCqD,aAAA,CAACvC,WAAW,MAAE,CACJ,CAEX,CAAC;AAEL","ignoreList":[]}
|
|
@@ -3,29 +3,37 @@ import { createElement, Fragment } from "react";
|
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
5
|
import { __experimentalVStack as VStack } from '@wordpress/components';
|
|
6
|
-
import { PluginPostStatusInfo, PostAuthorPanel, PostURLPanel, PostSchedulePanel, PostTemplatePanel, PostFeaturedImagePanel } from '@wordpress/editor';
|
|
6
|
+
import { PluginPostStatusInfo, PostAuthorPanel, PostURLPanel, PostSchedulePanel, PostTemplatePanel, PostFeaturedImagePanel, privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
import { unlock } from '../../../lock-unlock';
|
|
12
|
+
const {
|
|
13
|
+
PrivatePostExcerptPanel,
|
|
14
|
+
PostStatus,
|
|
15
|
+
PostContentInformation,
|
|
16
|
+
PostLastEditedPanel
|
|
17
|
+
} = unlock(editorPrivateApis);
|
|
18
|
+
export default function PageSummary() {
|
|
19
19
|
return createElement(VStack, {
|
|
20
20
|
spacing: 0
|
|
21
|
-
}, createElement(PluginPostStatusInfo.Slot, null, fills => createElement(Fragment, null, createElement(
|
|
21
|
+
}, createElement(PluginPostStatusInfo.Slot, null, fills => createElement(Fragment, null, createElement(VStack, {
|
|
22
|
+
spacing: 3
|
|
23
|
+
// TODO: this needs to be consolidated with the panel in post editor, when we unify them.
|
|
24
|
+
,
|
|
25
|
+
style: {
|
|
26
|
+
marginBlockEnd: '24px'
|
|
27
|
+
}
|
|
28
|
+
}, createElement(PostFeaturedImagePanel, {
|
|
22
29
|
withPanelBody: false
|
|
23
|
-
}), createElement(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
}), createElement(PrivatePostExcerptPanel, null), createElement(VStack, {
|
|
31
|
+
spacing: 1
|
|
32
|
+
}, createElement(PostContentInformation, null), createElement(PostLastEditedPanel, null))), createElement(VStack, {
|
|
33
|
+
spacing: 1,
|
|
34
|
+
style: {
|
|
35
|
+
marginBlockEnd: '12px'
|
|
36
|
+
}
|
|
37
|
+
}, createElement(PostStatus, null), createElement(PostSchedulePanel, null), createElement(PostTemplatePanel, null), createElement(PostURLPanel, null)), createElement(PostAuthorPanel, null), fills)));
|
|
30
38
|
}
|
|
31
39
|
//# sourceMappingURL=page-summary.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__experimentalVStack","VStack","PluginPostStatusInfo","PostAuthorPanel","PostURLPanel","PostSchedulePanel","PostTemplatePanel","PostFeaturedImagePanel","
|
|
1
|
+
{"version":3,"names":["__experimentalVStack","VStack","PluginPostStatusInfo","PostAuthorPanel","PostURLPanel","PostSchedulePanel","PostTemplatePanel","PostFeaturedImagePanel","privateApis","editorPrivateApis","unlock","PrivatePostExcerptPanel","PostStatus","PostContentInformation","PostLastEditedPanel","PageSummary","createElement","spacing","Slot","fills","Fragment","style","marginBlockEnd","withPanelBody"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/page-summary.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalVStack as VStack } from '@wordpress/components';\nimport {\n\tPluginPostStatusInfo,\n\tPostAuthorPanel,\n\tPostURLPanel,\n\tPostSchedulePanel,\n\tPostTemplatePanel,\n\tPostFeaturedImagePanel,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../../lock-unlock';\n\nconst {\n\tPrivatePostExcerptPanel,\n\tPostStatus,\n\tPostContentInformation,\n\tPostLastEditedPanel,\n} = unlock( editorPrivateApis );\n\nexport default function PageSummary() {\n\treturn (\n\t\t<VStack spacing={ 0 }>\n\t\t\t<PluginPostStatusInfo.Slot>\n\t\t\t\t{ ( fills ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tspacing={ 3 }\n\t\t\t\t\t\t\t// TODO: this needs to be consolidated with the panel in post editor, when we unify them.\n\t\t\t\t\t\t\tstyle={ { marginBlockEnd: '24px' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostFeaturedImagePanel withPanelBody={ false } />\n\t\t\t\t\t\t\t<PrivatePostExcerptPanel />\n\t\t\t\t\t\t\t<VStack spacing={ 1 }>\n\t\t\t\t\t\t\t\t<PostContentInformation />\n\t\t\t\t\t\t\t\t<PostLastEditedPanel />\n\t\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tspacing={ 1 }\n\t\t\t\t\t\t\tstyle={ { marginBlockEnd: '12px' } }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<PostStatus />\n\t\t\t\t\t\t\t<PostSchedulePanel />\n\t\t\t\t\t\t\t<PostTemplatePanel />\n\t\t\t\t\t\t\t<PostURLPanel />\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t\t<PostAuthorPanel />\n\t\t\t\t\t\t{ fills }\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\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AAC,EACjBgB,KACD,CAEuB,CACpB,CAAC;AAEX","ignoreList":[]}
|
|
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
6
|
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
7
|
-
import {
|
|
7
|
+
import { PluginDocumentSettingPanel, privateApis as editorPrivateApis, store as editorStore } from '@wordpress/editor';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
10
|
import { useAsyncList } from '@wordpress/compose';
|
|
@@ -24,9 +24,6 @@ import { unlock } from '../../../lock-unlock';
|
|
|
24
24
|
const {
|
|
25
25
|
PostCardPanel
|
|
26
26
|
} = unlock(editorPrivateApis);
|
|
27
|
-
const {
|
|
28
|
-
PatternOverridesPanel
|
|
29
|
-
} = unlock(editorPrivateApis);
|
|
30
27
|
const {
|
|
31
28
|
useHistory
|
|
32
29
|
} = unlock(routerPrivateApis);
|
|
@@ -110,13 +107,13 @@ export default function TemplatePanel() {
|
|
|
110
107
|
});
|
|
111
108
|
}
|
|
112
109
|
})
|
|
113
|
-
}), createElement(PluginTemplateSettingPanel.Slot, null), availablePatterns?.length > 0 && createElement(PanelBody, {
|
|
110
|
+
}), createElement(PluginTemplateSettingPanel.Slot, null), createElement(PluginDocumentSettingPanel.Slot, null), availablePatterns?.length > 0 && createElement(PanelBody, {
|
|
114
111
|
title: __('Transform into:'),
|
|
115
112
|
initialOpen: postType === TEMPLATE_PART_POST_TYPE
|
|
116
113
|
}, createElement(PanelRow, null, createElement("p", null, __('Choose a predefined pattern to switch up the look of your template.' // TODO - make this dynamic?
|
|
117
114
|
))), createElement(TemplatesList, {
|
|
118
115
|
availableTemplates: availablePatterns,
|
|
119
116
|
onSelect: onTemplateSelect
|
|
120
|
-
}))
|
|
117
|
+
})));
|
|
121
118
|
}
|
|
122
119
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","PanelBody","PanelRow","
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","PanelBody","PanelRow","PluginDocumentSettingPanel","privateApis","editorPrivateApis","store","editorStore","coreStore","__","useAsyncList","serialize","__experimentalBlockPatternsList","BlockPatternsList","routerPrivateApis","editSiteStore","TemplateActions","PluginTemplateSettingPanel","useAvailablePatterns","TEMPLATE_PART_POST_TYPE","unlock","PostCardPanel","useHistory","TemplatesList","availableTemplates","onSelect","shownTemplates","length","createElement","label","blockPatterns","shownPatterns","onClickPattern","showTitlesAsTooltip","POST_TYPE_PATH","wp_template","wp_template_part","TemplatePanel","title","description","record","postType","postId","select","getEditedPostType","getEditedPostId","getEditedEntityRecord","__experimentalGetTemplateInfo","getTemplateInfo","type","_postId","_record","info","icon","history","availablePatterns","editEntityRecord","onTemplateSelect","selectedTemplate","blocks","content","Fragment","className","actions","toggleProps","size","onRemove","push","path","Slot","initialOpen"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tPluginDocumentSettingPanel,\n\tprivateApis as editorPrivateApis,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { useAsyncList } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from '../../template-actions';\nimport PluginTemplateSettingPanel from '../../plugin-template-setting-panel';\nimport { useAvailablePatterns } from './hooks';\nimport { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';\nimport { unlock } from '../../../lock-unlock';\n\nconst { PostCardPanel } = unlock( editorPrivateApis );\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction TemplatesList( { availableTemplates, onSelect } ) {\n\tconst shownTemplates = useAsyncList( availableTemplates );\n\tif ( ! availableTemplates || availableTemplates?.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tlabel={ __( 'Templates' ) }\n\t\t\tblockPatterns={ availableTemplates }\n\t\t\tshownPatterns={ shownTemplates }\n\t\t\tonClickPattern={ onSelect }\n\t\t\tshowTitlesAsTooltip\n\t\t/>\n\t);\n}\n\nconst POST_TYPE_PATH = {\n\twp_template: '/wp_template',\n\twp_template_part: '/patterns',\n};\n\nexport default function TemplatePanel() {\n\tconst { title, description, record, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\n\t\t\tconst type = getEditedPostType();\n\t\t\tconst _postId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', type, _postId );\n\t\t\tconst info = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\ttitle: info.title,\n\t\t\t\tdescription: info.description,\n\t\t\t\ticon: info.icon,\n\t\t\t\trecord: _record,\n\t\t\t\tpostType: type,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst history = useHistory();\n\tconst availablePatterns = useAvailablePatterns( record );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\tconst onTemplateSelect = async ( selectedTemplate ) => {\n\t\tawait editEntityRecord( 'postType', postType, postId, {\n\t\t\tblocks: selectedTemplate.blocks,\n\t\t\tcontent: serialize( selectedTemplate.blocks ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PostCardPanel\n\t\t\t\tclassName=\"edit-site-template-card\"\n\t\t\t\tactions={\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\t\t\t\ttoggleProps={ { size: 'small' } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\tpath: POST_TYPE_PATH[ postType ],\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\t<PluginTemplateSettingPanel.Slot />\n\t\t\t<PluginDocumentSettingPanel.Slot />\n\t\t\t{ availablePatterns?.length > 0 && (\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ __( 'Transform into:' ) }\n\t\t\t\t\tinitialOpen={ postType === TEMPLATE_PART_POST_TYPE }\n\t\t\t\t>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Choose a predefined pattern to switch up the look of your template.' // TODO - make this dynamic?\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tavailableTemplates={ availablePatterns }\n\t\t\t\t\t\tonSelect={ onTemplateSelect }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AAC3D,SACCC,0BAA0B,EAC1BC,WAAW,IAAIC,iBAAiB,EAChCC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASD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AAE,CAAC;EACJ,CAAC;EAED,OACC/B,aAAA,CAAAiC,QAAA,QACCjC,aAAA,CAACP,aAAa;IACbyC,SAAS,EAAC,yBAAyB;IACnCC,OAAO,EACNnC,aAAA,CAACZ,eAAe;MACfyB,QAAQ,EAAGA,QAAU;MACrBC,MAAM,EAAGA,MAAQ;MACjBoB,SAAS,EAAC,kCAAkC;MAC5CE,WAAW,EAAG;QAAEC,IAAI,EAAE;MAAQ,CAAG;MACjCC,QAAQ,EAAGA,CAAA,KAAM;QAChBZ,OAAO,CAACa,IAAI,CAAE;UACbC,IAAI,EAAElC,cAAc,CAAEO,QAAQ;QAC/B,CAAE,CAAC;MACJ;IAAG,CACH;EACD,CACD,CAAC,EACFb,aAAA,CAACX,0BAA0B,CAACoD,IAAI,MAAE,CAAC,EACnCzC,aAAA,CAACzB,0BAA0B,CAACkE,IAAI,MAAE,CAAC,EACjCd,iBAAiB,EAAE5B,MAAM,GAAG,CAAC,IAC9BC,aAAA,CAAC3B,SAAS;IACTqC,KAAK,EAAG7B,EAAE,CAAE,iBAAkB,CAAG;IACjC6D,WAAW,EAAG7B,QAAQ,KAAKtB;EAAyB,GAEpDS,aAAA,CAAC1B,QAAQ,QACR0B,aAAA,YACGnB,EAAE,CACH,qEAAqE,CAAC;EACvE,CACE,CACM,CAAC,EAEXmB,aAAA,CAACL,aAAa;IACbC,kBAAkB,EAAG+B,iBAAmB;IACxC9B,QAAQ,EAAGgC;EAAkB,CAC7B,CACS,CAEX,CAAC;AAEL","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { createElement, Fragment } from "react";
|
|
|
2
2
|
/**
|
|
3
3
|
* WordPress dependencies
|
|
4
4
|
*/
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
6
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
7
7
|
import { __experimentalVStack as VStack, ExternalLink, __experimentalTruncate as Truncate } from '@wordpress/components';
|
|
8
8
|
import { store as coreStore, useEntityRecord } from '@wordpress/core-data';
|
|
@@ -14,6 +14,7 @@ import { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';
|
|
|
14
14
|
import { useEffect, useCallback } from '@wordpress/element';
|
|
15
15
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
16
16
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
17
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
@@ -38,6 +39,9 @@ export default function SidebarNavigationScreenPage({
|
|
|
38
39
|
setCanvasMode
|
|
39
40
|
} = unlock(useDispatch(editSiteStore));
|
|
40
41
|
const history = useHistory();
|
|
42
|
+
const {
|
|
43
|
+
createSuccessNotice
|
|
44
|
+
} = useDispatch(noticesStore);
|
|
41
45
|
const {
|
|
42
46
|
params: {
|
|
43
47
|
postId
|
|
@@ -74,15 +78,42 @@ export default function SidebarNavigationScreenPage({
|
|
|
74
78
|
}
|
|
75
79
|
}, [hasResolved, record, history]);
|
|
76
80
|
const onActionPerformed = useCallback((actionId, items) => {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
switch (actionId) {
|
|
82
|
+
case 'move-to-trash':
|
|
83
|
+
{
|
|
84
|
+
history.push({
|
|
85
|
+
path: '/' + items[0].type,
|
|
86
|
+
postId: undefined,
|
|
87
|
+
postType: undefined,
|
|
88
|
+
canvas: 'view'
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
case 'duplicate-post':
|
|
93
|
+
{
|
|
94
|
+
const newItem = items[0];
|
|
95
|
+
const title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
96
|
+
createSuccessNotice(sprintf(
|
|
97
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
98
|
+
__('"%s" successfully created.'), title), {
|
|
99
|
+
type: 'snackbar',
|
|
100
|
+
id: 'duplicate-post-action',
|
|
101
|
+
actions: [{
|
|
102
|
+
label: __('Edit'),
|
|
103
|
+
onClick: () => {
|
|
104
|
+
history.push({
|
|
105
|
+
path: undefined,
|
|
106
|
+
postId: newItem.id,
|
|
107
|
+
postType: newItem.type,
|
|
108
|
+
canvas: 'edit'
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}]
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
break;
|
|
84
115
|
}
|
|
85
|
-
}, [history]);
|
|
116
|
+
}, [history, createSuccessNotice]);
|
|
86
117
|
const featureImageAltText = featuredMediaAltText ? decodeEntities(featuredMediaAltText) : decodeEntities(record?.title?.rendered || __('Featured image'));
|
|
87
118
|
return record ? createElement(SidebarNavigationScreen, {
|
|
88
119
|
backPath: backPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","useDispatch","useSelect","__experimentalVStack","VStack","ExternalLink","__experimentalTruncate","Truncate","store","coreStore","useEntityRecord","decodeEntities","pencil","__unstableStripHTML","stripHTML","escapeAttribute","safeDecodeURIComponent","filterURLForDisplay","useEffect","useCallback","privateApis","routerPrivateApis","editorPrivateApis","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","PageDetails","SidebarNavigationScreenDetailsFooter","useLocation","useHistory","PostActions","SidebarNavigationScreenPage","backPath","setCanvasMode","history","params","postId","record","hasResolved","featuredMediaAltText","featuredMediaSourceUrl","select","getEntityRecord","attachedMedia","featured_media","media_details","sizes","medium","source_url","alt_text","description","raw","push","path","undefined","postType","canvas","onActionPerformed","actionId","items","type","featureImageAltText","title","rendered","createElement","actions","Fragment","buttonProps","size","onClick","label","icon","meta","className","href","link","content","alignment","spacing","alt","src","excerpt","numberOfLines","id","footer","modified"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalVStack as VStack,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport PageDetails from './page-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { PostActions } = unlock( editorPrivateApis );\n\nexport default function SidebarNavigationScreenPage( { backPath } ) {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst history = useHistory();\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'page',\n\t\tpostId\n\t);\n\n\tconst { featuredMediaAltText, featuredMediaSourceUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// Featured image.\n\t\t\tconst attachedMedia = record?.featured_media\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\trecord?.featured_media\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tfeaturedMediaSourceUrl:\n\t\t\t\t\tattachedMedia?.media_details.sizes?.medium?.source_url ||\n\t\t\t\t\tattachedMedia?.source_url,\n\t\t\t\tfeaturedMediaAltText: escapeAttribute(\n\t\t\t\t\tattachedMedia?.alt_text ||\n\t\t\t\t\t\tattachedMedia?.description?.raw ||\n\t\t\t\t\t\t''\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record ]\n\t);\n\n\t// Redirect to the main pages navigation screen if the page is not found or has been deleted.\n\tuseEffect( () => {\n\t\tif ( hasResolved && ! record ) {\n\t\t\thistory.push( {\n\t\t\t\tpath: '/page',\n\t\t\t\tpostId: undefined,\n\t\t\t\tpostType: undefined,\n\t\t\t\tcanvas: 'view',\n\t\t\t} );\n\t\t}\n\t}, [ hasResolved, record, history ] );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tif ( actionId === 'move-to-trash' ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath: '/' + items[ 0 ].type,\n\t\t\t\t\tpostId: undefined,\n\t\t\t\t\tpostType: undefined,\n\t\t\t\t\tcanvas: 'view',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tconst featureImageAltText = featuredMediaAltText\n\t\t? decodeEntities( featuredMediaAltText )\n\t\t: decodeEntities( record?.title?.rendered || __( 'Featured image' ) );\n\n\treturn record ? (\n\t\t<SidebarNavigationScreen\n\t\t\tbackPath={ backPath }\n\t\t\ttitle={ decodeEntities(\n\t\t\t\trecord?.title?.rendered || __( '(no title)' )\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<PostActions\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\tbuttonProps={ { size: 'default' } }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tmeta={\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\thref={ record.link }\n\t\t\t\t>\n\t\t\t\t\t{ filterURLForDisplay(\n\t\t\t\t\t\tsafeDecodeURIComponent( record.link )\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ !! featuredMediaSourceUrl && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__featured-image-wrapper\"\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-page__featured-image has-image\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ featureImageAltText }\n\t\t\t\t\t\t\t\t\tsrc={ featuredMediaSourceUrl }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! record?.excerpt?.rendered && (\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__excerpt\"\n\t\t\t\t\t\t\tnumberOfLines={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( record.excerpt.rendered ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t) }\n\t\t\t\t\t<PageDetails id={ postId } />\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\trecord?.modified ? (\n\t\t\t\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t\t\t\t) : null\n\t\t\t}\n\t\t/>\n\t) : null;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,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,CACR,EACC,CAAC,CAAEH,MAAM,EAAE4C,OAAO,EAAElB,QAAQ,IAC7BC,aAAA,CAAC1D,QAAQ;MACRmE,SAAS,EAAC,mDAAmD;MAC7DS,aAAa,EAAG;IAAG,GAEjBrE,SAAS,CAAEwB,MAAM,CAAC4C,OAAO,CAAClB,QAAS,CAC5B,CACV,EACDC,aAAA,CAACtC,WAAW;MAACyD,EAAE,EAAG/C;IAAQ,CAAE,CAC3B,CACF;IACDgD,MAAM,EACL/C,MAAM,EAAEgD,QAAQ,GACfrB,aAAA,CAACrC,oCAAoC;MAACU,MAAM,EAAGA;IAAQ,CAAE,CAAC,GACvD;EACJ,CACD,CAAC,GACC,IAAI;AACT","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["__","sprintf","useDispatch","useSelect","__experimentalVStack","VStack","ExternalLink","__experimentalTruncate","Truncate","store","coreStore","useEntityRecord","decodeEntities","pencil","__unstableStripHTML","stripHTML","escapeAttribute","safeDecodeURIComponent","filterURLForDisplay","useEffect","useCallback","privateApis","routerPrivateApis","editorPrivateApis","noticesStore","SidebarNavigationScreen","unlock","editSiteStore","SidebarButton","PageDetails","SidebarNavigationScreenDetailsFooter","useLocation","useHistory","PostActions","SidebarNavigationScreenPage","backPath","setCanvasMode","history","createSuccessNotice","params","postId","record","hasResolved","featuredMediaAltText","featuredMediaSourceUrl","select","getEntityRecord","attachedMedia","featured_media","media_details","sizes","medium","source_url","alt_text","description","raw","push","path","undefined","postType","canvas","onActionPerformed","actionId","items","type","newItem","title","rendered","id","actions","label","onClick","featureImageAltText","createElement","Fragment","buttonProps","size","icon","meta","className","href","link","content","alignment","spacing","alt","src","excerpt","numberOfLines","footer","modified"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\t__experimentalVStack as VStack,\n\tExternalLink,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { pencil } from '@wordpress/icons';\nimport { __unstableStripHTML as stripHTML } from '@wordpress/dom';\nimport { escapeAttribute } from '@wordpress/escape-html';\nimport { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';\nimport { useEffect, useCallback } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport PageDetails from './page-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\nconst { PostActions } = unlock( editorPrivateApis );\n\nexport default function SidebarNavigationScreenPage( { backPath } ) {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst history = useHistory();\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst {\n\t\tparams: { postId },\n\t} = useLocation();\n\tconst { record, hasResolved } = useEntityRecord(\n\t\t'postType',\n\t\t'page',\n\t\tpostId\n\t);\n\n\tconst { featuredMediaAltText, featuredMediaSourceUrl } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\t// Featured image.\n\t\t\tconst attachedMedia = record?.featured_media\n\t\t\t\t? getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'attachment',\n\t\t\t\t\t\trecord?.featured_media\n\t\t\t\t )\n\t\t\t\t: null;\n\n\t\t\treturn {\n\t\t\t\tfeaturedMediaSourceUrl:\n\t\t\t\t\tattachedMedia?.media_details.sizes?.medium?.source_url ||\n\t\t\t\t\tattachedMedia?.source_url,\n\t\t\t\tfeaturedMediaAltText: escapeAttribute(\n\t\t\t\t\tattachedMedia?.alt_text ||\n\t\t\t\t\t\tattachedMedia?.description?.raw ||\n\t\t\t\t\t\t''\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ record ]\n\t);\n\n\t// Redirect to the main pages navigation screen if the page is not found or has been deleted.\n\tuseEffect( () => {\n\t\tif ( hasResolved && ! record ) {\n\t\t\thistory.push( {\n\t\t\t\tpath: '/page',\n\t\t\t\tpostId: undefined,\n\t\t\t\tpostType: undefined,\n\t\t\t\tcanvas: 'view',\n\t\t\t} );\n\t\t}\n\t}, [ hasResolved, record, history ] );\n\n\tconst onActionPerformed = useCallback(\n\t\t( actionId, items ) => {\n\t\t\tswitch ( actionId ) {\n\t\t\t\tcase 'move-to-trash':\n\t\t\t\t\t{\n\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\tpath: '/' + items[ 0 ].type,\n\t\t\t\t\t\t\tpostId: undefined,\n\t\t\t\t\t\t\tpostType: undefined,\n\t\t\t\t\t\t\tcanvas: 'view',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'duplicate-post':\n\t\t\t\t\t{\n\t\t\t\t\t\tconst newItem = items[ 0 ];\n\t\t\t\t\t\tconst title =\n\t\t\t\t\t\t\ttypeof newItem.title === 'string'\n\t\t\t\t\t\t\t\t? newItem.title\n\t\t\t\t\t\t\t\t: newItem.title?.rendered;\n\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t// translators: %s: Title of the created post e.g: \"Post 1\".\n\t\t\t\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\t\t\t\ttitle\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\tid: 'duplicate-post-action',\n\t\t\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tlabel: __( 'Edit' ),\n\t\t\t\t\t\t\t\t\t\tonClick: () => {\n\t\t\t\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\t\t\t\tpath: undefined,\n\t\t\t\t\t\t\t\t\t\t\t\tpostId: newItem.id,\n\t\t\t\t\t\t\t\t\t\t\t\tpostType: newItem.type,\n\t\t\t\t\t\t\t\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\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\tbreak;\n\t\t\t}\n\t\t},\n\t\t[ history, createSuccessNotice ]\n\t);\n\n\tconst featureImageAltText = featuredMediaAltText\n\t\t? decodeEntities( featuredMediaAltText )\n\t\t: decodeEntities( record?.title?.rendered || __( 'Featured image' ) );\n\n\treturn record ? (\n\t\t<SidebarNavigationScreen\n\t\t\tbackPath={ backPath }\n\t\t\ttitle={ decodeEntities(\n\t\t\t\trecord?.title?.rendered || __( '(no title)' )\n\t\t\t) }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<PostActions\n\t\t\t\t\t\tonActionPerformed={ onActionPerformed }\n\t\t\t\t\t\tbuttonProps={ { size: 'default' } }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tmeta={\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen__page-link\"\n\t\t\t\t\thref={ record.link }\n\t\t\t\t>\n\t\t\t\t\t{ filterURLForDisplay(\n\t\t\t\t\t\tsafeDecodeURIComponent( record.link )\n\t\t\t\t\t) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ !! featuredMediaSourceUrl && (\n\t\t\t\t\t\t<VStack\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__featured-image-wrapper\"\n\t\t\t\t\t\t\talignment=\"left\"\n\t\t\t\t\t\t\tspacing={ 2 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-page__featured-image has-image\">\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\talt={ featureImageAltText }\n\t\t\t\t\t\t\t\t\tsrc={ featuredMediaSourceUrl }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</VStack>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! record?.excerpt?.rendered && (\n\t\t\t\t\t\t<Truncate\n\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-page__excerpt\"\n\t\t\t\t\t\t\tnumberOfLines={ 3 }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ stripHTML( record.excerpt.rendered ) }\n\t\t\t\t\t\t</Truncate>\n\t\t\t\t\t) }\n\t\t\t\t\t<PageDetails id={ postId } />\n\t\t\t\t</>\n\t\t\t}\n\t\t\tfooter={\n\t\t\t\trecord?.modified ? (\n\t\t\t\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t\t\t\t) : null\n\t\t\t}\n\t\t/>\n\t) : null;\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SACCC,oBAAoB,IAAIC,MAAM,EAC9BC,YAAY,EACZC,sBAAsB,IAAIC,QAAQ,QAC5B,uBAAuB;AAC9B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EAAE;MAAU;IAAG,CACnC,CAAC,EACFH,aAAA,CAAC7C,aAAa;MACb2C,OAAO,EAAGA,CAAA,KAAMnC,aAAa,CAAE,MAAO,CAAG;MACzCkC,KAAK,EAAGtE,EAAE,CAAE,MAAO,CAAG;MACtB6E,IAAI,EAAGhE;IAAQ,CACf,CACA,CACF;IACDiE,IAAI,EACHL,aAAA,CAACnE,YAAY;MACZyE,SAAS,EAAC,gDAAgD;MAC1DC,IAAI,EAAGvC,MAAM,CAACwC;IAAM,GAElB/D,mBAAmB,CACpBD,sBAAsB,CAAEwB,MAAM,CAACwC,IAAK,CACrC,CACa,CACd;IACDC,OAAO,EACNT,aAAA,CAAAC,QAAA,QACG,CAAC,CAAE9B,sBAAsB,IAC1B6B,aAAA,CAACpE,MAAM;MACN0E,SAAS,EAAC,kEAAkE;MAC5EI,SAAS,EAAC,MAAM;MAChBC,OAAO,EAAG;IAAG,GAEbX,aAAA;MAAKM,SAAS,EAAC;IAAoE,GAClFN,aAAA;MACCY,GAAG,EAAGb,mBAAqB;MAC3Bc,GAAG,EAAG1C;IAAwB,CAC9B,CACG,CACE,CACR,EACC,CAAC,CAAEH,MAAM,EAAE8C,OAAO,EAAEpB,QAAQ,IAC7BM,aAAA,CAACjE,QAAQ;MACRuE,SAAS,EAAC,mDAAmD;MAC7DS,aAAa,EAAG;IAAG,GAEjBzE,SAAS,CAAE0B,MAAM,CAAC8C,OAAO,CAACpB,QAAS,CAC5B,CACV,EACDM,aAAA,CAAC5C,WAAW;MAACuC,EAAE,EAAG5B;IAAQ,CAAE,CAC3B,CACF;IACDiD,MAAM,EACLhD,MAAM,EAAEiD,QAAQ,GACfjB,aAAA,CAAC3C,oCAAoC;MAACW,MAAM,EAAGA;IAAQ,CAAE,CAAC,GACvD;EACJ,CACD,CAAC,GACC,IAAI;AACT","ignoreList":[]}
|
|
@@ -5,7 +5,6 @@ import { createElement, Fragment } from "react";
|
|
|
5
5
|
import { useDispatch } from '@wordpress/data';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
7
|
import { pencil } from '@wordpress/icons';
|
|
8
|
-
import { getQueryArgs } from '@wordpress/url';
|
|
9
8
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -18,7 +17,6 @@ import usePatternDetails from './use-pattern-details';
|
|
|
18
17
|
import { store as editSiteStore } from '../../store';
|
|
19
18
|
import { unlock } from '../../lock-unlock';
|
|
20
19
|
import TemplateActions from '../template-actions';
|
|
21
|
-
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
22
20
|
const {
|
|
23
21
|
useLocation,
|
|
24
22
|
useHistory
|
|
@@ -29,24 +27,19 @@ export default function SidebarNavigationScreenPattern() {
|
|
|
29
27
|
const {
|
|
30
28
|
params: {
|
|
31
29
|
postType,
|
|
32
|
-
postId
|
|
30
|
+
postId,
|
|
31
|
+
categoryId,
|
|
32
|
+
categoryType
|
|
33
33
|
}
|
|
34
34
|
} = location;
|
|
35
|
-
const {
|
|
36
|
-
categoryType
|
|
37
|
-
} = getQueryArgs(window.location.href);
|
|
38
35
|
const {
|
|
39
36
|
setCanvasMode
|
|
40
37
|
} = unlock(useDispatch(editSiteStore));
|
|
41
38
|
useInitEditedEntityFromURL();
|
|
42
39
|
const patternDetails = usePatternDetails(postType, postId);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// page and the back button should return them to that list page.
|
|
47
|
-
const backPath = !categoryType && postType === TEMPLATE_PART_POST_TYPE ? {
|
|
48
|
-
path: '/wp_template_part/all'
|
|
49
|
-
} : {
|
|
40
|
+
const backPath = {
|
|
41
|
+
categoryId,
|
|
42
|
+
categoryType,
|
|
50
43
|
path: '/patterns'
|
|
51
44
|
};
|
|
52
45
|
return createElement(SidebarNavigationScreen, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDispatch","__","pencil","
|
|
1
|
+
{"version":3,"names":["useDispatch","__","pencil","privateApis","routerPrivateApis","SidebarButton","SidebarNavigationScreen","useInitEditedEntityFromURL","usePatternDetails","store","editSiteStore","unlock","TemplateActions","useLocation","useHistory","SidebarNavigationScreenPattern","history","location","params","postType","postId","categoryId","categoryType","setCanvasMode","patternDetails","backPath","path","createElement","actions","Fragment","toggleProps","as","onRemove","push","onClick","label","icon"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';\nimport usePatternDetails from './use-pattern-details';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport TemplateActions from '../template-actions';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreenPattern() {\n\tconst history = useHistory();\n\tconst location = useLocation();\n\tconst {\n\t\tparams: { postType, postId, categoryId, categoryType },\n\t} = location;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tuseInitEditedEntityFromURL();\n\n\tconst patternDetails = usePatternDetails( postType, postId );\n\n\tconst backPath = {\n\t\tcategoryId,\n\t\tcategoryType,\n\t\tpath: '/patterns',\n\t};\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\thistory.push( backPath );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<Sidebar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IACZI,IAAI,EAAE;EACP,CAAC;EAED,OACCC,aAAA,CAACrB,uBAAuB;IACvBsB,OAAO,EACND,aAAA,CAAAE,QAAA,QACCF,aAAA,CAACf,eAAe;MACfO,QAAQ,EAAGA,QAAU;MACrBC,MAAM,EAAGA,MAAQ;MACjBU,WAAW,EAAG;QAAEC,EAAE,EAAE1B;MAAc,CAAG;MACrC2B,QAAQ,EAAGA,CAAA,KAAM;QAChBhB,OAAO,CAACiB,IAAI,CAAER,QAAS,CAAC;MACzB;IAAG,CACH,CAAC,EACFE,aAAA,CAACtB,aAAa;MACb6B,OAAO,EAAGA,CAAA,KAAMX,aAAa,CAAE,MAAO,CAAG;MACzCY,KAAK,EAAGlC,EAAE,CAAE,MAAO,CAAG;MACtBmC,IAAI,EAAGlC;IAAQ,CACf,CACA,CACF;IACDuB,QAAQ,EAAGA,QAAU;IAAA,GAChBD;EAAc,CACnB,CAAC;AAEJ","ignoreList":[]}
|
package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js
CHANGED
|
@@ -12,7 +12,9 @@ import TemplatePartNavigationMenuList from './template-part-navigation-menu-list
|
|
|
12
12
|
export default function TemplatePartNavigationMenus({
|
|
13
13
|
menus
|
|
14
14
|
}) {
|
|
15
|
-
if (!menus.length)
|
|
15
|
+
if (!menus.length) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
16
18
|
|
|
17
19
|
// if there is a single menu then render TemplatePartNavigationMenu
|
|
18
20
|
if (menus.length === 1) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","__experimentalHeading","Heading","TemplatePartNavigationMenu","TemplatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","createElement","id","Fragment","className","size","upperCase","weight"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length )
|
|
1
|
+
{"version":3,"names":["__","__experimentalHeading","Heading","TemplatePartNavigationMenu","TemplatePartNavigationMenuList","TemplatePartNavigationMenus","menus","length","createElement","id","Fragment","className","size","upperCase","weight"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalHeading as Heading } from '@wordpress/components';\n/**\n * Internal dependencies\n */\nimport TemplatePartNavigationMenu from './template-part-navigation-menu';\nimport TemplatePartNavigationMenuList from './template-part-navigation-menu-list';\n\nexport default function TemplatePartNavigationMenus( { menus } ) {\n\tif ( ! menus.length ) {\n\t\treturn null;\n\t}\n\n\t// if there is a single menu then render TemplatePartNavigationMenu\n\tif ( menus.length === 1 ) {\n\t\treturn <TemplatePartNavigationMenu id={ menus[ 0 ] } />;\n\t}\n\n\t// if there are multiple menus then render TemplatePartNavigationMenuList\n\treturn (\n\t\t<>\n\t\t\t<Heading\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-template-part-navigation-menu__title\"\n\t\t\t\tsize=\"11\"\n\t\t\t\tupperCase\n\t\t\t\tweight={ 500 }\n\t\t\t>\n\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t</Heading>\n\t\t\t<TemplatePartNavigationMenuList menus={ menus } />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,qBAAqB,IAAIC,OAAO,QAAQ,uBAAuB;AACxE;AACA;AACA;AACA,OAAOC,0BAA0B,MAAM,iCAAiC;AACxE,OAAOC,8BAA8B,MAAM,sCAAsC;AAEjF,eAAe,SAASC,2BAA2BA,CAAE;EAAEC;AAAM,CAAC,EAAG;EAChE,IAAK,CAAEA,KAAK,CAACC,MAAM,EAAG;IACrB,OAAO,IAAI;EACZ;;EAEA;EACA,IAAKD,KAAK,CAACC,MAAM,KAAK,CAAC,EAAG;IACzB,OAAOC,aAAA,CAACL,0BAA0B;MAACM,EAAE,EAAGH,KAAK,CAAE,CAAC;IAAI,CAAE,CAAC;EACxD;;EAEA;EACA,OACCE,aAAA,CAAAE,QAAA,QACCF,aAAA,CAACN,OAAO;IACPS,SAAS,EAAC,0EAA0E;IACpFC,IAAI,EAAC,IAAI;IACTC,SAAS;IACTC,MAAM,EAAG;EAAK,GAEZd,EAAE,CAAE,YAAa,CACX,CAAC,EACVQ,aAAA,CAACJ,8BAA8B;IAACE,KAAK,EAAGA;EAAO,CAAE,CAChD,CAAC;AAEL","ignoreList":[]}
|
|
@@ -15,7 +15,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal dependencies
|
|
17
17
|
*/
|
|
18
|
-
import { useAddedBy } from '../page-templates
|
|
18
|
+
import { useAddedBy } from '../page-templates/hooks';
|
|
19
19
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
20
20
|
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
21
21
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sentenceCase","__","_x","sprintf","store","coreStore","editorStore","useSelect","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_SYNC_TYPES","TEMPLATE_ORIGINS","usePatternDetails","postType","postId","getDescription","getTitle","record","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","user","footer","modified","createElement","details","push","label","value","wp_pattern_sync_status","unsynced","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","className","origin","plugin","has_theme_file","isCustomized","content","Fragment","spacing","key"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,aAAa;;AAE1C;AACA;AACA;AACA,SAASC,EAAE,EAAEC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AACjD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,SAAS,QAAQ,iBAAiB;;A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_x","sprintf","store","coreStore","editorStore","useSelect","useAddedBy","useEditedEntityRecord","useNavigationMenuContent","SidebarNavigationScreenDetailsFooter","SidebarNavigationScreenDetailsPanel","SidebarNavigationScreenDetailsPanelRow","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue","PATTERN_TYPES","TEMPLATE_PART_POST_TYPE","PATTERN_SYNC_TYPES","TEMPLATE_ORIGINS","usePatternDetails","postType","postId","getDescription","getTitle","record","templatePartAreas","select","__experimentalGetDefaultTemplatePartAreas","currentTheme","userPatternCategories","getCurrentTheme","getUserPatternCategories","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","description","text","user","footer","modified","createElement","details","push","label","value","wp_pattern_sync_status","unsynced","wp_pattern_category","length","patternCategories","Map","forEach","userCategory","set","id","categories","filter","category","get","map","join","templatePartArea","find","area","areaDetailValue","className","origin","plugin","has_theme_file","isCustomized","content","Fragment","spacing","key"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { sentenceCase } from 'change-case';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { useAddedBy } from '../page-templates/hooks';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport useNavigationMenuContent from './use-navigation-menu-content';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport {\n\tPATTERN_TYPES,\n\tTEMPLATE_PART_POST_TYPE,\n\tPATTERN_SYNC_TYPES,\n\tTEMPLATE_ORIGINS,\n} from '../../utils/constants';\n\nexport default function usePatternDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst templatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editorStore ).__experimentalGetDefaultTemplatePartAreas(),\n\t\t[]\n\t);\n\tconst { currentTheme, userPatternCategories } = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme, getUserPatternCategories } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tcurrentTheme: getCurrentTheme(),\n\t\t\tuserPatternCategories: getUserPatternCategories(),\n\t\t};\n\t}, [] );\n\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet description = getDescription();\n\n\tif ( ! description && addedBy.text ) {\n\t\tdescription =\n\t\t\tpostType === PATTERN_TYPES.user\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: pattern title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s pattern.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t\t\t__( 'This is the %s template part.' ),\n\t\t\t\t\t\tgetTitle()\n\t\t\t\t );\n\t}\n\n\tif ( ! description && postType === PATTERN_TYPES.user && record?.title ) {\n\t\tdescription = sprintf(\n\t\t\t// translators: %s: user created pattern title e.g. \"Footer\".\n\t\t\t__( 'This is the %s pattern.' ),\n\t\t\trecord.title\n\t\t);\n\t}\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst details = [];\n\n\tif (\n\t\tpostType === PATTERN_TYPES.user ||\n\t\tpostType === TEMPLATE_PART_POST_TYPE\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Syncing' ),\n\t\t\tvalue:\n\t\t\t\trecord.wp_pattern_sync_status === PATTERN_SYNC_TYPES.unsynced\n\t\t\t\t\t? _x(\n\t\t\t\t\t\t\t'Not synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is not synchronized'\n\t\t\t\t\t )\n\t\t\t\t\t: _x(\n\t\t\t\t\t\t\t'Synced',\n\t\t\t\t\t\t\t'Text that indicates that the pattern is synchronized'\n\t\t\t\t\t ),\n\t\t} );\n\n\t\tif ( record.wp_pattern_category?.length === 0 ) {\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: __( 'Uncategorized' ),\n\t\t\t} );\n\t\t}\n\t\tif ( record.wp_pattern_category?.length > 0 ) {\n\t\t\tconst patternCategories = new Map();\n\t\t\tuserPatternCategories.forEach( ( userCategory ) =>\n\t\t\t\tpatternCategories.set( userCategory.id, userCategory )\n\t\t\t);\n\n\t\t\tconst categories = record.wp_pattern_category\n\t\t\t\t.filter( ( category ) => patternCategories.get( category ) )\n\t\t\t\t.map( ( category ) => patternCategories.get( category ).label );\n\n\t\t\tdetails.push( {\n\t\t\t\tlabel: __( 'Categories' ),\n\t\t\t\tvalue: categories.length > 0 ? categories.join( ', ' ) : '',\n\t\t\t} );\n\t\t}\n\t}\n\n\tif ( postType === TEMPLATE_PART_POST_TYPE ) {\n\t\tconst templatePartArea = templatePartAreas.find(\n\t\t\t( area ) => area.area === record.area\n\t\t);\n\n\t\tlet areaDetailValue = templatePartArea?.label;\n\n\t\tif ( ! areaDetailValue ) {\n\t\t\tareaDetailValue = record.area\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: Sentenced cased template part area e.g: \"My custom area\".\n\t\t\t\t\t\t__( '%s (removed)' ),\n\t\t\t\t\t\tsentenceCase( record.area )\n\t\t\t\t )\n\t\t\t\t: __( 'None' );\n\t\t}\n\n\t\tdetails.push( { label: __( 'Area' ), value: areaDetailValue } );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t! isAddedByActiveTheme\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Added by' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-author\">\n\t\t\t\t\t{ addedBy.text }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tif (\n\t\tpostType === TEMPLATE_PART_POST_TYPE &&\n\t\taddedBy.text &&\n\t\t( record.origin === TEMPLATE_ORIGINS.plugin ||\n\t\t\trecord.has_theme_file === true )\n\t) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Customized' ),\n\t\t\tvalue: (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-pattern__added-by-description-customized\">\n\t\t\t\t\t{ addedBy.isCustomized ? __( 'Yes' ) : __( 'No' ) }\n\t\t\t\t</span>\n\t\t\t),\n\t\t} );\n\t}\n\n\tconst content = (\n\t\t<>\n\t\t\t{ useNavigationMenuContent( postType, postId ) }\n\t\t\t{ !! details.length && (\n\t\t\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\ttitle={ __( 'Details' ) }\n\t\t\t\t>\n\t\t\t\t\t{ details.map( ( { label, value } ) => (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t\t\t{ value }\n\t\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t\t\t) ) }\n\t\t\t\t</SidebarNavigationScreenDetailsPanel>\n\t\t\t) }\n\t\t</>\n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