@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
|
@@ -2,21 +2,17 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { PanelBody } from '@wordpress/components';
|
|
5
|
-
import { __ } from '@wordpress/i18n';
|
|
6
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
8
|
import {
|
|
9
|
-
PageAttributesPanel,
|
|
10
9
|
PluginDocumentSettingPanel,
|
|
11
|
-
PostDiscussionPanel,
|
|
12
|
-
PostExcerptPanel,
|
|
13
|
-
PostLastRevisionPanel,
|
|
14
|
-
PostTaxonomiesPanel,
|
|
15
10
|
store as editorStore,
|
|
16
11
|
privateApis as editorPrivateApis,
|
|
17
12
|
} from '@wordpress/editor';
|
|
18
13
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
19
14
|
import { useCallback } from '@wordpress/element';
|
|
15
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
20
16
|
|
|
21
17
|
/**
|
|
22
18
|
* Internal dependencies
|
|
@@ -53,20 +49,57 @@ export default function PagePanels() {
|
|
|
53
49
|
renderingMode: getRenderingMode(),
|
|
54
50
|
};
|
|
55
51
|
}, [] );
|
|
56
|
-
|
|
52
|
+
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
57
53
|
const history = useHistory();
|
|
58
54
|
const onActionPerformed = useCallback(
|
|
59
55
|
( actionId, items ) => {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
switch ( actionId ) {
|
|
57
|
+
case 'move-to-trash':
|
|
58
|
+
{
|
|
59
|
+
history.push( {
|
|
60
|
+
path: '/' + items[ 0 ].type,
|
|
61
|
+
postId: undefined,
|
|
62
|
+
postType: undefined,
|
|
63
|
+
canvas: 'view',
|
|
64
|
+
} );
|
|
65
|
+
}
|
|
66
|
+
break;
|
|
67
|
+
case 'duplicate-post':
|
|
68
|
+
{
|
|
69
|
+
const newItem = items[ 0 ];
|
|
70
|
+
const title =
|
|
71
|
+
typeof newItem.title === 'string'
|
|
72
|
+
? newItem.title
|
|
73
|
+
: newItem.title?.rendered;
|
|
74
|
+
createSuccessNotice(
|
|
75
|
+
sprintf(
|
|
76
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
77
|
+
__( '"%s" successfully created.' ),
|
|
78
|
+
title
|
|
79
|
+
),
|
|
80
|
+
{
|
|
81
|
+
type: 'snackbar',
|
|
82
|
+
id: 'duplicate-post-action',
|
|
83
|
+
actions: [
|
|
84
|
+
{
|
|
85
|
+
label: __( 'Edit' ),
|
|
86
|
+
onClick: () => {
|
|
87
|
+
history.push( {
|
|
88
|
+
path: undefined,
|
|
89
|
+
postId: newItem.id,
|
|
90
|
+
postType: newItem.type,
|
|
91
|
+
canvas: 'edit',
|
|
92
|
+
} );
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
break;
|
|
67
100
|
}
|
|
68
101
|
},
|
|
69
|
-
[ history ]
|
|
102
|
+
[ history, createSuccessNotice ]
|
|
70
103
|
);
|
|
71
104
|
|
|
72
105
|
if ( ! hasResolved ) {
|
|
@@ -95,11 +128,6 @@ export default function PagePanels() {
|
|
|
95
128
|
<PageContent />
|
|
96
129
|
</PanelBody>
|
|
97
130
|
) }
|
|
98
|
-
<PostLastRevisionPanel />
|
|
99
|
-
<PostTaxonomiesPanel />
|
|
100
|
-
<PostExcerptPanel />
|
|
101
|
-
<PostDiscussionPanel />
|
|
102
|
-
<PageAttributesPanel />
|
|
103
131
|
</>
|
|
104
132
|
);
|
|
105
133
|
}
|
|
@@ -9,36 +9,48 @@ import {
|
|
|
9
9
|
PostSchedulePanel,
|
|
10
10
|
PostTemplatePanel,
|
|
11
11
|
PostFeaturedImagePanel,
|
|
12
|
+
privateApis as editorPrivateApis,
|
|
12
13
|
} from '@wordpress/editor';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Internal dependencies
|
|
16
17
|
*/
|
|
17
|
-
import
|
|
18
|
+
import { unlock } from '../../../lock-unlock';
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const {
|
|
21
|
+
PrivatePostExcerptPanel,
|
|
22
|
+
PostStatus,
|
|
23
|
+
PostContentInformation,
|
|
24
|
+
PostLastEditedPanel,
|
|
25
|
+
} = unlock( editorPrivateApis );
|
|
26
|
+
|
|
27
|
+
export default function PageSummary() {
|
|
26
28
|
return (
|
|
27
29
|
<VStack spacing={ 0 }>
|
|
28
30
|
<PluginPostStatusInfo.Slot>
|
|
29
31
|
{ ( fills ) => (
|
|
30
32
|
<>
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
<VStack
|
|
34
|
+
spacing={ 3 }
|
|
35
|
+
// TODO: this needs to be consolidated with the panel in post editor, when we unify them.
|
|
36
|
+
style={ { marginBlockEnd: '24px' } }
|
|
37
|
+
>
|
|
38
|
+
<PostFeaturedImagePanel withPanelBody={ false } />
|
|
39
|
+
<PrivatePostExcerptPanel />
|
|
40
|
+
<VStack spacing={ 1 }>
|
|
41
|
+
<PostContentInformation />
|
|
42
|
+
<PostLastEditedPanel />
|
|
43
|
+
</VStack>
|
|
44
|
+
</VStack>
|
|
45
|
+
<VStack
|
|
46
|
+
spacing={ 1 }
|
|
47
|
+
style={ { marginBlockEnd: '12px' } }
|
|
48
|
+
>
|
|
49
|
+
<PostStatus />
|
|
50
|
+
<PostSchedulePanel />
|
|
51
|
+
<PostTemplatePanel />
|
|
52
|
+
<PostURLPanel />
|
|
53
|
+
</VStack>
|
|
42
54
|
<PostAuthorPanel />
|
|
43
55
|
{ fills }
|
|
44
56
|
</>
|
|
@@ -4,11 +4,7 @@
|
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
PostDiscussionPanel,
|
|
9
|
-
PostExcerptPanel,
|
|
10
|
-
PostLastRevisionPanel,
|
|
11
|
-
PostTaxonomiesPanel,
|
|
7
|
+
PluginDocumentSettingPanel,
|
|
12
8
|
privateApis as editorPrivateApis,
|
|
13
9
|
store as editorStore,
|
|
14
10
|
} from '@wordpress/editor';
|
|
@@ -30,7 +26,6 @@ import { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';
|
|
|
30
26
|
import { unlock } from '../../../lock-unlock';
|
|
31
27
|
|
|
32
28
|
const { PostCardPanel } = unlock( editorPrivateApis );
|
|
33
|
-
const { PatternOverridesPanel } = unlock( editorPrivateApis );
|
|
34
29
|
const { useHistory } = unlock( routerPrivateApis );
|
|
35
30
|
|
|
36
31
|
function TemplatesList( { availableTemplates, onSelect } ) {
|
|
@@ -114,6 +109,7 @@ export default function TemplatePanel() {
|
|
|
114
109
|
}
|
|
115
110
|
/>
|
|
116
111
|
<PluginTemplateSettingPanel.Slot />
|
|
112
|
+
<PluginDocumentSettingPanel.Slot />
|
|
117
113
|
{ availablePatterns?.length > 0 && (
|
|
118
114
|
<PanelBody
|
|
119
115
|
title={ __( 'Transform into:' ) }
|
|
@@ -133,12 +129,6 @@ export default function TemplatePanel() {
|
|
|
133
129
|
/>
|
|
134
130
|
</PanelBody>
|
|
135
131
|
) }
|
|
136
|
-
<PostLastRevisionPanel />
|
|
137
|
-
<PostTaxonomiesPanel />
|
|
138
|
-
<PostExcerptPanel />
|
|
139
|
-
<PostDiscussionPanel />
|
|
140
|
-
<PageAttributesPanel />
|
|
141
|
-
<PatternOverridesPanel />
|
|
142
132
|
</>
|
|
143
133
|
);
|
|
144
134
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
4
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
5
5
|
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
6
|
import {
|
|
7
7
|
__experimentalVStack as VStack,
|
|
@@ -17,6 +17,7 @@ import { safeDecodeURIComponent, filterURLForDisplay } from '@wordpress/url';
|
|
|
17
17
|
import { useEffect, useCallback } from '@wordpress/element';
|
|
18
18
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
19
19
|
import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
20
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Internal dependencies
|
|
@@ -34,6 +35,7 @@ const { PostActions } = unlock( editorPrivateApis );
|
|
|
34
35
|
export default function SidebarNavigationScreenPage( { backPath } ) {
|
|
35
36
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
36
37
|
const history = useHistory();
|
|
38
|
+
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
37
39
|
const {
|
|
38
40
|
params: { postId },
|
|
39
41
|
} = useLocation();
|
|
@@ -83,16 +85,53 @@ export default function SidebarNavigationScreenPage( { backPath } ) {
|
|
|
83
85
|
|
|
84
86
|
const onActionPerformed = useCallback(
|
|
85
87
|
( actionId, items ) => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
switch ( actionId ) {
|
|
89
|
+
case 'move-to-trash':
|
|
90
|
+
{
|
|
91
|
+
history.push( {
|
|
92
|
+
path: '/' + items[ 0 ].type,
|
|
93
|
+
postId: undefined,
|
|
94
|
+
postType: undefined,
|
|
95
|
+
canvas: 'view',
|
|
96
|
+
} );
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case 'duplicate-post':
|
|
100
|
+
{
|
|
101
|
+
const newItem = items[ 0 ];
|
|
102
|
+
const title =
|
|
103
|
+
typeof newItem.title === 'string'
|
|
104
|
+
? newItem.title
|
|
105
|
+
: newItem.title?.rendered;
|
|
106
|
+
createSuccessNotice(
|
|
107
|
+
sprintf(
|
|
108
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
109
|
+
__( '"%s" successfully created.' ),
|
|
110
|
+
title
|
|
111
|
+
),
|
|
112
|
+
{
|
|
113
|
+
type: 'snackbar',
|
|
114
|
+
id: 'duplicate-post-action',
|
|
115
|
+
actions: [
|
|
116
|
+
{
|
|
117
|
+
label: __( 'Edit' ),
|
|
118
|
+
onClick: () => {
|
|
119
|
+
history.push( {
|
|
120
|
+
path: undefined,
|
|
121
|
+
postId: newItem.id,
|
|
122
|
+
postType: newItem.type,
|
|
123
|
+
canvas: 'edit',
|
|
124
|
+
} );
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
break;
|
|
93
132
|
}
|
|
94
133
|
},
|
|
95
|
-
[ history ]
|
|
134
|
+
[ history, createSuccessNotice ]
|
|
96
135
|
);
|
|
97
136
|
|
|
98
137
|
const featureImageAltText = featuredMediaAltText
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import { useDispatch } from '@wordpress/data';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
import { pencil } from '@wordpress/icons';
|
|
7
|
-
import { getQueryArgs } from '@wordpress/url';
|
|
8
7
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -17,7 +16,6 @@ import usePatternDetails from './use-pattern-details';
|
|
|
17
16
|
import { store as editSiteStore } from '../../store';
|
|
18
17
|
import { unlock } from '../../lock-unlock';
|
|
19
18
|
import TemplateActions from '../template-actions';
|
|
20
|
-
import { TEMPLATE_PART_POST_TYPE } from '../../utils/constants';
|
|
21
19
|
|
|
22
20
|
const { useLocation, useHistory } = unlock( routerPrivateApis );
|
|
23
21
|
|
|
@@ -25,22 +23,19 @@ export default function SidebarNavigationScreenPattern() {
|
|
|
25
23
|
const history = useHistory();
|
|
26
24
|
const location = useLocation();
|
|
27
25
|
const {
|
|
28
|
-
params: { postType, postId },
|
|
26
|
+
params: { postType, postId, categoryId, categoryType },
|
|
29
27
|
} = location;
|
|
30
|
-
const { categoryType } = getQueryArgs( window.location.href );
|
|
31
28
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
32
29
|
|
|
33
30
|
useInitEditedEntityFromURL();
|
|
34
31
|
|
|
35
32
|
const patternDetails = usePatternDetails( postType, postId );
|
|
36
33
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
? { path: '/wp_template_part/all' }
|
|
43
|
-
: { path: '/patterns' };
|
|
34
|
+
const backPath = {
|
|
35
|
+
categoryId,
|
|
36
|
+
categoryType,
|
|
37
|
+
path: '/patterns',
|
|
38
|
+
};
|
|
44
39
|
|
|
45
40
|
return (
|
|
46
41
|
<SidebarNavigationScreen
|
|
@@ -10,7 +10,9 @@ import TemplatePartNavigationMenu from './template-part-navigation-menu';
|
|
|
10
10
|
import TemplatePartNavigationMenuList from './template-part-navigation-menu-list';
|
|
11
11
|
|
|
12
12
|
export default function TemplatePartNavigationMenus( { menus } ) {
|
|
13
|
-
if ( ! menus.length )
|
|
13
|
+
if ( ! menus.length ) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
14
16
|
|
|
15
17
|
// if there is a single menu then render TemplatePartNavigationMenu
|
|
16
18
|
if ( menus.length === 1 ) {
|
|
@@ -14,7 +14,7 @@ import { useSelect } from '@wordpress/data';
|
|
|
14
14
|
/**
|
|
15
15
|
* Internal dependencies
|
|
16
16
|
*/
|
|
17
|
-
import { useAddedBy } from '../page-templates
|
|
17
|
+
import { useAddedBy } from '../page-templates/hooks';
|
|
18
18
|
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
19
19
|
import useNavigationMenuContent from './use-navigation-menu-content';
|
|
20
20
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
@@ -5,32 +5,33 @@ import {
|
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
6
|
__experimentalItem as Item,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
9
8
|
import { getTemplatePartIcon } from '@wordpress/editor';
|
|
10
9
|
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { getQueryArgs } from '@wordpress/url';
|
|
12
10
|
import { store as coreStore } from '@wordpress/core-data';
|
|
13
11
|
import { useSelect } from '@wordpress/data';
|
|
14
12
|
import { file } from '@wordpress/icons';
|
|
13
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* Internal dependencies
|
|
18
17
|
*/
|
|
19
18
|
import AddNewPattern from '../add-new-pattern';
|
|
20
|
-
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
21
19
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
22
20
|
import CategoryItem from './category-item';
|
|
23
21
|
import {
|
|
24
22
|
PATTERN_DEFAULT_CATEGORY,
|
|
25
23
|
PATTERN_TYPES,
|
|
26
24
|
TEMPLATE_PART_POST_TYPE,
|
|
25
|
+
TEMPLATE_PART_ALL_AREAS_CATEGORY,
|
|
27
26
|
} from '../../utils/constants';
|
|
28
|
-
import { useLink } from '../routes/link';
|
|
29
27
|
import usePatternCategories from './use-pattern-categories';
|
|
30
28
|
import useTemplatePartAreas from './use-template-part-areas';
|
|
31
|
-
import {
|
|
29
|
+
import { unlock } from '../../lock-unlock';
|
|
30
|
+
|
|
31
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
32
32
|
|
|
33
33
|
function CategoriesGroup( {
|
|
34
|
+
path,
|
|
34
35
|
templatePartAreas,
|
|
35
36
|
patternCategories,
|
|
36
37
|
currentCategory,
|
|
@@ -42,15 +43,16 @@ function CategoriesGroup( {
|
|
|
42
43
|
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
43
44
|
<CategoryItem
|
|
44
45
|
key="all"
|
|
46
|
+
path={ path }
|
|
45
47
|
count={ Object.values( templatePartAreas )
|
|
46
48
|
.map( ( { templateParts } ) => templateParts?.length || 0 )
|
|
47
49
|
.reduce( ( acc, val ) => acc + val, 0 ) }
|
|
48
50
|
icon={ getTemplatePartIcon() } /* no name, so it provides the fallback icon */
|
|
49
51
|
label={ __( 'All template parts' ) }
|
|
50
|
-
id={
|
|
52
|
+
id={ TEMPLATE_PART_ALL_AREAS_CATEGORY }
|
|
51
53
|
type={ TEMPLATE_PART_POST_TYPE }
|
|
52
54
|
isActive={
|
|
53
|
-
currentCategory ===
|
|
55
|
+
currentCategory === TEMPLATE_PART_ALL_AREAS_CATEGORY &&
|
|
54
56
|
currentType === TEMPLATE_PART_POST_TYPE
|
|
55
57
|
}
|
|
56
58
|
/>
|
|
@@ -58,6 +60,7 @@ function CategoriesGroup( {
|
|
|
58
60
|
( [ area, { label, templateParts } ] ) => (
|
|
59
61
|
<CategoryItem
|
|
60
62
|
key={ area }
|
|
63
|
+
path={ path }
|
|
61
64
|
count={ templateParts?.length }
|
|
62
65
|
icon={ getTemplatePartIcon( area ) }
|
|
63
66
|
label={ label }
|
|
@@ -74,6 +77,7 @@ function CategoriesGroup( {
|
|
|
74
77
|
{ allPatterns && (
|
|
75
78
|
<CategoryItem
|
|
76
79
|
key={ allPatterns.name }
|
|
80
|
+
path={ path }
|
|
77
81
|
count={ allPatterns.count }
|
|
78
82
|
label={ allPatterns.label }
|
|
79
83
|
icon={ file }
|
|
@@ -89,6 +93,7 @@ function CategoriesGroup( {
|
|
|
89
93
|
{ otherPatterns.map( ( category ) => (
|
|
90
94
|
<CategoryItem
|
|
91
95
|
key={ category.name }
|
|
96
|
+
path={ path }
|
|
92
97
|
count={ category.count }
|
|
93
98
|
label={ category.label }
|
|
94
99
|
icon={ file }
|
|
@@ -106,8 +111,9 @@ function CategoriesGroup( {
|
|
|
106
111
|
}
|
|
107
112
|
|
|
108
113
|
export default function SidebarNavigationScreenPatterns() {
|
|
109
|
-
const
|
|
110
|
-
|
|
114
|
+
const {
|
|
115
|
+
params: { categoryType, categoryId, path },
|
|
116
|
+
} = useLocation();
|
|
111
117
|
const currentCategory = categoryId || PATTERN_DEFAULT_CATEGORY;
|
|
112
118
|
const currentType = categoryType || PATTERN_TYPES.theme;
|
|
113
119
|
|
|
@@ -118,29 +124,19 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
118
124
|
( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,
|
|
119
125
|
[]
|
|
120
126
|
);
|
|
121
|
-
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
122
|
-
const settings = select( editSiteStore ).getSettings();
|
|
123
|
-
return !! settings.supportsTemplatePartsMode;
|
|
124
|
-
}, [] );
|
|
125
|
-
|
|
126
|
-
const templatePartsLink = useLink( {
|
|
127
|
-
path: '/wp_template_part/all',
|
|
128
|
-
// If a classic theme that supports template parts accessed
|
|
129
|
-
// the Patterns page directly, preserve that state in the URL.
|
|
130
|
-
didAccessPatternsPage:
|
|
131
|
-
! isBlockBasedTheme && isTemplatePartsMode ? 1 : undefined,
|
|
132
|
-
} );
|
|
133
|
-
|
|
134
|
-
const footer = ! isMobileViewport ? (
|
|
135
|
-
<ItemGroup>
|
|
136
|
-
{ ( isBlockBasedTheme || isTemplatePartsMode ) && (
|
|
137
|
-
<SidebarNavigationItem withChevron { ...templatePartsLink }>
|
|
138
|
-
{ __( 'Manage all template parts' ) }
|
|
139
|
-
</SidebarNavigationItem>
|
|
140
|
-
) }
|
|
141
|
-
</ItemGroup>
|
|
142
|
-
) : undefined;
|
|
143
127
|
|
|
128
|
+
/**
|
|
129
|
+
* This sidebar needs to temporarily accomodate two different "URLs":
|
|
130
|
+
*
|
|
131
|
+
* 1. path = /patterns
|
|
132
|
+
* Block based themes. Also classic themes can access this URL, though it's not linked anywhere.
|
|
133
|
+
*
|
|
134
|
+
* 2. path = /wp_template_part/all
|
|
135
|
+
* Classic themes with support for block-template-parts. We need to list only Template Parts in this case.
|
|
136
|
+
* The URL is accessible from the Appearance > Template Parts menu.
|
|
137
|
+
*
|
|
138
|
+
* This is temporary. We aim to consolidate to /patterns.
|
|
139
|
+
*/
|
|
144
140
|
return (
|
|
145
141
|
<SidebarNavigationScreen
|
|
146
142
|
isRoot={ ! isBlockBasedTheme }
|
|
@@ -149,22 +145,18 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
149
145
|
'Manage what patterns are available when editing the site.'
|
|
150
146
|
) }
|
|
151
147
|
actions={ <AddNewPattern /> }
|
|
152
|
-
footer={ footer }
|
|
153
148
|
content={
|
|
154
149
|
<>
|
|
155
|
-
{ isLoading && __( 'Loading
|
|
150
|
+
{ isLoading && __( 'Loading items…' ) }
|
|
156
151
|
{ ! isLoading && (
|
|
157
152
|
<>
|
|
158
153
|
{ ! hasTemplateParts && ! hasPatterns && (
|
|
159
154
|
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
160
|
-
<Item>
|
|
161
|
-
{ __(
|
|
162
|
-
'No template parts or patterns found'
|
|
163
|
-
) }
|
|
164
|
-
</Item>
|
|
155
|
+
<Item>{ __( 'No items found' ) }</Item>
|
|
165
156
|
</ItemGroup>
|
|
166
157
|
) }
|
|
167
158
|
<CategoriesGroup
|
|
159
|
+
path={ path }
|
|
168
160
|
templatePartAreas={ templatePartAreas }
|
|
169
161
|
patternCategories={ patternCategories }
|
|
170
162
|
currentCategory={ currentCategory }
|
|
@@ -17,7 +17,7 @@ import useEditedEntityRecord from '../use-edited-entity-record';
|
|
|
17
17
|
import { unlock } from '../../lock-unlock';
|
|
18
18
|
import { store as editSiteStore } from '../../store';
|
|
19
19
|
import SidebarButton from '../sidebar-button';
|
|
20
|
-
import { useAddedBy } from '../page-templates
|
|
20
|
+
import { useAddedBy } from '../page-templates/hooks';
|
|
21
21
|
import TemplateActions from '../template-actions';
|
|
22
22
|
import HomeTemplateDetails from './home-template-details';
|
|
23
23
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
@@ -9,8 +9,9 @@ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
|
9
9
|
* Internal dependencies
|
|
10
10
|
*/
|
|
11
11
|
import DataViewItem from '../sidebar-dataviews/dataview-item';
|
|
12
|
-
import { useAddedBy } from '../page-templates
|
|
12
|
+
import { useAddedBy } from '../page-templates/hooks';
|
|
13
13
|
import { layout } from '@wordpress/icons';
|
|
14
|
+
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
14
15
|
|
|
15
16
|
const EMPTY_ARRAY = [];
|
|
16
17
|
|
|
@@ -30,10 +31,9 @@ function TemplateDataviewItem( { template, isActive } ) {
|
|
|
30
31
|
|
|
31
32
|
export default function DataviewsTemplatesSidebarContent( {
|
|
32
33
|
activeView,
|
|
33
|
-
postType,
|
|
34
34
|
title,
|
|
35
35
|
} ) {
|
|
36
|
-
const { records } = useEntityRecords( 'postType',
|
|
36
|
+
const { records } = useEntityRecords( 'postType', TEMPLATE_POST_TYPE, {
|
|
37
37
|
per_page: -1,
|
|
38
38
|
} );
|
|
39
39
|
const firstItemPerAuthorText = useMemo( () => {
|
|
@@ -2,64 +2,32 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
5
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* Internal dependencies
|
|
10
9
|
*/
|
|
11
10
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
-
import { store as editSiteStore } from '../../store';
|
|
13
|
-
import {
|
|
14
|
-
TEMPLATE_POST_TYPE,
|
|
15
|
-
TEMPLATE_PART_POST_TYPE,
|
|
16
|
-
} from '../../utils/constants';
|
|
17
11
|
import { unlock } from '../../lock-unlock';
|
|
18
12
|
import DataviewsTemplatesSidebarContent from './content';
|
|
19
13
|
|
|
20
|
-
const config = {
|
|
21
|
-
[ TEMPLATE_POST_TYPE ]: {
|
|
22
|
-
title: __( 'Manage templates' ),
|
|
23
|
-
description: __(
|
|
24
|
-
'Create new templates, or reset any customizations made to the templates supplied by your theme.'
|
|
25
|
-
),
|
|
26
|
-
contentTitle: __( 'All templates' ),
|
|
27
|
-
},
|
|
28
|
-
[ TEMPLATE_PART_POST_TYPE ]: {
|
|
29
|
-
title: __( 'Manage template parts' ),
|
|
30
|
-
description: __(
|
|
31
|
-
'Create new template parts, or reset any customizations made to the template parts supplied by your theme.'
|
|
32
|
-
),
|
|
33
|
-
backPath: { path: '/patterns' },
|
|
34
|
-
contentTitle: __( 'All template parts' ),
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
14
|
const { useLocation } = unlock( routerPrivateApis );
|
|
39
15
|
|
|
40
|
-
export default function SidebarNavigationScreenTemplatesBrowse(
|
|
16
|
+
export default function SidebarNavigationScreenTemplatesBrowse() {
|
|
41
17
|
const {
|
|
42
|
-
params: {
|
|
18
|
+
params: { activeView = 'all' },
|
|
43
19
|
} = useLocation();
|
|
44
20
|
|
|
45
|
-
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
46
|
-
return !! select( editSiteStore ).getSettings()
|
|
47
|
-
.supportsTemplatePartsMode;
|
|
48
|
-
}, [] );
|
|
49
|
-
|
|
50
21
|
return (
|
|
51
22
|
<SidebarNavigationScreen
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
description={ config[ postType ].description }
|
|
57
|
-
backPath={ config[ postType ].backPath }
|
|
23
|
+
title={ __( 'Manage templates' ) }
|
|
24
|
+
description={ __(
|
|
25
|
+
'Create new templates, or reset any customizations made to the templates supplied by your theme.'
|
|
26
|
+
) }
|
|
58
27
|
content={
|
|
59
28
|
<DataviewsTemplatesSidebarContent
|
|
60
29
|
activeView={ activeView }
|
|
61
|
-
|
|
62
|
-
title={ config[ postType ].contentTitle }
|
|
30
|
+
title={ __( 'All templates' ) }
|
|
63
31
|
/>
|
|
64
32
|
}
|
|
65
33
|
/>
|
|
@@ -226,10 +226,6 @@ function useResolveEditedEntityAndContext( { path, postId, postType } ) {
|
|
|
226
226
|
return { isReady: true, postType: 'wp_template', postId, context };
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
if ( path === '/wp_template_part/all' && postId ) {
|
|
230
|
-
return { isReady: true, postType: 'wp_template_part', postId, context };
|
|
231
|
-
}
|
|
232
|
-
|
|
233
229
|
if ( postTypesWithoutParentTemplate.includes( postType ) ) {
|
|
234
230
|
return { isReady: true, postType, postId, context };
|
|
235
231
|
}
|
|
@@ -135,7 +135,7 @@ function ResetMenuItem( { template, onClose } ) {
|
|
|
135
135
|
onCancel={ () => setIsModalOpen( false ) }
|
|
136
136
|
confirmButtonText={ __( 'Reset' ) }
|
|
137
137
|
>
|
|
138
|
-
{ __( '
|
|
138
|
+
{ __( 'Reset to default and clear all customizations?' ) }
|
|
139
139
|
</ConfirmDialog>
|
|
140
140
|
</>
|
|
141
141
|
);
|