@wordpress/edit-site 5.31.0 → 5.32.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/block-editor/editor-canvas.js +8 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +15 -4
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +12 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -2
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +38 -0
- package/build/components/global-styles/background-panel.js.map +1 -0
- package/build/components/global-styles/font-families.js +1 -1
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +38 -9
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +20 -2
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/palette.js +3 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview-colors.js +2 -2
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/root-menu.js +8 -2
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-background.js +34 -0
- package/build/components/global-styles/screen-background.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +2 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +6 -4
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +3 -37
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +6 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/ui.js +4 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +10 -3
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +9 -2
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/layout/animation.js +129 -0
- package/build/components/layout/animation.js.map +1 -0
- package/build/components/layout/index.js +9 -17
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +21 -18
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +19 -17
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/index.js +18 -28
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +16 -58
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-templates-template-parts/actions.js +54 -41
- package/build/components/page-templates-template-parts/actions.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +26 -59
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +12 -1
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/save-button/index.js +45 -16
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +8 -112
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/sidebar/index.js +1 -5
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +1 -1
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +1 -1
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +5 -15
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +10 -16
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +5 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +10 -5
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -5
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/style-book/index.js +1 -1
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/hooks/index.js +0 -1
- package/build/hooks/index.js.map +1 -1
- package/build/store/selectors.js +1 -9
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +8 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +15 -4
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +13 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +1 -2
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +31 -0
- package/build-module/components/global-styles/background-panel.js.map +1 -0
- package/build-module/components/global-styles/font-families.js +1 -1
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +38 -9
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +20 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +3 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview-colors.js +2 -2
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +9 -3
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-background.js +26 -0
- package/build-module/components/global-styles/screen-background.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +2 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +6 -4
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +4 -38
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +6 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +10 -3
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +9 -2
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/layout/animation.js +122 -0
- package/build-module/components/layout/animation.js.map +1 -0
- package/build-module/components/layout/index.js +9 -17
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +21 -18
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +19 -17
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +20 -30
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +14 -55
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-templates-template-parts/actions.js +54 -40
- package/build-module/components/page-templates-template-parts/actions.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +29 -62
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +12 -1
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/save-button/index.js +46 -17
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +10 -114
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +1 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +1 -1
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -2
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +8 -18
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +11 -17
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +5 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +10 -5
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -5
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/style-book/index.js +1 -1
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/hooks/index.js +0 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/store/selectors.js +1 -9
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +116 -104
- package/build-style/style.css +116 -104
- package/package.json +44 -44
- package/src/components/block-editor/editor-canvas.js +14 -2
- package/src/components/block-editor/site-editor-canvas.js +10 -7
- package/src/components/editor/index.js +11 -4
- package/src/components/editor-canvas-container/index.js +0 -1
- package/src/components/global-styles/background-panel.js +34 -0
- package/src/components/global-styles/font-families.js +1 -1
- package/src/components/global-styles/font-library-modal/context.js +43 -14
- package/src/components/global-styles/font-library-modal/style.scss +1 -1
- package/src/components/global-styles/font-library-modal/utils/index.js +17 -4
- package/src/components/global-styles/palette.js +3 -1
- package/src/components/global-styles/preview-colors.js +2 -2
- package/src/components/global-styles/root-menu.js +12 -1
- package/src/components/global-styles/screen-background.js +29 -0
- package/src/components/global-styles/screen-color-palette.js +2 -2
- package/src/components/global-styles/screen-colors.js +4 -4
- package/src/components/global-styles/screen-style-variations.js +4 -36
- package/src/components/global-styles/screen-typography.js +6 -9
- package/src/components/global-styles/style-variations-container.js +2 -1
- package/src/components/global-styles/style.scss +14 -12
- package/src/components/global-styles/ui.js +5 -0
- package/src/components/global-styles/variations/style.scss +32 -17
- package/src/components/global-styles/variations/variations-color.js +4 -2
- package/src/components/global-styles/variations/variations-typography.js +4 -1
- package/src/components/header-edit-mode/style.scss +28 -17
- package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
- package/src/components/layout/animation.js +122 -0
- package/src/components/layout/index.js +12 -27
- package/src/components/layout/router.js +25 -19
- package/src/components/layout/style.scss +2 -0
- package/src/components/page-pages/index.js +27 -43
- package/src/components/page-patterns/index.js +20 -28
- package/src/components/page-patterns/search-items.js +13 -58
- package/src/components/page-templates-template-parts/actions.js +106 -91
- package/src/components/page-templates-template-parts/index.js +34 -78
- package/src/components/page-templates-template-parts/style.scss +5 -0
- package/src/components/plugin-template-setting-panel/index.js +14 -1
- package/src/components/save-button/index.js +55 -26
- package/src/components/save-hub/index.js +20 -164
- package/src/components/sidebar/index.js +0 -5
- package/src/components/sidebar-dataviews/default-views.js +1 -1
- package/src/components/sidebar-dataviews/index.js +1 -1
- package/src/components/sidebar-edit-mode/index.js +0 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +29 -60
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +10 -10
- package/src/components/sidebar-edit-mode/template-panel/index.js +23 -33
- package/src/components/sidebar-edit-mode/template-panel/style.scss +1 -29
- package/src/components/sidebar-navigation-screen/style.scss +12 -9
- package/src/components/sidebar-navigation-screen-details-footer/index.js +6 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +7 -13
- package/src/components/sidebar-navigation-screen-patterns/index.js +0 -7
- package/src/components/style-book/index.js +1 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +2 -2
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/src/hooks/index.js +0 -1
- package/src/store/selectors.js +3 -15
- package/src/style.scss +0 -1
- package/build/components/actions/index.js +0 -319
- package/build/components/actions/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +0 -48
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js +0 -70
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +0 -175
- package/build/components/sidebar-navigation-screen-pages/index.js.map +0 -1
- package/build/hooks/template-part-edit.js +0 -82
- package/build/hooks/template-part-edit.js.map +0 -1
- package/build/store/utils.js +0 -71
- package/build/store/utils.js.map +0 -1
- package/build-module/components/actions/index.js +0 -308
- package/build-module/components/actions/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +0 -40
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js +0 -63
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +0 -167
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +0 -1
- package/build-module/hooks/template-part-edit.js +0 -75
- package/build-module/hooks/template-part-edit.js.map +0 -1
- package/build-module/store/utils.js +0 -64
- package/build-module/store/utils.js.map +0 -1
- package/src/components/actions/index.js +0 -409
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +0 -53
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +0 -36
- package/src/components/sidebar-edit-mode/template-panel/template-areas.js +0 -86
- package/src/components/sidebar-navigation-screen-pages/index.js +0 -238
- package/src/hooks/template-part-edit.js +0 -89
- package/src/store/test/utils.js +0 -191
- package/src/store/utils.js +0 -69
|
@@ -3,9 +3,14 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
5
|
import { Button } from '@wordpress/components';
|
|
6
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
6
|
+
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
7
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
8
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
9
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
10
|
+
import {
|
|
11
|
+
useEntitiesSavedStatesIsDirty,
|
|
12
|
+
store as editorStore,
|
|
13
|
+
} from '@wordpress/editor';
|
|
9
14
|
|
|
10
15
|
/**
|
|
11
16
|
* Internal dependencies
|
|
@@ -15,30 +20,30 @@ import {
|
|
|
15
20
|
currentlyPreviewingTheme,
|
|
16
21
|
isPreviewingTheme,
|
|
17
22
|
} from '../../utils/is-previewing-theme';
|
|
23
|
+
import { unlock } from '../../lock-unlock';
|
|
24
|
+
|
|
25
|
+
const { useLocation } = unlock( routerPrivateApis );
|
|
18
26
|
|
|
19
27
|
export default function SaveButton( {
|
|
20
28
|
className = 'edit-site-save-button__button',
|
|
21
29
|
variant = 'primary',
|
|
22
30
|
showTooltip = true,
|
|
23
|
-
|
|
31
|
+
showReviewMessage,
|
|
24
32
|
icon,
|
|
25
33
|
size,
|
|
26
34
|
__next40pxDefaultSize = false,
|
|
27
35
|
} ) {
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
} = select( coreStore );
|
|
35
|
-
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
36
|
+
const { params } = useLocation();
|
|
37
|
+
const { setIsSaveViewOpened } = useDispatch( editSiteStore );
|
|
38
|
+
const { saveDirtyEntities } = unlock( useDispatch( editorStore ) );
|
|
39
|
+
const { dirtyEntityRecords } = useEntitiesSavedStatesIsDirty();
|
|
40
|
+
const { isSaving, isSaveViewOpen, previewingThemeName } = useSelect(
|
|
41
|
+
( select ) => {
|
|
42
|
+
const { isSavingEntityRecord, isResolving } = select( coreStore );
|
|
36
43
|
const { isSaveViewOpened } = select( editSiteStore );
|
|
37
44
|
const isActivatingTheme = isResolving( 'activateTheme' );
|
|
38
45
|
const currentlyPreviewingThemeId = currentlyPreviewingTheme();
|
|
39
|
-
|
|
40
46
|
return {
|
|
41
|
-
isDirty: dirtyEntityRecords.length > 0,
|
|
42
47
|
isSaving:
|
|
43
48
|
dirtyEntityRecords.some( ( record ) =>
|
|
44
49
|
isSavingEntityRecord(
|
|
@@ -55,12 +60,26 @@ export default function SaveButton( {
|
|
|
55
60
|
?.name?.rendered
|
|
56
61
|
: undefined,
|
|
57
62
|
};
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
},
|
|
64
|
+
[ dirtyEntityRecords ]
|
|
65
|
+
);
|
|
66
|
+
const hasDirtyEntities = !! dirtyEntityRecords.length;
|
|
67
|
+
let isOnlyCurrentEntityDirty;
|
|
68
|
+
// Check if the current entity is the only entity with changes.
|
|
69
|
+
// We have some extra logic for `wp_global_styles` for now, that
|
|
70
|
+
// is used in navigation sidebar.
|
|
71
|
+
if ( dirtyEntityRecords.length === 1 ) {
|
|
72
|
+
if ( params.postId ) {
|
|
73
|
+
isOnlyCurrentEntityDirty =
|
|
74
|
+
`${ dirtyEntityRecords[ 0 ].key }` === params.postId &&
|
|
75
|
+
dirtyEntityRecords[ 0 ].name === params.postType;
|
|
76
|
+
} else if ( params.path?.includes( 'wp_global_styles' ) ) {
|
|
77
|
+
isOnlyCurrentEntityDirty =
|
|
78
|
+
dirtyEntityRecords[ 0 ].name === 'globalStyles';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const disabled =
|
|
82
|
+
isSaving || ( ! hasDirtyEntities && ! isPreviewingTheme() );
|
|
64
83
|
const getLabel = () => {
|
|
65
84
|
if ( isPreviewingTheme() ) {
|
|
66
85
|
if ( isSaving ) {
|
|
@@ -71,32 +90,42 @@ export default function SaveButton( {
|
|
|
71
90
|
);
|
|
72
91
|
} else if ( disabled ) {
|
|
73
92
|
return __( 'Saved' );
|
|
74
|
-
} else if (
|
|
93
|
+
} else if ( hasDirtyEntities ) {
|
|
75
94
|
return sprintf(
|
|
76
95
|
/* translators: %s: The name of theme to be activated. */
|
|
77
96
|
__( 'Activate %s & Save' ),
|
|
78
97
|
previewingThemeName
|
|
79
98
|
);
|
|
80
99
|
}
|
|
81
|
-
|
|
82
100
|
return sprintf(
|
|
83
101
|
/* translators: %s: The name of theme to be activated. */
|
|
84
102
|
__( 'Activate %s' ),
|
|
85
103
|
previewingThemeName
|
|
86
104
|
);
|
|
87
105
|
}
|
|
88
|
-
|
|
89
106
|
if ( isSaving ) {
|
|
90
107
|
return __( 'Saving' );
|
|
91
|
-
}
|
|
108
|
+
}
|
|
109
|
+
if ( disabled ) {
|
|
92
110
|
return __( 'Saved' );
|
|
93
|
-
}
|
|
94
|
-
|
|
111
|
+
}
|
|
112
|
+
if ( ! isOnlyCurrentEntityDirty && showReviewMessage ) {
|
|
113
|
+
return sprintf(
|
|
114
|
+
// translators: %d: number of unsaved changes (number).
|
|
115
|
+
_n(
|
|
116
|
+
'Review %d change…',
|
|
117
|
+
'Review %d changes…',
|
|
118
|
+
dirtyEntityRecords.length
|
|
119
|
+
),
|
|
120
|
+
dirtyEntityRecords.length
|
|
121
|
+
);
|
|
95
122
|
}
|
|
96
123
|
return __( 'Save' );
|
|
97
124
|
};
|
|
98
125
|
const label = getLabel();
|
|
99
|
-
|
|
126
|
+
const onClick = isOnlyCurrentEntityDirty
|
|
127
|
+
? () => saveDirtyEntities( { dirtyEntityRecords } )
|
|
128
|
+
: () => setIsSaveViewOpened( true );
|
|
100
129
|
return (
|
|
101
130
|
<Button
|
|
102
131
|
variant={ variant }
|
|
@@ -104,7 +133,7 @@ export default function SaveButton( {
|
|
|
104
133
|
aria-disabled={ disabled }
|
|
105
134
|
aria-expanded={ isSaveViewOpen }
|
|
106
135
|
isBusy={ isSaving }
|
|
107
|
-
onClick={ disabled ? undefined :
|
|
136
|
+
onClick={ disabled ? undefined : onClick }
|
|
108
137
|
label={ label }
|
|
109
138
|
/*
|
|
110
139
|
* We want the tooltip to show the keyboard shortcut only when the
|
|
@@ -1,186 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { useSelect
|
|
5
|
-
import {
|
|
6
|
-
import { __, sprintf, _n } from '@wordpress/i18n';
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { __experimentalHStack as HStack } from '@wordpress/components';
|
|
7
6
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
7
|
import { check } from '@wordpress/icons';
|
|
10
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
11
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
12
8
|
|
|
13
9
|
/**
|
|
14
10
|
* Internal dependencies
|
|
15
11
|
*/
|
|
16
12
|
import SaveButton from '../save-button';
|
|
17
13
|
import { isPreviewingTheme } from '../../utils/is-previewing-theme';
|
|
18
|
-
import { unlock } from '../../lock-unlock';
|
|
19
|
-
import { NAVIGATION_POST_TYPE } from '../../utils/constants';
|
|
20
|
-
|
|
21
|
-
const { useLocation } = unlock( routerPrivateApis );
|
|
22
|
-
|
|
23
|
-
const PUBLISH_ON_SAVE_ENTITIES = [
|
|
24
|
-
{
|
|
25
|
-
kind: 'postType',
|
|
26
|
-
name: NAVIGATION_POST_TYPE,
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
14
|
|
|
30
15
|
export default function SaveHub() {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const { createSuccessNotice, createErrorNotice, removeNotice } =
|
|
38
|
-
useDispatch( noticesStore );
|
|
39
|
-
|
|
40
|
-
const { dirtyCurrentEntity, countUnsavedChanges, isDirty, isSaving } =
|
|
41
|
-
useSelect(
|
|
42
|
-
( select ) => {
|
|
43
|
-
const {
|
|
44
|
-
__experimentalGetDirtyEntityRecords,
|
|
45
|
-
isSavingEntityRecord,
|
|
46
|
-
} = select( coreStore );
|
|
47
|
-
const dirtyEntityRecords =
|
|
48
|
-
__experimentalGetDirtyEntityRecords();
|
|
49
|
-
let calcDirtyCurrentEntity = null;
|
|
50
|
-
|
|
51
|
-
if ( dirtyEntityRecords.length === 1 ) {
|
|
52
|
-
// if we are on global styles
|
|
53
|
-
if ( params.path?.includes( 'wp_global_styles' ) ) {
|
|
54
|
-
calcDirtyCurrentEntity = dirtyEntityRecords.find(
|
|
55
|
-
( record ) => record.name === 'globalStyles'
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
// if we are on pages
|
|
59
|
-
else if ( params.postId ) {
|
|
60
|
-
calcDirtyCurrentEntity = dirtyEntityRecords.find(
|
|
61
|
-
( record ) =>
|
|
62
|
-
record.name === params.postType &&
|
|
63
|
-
String( record.key ) === params.postId
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return {
|
|
69
|
-
dirtyCurrentEntity: calcDirtyCurrentEntity,
|
|
70
|
-
isDirty: dirtyEntityRecords.length > 0,
|
|
71
|
-
isSaving: dirtyEntityRecords.some( ( record ) =>
|
|
72
|
-
isSavingEntityRecord(
|
|
73
|
-
record.kind,
|
|
74
|
-
record.name,
|
|
75
|
-
record.key
|
|
76
|
-
)
|
|
77
|
-
),
|
|
78
|
-
countUnsavedChanges: dirtyEntityRecords.length,
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
[ params.path, params.postType, params.postId ]
|
|
16
|
+
const { isDisabled, isSaving } = useSelect( ( select ) => {
|
|
17
|
+
const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =
|
|
18
|
+
select( coreStore );
|
|
19
|
+
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
20
|
+
const _isSaving = dirtyEntityRecords.some( ( record ) =>
|
|
21
|
+
isSavingEntityRecord( record.kind, record.name, record.key )
|
|
82
22
|
);
|
|
83
|
-
|
|
84
|
-
const {
|
|
85
|
-
editEntityRecord,
|
|
86
|
-
saveEditedEntityRecord,
|
|
87
|
-
__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,
|
|
88
|
-
} = useDispatch( coreStore );
|
|
89
|
-
|
|
90
|
-
const disabled = isSaving || ( ! isDirty && ! isPreviewingTheme() );
|
|
91
|
-
|
|
92
|
-
// if we have only one unsaved change and it matches current context, we can show a more specific label
|
|
93
|
-
let label = dirtyCurrentEntity
|
|
94
|
-
? __( 'Save' )
|
|
95
|
-
: sprintf(
|
|
96
|
-
// translators: %d: number of unsaved changes (number).
|
|
97
|
-
_n(
|
|
98
|
-
'Review %d change…',
|
|
99
|
-
'Review %d changes…',
|
|
100
|
-
countUnsavedChanges
|
|
101
|
-
),
|
|
102
|
-
countUnsavedChanges
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
if ( isSaving ) {
|
|
106
|
-
label = __( 'Saving' );
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const { homeUrl } = useSelect( ( select ) => {
|
|
110
|
-
const {
|
|
111
|
-
getUnstableBase, // Site index.
|
|
112
|
-
} = select( coreStore );
|
|
113
23
|
return {
|
|
114
|
-
|
|
24
|
+
isSaving: _isSaving,
|
|
25
|
+
isDisabled:
|
|
26
|
+
_isSaving ||
|
|
27
|
+
( ! dirtyEntityRecords.length && ! isPreviewingTheme() ),
|
|
115
28
|
};
|
|
116
29
|
}, [] );
|
|
117
|
-
|
|
118
|
-
const saveCurrentEntity = async () => {
|
|
119
|
-
if ( ! dirtyCurrentEntity ) return;
|
|
120
|
-
|
|
121
|
-
removeNotice( saveNoticeId );
|
|
122
|
-
const { kind, name, key, property } = dirtyCurrentEntity;
|
|
123
|
-
|
|
124
|
-
try {
|
|
125
|
-
if ( 'root' === dirtyCurrentEntity.kind && 'site' === name ) {
|
|
126
|
-
await saveSpecifiedEntityEdits( 'root', 'site', undefined, [
|
|
127
|
-
property,
|
|
128
|
-
] );
|
|
129
|
-
} else {
|
|
130
|
-
if (
|
|
131
|
-
PUBLISH_ON_SAVE_ENTITIES.some(
|
|
132
|
-
( typeToPublish ) =>
|
|
133
|
-
typeToPublish.kind === kind &&
|
|
134
|
-
typeToPublish.name === name
|
|
135
|
-
)
|
|
136
|
-
) {
|
|
137
|
-
editEntityRecord( kind, name, key, { status: 'publish' } );
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
await saveEditedEntityRecord( kind, name, key );
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
__unstableMarkLastChangeAsPersistent();
|
|
144
|
-
|
|
145
|
-
createSuccessNotice( __( 'Site updated.' ), {
|
|
146
|
-
type: 'snackbar',
|
|
147
|
-
actions: [
|
|
148
|
-
{
|
|
149
|
-
label: __( 'View site' ),
|
|
150
|
-
url: homeUrl,
|
|
151
|
-
},
|
|
152
|
-
],
|
|
153
|
-
id: saveNoticeId,
|
|
154
|
-
} );
|
|
155
|
-
} catch ( error ) {
|
|
156
|
-
createErrorNotice( `${ __( 'Saving failed.' ) } ${ error }` );
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
30
|
return (
|
|
161
31
|
<HStack className="edit-site-save-hub" alignment="right" spacing={ 4 }>
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
__next40pxDefaultSize
|
|
171
|
-
>
|
|
172
|
-
{ label }
|
|
173
|
-
</Button>
|
|
174
|
-
) : (
|
|
175
|
-
<SaveButton
|
|
176
|
-
className="edit-site-save-hub__button"
|
|
177
|
-
variant={ disabled ? null : 'primary' }
|
|
178
|
-
showTooltip={ false }
|
|
179
|
-
icon={ disabled && ! isSaving ? check : null }
|
|
180
|
-
defaultLabel={ label }
|
|
181
|
-
__next40pxDefaultSize
|
|
182
|
-
/>
|
|
183
|
-
) }
|
|
32
|
+
<SaveButton
|
|
33
|
+
className="edit-site-save-hub__button"
|
|
34
|
+
variant={ isDisabled ? null : 'primary' }
|
|
35
|
+
showTooltip={ false }
|
|
36
|
+
icon={ isDisabled && ! isSaving ? check : null }
|
|
37
|
+
showReviewMessage
|
|
38
|
+
__next40pxDefaultSize
|
|
39
|
+
/>
|
|
184
40
|
</HStack>
|
|
185
41
|
);
|
|
186
42
|
}
|
|
@@ -31,7 +31,6 @@ import SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-gl
|
|
|
31
31
|
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
|
|
32
32
|
import SaveHub from '../save-hub';
|
|
33
33
|
import { unlock } from '../../lock-unlock';
|
|
34
|
-
import SidebarNavigationScreenPages from '../sidebar-navigation-screen-pages';
|
|
35
34
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
36
35
|
import DataViewsSidebarContent from '../sidebar-dataviews';
|
|
37
36
|
import SidebarNavigationScreenPage from '../sidebar-navigation-screen-page';
|
|
@@ -69,13 +68,9 @@ function SidebarScreens() {
|
|
|
69
68
|
<SidebarNavigationScreenGlobalStyles />
|
|
70
69
|
</SidebarScreenWrapper>
|
|
71
70
|
<SidebarScreenWrapper path="/page">
|
|
72
|
-
<SidebarNavigationScreenPages />
|
|
73
|
-
</SidebarScreenWrapper>
|
|
74
|
-
<SidebarScreenWrapper path="/pages">
|
|
75
71
|
<SidebarNavigationScreen
|
|
76
72
|
title={ __( 'Manage pages' ) }
|
|
77
73
|
content={ <DataViewsSidebarContent /> }
|
|
78
|
-
backPath="/page"
|
|
79
74
|
/>
|
|
80
75
|
</SidebarScreenWrapper>
|
|
81
76
|
<SidebarScreenWrapper path="/page/:postId">
|
|
@@ -22,7 +22,6 @@ import { STORE_NAME } from '../../store/constants';
|
|
|
22
22
|
import SettingsHeader from './settings-header';
|
|
23
23
|
import PagePanels from './page-panels';
|
|
24
24
|
import TemplatePanel from './template-panel';
|
|
25
|
-
import PluginTemplateSettingPanel from '../plugin-template-setting-panel';
|
|
26
25
|
import { SIDEBAR_BLOCK, SIDEBAR_TEMPLATE } from './constants';
|
|
27
26
|
import { store as editSiteStore } from '../../store';
|
|
28
27
|
import { unlock } from '../../lock-unlock';
|
|
@@ -96,7 +95,6 @@ const FillContents = ( {
|
|
|
96
95
|
focusable={ false }
|
|
97
96
|
>
|
|
98
97
|
{ isEditingPage ? <PagePanels /> : <TemplatePanel /> }
|
|
99
|
-
<PluginTemplateSettingPanel.Slot />
|
|
100
98
|
</Tabs.TabPanel>
|
|
101
99
|
<Tabs.TabPanel tabId={ SIDEBAR_BLOCK } focusable={ false }>
|
|
102
100
|
<InspectorSlot bubblesVirtually />
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
__experimentalText as Text,
|
|
7
|
-
__experimentalVStack as VStack,
|
|
8
|
-
} from '@wordpress/components';
|
|
9
|
-
import { page as pageIcon } from '@wordpress/icons';
|
|
10
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
11
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
4
|
+
import { PanelBody } from '@wordpress/components';
|
|
5
|
+
import { __ } from '@wordpress/i18n';
|
|
12
6
|
import { useSelect } from '@wordpress/data';
|
|
13
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
14
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
15
8
|
import {
|
|
16
9
|
PageAttributesPanel,
|
|
17
10
|
PluginDocumentSettingPanel,
|
|
@@ -20,50 +13,42 @@ import {
|
|
|
20
13
|
PostLastRevisionPanel,
|
|
21
14
|
PostTaxonomiesPanel,
|
|
22
15
|
store as editorStore,
|
|
16
|
+
privateApis as editorPrivateApis,
|
|
23
17
|
} from '@wordpress/editor';
|
|
24
18
|
|
|
25
19
|
/**
|
|
26
20
|
* Internal dependencies
|
|
27
21
|
*/
|
|
28
22
|
import { store as editSiteStore } from '../../../store';
|
|
29
|
-
import SidebarCard from '../sidebar-card';
|
|
30
23
|
import PageContent from './page-content';
|
|
31
24
|
import PageSummary from './page-summary';
|
|
25
|
+
import { unlock } from '../../../lock-unlock';
|
|
26
|
+
|
|
27
|
+
const { PostCardPanel } = unlock( editorPrivateApis );
|
|
32
28
|
|
|
33
29
|
export default function PagePanels() {
|
|
34
|
-
const {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
),
|
|
57
|
-
title: page?.title,
|
|
58
|
-
id: page?.id,
|
|
59
|
-
type: page?.type,
|
|
60
|
-
status: page?.status,
|
|
61
|
-
date: page?.date,
|
|
62
|
-
password: page?.password,
|
|
63
|
-
modified: page?.modified,
|
|
64
|
-
renderingMode: getRenderingMode(),
|
|
65
|
-
};
|
|
66
|
-
}, [] );
|
|
30
|
+
const { id, type, hasResolved, status, date, password, renderingMode } =
|
|
31
|
+
useSelect( ( select ) => {
|
|
32
|
+
const { getEditedPostContext } = select( editSiteStore );
|
|
33
|
+
const { getEditedEntityRecord, hasFinishedResolution } =
|
|
34
|
+
select( coreStore );
|
|
35
|
+
const { getRenderingMode } = select( editorStore );
|
|
36
|
+
const context = getEditedPostContext();
|
|
37
|
+
const queryArgs = [ 'postType', context.postType, context.postId ];
|
|
38
|
+
const page = getEditedEntityRecord( ...queryArgs );
|
|
39
|
+
return {
|
|
40
|
+
hasResolved: hasFinishedResolution(
|
|
41
|
+
'getEditedEntityRecord',
|
|
42
|
+
queryArgs
|
|
43
|
+
),
|
|
44
|
+
id: page?.id,
|
|
45
|
+
type: page?.type,
|
|
46
|
+
status: page?.status,
|
|
47
|
+
date: page?.date,
|
|
48
|
+
password: page?.password,
|
|
49
|
+
renderingMode: getRenderingMode(),
|
|
50
|
+
};
|
|
51
|
+
}, [] );
|
|
67
52
|
|
|
68
53
|
if ( ! hasResolved ) {
|
|
69
54
|
return null;
|
|
@@ -71,23 +56,7 @@ export default function PagePanels() {
|
|
|
71
56
|
|
|
72
57
|
return (
|
|
73
58
|
<>
|
|
74
|
-
<
|
|
75
|
-
<SidebarCard
|
|
76
|
-
title={ decodeEntities( title ) }
|
|
77
|
-
icon={ pageIcon }
|
|
78
|
-
description={
|
|
79
|
-
<VStack>
|
|
80
|
-
<Text>
|
|
81
|
-
{ sprintf(
|
|
82
|
-
// translators: %s: Human-readable time difference, e.g. "2 days ago".
|
|
83
|
-
__( 'Last edited %s' ),
|
|
84
|
-
humanTimeDiff( modified )
|
|
85
|
-
) }
|
|
86
|
-
</Text>
|
|
87
|
-
</VStack>
|
|
88
|
-
}
|
|
89
|
-
/>
|
|
90
|
-
</PanelBody>
|
|
59
|
+
<PostCardPanel />
|
|
91
60
|
<PanelBody title={ __( 'Summary' ) }>
|
|
92
61
|
<PageSummary
|
|
93
62
|
status={ status }
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
privateApis as blockEditorPrivateApis,
|
|
8
8
|
} from '@wordpress/block-editor';
|
|
9
|
-
import { useMemo } from '@wordpress/element';
|
|
10
9
|
|
|
11
10
|
/**
|
|
12
11
|
* Internal dependencies
|
|
@@ -15,15 +14,16 @@ import { unlock } from '../../../lock-unlock';
|
|
|
15
14
|
|
|
16
15
|
const { BlockQuickNavigation } = unlock( blockEditorPrivateApis );
|
|
17
16
|
|
|
17
|
+
const PAGE_CONTENT_BLOCKS = [
|
|
18
|
+
'core/post-content',
|
|
19
|
+
'core/post-featured-image',
|
|
20
|
+
'core/post-title',
|
|
21
|
+
];
|
|
22
|
+
|
|
18
23
|
export default function PageContent() {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
);
|
|
24
|
-
const clientIds = useMemo(
|
|
25
|
-
() => clientIdsTree.map( ( { clientId } ) => clientId ),
|
|
26
|
-
[ clientIdsTree ]
|
|
27
|
-
);
|
|
24
|
+
const clientIds = useSelect( ( select ) => {
|
|
25
|
+
const { getBlocksByName } = select( blockEditorStore );
|
|
26
|
+
return getBlocksByName( PAGE_CONTENT_BLOCKS );
|
|
27
|
+
}, [] );
|
|
28
28
|
return <BlockQuickNavigation clientIds={ clientIds } />;
|
|
29
29
|
}
|
|
@@ -9,11 +9,10 @@ import {
|
|
|
9
9
|
PostExcerptPanel,
|
|
10
10
|
PostLastRevisionPanel,
|
|
11
11
|
PostTaxonomiesPanel,
|
|
12
|
+
privateApis as editorPrivateApis,
|
|
12
13
|
store as editorStore,
|
|
13
14
|
} from '@wordpress/editor';
|
|
14
15
|
import { store as coreStore } from '@wordpress/core-data';
|
|
15
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
16
|
-
import { navigation, symbol } from '@wordpress/icons';
|
|
17
16
|
import { __ } from '@wordpress/i18n';
|
|
18
17
|
import { useAsyncList } from '@wordpress/compose';
|
|
19
18
|
import { serialize } from '@wordpress/blocks';
|
|
@@ -25,19 +24,15 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
25
24
|
*/
|
|
26
25
|
import { store as editSiteStore } from '../../../store';
|
|
27
26
|
import TemplateActions from '../../template-actions';
|
|
28
|
-
import
|
|
29
|
-
import SidebarCard from '../sidebar-card';
|
|
27
|
+
import PluginTemplateSettingPanel from '../../plugin-template-setting-panel';
|
|
30
28
|
import { useAvailablePatterns } from './hooks';
|
|
31
29
|
import { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';
|
|
32
30
|
import { unlock } from '../../../lock-unlock';
|
|
33
31
|
|
|
32
|
+
const { PostCardPanel } = unlock( editorPrivateApis );
|
|
33
|
+
const { PatternOverridesPanel } = unlock( editorPrivateApis );
|
|
34
34
|
const { useHistory } = unlock( routerPrivateApis );
|
|
35
35
|
|
|
36
|
-
const CARD_ICONS = {
|
|
37
|
-
wp_block: symbol,
|
|
38
|
-
wp_navigation: navigation,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
36
|
function TemplatesList( { availableTemplates, onSelect } ) {
|
|
42
37
|
const shownTemplates = useAsyncList( availableTemplates );
|
|
43
38
|
if ( ! availableTemplates || availableTemplates?.length === 0 ) {
|
|
@@ -61,7 +56,7 @@ const POST_TYPE_PATH = {
|
|
|
61
56
|
};
|
|
62
57
|
|
|
63
58
|
export default function TemplatePanel() {
|
|
64
|
-
const { title, description,
|
|
59
|
+
const { title, description, record, postType, postId } = useSelect(
|
|
65
60
|
( select ) => {
|
|
66
61
|
const { getEditedPostType, getEditedPostId } =
|
|
67
62
|
select( editSiteStore );
|
|
@@ -102,29 +97,23 @@ export default function TemplatePanel() {
|
|
|
102
97
|
|
|
103
98
|
return (
|
|
104
99
|
<>
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
/>
|
|
123
|
-
}
|
|
124
|
-
>
|
|
125
|
-
<TemplateAreas />
|
|
126
|
-
</SidebarCard>
|
|
127
|
-
</PanelBody>
|
|
100
|
+
<PostCardPanel
|
|
101
|
+
className="edit-site-template-card"
|
|
102
|
+
actions={
|
|
103
|
+
<TemplateActions
|
|
104
|
+
postType={ postType }
|
|
105
|
+
postId={ postId }
|
|
106
|
+
className="edit-site-template-card__actions"
|
|
107
|
+
toggleProps={ { size: 'small' } }
|
|
108
|
+
onRemove={ () => {
|
|
109
|
+
history.push( {
|
|
110
|
+
path: POST_TYPE_PATH[ postType ],
|
|
111
|
+
} );
|
|
112
|
+
} }
|
|
113
|
+
/>
|
|
114
|
+
}
|
|
115
|
+
/>
|
|
116
|
+
<PluginTemplateSettingPanel.Slot />
|
|
128
117
|
{ availablePatterns?.length > 0 && (
|
|
129
118
|
<PanelBody
|
|
130
119
|
title={ __( 'Transform into:' ) }
|
|
@@ -149,6 +138,7 @@ export default function TemplatePanel() {
|
|
|
149
138
|
<PostExcerptPanel />
|
|
150
139
|
<PostDiscussionPanel />
|
|
151
140
|
<PageAttributesPanel />
|
|
141
|
+
<PatternOverridesPanel />
|
|
152
142
|
</>
|
|
153
143
|
);
|
|
154
144
|
}
|