@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","PanelBody","PanelRow","PageAttributesPanel","PostDiscussionPanel","PostExcerptPanel","
|
|
1
|
+
{"version":3,"names":["useSelect","useDispatch","PanelBody","PanelRow","PageAttributesPanel","PostDiscussionPanel","PostExcerptPanel","PostLastRevisionPanel","PostTaxonomiesPanel","store","editorStore","coreStore","decodeEntities","navigation","symbol","__","useAsyncList","serialize","__experimentalBlockPatternsList","BlockPatternsList","privateApis","routerPrivateApis","editSiteStore","TemplateActions","TemplateAreas","SidebarCard","useAvailablePatterns","TEMPLATE_PART_POST_TYPE","unlock","useHistory","CARD_ICONS","wp_block","wp_navigation","TemplatesList","availableTemplates","onSelect","shownTemplates","length","createElement","label","blockPatterns","shownPatterns","onClickPattern","showTitlesAsTooltip","POST_TYPE_PATH","wp_template","wp_template_part","TemplatePanel","_CARD_ICONS$record$ty","title","description","icon","record","postType","postId","select","getEditedPostType","getEditedPostId","getEditedEntityRecord","__experimentalGetTemplateInfo","getTemplateInfo","type","_postId","_record","info","history","availablePatterns","editEntityRecord","onTemplateSelect","selectedTemplate","blocks","content","Fragment","className","actions","toggleProps","size","onRemove","push","path","initialOpen"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/template-panel/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { PanelBody, PanelRow } from '@wordpress/components';\nimport {\n\tPageAttributesPanel,\n\tPostDiscussionPanel,\n\tPostExcerptPanel,\n\tPostLastRevisionPanel,\n\tPostTaxonomiesPanel,\n\tstore as editorStore,\n} from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { navigation, symbol } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useAsyncList } from '@wordpress/compose';\nimport { serialize } from '@wordpress/blocks';\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport TemplateActions from '../../template-actions';\nimport TemplateAreas from './template-areas';\nimport SidebarCard from '../sidebar-card';\nimport { useAvailablePatterns } from './hooks';\nimport { TEMPLATE_PART_POST_TYPE } from '../../../utils/constants';\nimport { unlock } from '../../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst CARD_ICONS = {\n\twp_block: symbol,\n\twp_navigation: navigation,\n};\n\nfunction TemplatesList( { availableTemplates, onSelect } ) {\n\tconst shownTemplates = useAsyncList( availableTemplates );\n\tif ( ! availableTemplates || availableTemplates?.length === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tlabel={ __( 'Templates' ) }\n\t\t\tblockPatterns={ availableTemplates }\n\t\t\tshownPatterns={ shownTemplates }\n\t\t\tonClickPattern={ onSelect }\n\t\t\tshowTitlesAsTooltip\n\t\t/>\n\t);\n}\n\nconst POST_TYPE_PATH = {\n\twp_template: '/wp_template',\n\twp_template_part: '/wp_template_part/all',\n};\n\nexport default function TemplatePanel() {\n\tconst { title, description, icon, record, postType, postId } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\n\t\t\tconst type = getEditedPostType();\n\t\t\tconst _postId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord( 'postType', type, _postId );\n\t\t\tconst info = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\ttitle: info.title,\n\t\t\t\tdescription: info.description,\n\t\t\t\ticon: info.icon,\n\t\t\t\trecord: _record,\n\t\t\t\tpostType: type,\n\t\t\t\tpostId: _postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst history = useHistory();\n\tconst availablePatterns = useAvailablePatterns( record );\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\n\tif ( ! title && ! description ) {\n\t\treturn null;\n\t}\n\n\tconst onTemplateSelect = async ( selectedTemplate ) => {\n\t\tawait editEntityRecord( 'postType', postType, postId, {\n\t\t\tblocks: selectedTemplate.blocks,\n\t\t\tcontent: serialize( selectedTemplate.blocks ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<PanelBody>\n\t\t\t\t<SidebarCard\n\t\t\t\t\tclassName=\"edit-site-template-card\"\n\t\t\t\t\ttitle={ decodeEntities( title ) }\n\t\t\t\t\ticon={ CARD_ICONS[ record?.type ] ?? icon }\n\t\t\t\t\tdescription={ decodeEntities( description ) }\n\t\t\t\t\tactions={\n\t\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\t\tclassName=\"edit-site-template-card__actions\"\n\t\t\t\t\t\t\ttoggleProps={ { size: 'small' } }\n\t\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\t\thistory.push( {\n\t\t\t\t\t\t\t\t\tpath: POST_TYPE_PATH[ postType ],\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<TemplateAreas />\n\t\t\t\t</SidebarCard>\n\t\t\t</PanelBody>\n\t\t\t{ availablePatterns?.length > 0 && (\n\t\t\t\t<PanelBody\n\t\t\t\t\ttitle={ __( 'Transform into:' ) }\n\t\t\t\t\tinitialOpen={ postType === TEMPLATE_PART_POST_TYPE }\n\t\t\t\t>\n\t\t\t\t\t<PanelRow>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Choose a predefined pattern to switch up the look of your template.' // TODO - make this dynamic?\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</p>\n\t\t\t\t\t</PanelRow>\n\n\t\t\t\t\t<TemplatesList\n\t\t\t\t\t\tavailableTemplates={ availablePatterns }\n\t\t\t\t\t\tonSelect={ onTemplateSelect }\n\t\t\t\t\t/>\n\t\t\t\t</PanelBody>\n\t\t\t) }\n\t\t\t<PostLastRevisionPanel />\n\t\t\t<PostTaxonomiesPanel />\n\t\t\t<PostExcerptPanel />\n\t\t\t<PostDiscussionPanel />\n\t\t\t<PageAttributesPanel />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,EAAEC,QAAQ,QAAQ,uBAAuB;AAC3D,SACCC,mBAAmB,EACnBC,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,EACrBC,mBAAmB,EACnBC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASD,KAAK,IAAIE,SAAS,QAAQ,sBAAsB;AACzD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,UAAU,EAAEC,MAAM,QAAQ,kBAAkB;AACrD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,+BAA+B,IAAIC,iBAAiB,QAAQ,yBAAyB;AAC9F,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASZ,KAAK,IAAIa,aAAa,QAAQ,gBAAgB;AACvD,OAAOC,eAAe,MAAM,wBAAwB;AACpD,OAAOC,aAAa,MAAM,kBAAkB;AAC5C,OAAOC,WAAW,MAAM,iBAAiB;AACzC,SAASC,oBAAoB,QAAQ,SAAS;AAC9C,SAASC,uBAAuB,QAAQ,0BAA0B;AAClE,SAASC,MAAM,QAAQ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MACrBC,MAAM,EAAGA,MAAQ;MACjBmB,SAAS,EAAC,kCAAkC;MAC5CE,WAAW,EAAG;QAAEC,IAAI,EAAE;MAAQ,CAAG;MACjCC,QAAQ,EAAGA,CAAA,KAAM;QAChBZ,OAAO,CAACa,IAAI,CAAE;UACbC,IAAI,EAAEnC,cAAc,CAAES,QAAQ;QAC/B,CAAE,CAAC;MACJ;IAAG,CACH;EACD,GAEDf,aAAA,CAACd,aAAa,MAAE,CACJ,CACH,CAAC,EACV0C,iBAAiB,EAAE7B,MAAM,GAAG,CAAC,IAC9BC,aAAA,CAACpC,SAAS;IACT+C,KAAK,EAAGlC,EAAE,CAAE,iBAAkB,CAAG;IACjCiE,WAAW,EAAG3B,QAAQ,KAAK1B;EAAyB,GAEpDW,aAAA,CAACnC,QAAQ,QACRmC,aAAA,YACGvB,EAAE,CACH,qEAAqE,CAAC;EACvE,CACE,CACM,CAAC,EAEXuB,aAAA,CAACL,aAAa;IACbC,kBAAkB,EAAGgC,iBAAmB;IACxC/B,QAAQ,EAAGiC;EAAkB,CAC7B,CACS,CACX,EACD9B,aAAA,CAAC/B,qBAAqB,MAAE,CAAC,EACzB+B,aAAA,CAAC9B,mBAAmB,MAAE,CAAC,EACvB8B,aAAA,CAAChC,gBAAgB,MAAE,CAAC,EACpBgC,aAAA,CAACjC,mBAAmB,MAAE,CAAC,EACvBiC,aAAA,CAAClC,mBAAmB,MAAE,CACrB,CAAC;AAEL"}
|
|
@@ -6,7 +6,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
6
6
|
import { edit, seen } from '@wordpress/icons';
|
|
7
7
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
8
8
|
import { store as coreStore } from '@wordpress/core-data';
|
|
9
|
-
import { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';
|
|
9
|
+
import { __experimentalNavigatorButton as NavigatorButton, __experimentalVStack as VStack } from '@wordpress/components';
|
|
10
10
|
import { useViewportMatch } from '@wordpress/compose';
|
|
11
11
|
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
12
12
|
import { useCallback } from '@wordpress/element';
|
|
@@ -25,6 +25,9 @@ import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
|
25
25
|
import StyleBook from '../style-book';
|
|
26
26
|
import useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';
|
|
27
27
|
import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';
|
|
28
|
+
import ColorVariations from '../global-styles/variations/variations-color';
|
|
29
|
+
import TypographyVariations from '../global-styles/variations/variations-typography';
|
|
30
|
+
import { useColorVariations, useTypographyVariations } from '../global-styles/hooks';
|
|
28
31
|
const noop = () => {};
|
|
29
32
|
export function SidebarNavigationItemGlobalStyles(props) {
|
|
30
33
|
const {
|
|
@@ -62,6 +65,8 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
62
65
|
storedSettings: getSettings()
|
|
63
66
|
};
|
|
64
67
|
}, []);
|
|
68
|
+
const colorVariations = useColorVariations();
|
|
69
|
+
const typographyVariations = useTypographyVariations();
|
|
65
70
|
|
|
66
71
|
// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are
|
|
67
72
|
// loaded. This is necessary because the Iframe component waits until
|
|
@@ -72,7 +77,14 @@ function SidebarNavigationScreenGlobalStylesContent() {
|
|
|
72
77
|
settings: storedSettings,
|
|
73
78
|
onChange: noop,
|
|
74
79
|
onInput: noop
|
|
75
|
-
}, createElement(
|
|
80
|
+
}, createElement(VStack, {
|
|
81
|
+
spacing: 10,
|
|
82
|
+
className: "edit-site-global-styles-variation-container"
|
|
83
|
+
}, createElement(StyleVariationsContainer, null), colorVariations?.length && createElement("div", null, createElement("h3", {
|
|
84
|
+
className: "edit-site-global-styles-variation-title"
|
|
85
|
+
}, __('Colors')), createElement(ColorVariations, null)), typographyVariations?.length && createElement("div", null, createElement("h3", {
|
|
86
|
+
className: "edit-site-global-styles-variation-title"
|
|
87
|
+
}, __('Typography')), createElement(TypographyVariations, null))));
|
|
76
88
|
}
|
|
77
89
|
export default function SidebarNavigationScreenGlobalStyles() {
|
|
78
90
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","useViewportMatch","BlockEditorProvider","useCallback","editorStore","preferencesStore","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","settings","onChange","onInput","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","record","actions","icon","label","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalNavigatorButton as NavigatorButton } from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,6BAA6B,IAAIC,eAAe,QAAQ,uBAAuB;AACxF,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,WAAW,QAAQ,o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Ae;IAC1BmB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
1
|
+
{"version":3,"names":["__","edit","seen","useSelect","useDispatch","store","coreStore","__experimentalNavigatorButton","NavigatorButton","__experimentalVStack","VStack","useViewportMatch","BlockEditorProvider","useCallback","editorStore","preferencesStore","SidebarNavigationScreen","StyleVariationsContainer","unlock","editSiteStore","SidebarButton","SidebarNavigationItem","StyleBook","useGlobalStylesRevisions","SidebarNavigationScreenDetailsFooter","ColorVariations","TypographyVariations","useColorVariations","useTypographyVariations","noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","setCanvasMode","hasGlobalStyleVariations","select","__experimentalGetCurrentThemeGlobalStylesVariations","length","createElement","as","path","onClick","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","colorVariations","typographyVariations","settings","onChange","onInput","spacing","className","SidebarNavigationScreenGlobalStyles","revisions","isLoading","isLoadingRevisions","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","revisionsCount","_globalStyles$_links$","getCanvasMode","getEditorCanvasContainerView","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","set","setPreference","openGlobalStyles","Promise","all","openStyleBook","openRevisions","hasRevisions","modifiedDateTime","modified","shouldShowGlobalStylesFooter","Fragment","title","description","content","footer","record","actions","icon","label","isPressed","enableResizing","isSelected","onSelect","showCloseButton","showTabs"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { useCallback } from '@wordpress/element';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport ColorVariations from '../global-styles/variations/variations-color';\nimport TypographyVariations from '../global-styles/variations/variations-typography';\nimport {\n\tuseColorVariations,\n\tuseTypographyVariations,\n} from '../global-styles/hooks';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst colorVariations = useColorVariations();\n\tconst typographyVariations = useTypographyVariations();\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<VStack\n\t\t\t\tspacing={ 10 }\n\t\t\t\tclassName=\"edit-site-global-styles-variation-container\"\n\t\t\t>\n\t\t\t\t<StyleVariationsContainer />\n\t\t\t\t{ colorVariations?.length && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<h3 className=\"edit-site-global-styles-variation-title\">\n\t\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<ColorVariations />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t{ typographyVariations?.length && (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<h3 className=\"edit-site-global-styles-variation-title\">\n\t\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t\t</h3>\n\t\t\t\t\t\t<TypographyVariations />\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</BlockEditorProvider>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { revisions, isLoading: isLoadingRevisions } =\n\t\tuseGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\t\tconst globalStyles = globalStylesId\n\t\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t\t: undefined;\n\t\t\treturn {\n\t\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\t\tisStyleBookOpened:\n\t\t\t\t\t'style-book' === getEditorCanvasContainerView(),\n\t\t\t\trevisionsCount:\n\t\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??\n\t\t\t\t\t0,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, setPreference ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst hasRevisions = revisionsCount > 0;\n\tconst modifiedDateTime = revisions?.[ 0 ]?.modified;\n\tconst shouldShowGlobalStylesFooter =\n\t\thasRevisions && ! isLoadingRevisions && modifiedDateTime;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\tonClick={ openRevisions }\n\t\t\t\t\t\t/>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t/>\n\t\t\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,IAAI,EAAEC,IAAI,QAAQ,kBAAkB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SACCC,6BAA6B,IAAIC,eAAe,EAChDC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;AAC9B,SAASC,gBAAgB,QAAQ,oBAAoB;AACrD,SAASC,mBAAmB,QAAQ,yBAAyB;AAC7D,SAASC,WAAW,QAAQ,oBAAoB;AAChD,SAASR,KAAK,IAAIS,WAAW,QAAQ,mBAAmB;AACxD,SAAST,KAAK,IAAIU,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,uBAAuB,MAAM,8BAA8B;AAClE,OAAOC,wBAAwB,MAAM,6CAA6C;AAClF,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASb,KAAK,IAAIc,aAAa,QAAQ,aAAa;AACpD,OAAOC,aAAa,MAAM,mBAAmB;AAC7C,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,SAAS,MAAM,eAAe;AACrC,OAAOC,wBAAwB,MAAM,+DAA+D;AACpG,OAAOC,o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,CAChD,CACA;EACF,CACD,CAAC,EACAd,iBAAiB,IAAI,CAAEH,gBAAgB,IAAIE,UAAU,IACtDrB,aAAA,CAAChB,SAAS;IACTuE,cAAc,EAAG,KAAO;IACxBC,UAAU,EAAGA,CAAA,KAAM,KAAO;IAC1BrD,OAAO,EAAGoC,aAAe;IACzBkB,QAAQ,EAAGlB,aAAe;IAC1BmB,eAAe,EAAG,KAAO;IACzBC,QAAQ,EAAG;EAAO,CAClB,CAED,CAAC;AAEL"}
|
|
@@ -4,14 +4,13 @@ import { createElement } from "react";
|
|
|
4
4
|
*/
|
|
5
5
|
import { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';
|
|
6
6
|
import { __ } from '@wordpress/i18n';
|
|
7
|
-
export default function
|
|
7
|
+
export default function DeleteConfirmDialog({
|
|
8
8
|
onClose,
|
|
9
9
|
onConfirm
|
|
10
10
|
}) {
|
|
11
11
|
return createElement(ConfirmDialog, {
|
|
12
12
|
isOpen: true,
|
|
13
|
-
onConfirm:
|
|
14
|
-
e.preventDefault();
|
|
13
|
+
onConfirm: () => {
|
|
15
14
|
onConfirm();
|
|
16
15
|
|
|
17
16
|
// Immediate close avoids ability to hit delete multiple times.
|
|
@@ -21,4 +20,4 @@ export default function RenameModal({
|
|
|
21
20
|
confirmButtonText: __('Delete')
|
|
22
21
|
}, __('Are you sure you want to delete this Navigation menu?'));
|
|
23
22
|
}
|
|
24
|
-
//# sourceMappingURL=delete-
|
|
23
|
+
//# sourceMappingURL=delete-confirm-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__experimentalConfirmDialog","ConfirmDialog","__","DeleteConfirmDialog","onClose","onConfirm","createElement","isOpen","onCancel","confirmButtonText"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function DeleteConfirmDialog( { onClose, onConfirm } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen\n\t\t\tonConfirm={ () => {\n\t\t\t\tonConfirm();\n\n\t\t\t\t// Immediate close avoids ability to hit delete multiple times.\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\tonCancel={ onClose }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t>\n\t\t\t{ __( 'Are you sure you want to delete this Navigation menu?' ) }\n\t\t</ConfirmDialog>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,2BAA2B,IAAIC,aAAa,QAAQ,uBAAuB;AACpF,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,eAAe,SAASC,mBAAmBA,CAAE;EAAEC,OAAO;EAAEC;AAAU,CAAC,EAAG;EACrE,OACCC,aAAA,CAACL,aAAa;IACbM,MAAM;IACNF,SAAS,EAAGA,CAAA,KAAM;MACjBA,SAAS,CAAC,CAAC;;MAEX;MACAD,OAAO,CAAC,CAAC;IACV,CAAG;IACHI,QAAQ,EAAGJ,OAAS;IACpBK,iBAAiB,EAAGP,EAAE,CAAE,QAAS;EAAG,GAElCA,EAAE,CAAE,uDAAwD,CAChD,CAAC;AAElB"}
|
|
@@ -11,7 +11,7 @@ import { useState } from '@wordpress/element';
|
|
|
11
11
|
* Internal dependencies
|
|
12
12
|
*/
|
|
13
13
|
import RenameModal from './rename-modal';
|
|
14
|
-
import
|
|
14
|
+
import DeleteConfirmDialog from './delete-confirm-dialog';
|
|
15
15
|
const POPOVER_PROPS = {
|
|
16
16
|
position: 'bottom right'
|
|
17
17
|
};
|
|
@@ -23,13 +23,13 @@ export default function ScreenNavigationMoreMenu(props) {
|
|
|
23
23
|
menuTitle
|
|
24
24
|
} = props;
|
|
25
25
|
const [renameModalOpen, setRenameModalOpen] = useState(false);
|
|
26
|
-
const [
|
|
26
|
+
const [deleteConfirmDialogOpen, setDeleteConfirmDialogOpen] = useState(false);
|
|
27
27
|
const closeModals = () => {
|
|
28
28
|
setRenameModalOpen(false);
|
|
29
|
-
|
|
29
|
+
setDeleteConfirmDialogOpen(false);
|
|
30
30
|
};
|
|
31
31
|
const openRenameModal = () => setRenameModalOpen(true);
|
|
32
|
-
const
|
|
32
|
+
const openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen(true);
|
|
33
33
|
return createElement(Fragment, null, createElement(DropdownMenu, {
|
|
34
34
|
className: "sidebar-navigation__more-menu",
|
|
35
35
|
label: __('Actions'),
|
|
@@ -51,12 +51,12 @@ export default function ScreenNavigationMoreMenu(props) {
|
|
|
51
51
|
}, __('Duplicate')), createElement(MenuItem, {
|
|
52
52
|
isDestructive: true,
|
|
53
53
|
onClick: () => {
|
|
54
|
-
|
|
54
|
+
openDeleteConfirmDialog();
|
|
55
55
|
|
|
56
56
|
// Close the dropdown after opening the modal.
|
|
57
57
|
onClose();
|
|
58
58
|
}
|
|
59
|
-
}, __('Delete'))))),
|
|
59
|
+
}, __('Delete'))))), deleteConfirmDialogOpen && createElement(DeleteConfirmDialog, {
|
|
60
60
|
onClose: closeModals,
|
|
61
61
|
onConfirm: onDelete
|
|
62
62
|
}), renameModalOpen && createElement(RenameModal, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DropdownMenu","MenuItem","MenuGroup","moreVertical","__","useState","RenameModal","
|
|
1
|
+
{"version":3,"names":["DropdownMenu","MenuItem","MenuGroup","moreVertical","__","useState","RenameModal","DeleteConfirmDialog","POPOVER_PROPS","position","ScreenNavigationMoreMenu","props","onDelete","onSave","onDuplicate","menuTitle","renameModalOpen","setRenameModalOpen","deleteConfirmDialogOpen","setDeleteConfirmDialogOpen","closeModals","openRenameModal","openDeleteConfirmDialog","createElement","Fragment","className","label","icon","popoverProps","onClose","onClick","isDestructive","onConfirm"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport RenameModal from './rename-modal';\nimport DeleteConfirmDialog from './delete-confirm-dialog';\n\nconst POPOVER_PROPS = {\n\tposition: 'bottom right',\n};\n\nexport default function ScreenNavigationMoreMenu( props ) {\n\tconst { onDelete, onSave, onDuplicate, menuTitle } = props;\n\n\tconst [ renameModalOpen, setRenameModalOpen ] = useState( false );\n\tconst [ deleteConfirmDialogOpen, setDeleteConfirmDialogOpen ] =\n\t\tuseState( false );\n\n\tconst closeModals = () => {\n\t\tsetRenameModalOpen( false );\n\t\tsetDeleteConfirmDialogOpen( false );\n\t};\n\tconst openRenameModal = () => setRenameModalOpen( true );\n\tconst openDeleteConfirmDialog = () => setDeleteConfirmDialogOpen( true );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"sidebar-navigation__more-menu\"\n\t\t\t\tlabel={ __( 'Actions' ) }\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<div>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenRenameModal();\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Rename' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tonDuplicate();\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Duplicate' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\topenDeleteConfirmDialog();\n\n\t\t\t\t\t\t\t\t\t// Close the dropdown after opening the modal.\n\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ deleteConfirmDialogOpen && (\n\t\t\t\t<DeleteConfirmDialog\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tonConfirm={ onDelete }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ renameModalOpen && (\n\t\t\t\t<RenameModal\n\t\t\t\t\tonClose={ closeModals }\n\t\t\t\t\tmenuTitle={ menuTitle }\n\t\t\t\t\tonSave={ onSave }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,uBAAuB;AACzE,SAASC,YAAY,QAAQ,kBAAkB;AAC/C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,oBAAoB;;AAE7C;AACA;AACA;AACA,OAAOC,WAAW,MAAM,gBAAgB;AACxC,OAAOC,mBAAmB,MAAM,yBAAyB;AAEzD,MAAMC,aAAa,GAAG;EACrBC,QAAQ,EAAE;AACX,CAAC;AAED,eAAe,SAASC,wBAAwBA,CAAEC,KAAK,EAAG;EACzD,MAAM;IAAEC,QAAQ;IAAEC,MAAM;IAAEC,WAAW;IAAEC;EAAU,CAAC,GAAGJ,K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,mBAAmB;IACnBsB,OAAO,EAAGT,WAAa;IACvBY,SAAS,EAAGpB;EAAU,CACtB,CACD,EACCI,eAAe,IAChBO,aAAA,CAACjB,WAAW;IACXuB,OAAO,EAAGT,WAAa;IACvBL,SAAS,EAAGA,SAAW;IACvBF,MAAM,EAAGA;EAAQ,CACjB,CAED,CAAC;AAEL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["store","coreStore","__experimentalUseNavigator","useNavigator","__","sprintf","useSelect","useDispatch","noticesStore","postType","NAVIGATION_POST_TYPE","useDeleteNavigationMenu","goTo","deleteEntityRecord","createSuccessNotice","createErrorNotice","handleDelete","navigationMenu","postId","id","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice(
|
|
1
|
+
{"version":3,"names":["store","coreStore","__experimentalUseNavigator","useNavigator","__","sprintf","useSelect","useDispatch","noticesStore","postType","NAVIGATION_POST_TYPE","useDeleteNavigationMenu","goTo","deleteEntityRecord","createSuccessNotice","createErrorNotice","handleDelete","navigationMenu","postId","id","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","__experimentalSaveSpecifiedEntityEdits","saveSpecifiedEntityEdits","handleSave","edits","originalRecord","recordPropertiesToSave","Object","keys","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\nimport { NAVIGATION_POST_TYPE } from '../../utils/constants';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice(\n\t\t\t\t__( 'Navigation menu successfully deleted.' ),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t\tgoTo( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst {\n\t\teditEntityRecord,\n\t\t__experimentalSaveSpecifiedEntityEdits: saveSpecifiedEntityEdits,\n\t} = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tNAVIGATION_POST_TYPE,\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\tconst recordPropertiesToSave = Object.keys( edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveSpecifiedEntityEdits(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\trecordPropertiesToSave,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tgoTo( `/navigation/${ postType }/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,0BAA0B,IAAIC,YAAY,QAAQ,uBAAuB;AAClF,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASP,KAAK,IAAIQ,YAAY,QAAQ,oBAAoB;;AAE1D;AACA;AACA;AACA,SAASC,QAAQ,QAAQ,GAAG;AAC5B,SAASC,oBAAoB,QAAQ,uBAAuB;AAE5D,SAASC,uBAAuBA,CAAA,EAAG;EAClC,MAAM;IAAEC;EAAK,CAAC,GAAGT,YAAY,CAAC,CAAC;EAE/B,MAAM;IAAEU;EAAmB,CAAC,GAAGN,WAAW,CAAEN,SAAU,CAAC;EAEvD,MAAM;IAAEa,mBAAmB;IAAEC;EAAkB,CAAC,GAC/CR,WAAW,CAAEC,YAAa,CAAC;EAE5B,MAAMQ,YAAY,GAAG,MAAQC,cAAc,IAAM;IAChD,MAAMC,MAAM,GAAGD,cAAc,EAAEE,EAAE;IACjC,IAAI;MACH,MAAM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ACf,CACD,CAAC;MAED,IAAKwB,WAAW,EAAG;QAClB/B,mBAAmB,CAAEV,EAAE,CAAE,4BAA6B,CAAC,EAAE;UACxDkB,IAAI,EAAE;QACP,CAAE,CAAC;QACHV,IAAI,CAAG,eAAeH,QAAU,IAAIoC,WAAW,CAAC1B,EAAI,EAAE,CAAC;MACxD;IACD,CAAC,CAAC,OAAQI,KAAK,EAAG;MACjBR,iBAAiB,CAChBV,OAAO,EACN;MACAD,EAAE,CAAG,2CAA2C,CAAC,EACjDmB,KAAK,EAAEC,OACR,CAAC,EAED;QACCF,IAAI,EAAE;MACP,CACD,CAAC;IACF;EACD,CAAC;EAED,OAAOkB,eAAe;AACvB;AAEA,eAAe,SAASS,yBAAyBA,CAAA,EAAG;EACnD,OAAO;IACNjC,YAAY,EAAEL,uBAAuB,CAAC,CAAC;IACvCqB,UAAU,EAAEP,qBAAqB,CAAC,CAAC;IACnCe,eAAe,EAAEF,0BAA0B,CAAC;EAC7C,CAAC;AACF"}
|
|
@@ -61,6 +61,10 @@ function useTemplateDetails(postType, postId) {
|
|
|
61
61
|
footer
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
const POST_TYPE_PATH = {
|
|
65
|
+
wp_template: '/wp_template',
|
|
66
|
+
wp_template_part: '/wp_template_part/all'
|
|
67
|
+
};
|
|
64
68
|
export default function SidebarNavigationScreenTemplate() {
|
|
65
69
|
const navigator = useNavigator();
|
|
66
70
|
const {
|
|
@@ -87,7 +91,7 @@ export default function SidebarNavigationScreenTemplate() {
|
|
|
87
91
|
as: SidebarButton
|
|
88
92
|
},
|
|
89
93
|
onRemove: () => {
|
|
90
|
-
navigator.goTo(
|
|
94
|
+
navigator.goTo(POST_TYPE_PATH[postType]);
|
|
91
95
|
}
|
|
92
96
|
}), createElement(SidebarButton, {
|
|
93
97
|
onClick: () => setCanvasMode('edit'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["__","_x","useDispatch","useSelect","pencil","__experimentalUseNavigator","useNavigator","Icon","store","coreStore","TemplateAreas","SidebarNavigationScreen","useEditedEntityRecord","unlock","editSiteStore","SidebarButton","useAddedBy","TemplateActions","HomeTemplateDetails","SidebarNavigationScreenDetailsFooter","useTemplateDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","content","slug","createElement","Fragment","footer","modified","description","className","imageUrl","src","alt","width","height","icon","isCustomized","SidebarNavigationScreenTemplate","navigator","params","setCanvasMode","actions","toggleProps","as","onRemove","goTo","onClick","label"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nfunction useTemplateDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst navigator = useNavigator();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = navigator;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tnavigator.goTo(
|
|
1
|
+
{"version":3,"names":["__","_x","useDispatch","useSelect","pencil","__experimentalUseNavigator","useNavigator","Icon","store","coreStore","TemplateAreas","SidebarNavigationScreen","useEditedEntityRecord","unlock","editSiteStore","SidebarButton","useAddedBy","TemplateActions","HomeTemplateDetails","SidebarNavigationScreenDetailsFooter","useTemplateDetails","postType","postId","getDescription","getTitle","record","currentTheme","select","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","content","slug","createElement","Fragment","footer","modified","description","className","imageUrl","src","alt","width","height","icon","isCustomized","POST_TYPE_PATH","wp_template","wp_template_part","SidebarNavigationScreenTemplate","navigator","params","setCanvasMode","actions","toggleProps","as","onRemove","goTo","onClick","label"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n/**\n * Internal dependencies\n */\nimport TemplateAreas from './template-areas';\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport TemplateActions from '../template-actions';\nimport HomeTemplateDetails from './home-template-details';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\n\nfunction useTemplateDetails( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tdescriptionText = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\tconst content =\n\t\trecord?.slug === 'home' || record?.slug === 'index' ? (\n\t\t\t<>\n\t\t\t\t<HomeTemplateDetails />\n\t\t\t\t<TemplateAreas />\n\t\t\t</>\n\t\t) : (\n\t\t\t<TemplateAreas />\n\t\t);\n\n\tconst footer = record?.modified ? (\n\t\t<SidebarNavigationScreenDetailsFooter record={ record } />\n\t) : null;\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ _x( '(Customized)', 'template' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description, content, footer };\n}\n\nconst POST_TYPE_PATH = {\n\twp_template: '/wp_template',\n\twp_template_part: '/wp_template_part/all',\n};\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst navigator = useNavigator();\n\tconst {\n\t\tparams: { postType, postId },\n\t} = navigator;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, content, description, footer } = useTemplateDetails(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<TemplateActions\n\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\tpostId={ postId }\n\t\t\t\t\t\ttoggleProps={ { as: SidebarButton } }\n\t\t\t\t\t\tonRemove={ () => {\n\t\t\t\t\t\t\tnavigator.goTo( POST_TYPE_PATH[ postType ] );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\t\ticon={ pencil }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t\tcontent={ content }\n\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
|
32
32
|
}
|
|
33
33
|
export default function DataviewsTemplatesSidebarContent({
|
|
@@ -56,7 +56,7 @@ export default function DataviewsTemplatesSidebarContent({
|
|
|
56
56
|
title: title,
|
|
57
57
|
icon: layout,
|
|
58
58
|
isActive: activeView === 'all',
|
|
59
|
-
isCustom:
|
|
59
|
+
isCustom: false
|
|
60
60
|
}), firstItemPerAuthorText.map(template => {
|
|
61
61
|
return createElement(TemplateDataviewItem, {
|
|
62
62
|
key: template.author_text,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","DataViewItem","useAddedBy","layout","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","createElement","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","postType","records","per_page","firstItemPerAuthorText","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport { layout } from '@wordpress/icons';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom
|
|
1
|
+
{"version":3,"names":["useEntityRecords","useMemo","__experimentalItemGroup","ItemGroup","DataViewItem","useAddedBy","layout","EMPTY_ARRAY","TemplateDataviewItem","template","isActive","text","icon","type","id","createElement","key","slug","title","isCustom","DataviewsTemplatesSidebarContent","activeView","postType","records","per_page","firstItemPerAuthorText","_ref","firstItemPerAuthor","reduce","acc","author","author_text","Object","values","map"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/content.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport DataViewItem from '../sidebar-dataviews/dataview-item';\nimport { useAddedBy } from '../page-templates-template-parts/hooks';\nimport { layout } from '@wordpress/icons';\n\nconst EMPTY_ARRAY = [];\n\nfunction TemplateDataviewItem( { template, isActive } ) {\n\tconst { text, icon } = useAddedBy( template.type, template.id );\n\treturn (\n\t\t<DataViewItem\n\t\t\tkey={ text }\n\t\t\tslug={ text }\n\t\t\ttitle={ text }\n\t\t\ticon={ icon }\n\t\t\tisActive={ isActive }\n\t\t\tisCustom={ false }\n\t\t/>\n\t);\n}\n\nexport default function DataviewsTemplatesSidebarContent( {\n\tactiveView,\n\tpostType,\n\ttitle,\n} ) {\n\tconst { records } = useEntityRecords( 'postType', postType, {\n\t\tper_page: -1,\n\t} );\n\tconst firstItemPerAuthorText = useMemo( () => {\n\t\tconst firstItemPerAuthor = records?.reduce( ( acc, template ) => {\n\t\t\tconst author = template.author_text;\n\t\t\tif ( author && ! acc[ author ] ) {\n\t\t\t\tacc[ author ] = template;\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} );\n\t\treturn (\n\t\t\t( firstItemPerAuthor && Object.values( firstItemPerAuthor ) ) ??\n\t\t\tEMPTY_ARRAY\n\t\t);\n\t}, [ records ] );\n\n\treturn (\n\t\t<ItemGroup>\n\t\t\t<DataViewItem\n\t\t\t\tslug={ 'all' }\n\t\t\t\ttitle={ title }\n\t\t\t\ticon={ layout }\n\t\t\t\tisActive={ activeView === 'all' }\n\t\t\t\tisCustom={ false }\n\t\t\t/>\n\t\t\t{ firstItemPerAuthorText.map( ( template ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<TemplateDataviewItem\n\t\t\t\t\t\tkey={ template.author_text }\n\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\tisActive={ activeView === template.author_text }\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\t} ) }\n\t\t</ItemGroup>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,sBAAsB;AACvD,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;;AAE5E;AACA;AACA;AACA,OAAOC,YAAY,MAAM,oCAAoC;AAC7D,SAASC,UAAU,QAAQ,wCAAwC;AACnE,SAASC,MAAM,QAAQ,kBAAkB;AAEzC,MAAMC,WAAW,GAAG,EAAE;AAEtB,SAASC,oBAAoBA,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAG;EACvD,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAC,GAAGP,UAAU,CAAEI,QAAQ,CAACI,IAAI,EAAEJ,QAAQ,CAACK,EAAG,CAAC;EAC/D,OACCC,aAAA,CAACX,YAAY;IACZY,GAAG,EAAGL,IAAM;IACZM,IAAI,EAAGN,IAAM;IACbO,KAAK,EAAGP,IAAM;IACdC,IAAI,EAAGA,IAAM;IACbF,QAAQ,EAAGA,QAAU;IACrBS,QAAQ,EAAG;EAAO,CAClB,CAAC;AAEJ;AAEA,eAAe,SAASC,gCAAgCA,CAAE;EACzDC,UAAU;EACVC,QAAQ;EACRJ;AACD,CAAC,EAAG;EACH,MAAM;IAAEK;EAAQ,CAAC,GAAGvB,gBAAgB,CAAE,UAAU,EAAEsB,QAAQ,EAAE;IAC3DE,QAAQ,EAAE,CAAC;EACZ,CAAE,CAAC;EACH,MAAMC,sBAAsB,GAAGxB,OAAO,CAAE,MAAM;IAAA,IAAAyB,IAAA;IAC7C,MAAMC,kBAAkB,GAAGJ,OAAO,EAAEK,MAAM,CAAE,CAAEC,GAAG,EAAEpB,QAAQ,KAAM;MAChE,MAAMqB,MAAM,GAAGrB,QAAQ,CAACsB,WAAW;MACnC,IAAKD,MAAM,IAAI,CAAED,GAAG,CAAEC,MAAM,CAAE,EAAG;QAChCD,GAAG,CAAEC,MAAM,CAAE,GAAGrB,QAAQ;MACzB;MACA,OAAOoB,GAAG;IACX,CAAC,EAAE,CAAC,CAAE,CAAC;IACP,QAAAH,IAAA,GACGC,kBAAkB,IAAIK,MAAM,CAACC,MAAM,CAAEN,kBAAmB,CAAC,cAAAD,IAAA,cAAAA,IAAA,GAC3DnB,WAAW;EAEb,CAAC,EAAE,CAAEgB,OAAO,CAAG,CAAC;EAEhB,OACCR,aAAA,CAACZ,SAAS,QACTY,aAAA,CAACX,YAAY;IACZa,IAAI,EAAG,KAAO;IACdC,KAAK,EAAGA,KAAO;IACfN,IAAI,EAAGN,MAAQ;IACfI,QAAQ,EAAGW,UAAU,KAAK,KAAO;IACjCF,QAAQ,EAAG;EAAO,CAClB,CAAC,EACAM,sBAAsB,CAACS,GAAG,CAAIzB,QAAQ,IAAM;IAC7C,OACCM,aAAA,CAACP,oBAAoB;MACpBQ,GAAG,EAAGP,QAAQ,CAACsB,WAAa;MAC5BtB,QAAQ,EAAGA,QAAU;MACrBC,QAAQ,EAAGW,UAAU,KAAKZ,QAAQ,CAACsB;IAAa,CAChD,CAAC;EAEJ,CAAE,CACQ,CAAC;AAEd"}
|
|
@@ -162,7 +162,7 @@ function useResolveEditedEntityAndContext({
|
|
|
162
162
|
}
|
|
163
163
|
return {};
|
|
164
164
|
}, [homepageId, postType, postId, path]);
|
|
165
|
-
if (path === '/wp_template
|
|
165
|
+
if (path === '/wp_template' && postId) {
|
|
166
166
|
return {
|
|
167
167
|
isReady: true,
|
|
168
168
|
postType: 'wp_template',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useMemo","useSelect","useDispatch","store","coreDataStore","privateApis","routerPrivateApis","editSiteStore","unlock","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","useLocation","postTypesWithoutParentTemplate","user","useResolveEditedEntityAndContext","path","postId","postType","hasLoadedAllDependencies","homepageId","url","frontPageTemplateId","select","getSite","getUnstableBase","getEntityRecords","siteData","base","templates","per_page","_frontPateTemplateId","frontPageTemplate","find","t","slug","id","show_on_front","includes","page_on_front","toString","home","resolvedTemplateId","undefined","getEditedEntityRecord","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","currentTemplateSlug","template","currentTemplate","slugToCheck","context","isReady","useInitEditedEntityFromURL","params","setEditedEntity"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nfunction useResolveEditedEntityAndContext( { path, postId, postType } ) {\n\tconst { hasLoadedAllDependencies, homepageId, url, frontPageTemplateId } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSite, getUnstableBase, getEntityRecords } =\n\t\t\t\tselect( coreDataStore );\n\t\t\tconst siteData = getSite();\n\t\t\tconst base = getUnstableBase();\n\t\t\tconst templates = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t);\n\t\t\tlet _frontPateTemplateId;\n\t\t\tif ( templates ) {\n\t\t\t\tconst frontPageTemplate = templates.find(\n\t\t\t\t\t( t ) => t.slug === 'front-page'\n\t\t\t\t);\n\t\t\t\t_frontPateTemplateId = frontPageTemplate\n\t\t\t\t\t? frontPageTemplate.id\n\t\t\t\t\t: false;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasLoadedAllDependencies: !! base && !! siteData,\n\t\t\t\thomepageId:\n\t\t\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t\t\t[ 'number', 'string' ].includes(\n\t\t\t\t\t\ttypeof siteData.page_on_front\n\t\t\t\t\t)\n\t\t\t\t\t\t? siteData.page_on_front.toString()\n\t\t\t\t\t\t: null,\n\t\t\t\turl: base?.home,\n\t\t\t\tfrontPageTemplateId: _frontPateTemplateId,\n\t\t\t};\n\t\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\t// For the front page, we always use the front page template if existing.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\thomepageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\t// We're still checking whether the front page template exists.\n\t\t\t\t\t// Don't resolve the template yet.\n\t\t\t\t\tif ( frontPageTemplateId === undefined ) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !! frontPageTemplateId ) {\n\t\t\t\t\t\treturn frontPageTemplateId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\tlet slugToCheck;\n\t\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t\t// through template hierarchy.\n\t\t\t\tif ( editedEntity.slug ) {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? `${ postTypeToResolve }-${ editedEntity.slug }`\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }-${ editedEntity.slug }`;\n\t\t\t\t} else {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }`;\n\t\t\t\t}\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( ! hasLoadedAllDependencies ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, post... we need to resolve its template.\n\t\t\tif ( postType && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// Some URLs in list views are different\n\t\t\tif ( path === '/pages' && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thomepageId,\n\t\t\thasLoadedAllDependencies,\n\t\t\turl,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tpath,\n\t\t\tfrontPageTemplateId,\n\t\t]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\n\t\t// Some URLs in list views are different\n\t\tif ( path === '/pages' && postId ) {\n\t\t\treturn { postType: 'page', postId };\n\t\t}\n\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId, path ] );\n\n\tif ( path === '/wp_template/all' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template', postId, context };\n\t}\n\n\tif ( path === '/wp_template_part/all' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template_part', postId, context };\n\t}\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( hasLoadedAllDependencies ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SACCC,kBAAkB,EAClBC,uBAAuB,EACvBC,oBAAoB,EACpBC,aAAa,QACP,uBAAuB;AAE9B,MAAM;EAAEC;AAAY,CAAC,GAAGL,MAAM,CAAEF,iBAAkB,CAAC;AAEnD,MAAMQ,8BAA8B,GAAG,CAC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OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEC,OAAO,EAAEtC,QAAQ,EAAED,MAAM,EAAEsC,OAAO,EAAEI,eAAe,CAAG,CAAC;AAC7D"}
|
|
1
|
+
{"version":3,"names":["useEffect","useMemo","useSelect","useDispatch","store","coreDataStore","privateApis","routerPrivateApis","editSiteStore","unlock","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","useLocation","postTypesWithoutParentTemplate","user","useResolveEditedEntityAndContext","path","postId","postType","hasLoadedAllDependencies","homepageId","url","frontPageTemplateId","select","getSite","getUnstableBase","getEntityRecords","siteData","base","templates","per_page","_frontPateTemplateId","frontPageTemplate","find","t","slug","id","show_on_front","includes","page_on_front","toString","home","resolvedTemplateId","undefined","getEditedEntityRecord","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","currentTemplateSlug","template","currentTemplate","slugToCheck","context","isReady","useInitEditedEntityFromURL","params","setEditedEntity"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nfunction useResolveEditedEntityAndContext( { path, postId, postType } ) {\n\tconst { hasLoadedAllDependencies, homepageId, url, frontPageTemplateId } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSite, getUnstableBase, getEntityRecords } =\n\t\t\t\tselect( coreDataStore );\n\t\t\tconst siteData = getSite();\n\t\t\tconst base = getUnstableBase();\n\t\t\tconst templates = getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t);\n\t\t\tlet _frontPateTemplateId;\n\t\t\tif ( templates ) {\n\t\t\t\tconst frontPageTemplate = templates.find(\n\t\t\t\t\t( t ) => t.slug === 'front-page'\n\t\t\t\t);\n\t\t\t\t_frontPateTemplateId = frontPageTemplate\n\t\t\t\t\t? frontPageTemplate.id\n\t\t\t\t\t: false;\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\thasLoadedAllDependencies: !! base && !! siteData,\n\t\t\t\thomepageId:\n\t\t\t\t\tsiteData?.show_on_front === 'page' &&\n\t\t\t\t\t[ 'number', 'string' ].includes(\n\t\t\t\t\t\ttypeof siteData.page_on_front\n\t\t\t\t\t)\n\t\t\t\t\t\t? siteData.page_on_front.toString()\n\t\t\t\t\t\t: null,\n\t\t\t\turl: base?.home,\n\t\t\t\tfrontPageTemplateId: _frontPateTemplateId,\n\t\t\t};\n\t\t}, [] );\n\n\t/**\n\t * This is a hook that recreates the logic to resolve a template for a given WordPress postID postTypeId\n\t * in order to match the frontend as closely as possible in the site editor.\n\t *\n\t * It is not possible to rely on the server logic because there maybe unsaved changes that impact the template resolution.\n\t */\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\t// For the front page, we always use the front page template if existing.\n\t\t\t\tif (\n\t\t\t\t\tpostTypeToResolve === 'page' &&\n\t\t\t\t\thomepageId === postIdToResolve\n\t\t\t\t) {\n\t\t\t\t\t// We're still checking whether the front page template exists.\n\t\t\t\t\t// Don't resolve the template yet.\n\t\t\t\t\tif ( frontPageTemplateId === undefined ) {\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\n\t\t\t\t\tif ( !! frontPageTemplateId ) {\n\t\t\t\t\t\treturn frontPageTemplateId;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\tlet slugToCheck;\n\t\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t\t// through template hierarchy.\n\t\t\t\tif ( editedEntity.slug ) {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? `${ postTypeToResolve }-${ editedEntity.slug }`\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }-${ editedEntity.slug }`;\n\t\t\t\t} else {\n\t\t\t\t\tslugToCheck =\n\t\t\t\t\t\tpostTypeToResolve === 'page'\n\t\t\t\t\t\t\t? 'page'\n\t\t\t\t\t\t\t: `single-${ postTypeToResolve }`;\n\t\t\t\t}\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\tif ( ! hasLoadedAllDependencies ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, post... we need to resolve its template.\n\t\t\tif ( postType && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// Some URLs in list views are different\n\t\t\tif ( path === '/pages' && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[\n\t\t\thomepageId,\n\t\t\thasLoadedAllDependencies,\n\t\t\turl,\n\t\t\tpostId,\n\t\t\tpostType,\n\t\t\tpath,\n\t\t\tfrontPageTemplateId,\n\t\t]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\n\t\t// Some URLs in list views are different\n\t\tif ( path === '/pages' && postId ) {\n\t\t\treturn { postType: 'page', postId };\n\t\t}\n\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId, path ] );\n\n\tif ( path === '/wp_template' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template', postId, context };\n\t}\n\n\tif ( path === '/wp_template_part/all' && postId ) {\n\t\treturn { isReady: true, postType: 'wp_template_part', postId, context };\n\t}\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( hasLoadedAllDependencies ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,OAAO,QAAQ,oBAAoB;AACvD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,aAAa,QAAQ,sBAAsB;AAC7D,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AACpD,SAAS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zC,gCAAgC,CAAE2C,MAAO,CAAC;EAE3C,MAAM;IAAEC;EAAgB,CAAC,GAAG1D,WAAW,CAAEK,aAAc,CAAC;EAExDR,SAAS,CAAE,MAAM;IAChB,IAAK0D,OAAO,EAAG;MACdG,eAAe,CAAEzC,QAAQ,EAAED,MAAM,EAAEsC,OAAQ,CAAC;IAC7C;EACD,CAAC,EAAE,CAAEC,OAAO,EAAEtC,QAAQ,EAAED,MAAM,EAAEsC,OAAO,EAAEI,eAAe,CAAG,CAAC;AAC7D"}
|
|
@@ -87,20 +87,10 @@ export default function useSyncPathWithURL() {
|
|
|
87
87
|
canvas: undefined,
|
|
88
88
|
path: navigatorLocation.path
|
|
89
89
|
});
|
|
90
|
-
} else if (navigatorLocation.path === '/wp_template/all' && !window?.__experimentalAdminViews) {
|
|
91
|
-
// When the experiment is disabled, we only support table layout.
|
|
92
|
-
// Clear it out from the URL, so layouts other than table cannot be accessed.
|
|
93
|
-
updateUrlParams({
|
|
94
|
-
postType: undefined,
|
|
95
|
-
categoryType: undefined,
|
|
96
|
-
categoryId: undefined,
|
|
97
|
-
path: navigatorLocation.path,
|
|
98
|
-
layout: undefined
|
|
99
|
-
});
|
|
100
90
|
} else if (
|
|
101
91
|
// 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.
|
|
102
92
|
// The "type" property should be kept as well.
|
|
103
|
-
navigatorLocation.path === '/pages'
|
|
93
|
+
navigatorLocation.path === '/pages' || navigatorLocation.path === '/wp_template' || navigatorLocation.path === '/wp_template_part/all') {
|
|
104
94
|
updateUrlParams({
|
|
105
95
|
postType: undefined,
|
|
106
96
|
categoryType: undefined,
|