@wordpress/edit-site 5.30.0 → 5.31.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/actions/index.js +2 -4
- package/build/components/actions/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +16 -3
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +1 -1
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +0 -9
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +15 -8
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +4 -3
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +3 -2
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/upload-fonts.js +44 -10
- package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +2 -2
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/header.js +1 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +50 -1
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview-iframe.js +0 -1
- package/build/components/global-styles/preview-iframe.js.map +1 -1
- package/build/components/global-styles/preview-styles.js +2 -2
- package/build/components/global-styles/preview-styles.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +2 -9
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +1 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +3 -1
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
- package/build/components/global-styles/typography-example.js.map +1 -0
- package/build/components/global-styles/typography-preview.js +3 -1
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +8 -9
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +27 -37
- package/build/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build/components/header-edit-mode/index.js +2 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/global.js +17 -3
- package/build/components/keyboard-shortcuts/global.js.map +1 -1
- package/build/components/layout/router.js +2 -5
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +6 -11
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +6 -1
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/index.js +1 -4
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +9 -9
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +11 -16
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/save-panel/index.js +14 -9
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +2 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +2 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +4 -3
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +12 -6
- package/build/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +23 -3
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +13 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +4 -5
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +5 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- 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 -11
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +44 -27
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +11 -2
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build/utils/constants.js +5 -3
- package/build/utils/constants.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/math.js +98 -0
- package/build/utils/math.js.map +1 -0
- package/build-module/components/actions/index.js +3 -5
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +16 -3
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +0 -8
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +16 -9
- 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 +4 -3
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +4 -3
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js +44 -10
- package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +2 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +3 -0
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/header.js +1 -1
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +48 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview-iframe.js +0 -1
- package/build-module/components/global-styles/preview-iframe.js.map +1 -1
- package/build-module/components/global-styles/preview-styles.js +2 -2
- package/build-module/components/global-styles/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +2 -9
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +1 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +3 -1
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/{preview-typography.js → typography-example.js} +4 -2
- package/build-module/components/global-styles/typography-example.js.map +1 -0
- package/build-module/components/global-styles/typography-preview.js +3 -1
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +8 -9
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +28 -38
- package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +2 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +6 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/global.js +17 -3
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -1
- package/build-module/components/layout/router.js +2 -5
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +7 -12
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +6 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/index.js +2 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +9 -9
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +12 -17
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +14 -9
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +2 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +2 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +3 -3
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +4 -3
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +3 -3
- 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 +4 -2
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +13 -7
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +24 -4
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +14 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +3 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +6 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +5 -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 +2 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- 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 -11
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +44 -27
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +11 -2
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +15 -2
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
- package/build-module/utils/constants.js +4 -2
- package/build-module/utils/constants.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/math.js +92 -0
- package/build-module/utils/math.js.map +1 -0
- package/build-style/style-rtl.css +41 -37
- package/build-style/style.css +41 -37
- package/package.json +42 -42
- package/src/components/actions/index.js +3 -5
- package/src/components/block-editor/editor-canvas.js +20 -7
- package/src/components/block-editor/use-site-editor-settings.js +0 -2
- package/src/components/global-styles/color-palette-panel.js +0 -11
- package/src/components/global-styles/font-library-modal/context.js +34 -17
- package/src/components/global-styles/font-library-modal/font-collection.js +4 -3
- package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +9 -2
- package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -1
- package/src/components/global-styles/font-library-modal/style.scss +14 -5
- package/src/components/global-styles/font-library-modal/upload-fonts.js +53 -8
- package/src/components/global-styles/font-library-modal/utils/index.js +4 -4
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +4 -0
- package/src/components/global-styles/header.js +1 -1
- package/src/components/global-styles/hooks.js +68 -1
- package/src/components/global-styles/preview-iframe.js +0 -1
- package/src/components/global-styles/preview-styles.js +2 -2
- package/src/components/global-styles/screen-colors.js +2 -13
- package/src/components/global-styles/screen-typography.js +1 -12
- package/src/components/global-styles/style.scss +4 -1
- package/src/components/global-styles/typography-elements.js +5 -1
- package/src/components/global-styles/{preview-typography.js → typography-example.js} +3 -1
- package/src/components/global-styles/typography-preview.js +3 -1
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/global-styles/variations/style.scss +0 -6
- package/src/components/global-styles/variations/variations-color.js +9 -5
- package/src/components/global-styles/variations/variations-typography.js +37 -59
- package/src/components/header-edit-mode/index.js +1 -0
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/keyboard-shortcuts/global.js +16 -4
- package/src/components/layout/router.js +2 -7
- package/src/components/page-pages/index.js +8 -13
- package/src/components/page-patterns/delete-category-menu-item.js +7 -0
- package/src/components/page-patterns/index.js +2 -3
- package/src/components/page-patterns/use-patterns.js +17 -10
- package/src/components/page-templates-template-parts/index.js +14 -22
- package/src/components/save-panel/index.js +24 -17
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -2
- package/src/components/sidebar-dataviews/dataview-item.js +2 -2
- package/src/components/sidebar-dataviews/default-views.js +11 -3
- package/src/components/sidebar-dataviews/index.js +4 -3
- package/src/components/sidebar-edit-mode/page-panels/index.js +2 -2
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +30 -11
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +10 -11
- package/src/components/sidebar-edit-mode/template-panel/index.js +24 -5
- package/src/components/sidebar-navigation-screen/style.scss +10 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +35 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/{delete-modal.js → delete-confirm-dialog.js} +2 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +11 -9
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +6 -3
- package/src/components/sidebar-navigation-screen-template/index.js +6 -1
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +2 -2
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +1 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +3 -19
- package/src/components/template-actions/index.js +63 -46
- package/src/components/welcome-guide/editor.js +9 -6
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +21 -4
- package/src/style.scss +0 -1
- package/src/utils/constants.js +4 -2
- package/src/utils/get-is-list-page.js +1 -1
- package/src/utils/math.js +93 -0
- package/build/components/global-styles/preview-typography.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js +0 -50
- package/build/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
- package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/build-module/components/global-styles/preview-typography.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js +0 -42
- package/build-module/components/sidebar-edit-mode/template-panel/template-actions.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
- package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
|
@@ -25,6 +25,7 @@ export default function DataViewsSidebarContent() {
|
|
|
25
25
|
if ( ! path || ! PATH_TO_TYPE[ path ] ) {
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
+
const isCustomBoolean = isCustom === 'true';
|
|
28
29
|
const type = PATH_TO_TYPE[ path ];
|
|
29
30
|
|
|
30
31
|
return (
|
|
@@ -39,10 +40,10 @@ export default function DataViewsSidebarContent() {
|
|
|
39
40
|
icon={ dataview.icon }
|
|
40
41
|
type={ dataview.view.type }
|
|
41
42
|
isActive={
|
|
42
|
-
|
|
43
|
+
! isCustomBoolean &&
|
|
43
44
|
dataview.slug === activeView
|
|
44
45
|
}
|
|
45
|
-
isCustom=
|
|
46
|
+
isCustom={ false }
|
|
46
47
|
/>
|
|
47
48
|
);
|
|
48
49
|
} ) }
|
|
@@ -51,7 +52,7 @@ export default function DataViewsSidebarContent() {
|
|
|
51
52
|
<CustomDataViewsList
|
|
52
53
|
activeView={ activeView }
|
|
53
54
|
type={ type }
|
|
54
|
-
isCustom
|
|
55
|
+
isCustom
|
|
55
56
|
/>
|
|
56
57
|
) }
|
|
57
58
|
</>
|
|
@@ -14,9 +14,9 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
14
14
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
15
15
|
import {
|
|
16
16
|
PageAttributesPanel,
|
|
17
|
+
PluginDocumentSettingPanel,
|
|
17
18
|
PostDiscussionPanel,
|
|
18
19
|
PostExcerptPanel,
|
|
19
|
-
PostFeaturedImagePanel,
|
|
20
20
|
PostLastRevisionPanel,
|
|
21
21
|
PostTaxonomiesPanel,
|
|
22
22
|
store as editorStore,
|
|
@@ -97,6 +97,7 @@ export default function PagePanels() {
|
|
|
97
97
|
postType={ type }
|
|
98
98
|
/>
|
|
99
99
|
</PanelBody>
|
|
100
|
+
<PluginDocumentSettingPanel.Slot />
|
|
100
101
|
{ renderingMode !== 'post-only' && (
|
|
101
102
|
<PanelBody title={ __( 'Content' ) }>
|
|
102
103
|
<PageContent />
|
|
@@ -104,7 +105,6 @@ export default function PagePanels() {
|
|
|
104
105
|
) }
|
|
105
106
|
<PostLastRevisionPanel />
|
|
106
107
|
<PostTaxonomiesPanel />
|
|
107
|
-
<PostFeaturedImagePanel />
|
|
108
108
|
<PostExcerptPanel />
|
|
109
109
|
<PostDiscussionPanel />
|
|
110
110
|
<PageAttributesPanel />
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PostURLPanel,
|
|
8
8
|
PostSchedulePanel,
|
|
9
9
|
PostTemplatePanel,
|
|
10
|
+
PostFeaturedImagePanel,
|
|
10
11
|
} from '@wordpress/editor';
|
|
11
12
|
|
|
12
13
|
/**
|
|
@@ -23,6 +24,7 @@ export default function PageSummary( {
|
|
|
23
24
|
} ) {
|
|
24
25
|
return (
|
|
25
26
|
<VStack spacing={ 0 }>
|
|
27
|
+
<PostFeaturedImagePanel withPanelBody={ false } />
|
|
26
28
|
<PageStatus
|
|
27
29
|
status={ status }
|
|
28
30
|
date={ date }
|
|
@@ -6,7 +6,12 @@ import classnames from 'classnames';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
Icon,
|
|
11
|
+
__experimentalText as Text,
|
|
12
|
+
__experimentalHStack as HStack,
|
|
13
|
+
__experimentalVStack as VStack,
|
|
14
|
+
} from '@wordpress/components';
|
|
10
15
|
|
|
11
16
|
export default function SidebarCard( {
|
|
12
17
|
className,
|
|
@@ -18,17 +23,31 @@ export default function SidebarCard( {
|
|
|
18
23
|
} ) {
|
|
19
24
|
return (
|
|
20
25
|
<div className={ classnames( 'edit-site-sidebar-card', className ) }>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
{
|
|
29
|
-
|
|
26
|
+
<HStack
|
|
27
|
+
spacing={ 2 }
|
|
28
|
+
className="edit-site-sidebar-card__header"
|
|
29
|
+
align="flex-start"
|
|
30
|
+
>
|
|
31
|
+
<Icon className="edit-site-sidebar-card__icon" icon={ icon } />
|
|
32
|
+
<Text
|
|
33
|
+
numberOfLines={ 2 }
|
|
34
|
+
truncate
|
|
35
|
+
className="edit-site-sidebar-card__title"
|
|
36
|
+
weight={ 500 }
|
|
37
|
+
as="h2"
|
|
38
|
+
>
|
|
39
|
+
{ title }
|
|
40
|
+
</Text>
|
|
41
|
+
{ actions }
|
|
42
|
+
</HStack>
|
|
43
|
+
<VStack className="edit-site-sidebar-card__content">
|
|
44
|
+
{ description && (
|
|
45
|
+
<div className="edit-site-sidebar-card__description">
|
|
46
|
+
{ description }
|
|
47
|
+
</div>
|
|
48
|
+
) }
|
|
30
49
|
{ children }
|
|
31
|
-
</
|
|
50
|
+
</VStack>
|
|
32
51
|
</div>
|
|
33
52
|
);
|
|
34
53
|
}
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
.edit-site-sidebar-card {
|
|
2
|
-
display: flex;
|
|
3
|
-
align-items: flex-start;
|
|
4
|
-
|
|
5
2
|
&__content {
|
|
6
3
|
flex-grow: 1;
|
|
7
|
-
margin-bottom: $grid-unit-05;
|
|
8
4
|
}
|
|
9
5
|
|
|
10
6
|
&__title {
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
width: 100%;
|
|
8
|
+
|
|
13
9
|
&.edit-site-sidebar-card__title {
|
|
14
|
-
font-size:
|
|
15
|
-
line-height: $
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
line-height: $icon-size;
|
|
16
12
|
margin: 0;
|
|
17
|
-
padding: 3px 0; // This makes the title as high as the icon.
|
|
18
13
|
}
|
|
19
14
|
}
|
|
20
15
|
|
|
21
16
|
&__description {
|
|
22
17
|
font-size: $default-font-size;
|
|
18
|
+
color: $gray-700;
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
&__icon {
|
|
26
22
|
flex: 0 0 $icon-size;
|
|
27
|
-
margin-right: $grid-unit-15;
|
|
28
23
|
width: $icon-size;
|
|
29
24
|
height: $icon-size;
|
|
30
25
|
}
|
|
@@ -32,6 +27,10 @@
|
|
|
32
27
|
&__header {
|
|
33
28
|
display: flex;
|
|
34
29
|
justify-content: space-between;
|
|
35
|
-
margin: 0 0 $grid-unit-
|
|
30
|
+
margin: 0 0 $grid-unit-15;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.edit-site-template-card__actions {
|
|
34
|
+
flex-shrink: 0;
|
|
36
35
|
}
|
|
37
36
|
}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
PageAttributesPanel,
|
|
8
8
|
PostDiscussionPanel,
|
|
9
9
|
PostExcerptPanel,
|
|
10
|
-
PostFeaturedImagePanel,
|
|
11
10
|
PostLastRevisionPanel,
|
|
12
11
|
PostTaxonomiesPanel,
|
|
13
12
|
store as editorStore,
|
|
@@ -19,16 +18,20 @@ import { __ } from '@wordpress/i18n';
|
|
|
19
18
|
import { useAsyncList } from '@wordpress/compose';
|
|
20
19
|
import { serialize } from '@wordpress/blocks';
|
|
21
20
|
import { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
|
|
21
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Internal dependencies
|
|
25
25
|
*/
|
|
26
26
|
import { store as editSiteStore } from '../../../store';
|
|
27
|
-
import TemplateActions from '
|
|
27
|
+
import TemplateActions from '../../template-actions';
|
|
28
28
|
import TemplateAreas from './template-areas';
|
|
29
29
|
import SidebarCard from '../sidebar-card';
|
|
30
30
|
import { useAvailablePatterns } from './hooks';
|
|
31
31
|
import { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';
|
|
32
|
+
import { unlock } from '../../../lock-unlock';
|
|
33
|
+
|
|
34
|
+
const { useHistory } = unlock( routerPrivateApis );
|
|
32
35
|
|
|
33
36
|
const CARD_ICONS = {
|
|
34
37
|
wp_block: symbol,
|
|
@@ -52,6 +55,11 @@ function TemplatesList( { availableTemplates, onSelect } ) {
|
|
|
52
55
|
);
|
|
53
56
|
}
|
|
54
57
|
|
|
58
|
+
const POST_TYPE_PATH = {
|
|
59
|
+
wp_template: '/wp_template',
|
|
60
|
+
wp_template_part: '/wp_template_part/all',
|
|
61
|
+
};
|
|
62
|
+
|
|
55
63
|
export default function TemplatePanel() {
|
|
56
64
|
const { title, description, icon, record, postType, postId } = useSelect(
|
|
57
65
|
( select ) => {
|
|
@@ -77,7 +85,7 @@ export default function TemplatePanel() {
|
|
|
77
85
|
},
|
|
78
86
|
[]
|
|
79
87
|
);
|
|
80
|
-
|
|
88
|
+
const history = useHistory();
|
|
81
89
|
const availablePatterns = useAvailablePatterns( record );
|
|
82
90
|
const { editEntityRecord } = useDispatch( coreStore );
|
|
83
91
|
|
|
@@ -100,7 +108,19 @@ export default function TemplatePanel() {
|
|
|
100
108
|
title={ decodeEntities( title ) }
|
|
101
109
|
icon={ CARD_ICONS[ record?.type ] ?? icon }
|
|
102
110
|
description={ decodeEntities( description ) }
|
|
103
|
-
actions={
|
|
111
|
+
actions={
|
|
112
|
+
<TemplateActions
|
|
113
|
+
postType={ postType }
|
|
114
|
+
postId={ postId }
|
|
115
|
+
className="edit-site-template-card__actions"
|
|
116
|
+
toggleProps={ { size: 'small' } }
|
|
117
|
+
onRemove={ () => {
|
|
118
|
+
history.push( {
|
|
119
|
+
path: POST_TYPE_PATH[ postType ],
|
|
120
|
+
} );
|
|
121
|
+
} }
|
|
122
|
+
/>
|
|
123
|
+
}
|
|
104
124
|
>
|
|
105
125
|
<TemplateAreas />
|
|
106
126
|
</SidebarCard>
|
|
@@ -126,7 +146,6 @@ export default function TemplatePanel() {
|
|
|
126
146
|
) }
|
|
127
147
|
<PostLastRevisionPanel />
|
|
128
148
|
<PostTaxonomiesPanel />
|
|
129
|
-
<PostFeaturedImagePanel />
|
|
130
149
|
<PostExcerptPanel />
|
|
131
150
|
<PostDiscussionPanel />
|
|
132
151
|
<PageAttributesPanel />
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
flex-shrink: 0;
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
.edit-site-sidebar-navigation-screen__content .edit-site-global-styles-
|
|
80
|
+
.edit-site-sidebar-navigation-screen__content .edit-site-global-styles-variation-container {
|
|
81
81
|
@include break-medium() {
|
|
82
82
|
// Safari does not currently support `scrollbar-gutter: stable`, so at
|
|
83
83
|
// particular viewport sizes it's possible for previews to render prior to a
|
|
@@ -90,7 +90,16 @@
|
|
|
90
90
|
// See: https://github.com/WordPress/gutenberg/issues/55112
|
|
91
91
|
max-width: 292px;
|
|
92
92
|
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.edit-site-global-styles-variation-title {
|
|
96
|
+
color: $gray-300;
|
|
97
|
+
font-size: 11px;
|
|
98
|
+
text-transform: uppercase;
|
|
99
|
+
font-weight: 500;
|
|
100
|
+
}
|
|
93
101
|
|
|
102
|
+
.edit-site-sidebar-navigation-screen__content .edit-site-global-styles-style-variations-container {
|
|
94
103
|
.edit-site-global-styles-variations_item-preview {
|
|
95
104
|
box-shadow: 0 0 0 $border-width $gray-900;
|
|
96
105
|
}
|
|
@@ -5,7 +5,10 @@ import { __ } from '@wordpress/i18n';
|
|
|
5
5
|
import { edit, seen } from '@wordpress/icons';
|
|
6
6
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
7
7
|
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
__experimentalNavigatorButton as NavigatorButton,
|
|
10
|
+
__experimentalVStack as VStack,
|
|
11
|
+
} from '@wordpress/components';
|
|
9
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
10
13
|
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
11
14
|
import { useCallback } from '@wordpress/element';
|
|
@@ -24,6 +27,12 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
24
27
|
import StyleBook from '../style-book';
|
|
25
28
|
import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
|
|
26
29
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
30
|
+
import ColorVariations from '../global-styles/variations/variations-color';
|
|
31
|
+
import TypographyVariations from '../global-styles/variations/variations-typography';
|
|
32
|
+
import {
|
|
33
|
+
useColorVariations,
|
|
34
|
+
useTypographyVariations,
|
|
35
|
+
} from '../global-styles/hooks';
|
|
27
36
|
|
|
28
37
|
const noop = () => {};
|
|
29
38
|
|
|
@@ -69,6 +78,9 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
69
78
|
};
|
|
70
79
|
}, [] );
|
|
71
80
|
|
|
81
|
+
const colorVariations = useColorVariations();
|
|
82
|
+
const typographyVariations = useTypographyVariations();
|
|
83
|
+
|
|
72
84
|
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
|
|
73
85
|
// loaded. This is necessary because the Iframe component waits until
|
|
74
86
|
// the block editor store's `__internalIsInitialized` is true before
|
|
@@ -80,7 +92,28 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
80
92
|
onChange={ noop }
|
|
81
93
|
onInput={ noop }
|
|
82
94
|
>
|
|
83
|
-
<
|
|
95
|
+
<VStack
|
|
96
|
+
spacing={ 10 }
|
|
97
|
+
className="edit-site-global-styles-variation-container"
|
|
98
|
+
>
|
|
99
|
+
<StyleVariationsContainer />
|
|
100
|
+
{ colorVariations?.length && (
|
|
101
|
+
<div>
|
|
102
|
+
<h3 className="edit-site-global-styles-variation-title">
|
|
103
|
+
{ __( 'Colors' ) }
|
|
104
|
+
</h3>
|
|
105
|
+
<ColorVariations />
|
|
106
|
+
</div>
|
|
107
|
+
) }
|
|
108
|
+
{ typographyVariations?.length && (
|
|
109
|
+
<div>
|
|
110
|
+
<h3 className="edit-site-global-styles-variation-title">
|
|
111
|
+
{ __( 'Typography' ) }
|
|
112
|
+
</h3>
|
|
113
|
+
<TypographyVariations />
|
|
114
|
+
</div>
|
|
115
|
+
) }
|
|
116
|
+
</VStack>
|
|
84
117
|
</BlockEditorProvider>
|
|
85
118
|
);
|
|
86
119
|
}
|
|
@@ -4,12 +4,11 @@
|
|
|
4
4
|
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
5
5
|
import { __ } from '@wordpress/i18n';
|
|
6
6
|
|
|
7
|
-
export default function
|
|
7
|
+
export default function DeleteConfirmDialog( { onClose, onConfirm } ) {
|
|
8
8
|
return (
|
|
9
9
|
<ConfirmDialog
|
|
10
10
|
isOpen
|
|
11
|
-
onConfirm={ (
|
|
12
|
-
e.preventDefault();
|
|
11
|
+
onConfirm={ () => {
|
|
13
12
|
onConfirm();
|
|
14
13
|
|
|
15
14
|
// Immediate close avoids ability to hit delete multiple times.
|
|
@@ -10,7 +10,7 @@ import { useState } from '@wordpress/element';
|
|
|
10
10
|
* Internal dependencies
|
|
11
11
|
*/
|
|
12
12
|
import RenameModal from './rename-modal';
|
|
13
|
-
import
|
|
13
|
+
import DeleteConfirmDialog from './delete-confirm-dialog';
|
|
14
14
|
|
|
15
15
|
const POPOVER_PROPS = {
|
|
16
16
|
position: 'bottom right',
|
|
@@ -20,14 +20,15 @@ export default function ScreenNavigationMoreMenu( props ) {
|
|
|
20
20
|
const { onDelete, onSave, onDuplicate, menuTitle } = props;
|
|
21
21
|
|
|
22
22
|
const [ renameModalOpen, setRenameModalOpen ] = useState( false );
|
|
23
|
-
const [
|
|
23
|
+
const [ deleteConfirmDialogOpen, setDeleteConfirmDialogOpen ] =
|
|
24
|
+
useState( false );
|
|
24
25
|
|
|
25
26
|
const closeModals = () => {
|
|
26
27
|
setRenameModalOpen( false );
|
|
27
|
-
|
|
28
|
+
setDeleteConfirmDialogOpen( false );
|
|
28
29
|
};
|
|
29
30
|
const openRenameModal = () => setRenameModalOpen( true );
|
|
30
|
-
const
|
|
31
|
+
const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen( true );
|
|
31
32
|
|
|
32
33
|
return (
|
|
33
34
|
<>
|
|
@@ -60,7 +61,7 @@ export default function ScreenNavigationMoreMenu( props ) {
|
|
|
60
61
|
<MenuItem
|
|
61
62
|
isDestructive
|
|
62
63
|
onClick={ () => {
|
|
63
|
-
|
|
64
|
+
openDeleteConfirmDialog();
|
|
64
65
|
|
|
65
66
|
// Close the dropdown after opening the modal.
|
|
66
67
|
onClose();
|
|
@@ -72,11 +73,12 @@ export default function ScreenNavigationMoreMenu( props ) {
|
|
|
72
73
|
</div>
|
|
73
74
|
) }
|
|
74
75
|
</DropdownMenu>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
{ deleteConfirmDialogOpen && (
|
|
77
|
+
<DeleteConfirmDialog
|
|
78
|
+
onClose={ closeModals }
|
|
79
|
+
onConfirm={ onDelete }
|
|
80
|
+
/>
|
|
78
81
|
) }
|
|
79
|
-
|
|
80
82
|
{ renameModalOpen && (
|
|
81
83
|
<RenameModal
|
|
82
84
|
onClose={ closeModals }
|
package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
CHANGED
|
@@ -35,9 +35,12 @@ function useDeleteNavigationMenu() {
|
|
|
35
35
|
throwOnError: true,
|
|
36
36
|
}
|
|
37
37
|
);
|
|
38
|
-
createSuccessNotice(
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
createSuccessNotice(
|
|
39
|
+
__( 'Navigation menu successfully deleted.' ),
|
|
40
|
+
{
|
|
41
|
+
type: 'snackbar',
|
|
42
|
+
}
|
|
43
|
+
);
|
|
41
44
|
goTo( '/navigation' );
|
|
42
45
|
} catch ( error ) {
|
|
43
46
|
createErrorNotice(
|
|
@@ -93,6 +93,11 @@ function useTemplateDetails( postType, postId ) {
|
|
|
93
93
|
return { title, description, content, footer };
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
+
const POST_TYPE_PATH = {
|
|
97
|
+
wp_template: '/wp_template',
|
|
98
|
+
wp_template_part: '/wp_template_part/all',
|
|
99
|
+
};
|
|
100
|
+
|
|
96
101
|
export default function SidebarNavigationScreenTemplate() {
|
|
97
102
|
const navigator = useNavigator();
|
|
98
103
|
const {
|
|
@@ -114,7 +119,7 @@ export default function SidebarNavigationScreenTemplate() {
|
|
|
114
119
|
postId={ postId }
|
|
115
120
|
toggleProps={ { as: SidebarButton } }
|
|
116
121
|
onRemove={ () => {
|
|
117
|
-
navigator.goTo(
|
|
122
|
+
navigator.goTo( POST_TYPE_PATH[ postType ] );
|
|
118
123
|
} }
|
|
119
124
|
/>
|
|
120
125
|
<SidebarButton
|
|
@@ -23,7 +23,7 @@ function TemplateDataviewItem( { template, isActive } ) {
|
|
|
23
23
|
title={ text }
|
|
24
24
|
icon={ icon }
|
|
25
25
|
isActive={ isActive }
|
|
26
|
-
isCustom=
|
|
26
|
+
isCustom={ false }
|
|
27
27
|
/>
|
|
28
28
|
);
|
|
29
29
|
}
|
|
@@ -57,7 +57,7 @@ export default function DataviewsTemplatesSidebarContent( {
|
|
|
57
57
|
title={ title }
|
|
58
58
|
icon={ layout }
|
|
59
59
|
isActive={ activeView === 'all' }
|
|
60
|
-
isCustom=
|
|
60
|
+
isCustom={ false }
|
|
61
61
|
/>
|
|
62
62
|
{ firstItemPerAuthorText.map( ( template ) => {
|
|
63
63
|
return (
|
|
@@ -207,7 +207,7 @@ function useResolveEditedEntityAndContext( { path, postId, postType } ) {
|
|
|
207
207
|
return {};
|
|
208
208
|
}, [ homepageId, postType, postId, path ] );
|
|
209
209
|
|
|
210
|
-
if ( path === '/wp_template
|
|
210
|
+
if ( path === '/wp_template' && postId ) {
|
|
211
211
|
return { isReady: true, postType: 'wp_template', postId, context };
|
|
212
212
|
}
|
|
213
213
|
|
|
@@ -101,28 +101,12 @@ export default function useSyncPathWithURL() {
|
|
|
101
101
|
canvas: undefined,
|
|
102
102
|
path: navigatorLocation.path,
|
|
103
103
|
} );
|
|
104
|
-
} else if (
|
|
105
|
-
navigatorLocation.path === '/wp_template/all' &&
|
|
106
|
-
! window?.__experimentalAdminViews
|
|
107
|
-
) {
|
|
108
|
-
// When the experiment is disabled, we only support table layout.
|
|
109
|
-
// Clear it out from the URL, so layouts other than table cannot be accessed.
|
|
110
|
-
updateUrlParams( {
|
|
111
|
-
postType: undefined,
|
|
112
|
-
categoryType: undefined,
|
|
113
|
-
categoryId: undefined,
|
|
114
|
-
path: navigatorLocation.path,
|
|
115
|
-
layout: undefined,
|
|
116
|
-
} );
|
|
117
104
|
} else if (
|
|
118
105
|
// These sidebar paths are special in the sense that the url in these pages may or may not have a postId and we need to retain it if it has.
|
|
119
106
|
// The "type" property should be kept as well.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
window?.__experimentalAdminViews ) ||
|
|
124
|
-
( navigatorLocation.path === '/wp_template_part/all' &&
|
|
125
|
-
window?.__experimentalAdminViews )
|
|
107
|
+
navigatorLocation.path === '/pages' ||
|
|
108
|
+
navigatorLocation.path === '/wp_template' ||
|
|
109
|
+
navigatorLocation.path === '/wp_template_part/all'
|
|
126
110
|
) {
|
|
127
111
|
updateUrlParams( {
|
|
128
112
|
postType: undefined,
|
|
@@ -36,10 +36,7 @@ export default function TemplateActions( {
|
|
|
36
36
|
select( coreStore ).getEntityRecord( 'postType', postType, postId ),
|
|
37
37
|
[ postType, postId ]
|
|
38
38
|
);
|
|
39
|
-
const { removeTemplate
|
|
40
|
-
const { saveEditedEntityRecord } = useDispatch( coreStore );
|
|
41
|
-
const { createSuccessNotice, createErrorNotice } =
|
|
42
|
-
useDispatch( noticesStore );
|
|
39
|
+
const { removeTemplate } = useDispatch( editSiteStore );
|
|
43
40
|
const isRemovable = isTemplateRemovable( template );
|
|
44
41
|
const isRevertable = isTemplateRevertable( template );
|
|
45
42
|
|
|
@@ -47,6 +44,49 @@ export default function TemplateActions( {
|
|
|
47
44
|
return null;
|
|
48
45
|
}
|
|
49
46
|
|
|
47
|
+
return (
|
|
48
|
+
<DropdownMenu
|
|
49
|
+
icon={ moreVertical }
|
|
50
|
+
label={ __( 'Actions' ) }
|
|
51
|
+
className={ className }
|
|
52
|
+
toggleProps={ toggleProps }
|
|
53
|
+
>
|
|
54
|
+
{ ( { onClose } ) => (
|
|
55
|
+
<MenuGroup>
|
|
56
|
+
{ isRemovable && (
|
|
57
|
+
<>
|
|
58
|
+
<RenameMenuItem
|
|
59
|
+
template={ template }
|
|
60
|
+
onClose={ onClose }
|
|
61
|
+
/>
|
|
62
|
+
<DeleteMenuItem
|
|
63
|
+
onRemove={ () => {
|
|
64
|
+
removeTemplate( template );
|
|
65
|
+
onRemove?.();
|
|
66
|
+
onClose();
|
|
67
|
+
} }
|
|
68
|
+
title={ template.title.rendered }
|
|
69
|
+
/>
|
|
70
|
+
</>
|
|
71
|
+
) }
|
|
72
|
+
{ isRevertable && (
|
|
73
|
+
<ResetMenuItem
|
|
74
|
+
template={ template }
|
|
75
|
+
onClose={ onClose }
|
|
76
|
+
/>
|
|
77
|
+
) }
|
|
78
|
+
</MenuGroup>
|
|
79
|
+
) }
|
|
80
|
+
</DropdownMenu>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function ResetMenuItem( { template, onClose } ) {
|
|
85
|
+
const [ isModalOpen, setIsModalOpen ] = useState( false );
|
|
86
|
+
const { revertTemplate } = useDispatch( editSiteStore );
|
|
87
|
+
const { saveEditedEntityRecord } = useDispatch( coreStore );
|
|
88
|
+
const { createSuccessNotice, createErrorNotice } =
|
|
89
|
+
useDispatch( noticesStore );
|
|
50
90
|
async function revertAndSaveTemplate() {
|
|
51
91
|
try {
|
|
52
92
|
await revertTemplate( template, { allowUndo: false } );
|
|
@@ -55,7 +95,6 @@ export default function TemplateActions( {
|
|
|
55
95
|
template.type,
|
|
56
96
|
template.id
|
|
57
97
|
);
|
|
58
|
-
|
|
59
98
|
createSuccessNotice(
|
|
60
99
|
sprintf(
|
|
61
100
|
/* translators: The template/part's name. */
|
|
@@ -82,48 +121,26 @@ export default function TemplateActions( {
|
|
|
82
121
|
createErrorNotice( errorMessage, { type: 'snackbar' } );
|
|
83
122
|
}
|
|
84
123
|
}
|
|
85
|
-
|
|
86
124
|
return (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
} }
|
|
107
|
-
title={ template.title.rendered }
|
|
108
|
-
/>
|
|
109
|
-
</>
|
|
110
|
-
) }
|
|
111
|
-
{ isRevertable && (
|
|
112
|
-
<MenuItem
|
|
113
|
-
info={ __(
|
|
114
|
-
'Use the template as supplied by the theme.'
|
|
115
|
-
) }
|
|
116
|
-
onClick={ () => {
|
|
117
|
-
revertAndSaveTemplate();
|
|
118
|
-
onClose();
|
|
119
|
-
} }
|
|
120
|
-
>
|
|
121
|
-
{ __( 'Clear customizations' ) }
|
|
122
|
-
</MenuItem>
|
|
123
|
-
) }
|
|
124
|
-
</MenuGroup>
|
|
125
|
-
) }
|
|
126
|
-
</DropdownMenu>
|
|
125
|
+
<>
|
|
126
|
+
<MenuItem
|
|
127
|
+
info={ __( 'Use the template as supplied by the theme.' ) }
|
|
128
|
+
onClick={ () => setIsModalOpen( true ) }
|
|
129
|
+
>
|
|
130
|
+
{ __( 'Clear customizations' ) }
|
|
131
|
+
</MenuItem>
|
|
132
|
+
<ConfirmDialog
|
|
133
|
+
isOpen={ isModalOpen }
|
|
134
|
+
onConfirm={ () => {
|
|
135
|
+
revertAndSaveTemplate();
|
|
136
|
+
onClose();
|
|
137
|
+
} }
|
|
138
|
+
onCancel={ () => setIsModalOpen( false ) }
|
|
139
|
+
confirmButtonText={ __( 'Clear' ) }
|
|
140
|
+
>
|
|
141
|
+
{ __( 'Are you sure you want to clear these customizations?' ) }
|
|
142
|
+
</ConfirmDialog>
|
|
143
|
+
</>
|
|
127
144
|
);
|
|
128
145
|
}
|
|
129
146
|
|