@wordpress/edit-site 5.30.0 → 5.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/block-editor/editor-canvas.js +24 -4
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +15 -4
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/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/editor/index.js +12 -3
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -2
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +38 -0
- package/build/components/global-styles/background-panel.js.map +1 -0
- package/build/components/global-styles/color-palette-panel.js +0 -9
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/font-families.js +1 -1
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +53 -17
- 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 +22 -4
- 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/palette.js +3 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview-colors.js +2 -2
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/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/root-menu.js +8 -2
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-background.js +34 -0
- package/build/components/global-styles/screen-background.js.map +1 -0
- package/build/components/global-styles/screen-color-palette.js +2 -2
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +5 -10
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +3 -37
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +6 -11
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +5 -2
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/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/ui.js +4 -1
- package/build/components/global-styles/ui.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 +13 -7
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles/variations/variations-typography.js +34 -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-shortcut-help-modal/index.js +3 -0
- package/build/components/keyboard-shortcut-help-modal/index.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/animation.js +129 -0
- package/build/components/layout/animation.js.map +1 -0
- package/build/components/layout/index.js +9 -17
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +22 -22
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-pages/index.js +24 -27
- 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 +19 -32
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-patterns/search-items.js +16 -58
- package/build/components/page-patterns/search-items.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +9 -9
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates-template-parts/actions.js +54 -41
- package/build/components/page-templates-template-parts/actions.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +31 -69
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +12 -1
- package/build/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build/components/save-button/index.js +45 -16
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +8 -112
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +14 -9
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -8
- 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 +3 -3
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +5 -4
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +1 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +7 -17
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build/components/sidebar-edit-mode/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/template-panel/index.js +32 -18
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js +5 -1
- package/build/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +18 -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-patterns/index.js +1 -5
- package/build/components/sidebar-navigation-screen-patterns/index.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/style-book/index.js +1 -1
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
- 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/index.js +0 -1
- package/build/hooks/index.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/store/selectors.js +1 -9
- package/build/store/selectors.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/block-editor/editor-canvas.js +24 -4
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +15 -4
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/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/editor/index.js +13 -4
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +1 -2
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +31 -0
- package/build-module/components/global-styles/background-panel.js.map +1 -0
- package/build-module/components/global-styles/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-families.js +1 -1
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +54 -18
- 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 +22 -4
- 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/palette.js +3 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview-colors.js +2 -2
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/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/root-menu.js +9 -3
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-background.js +26 -0
- package/build-module/components/global-styles/screen-background.js.map +1 -0
- package/build-module/components/global-styles/screen-color-palette.js +2 -2
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +5 -10
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +4 -38
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +6 -11
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +5 -2
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/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/ui.js +4 -1
- package/build-module/components/global-styles/ui.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 +13 -7
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-typography.js +35 -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-shortcut-help-modal/index.js +3 -0
- package/build-module/components/keyboard-shortcut-help-modal/index.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/animation.js +122 -0
- package/build-module/components/layout/animation.js.map +1 -0
- package/build-module/components/layout/index.js +9 -17
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +22 -22
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-pages/index.js +25 -28
- 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 +21 -34
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-patterns/search-items.js +14 -55
- package/build-module/components/page-patterns/search-items.js.map +1 -1
- package/build-module/components/page-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/actions.js +54 -40
- package/build-module/components/page-templates-template-parts/actions.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +34 -72
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +12 -1
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -1
- package/build-module/components/save-button/index.js +46 -17
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +10 -114
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +14 -9
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -8
- 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 +4 -4
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +5 -4
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +1 -2
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +10 -20
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +7 -5
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/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/template-panel/index.js +33 -19
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js +5 -1
- package/build-module/components/sidebar-navigation-screen-details-footer/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +19 -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-patterns/index.js +1 -5
- package/build-module/components/sidebar-navigation-screen-patterns/index.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/style-book/index.js +1 -1
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
- 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/index.js +0 -1
- package/build-module/hooks/index.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/store/selectors.js +1 -9
- package/build-module/store/selectors.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 +146 -130
- package/build-style/style.css +146 -130
- package/package.json +44 -44
- package/src/components/block-editor/editor-canvas.js +34 -9
- package/src/components/block-editor/site-editor-canvas.js +10 -7
- package/src/components/block-editor/use-site-editor-settings.js +0 -2
- package/src/components/editor/index.js +11 -4
- package/src/components/editor-canvas-container/index.js +0 -1
- package/src/components/global-styles/background-panel.js +34 -0
- package/src/components/global-styles/color-palette-panel.js +0 -11
- package/src/components/global-styles/font-families.js +1 -1
- package/src/components/global-styles/font-library-modal/context.js +77 -31
- 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 +15 -6
- package/src/components/global-styles/font-library-modal/upload-fonts.js +53 -8
- package/src/components/global-styles/font-library-modal/utils/index.js +21 -8
- 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/palette.js +3 -1
- package/src/components/global-styles/preview-colors.js +2 -2
- 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/root-menu.js +12 -1
- package/src/components/global-styles/screen-background.js +29 -0
- package/src/components/global-styles/screen-color-palette.js +2 -2
- package/src/components/global-styles/screen-colors.js +4 -15
- package/src/components/global-styles/screen-style-variations.js +4 -36
- package/src/components/global-styles/screen-typography.js +6 -20
- package/src/components/global-styles/style-variations-container.js +2 -1
- package/src/components/global-styles/style.scss +15 -10
- 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/ui.js +5 -0
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/global-styles/variations/style.scss +32 -23
- package/src/components/global-styles/variations/variations-color.js +12 -6
- package/src/components/global-styles/variations/variations-typography.js +41 -60
- package/src/components/header-edit-mode/index.js +1 -0
- package/src/components/header-edit-mode/style.scss +28 -17
- package/src/components/keyboard-shortcut-help-modal/config.js +4 -0
- package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
- package/src/components/keyboard-shortcuts/global.js +16 -4
- package/src/components/layout/animation.js +122 -0
- package/src/components/layout/index.js +12 -27
- package/src/components/layout/router.js +26 -25
- package/src/components/layout/style.scss +2 -0
- package/src/components/page-pages/index.js +33 -54
- package/src/components/page-patterns/delete-category-menu-item.js +7 -0
- package/src/components/page-patterns/index.js +22 -31
- package/src/components/page-patterns/search-items.js +13 -58
- package/src/components/page-patterns/use-patterns.js +17 -10
- package/src/components/page-templates-template-parts/actions.js +106 -91
- package/src/components/page-templates-template-parts/index.js +41 -93
- package/src/components/page-templates-template-parts/style.scss +5 -0
- package/src/components/plugin-template-setting-panel/index.js +14 -1
- package/src/components/save-button/index.js +55 -26
- package/src/components/save-hub/index.js +20 -164
- package/src/components/save-panel/index.js +24 -17
- package/src/components/sidebar/index.js +2 -8
- 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 +12 -4
- package/src/components/sidebar-dataviews/index.js +5 -4
- package/src/components/sidebar-edit-mode/index.js +0 -2
- package/src/components/sidebar-edit-mode/page-panels/index.js +31 -62
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +10 -10
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +2 -0
- package/src/components/sidebar-edit-mode/template-panel/index.js +33 -24
- package/src/components/sidebar-edit-mode/template-panel/style.scss +1 -29
- package/src/components/sidebar-navigation-screen/style.scss +21 -9
- package/src/components/sidebar-navigation-screen-details-footer/index.js +6 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +29 -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-patterns/index.js +0 -7
- 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/style-book/index.js +1 -3
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +3 -3
- 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/index.js +0 -1
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +21 -4
- package/src/store/selectors.js +3 -15
- package/src/style.scss +0 -2
- 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/actions/index.js +0 -321
- package/build/components/actions/index.js.map +0 -1
- package/build/components/global-styles/preview-typography.js.map +0 -1
- package/build/components/sidebar-edit-mode/sidebar-card/index.js +0 -42
- package/build/components/sidebar-edit-mode/sidebar-card/index.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-edit-mode/template-panel/template-areas.js +0 -70
- package/build/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +0 -175
- package/build/components/sidebar-navigation-screen-pages/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +0 -132
- package/build/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/build/hooks/template-part-edit.js +0 -82
- package/build/hooks/template-part-edit.js.map +0 -1
- package/build/store/utils.js +0 -71
- package/build/store/utils.js.map +0 -1
- package/build-module/components/actions/index.js +0 -310
- package/build-module/components/actions/index.js.map +0 -1
- package/build-module/components/global-styles/preview-typography.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
- package/build-module/components/sidebar-edit-mode/sidebar-card/index.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-edit-mode/template-panel/template-areas.js +0 -63
- package/build-module/components/sidebar-edit-mode/template-panel/template-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +0 -167
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +0 -124
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +0 -1
- package/build-module/hooks/template-part-edit.js +0 -75
- package/build-module/hooks/template-part-edit.js.map +0 -1
- package/build-module/store/utils.js +0 -64
- package/build-module/store/utils.js.map +0 -1
- package/src/components/actions/index.js +0 -411
- package/src/components/sidebar-edit-mode/sidebar-card/index.js +0 -34
- package/src/components/sidebar-edit-mode/sidebar-card/style.scss +0 -37
- package/src/components/sidebar-edit-mode/template-panel/template-actions.js +0 -49
- package/src/components/sidebar-edit-mode/template-panel/template-areas.js +0 -86
- package/src/components/sidebar-navigation-screen-pages/index.js +0 -238
- package/src/components/sidebar-navigation-screen-templates/index.js +0 -156
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -9
- package/src/hooks/template-part-edit.js +0 -89
- package/src/store/test/utils.js +0 -191
- package/src/store/utils.js +0 -69
package/build/store/selectors.js
CHANGED
|
@@ -26,10 +26,7 @@ var _data = require("@wordpress/data");
|
|
|
26
26
|
var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
27
27
|
var _element = require("@wordpress/element");
|
|
28
28
|
var _preferences = require("@wordpress/preferences");
|
|
29
|
-
var _blockEditor = require("@wordpress/block-editor");
|
|
30
29
|
var _editor = require("@wordpress/editor");
|
|
31
|
-
var _utils = require("./utils");
|
|
32
|
-
var _constants = require("../utils/constants");
|
|
33
30
|
var _lockUnlock = require("../lock-unlock");
|
|
34
31
|
/**
|
|
35
32
|
* WordPress dependencies
|
|
@@ -244,12 +241,7 @@ function isSaveViewOpened(state) {
|
|
|
244
241
|
* @return {Array} Template parts and their blocks in an array.
|
|
245
242
|
*/
|
|
246
243
|
const getCurrentTemplateTemplateParts = exports.getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select => () => {
|
|
247
|
-
|
|
248
|
-
per_page: -1
|
|
249
|
-
});
|
|
250
|
-
const clientIds = select(_blockEditor.store).getBlocksByName('core/template-part');
|
|
251
|
-
const blocks = select(_blockEditor.store).getBlocksByClientId(clientIds);
|
|
252
|
-
return (0, _utils.getFilteredTemplatePartBlocks)(blocks, templateParts);
|
|
244
|
+
return (0, _lockUnlock.unlock)(select(_editor.store)).getCurrentTemplateTemplateParts();
|
|
253
245
|
});
|
|
254
246
|
|
|
255
247
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","exports","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","getBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,IAAAE,4BAAsB,EAClDC,MAAM,IAAM,CAAEC,CAAC,EAAEC,WAAW,KAAM;EACnC,IAAAC,mBAAU,EAAG,4CAA2C,EAAE;IACzDC,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG;EACf,CAAE,CAAC;EAEH,OAAO,CAAC,CAAEL,MAAM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M;EACxE,OAAOA,MAAM,CAAEM,kBAAiB,CAAC,CAACC,GAAG,CAAE,MAAM,EAAE,YAAa,CAAC;AAC9D,CAAE,CAAC;;AAEH;AACA;AACA;AACO,SAAS2C,wCAAwCA,CAAA,EAAG;EAC1D,IAAA/C,mBAAU,EACT,uEAAuE,EACvE;IACCC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACO,SAAS0C,4BAA4BA,CAAA,EAAG;EAC9C,IAAAhD,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAAS2C,kBAAkBA,CAAA,EAAG;EACpC,IAAAjD,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS4C,MAAMA,CAAE/B,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEuB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAApD,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
|
|
1
|
+
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_editor","_lockUnlock","isFeatureActive","exports","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\treturn unlock(\n\t\t\tselect( editorStore )\n\t\t).getCurrentTemplateTemplateParts();\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAA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AA3C,OAAA,CAAA2C,aAAA,GAAG,IAAA1C,4BAAsB,EAAIC,MAAM,IAAM,MAAM;EACxE,OAAOA,MAAM,CAAEM,kBAAiB,CAAC,CAACC,GAAG,CAAE,MAAM,EAAE,YAAa,CAAC;AAC9D,CAAE,CAAC;;AAEH;AACA;AACA;AACO,SAASmC,wCAAwCA,CAAA,EAAG;EAC1D,IAAAvC,mBAAU,EACT,uEAAuE,EACvE;IACCC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CACD,CAAC;AACF;;AAEA;AACA;AACA;AACO,SAASkC,4BAA4BA,CAAA,EAAG;EAC9C,IAAAxC,mBAAU,EAAE,2DAA2D,EAAE;IACxEC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACO,SAASmC,kBAAkBA,CAAA,EAAG;EACpC,IAAAzC,mBAAU,EAAE,iDAAiD,EAAE;IAC9DC,KAAK,EAAE,KAAK;IACZK,OAAO,EAAE;EACV,CAAE,CAAC;AACJ;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASoC,MAAMA,CAAEvB,KAAK,EAAG;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEe,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAA5C,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
|
package/build/utils/constants.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = exports.TEMPLATE_ORIGINS = exports.POST_TYPE_LABELS = exports.PATTERN_USER_CATEGORY = exports.PATTERN_TYPES = exports.PATTERN_SYNC_TYPES = exports.PATTERN_DEFAULT_CATEGORY = exports.
|
|
6
|
+
exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_AREA_DEFAULT_CATEGORY = exports.TEMPLATE_ORIGINS = exports.POST_TYPE_LABELS = exports.PATTERN_USER_CATEGORY = exports.PATTERN_TYPES = exports.PATTERN_SYNC_TYPES = exports.PATTERN_DEFAULT_CATEGORY = exports.OPERATOR_IS_NOT = exports.OPERATOR_IS_NONE = exports.OPERATOR_IS_ANY = exports.OPERATOR_IS = exports.NAVIGATION_POST_TYPE = exports.LAYOUT_TABLE = exports.LAYOUT_LIST = exports.LAYOUT_GRID = exports.FOCUSABLE_ENTITIES = exports.EXCLUDED_PATTERN_SOURCES = exports.ENUMERATION_TYPE = void 0;
|
|
7
7
|
var _i18n = require("@wordpress/i18n");
|
|
8
8
|
var _patterns = require("@wordpress/patterns");
|
|
9
9
|
var _lockUnlock = require("../lock-unlock");
|
|
@@ -56,6 +56,8 @@ const LAYOUT_GRID = exports.LAYOUT_GRID = 'grid';
|
|
|
56
56
|
const LAYOUT_TABLE = exports.LAYOUT_TABLE = 'table';
|
|
57
57
|
const LAYOUT_LIST = exports.LAYOUT_LIST = 'list';
|
|
58
58
|
const ENUMERATION_TYPE = exports.ENUMERATION_TYPE = 'enumeration';
|
|
59
|
-
const
|
|
60
|
-
const
|
|
59
|
+
const OPERATOR_IS = exports.OPERATOR_IS = 'is';
|
|
60
|
+
const OPERATOR_IS_NOT = exports.OPERATOR_IS_NOT = 'isNot';
|
|
61
|
+
const OPERATOR_IS_ANY = exports.OPERATOR_IS_ANY = 'isAny';
|
|
62
|
+
const OPERATOR_IS_NONE = exports.OPERATOR_IS_NONE = 'isNone';
|
|
61
63
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","__","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","ENUMERATION_TYPE","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_patterns","_lockUnlock","NAVIGATION_POST_TYPE","exports","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","TEMPLATE_PART_AREA_DEFAULT_CATEGORY","PATTERN_TYPES","PATTERN_DEFAULT_CATEGORY","PATTERN_USER_CATEGORY","EXCLUDED_PATTERN_SOURCES","PATTERN_SYNC_TYPES","unlock","patternPrivateApis","FOCUSABLE_ENTITIES","user","POST_TYPE_LABELS","__","LAYOUT_GRID","LAYOUT_TABLE","LAYOUT_LIST","ENUMERATION_TYPE","OPERATOR_IS","OPERATOR_IS_NOT","OPERATOR_IS_ANY","OPERATOR_IS_NONE"],"sources":["@wordpress/edit-site/src/utils/constants.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../lock-unlock';\n\n// Navigation\nexport const NAVIGATION_POST_TYPE = 'wp_navigation';\n\n// Templates.\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\nexport const TEMPLATE_PART_AREA_DEFAULT_CATEGORY = 'uncategorized';\n\n// Patterns.\nexport const {\n\tPATTERN_TYPES,\n\tPATTERN_DEFAULT_CATEGORY,\n\tPATTERN_USER_CATEGORY,\n\tEXCLUDED_PATTERN_SOURCES,\n\tPATTERN_SYNC_TYPES,\n} = unlock( patternPrivateApis );\n\n// Entities that are editable in focus mode.\nexport const FOCUSABLE_ENTITIES = [\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nexport const POST_TYPE_LABELS = {\n\t[ TEMPLATE_POST_TYPE ]: __( 'Template' ),\n\t[ TEMPLATE_PART_POST_TYPE ]: __( 'Template part' ),\n\t[ PATTERN_TYPES.user ]: __( 'Pattern' ),\n\t[ NAVIGATION_POST_TYPE ]: __( 'Navigation' ),\n};\n\n// DataViews constants\nexport const LAYOUT_GRID = 'grid';\nexport const LAYOUT_TABLE = 'table';\nexport const LAYOUT_LIST = 'list';\nexport const ENUMERATION_TYPE = 'enumeration';\nexport const OPERATOR_IS = 'is';\nexport const OPERATOR_IS_NOT = 'isNot';\nexport const OPERATOR_IS_ANY = 'isAny';\nexport const OPERATOR_IS_NONE = 'isNone';\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAKA,IAAAE,WAAA,GAAAF,OAAA;AATA;AACA;AACA;;AAIA;AACA;AACA;;AAGA;AACO,MAAMG,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,eAAe;;AAEnD;AACO,MAAME,kBAAkB,GAAAD,OAAA,CAAAC,kBAAA,GAAG,aAAa;AACxC,MAAMC,uBAAuB,GAAAF,OAAA,CAAAE,uBAAA,GAAG,kBAAkB;AAClD,MAAMC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AACM,MAAMC,mCAAmC,GAAAP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,CAAAyB,eAAA,GAAG,OAAO;AAC/B,MAAMC,gBAAgB,GAAA1B,OAAA,CAAA0B,gBAAA,GAAG,QAAQ"}
|
|
@@ -20,7 +20,7 @@ function getIsListPage({
|
|
|
20
20
|
categoryType,
|
|
21
21
|
categoryId
|
|
22
22
|
}, isMobileViewport) {
|
|
23
|
-
return ['/wp_template
|
|
23
|
+
return ['/wp_template', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
|
|
24
24
|
// Don't treat "/patterns" without categoryType and categoryId as a
|
|
25
25
|
// list page in mobile because the sidebar covers the whole page.
|
|
26
26
|
!isMobileViewport || !!categoryType && !!categoryId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template
|
|
1
|
+
{"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template', '/wp_template_part/all', '/pages' ].includes(\n\t\t\tpath\n\t\t) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,cAAc,EAAE,uBAAuB,EAAE,QAAQ,CAAE,CAACC,QAAQ,CAC7DJ,IACD,CAAC,IACCA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.computeIFrameScale = computeIFrameScale;
|
|
7
|
+
/**
|
|
8
|
+
* @typedef {Object} WPPoint
|
|
9
|
+
* @property {number} x The horizontal coordinate.
|
|
10
|
+
* @property {number} y The vertical coordinate.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Clamps a value to a range. Uses the CSS `clamp()` ordering for arguments.
|
|
15
|
+
*
|
|
16
|
+
* @param {number} min Minimum range.
|
|
17
|
+
* @param {number} value Value to clamp.
|
|
18
|
+
* @param {number} max Maximum range.
|
|
19
|
+
*
|
|
20
|
+
* @return {number} Clamped value.
|
|
21
|
+
*/
|
|
22
|
+
function clamp(min, value, max) {
|
|
23
|
+
return Math.max(min, Math.min(value, max));
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Evaluates a linear function passing through two points at the given x value.
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* f(x)
|
|
31
|
+
* │ ╲
|
|
32
|
+
* │ * (p0)
|
|
33
|
+
* │ ╲
|
|
34
|
+
* │ ╲
|
|
35
|
+
* │ (p1) *
|
|
36
|
+
* │ ╲
|
|
37
|
+
* └──────────── x
|
|
38
|
+
*
|
|
39
|
+
* @param {WPPoint} p0 First point.
|
|
40
|
+
* @param {WPPoint} p1 Second point.
|
|
41
|
+
* @param {number} x Value to evaluate at.
|
|
42
|
+
*
|
|
43
|
+
* @return {number} Result of the two-point linear function at x.
|
|
44
|
+
*/
|
|
45
|
+
function twoPointLinearFn(p0, p1, x) {
|
|
46
|
+
return (p1.y - p0.y) / (p1.x - p0.x) * (x - p0.x) + p0.y;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Evaluates a two-point linear function at a given x value, clamped to the range of the points.
|
|
51
|
+
*
|
|
52
|
+
* Example:
|
|
53
|
+
* f(x)
|
|
54
|
+
* │ ───* (p0)
|
|
55
|
+
* │ ╲
|
|
56
|
+
* │ ╲
|
|
57
|
+
* │ (p1) *───
|
|
58
|
+
* └──────────── x
|
|
59
|
+
*
|
|
60
|
+
* @param {WPPoint} p0 First point.
|
|
61
|
+
* @param {WPPoint} p1 Second point.
|
|
62
|
+
* @param {number} x Value to evaluate at.
|
|
63
|
+
*
|
|
64
|
+
* @return {number} Result of the two-point linear function clamped to the range of the points.
|
|
65
|
+
*/
|
|
66
|
+
function clampedTwoPointLinearFn(p0, p1, x) {
|
|
67
|
+
return clamp(Math.min(p0.y, p1.y), twoPointLinearFn(p0, p1, x), Math.max(p0.y, p1.y));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Computes the iframe scale using a start and end width/scale pair and the current width.
|
|
72
|
+
*
|
|
73
|
+
* The scale is clamped outside the points and is linearly interpolated between.
|
|
74
|
+
*
|
|
75
|
+
* Example:
|
|
76
|
+
* scale
|
|
77
|
+
* │ ───* (start)
|
|
78
|
+
* │ ╲
|
|
79
|
+
* │ ╲
|
|
80
|
+
* │ (end) *───
|
|
81
|
+
* └──────────── width
|
|
82
|
+
*
|
|
83
|
+
* @param {Object} start First width and scale pair.
|
|
84
|
+
* @param {Object} end Second width and scale pair.
|
|
85
|
+
* @param {number} currentWidth Current width.
|
|
86
|
+
*
|
|
87
|
+
* @return {number} The scale of the current width between the two points.
|
|
88
|
+
*/
|
|
89
|
+
function computeIFrameScale(start, end, currentWidth) {
|
|
90
|
+
return clampedTwoPointLinearFn({
|
|
91
|
+
x: start.width,
|
|
92
|
+
y: start.scale
|
|
93
|
+
}, {
|
|
94
|
+
x: end.width,
|
|
95
|
+
y: end.scale
|
|
96
|
+
}, currentWidth);
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=math.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["clamp","min","value","max","Math","twoPointLinearFn","p0","p1","x","y","clampedTwoPointLinearFn","computeIFrameScale","start","end","currentWidth","width","scale"],"sources":["@wordpress/edit-site/src/utils/math.js"],"sourcesContent":["/**\n * @typedef {Object} WPPoint\n * @property {number} x The horizontal coordinate.\n * @property {number} y The vertical coordinate.\n */\n\n/**\n * Clamps a value to a range. Uses the CSS `clamp()` ordering for arguments.\n *\n * @param {number} min Minimum range.\n * @param {number} value Value to clamp.\n * @param {number} max Maximum range.\n *\n * @return {number} Clamped value.\n */\nfunction clamp( min, value, max ) {\n\treturn Math.max( min, Math.min( value, max ) );\n}\n\n/**\n * Evaluates a linear function passing through two points at the given x value.\n *\n * Example:\n * f(x)\n * │ ╲\n * │ * (p0)\n * │ ╲\n * │ ╲\n * │ (p1) *\n * │ ╲\n * └──────────── x\n *\n * @param {WPPoint} p0 First point.\n * @param {WPPoint} p1 Second point.\n * @param {number} x Value to evaluate at.\n *\n * @return {number} Result of the two-point linear function at x.\n */\nfunction twoPointLinearFn( p0, p1, x ) {\n\treturn ( ( p1.y - p0.y ) / ( p1.x - p0.x ) ) * ( x - p0.x ) + p0.y;\n}\n\n/**\n * Evaluates a two-point linear function at a given x value, clamped to the range of the points.\n *\n * Example:\n * f(x)\n * │ ───* (p0)\n * │ ╲\n * │ ╲\n * │ (p1) *───\n * └──────────── x\n *\n * @param {WPPoint} p0 First point.\n * @param {WPPoint} p1 Second point.\n * @param {number} x Value to evaluate at.\n *\n * @return {number} Result of the two-point linear function clamped to the range of the points.\n */\nfunction clampedTwoPointLinearFn( p0, p1, x ) {\n\treturn clamp(\n\t\tMath.min( p0.y, p1.y ),\n\t\ttwoPointLinearFn( p0, p1, x ),\n\t\tMath.max( p0.y, p1.y )\n\t);\n}\n\n/**\n * Computes the iframe scale using a start and end width/scale pair and the current width.\n *\n * The scale is clamped outside the points and is linearly interpolated between.\n *\n * Example:\n * scale\n * │ ───* (start)\n * │ ╲\n * │ ╲\n * │ (end) *───\n * └──────────── width\n *\n * @param {Object} start First width and scale pair.\n * @param {Object} end Second width and scale pair.\n * @param {number} currentWidth Current width.\n *\n * @return {number} The scale of the current width between the two points.\n */\nexport function computeIFrameScale( start, end, currentWidth ) {\n\treturn clampedTwoPointLinearFn(\n\t\t{ x: start.width, y: start.scale },\n\t\t{ x: end.width, y: end.scale },\n\t\tcurrentWidth\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,KAAKA,CAAEC,GAAG,EAAEC,KAAK,EAAEC,GAAG,EAAG;EACjC,OAAOC,IAAI,CAACD,GAAG,CAAEF,GAAG,EAAEG,IAAI,CAACH,GAAG,CAAEC,KAAK,EAAEC,GAAI,CAAE,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASE,gBAAgBA,CAAEC,EAAE,EAAEC,EAAE,EAAEC,CAAC,EAAG;EACtC,OAAS,CAAED,EAAE,CAACE,CAAC,GAAGH,EAAE,CAACG,CAAC,KAAOF,EAAE,CAACC,CAAC,GAAGF,EAAE,CAACE,CAAC,CAAE,IAAOA,CAAC,GAAGF,EAAE,CAACE,CAAC,CAAE,GAAGF,EAAE,CAACG,CAAC;AACnE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,uBAAuBA,CAAEJ,EAAE,EAAEC,EAAE,EAAEC,CAAC,EAAG;EAC7C,OAAOR,KAAK,CACXI,IAAI,CAACH,GAAG,CAAEK,EAAE,CAACG,CAAC,EAAEF,EAAE,CAACE,CAAE,CAAC,EACtBJ,gBAAgB,CAAEC,EAAE,EAAEC,EAAE,EAAEC,CAAE,CAAC,EAC7BJ,IAAI,CAACD,GAAG,CAAEG,EAAE,CAACG,CAAC,EAAEF,EAAE,CAACE,CAAE,CACtB,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAAEC,KAAK,EAAEC,GAAG,EAAEC,YAAY,EAAG;EAC9D,OAAOJ,uBAAuB,CAC7B;IAAEF,CAAC,EAAEI,KAAK,CAACG,KAAK;IAAEN,CAAC,EAAEG,KAAK,CAACI;EAAM,CAAC,EAClC;IAAER,CAAC,EAAEK,GAAG,CAACE,KAAK;IAAEN,CAAC,EAAEI,GAAG,CAACG;EAAM,CAAC,EAC9BF,YACD,CAAC;AACF"}
|
|
@@ -20,6 +20,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
|
|
|
20
20
|
import { unlock } from '../../lock-unlock';
|
|
21
21
|
import { store as editSiteStore } from '../../store';
|
|
22
22
|
import { FOCUSABLE_ENTITIES, NAVIGATION_POST_TYPE } from '../../utils/constants';
|
|
23
|
+
import { computeIFrameScale } from '../../utils/math';
|
|
23
24
|
const {
|
|
24
25
|
EditorCanvas: EditorCanvasRoot
|
|
25
26
|
} = unlock(editorPrivateApis);
|
|
@@ -27,16 +28,19 @@ function EditorCanvas({
|
|
|
27
28
|
enableResizing,
|
|
28
29
|
settings,
|
|
29
30
|
children,
|
|
31
|
+
onClick,
|
|
30
32
|
...props
|
|
31
33
|
}) {
|
|
32
34
|
const {
|
|
33
35
|
hasBlocks,
|
|
34
36
|
isFocusMode,
|
|
35
37
|
templateType,
|
|
36
|
-
canvasMode
|
|
38
|
+
canvasMode,
|
|
39
|
+
isZoomOutMode
|
|
37
40
|
} = useSelect(select => {
|
|
38
41
|
const {
|
|
39
|
-
getBlockCount
|
|
42
|
+
getBlockCount,
|
|
43
|
+
__unstableGetEditorMode
|
|
40
44
|
} = select(blockEditorStore);
|
|
41
45
|
const {
|
|
42
46
|
getEditedPostType,
|
|
@@ -46,6 +50,7 @@ function EditorCanvas({
|
|
|
46
50
|
return {
|
|
47
51
|
templateType: _templateType,
|
|
48
52
|
isFocusMode: FOCUSABLE_ENTITIES.includes(_templateType),
|
|
53
|
+
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
49
54
|
canvasMode: getCanvasMode(),
|
|
50
55
|
hasBlocks: !!getBlockCount()
|
|
51
56
|
};
|
|
@@ -78,7 +83,13 @@ function EditorCanvas({
|
|
|
78
83
|
setCanvasMode('edit');
|
|
79
84
|
}
|
|
80
85
|
},
|
|
81
|
-
onClick: () =>
|
|
86
|
+
onClick: () => {
|
|
87
|
+
if (!!onClick) {
|
|
88
|
+
onClick();
|
|
89
|
+
} else {
|
|
90
|
+
setCanvasMode('edit');
|
|
91
|
+
}
|
|
92
|
+
},
|
|
82
93
|
readonly: true
|
|
83
94
|
};
|
|
84
95
|
const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;
|
|
@@ -96,6 +107,14 @@ function EditorCanvas({
|
|
|
96
107
|
// which isn't a requirement in auto resize mode.
|
|
97
108
|
enableResizing ? 'min-height:0!important;' : ''}}body{position:relative; ${canvasMode === 'view' ? 'cursor: pointer; min-height: 100vh;' : ''}}}`
|
|
98
109
|
}], [settings.styles, enableResizing, canvasMode]);
|
|
110
|
+
const frameSize = isZoomOutMode ? 20 : undefined;
|
|
111
|
+
const scale = isZoomOutMode ? contentWidth => computeIFrameScale({
|
|
112
|
+
width: 1000,
|
|
113
|
+
scale: 0.45
|
|
114
|
+
}, {
|
|
115
|
+
width: 400,
|
|
116
|
+
scale: 0.9
|
|
117
|
+
}, contentWidth) : undefined;
|
|
99
118
|
return createElement(EditorCanvasRoot, {
|
|
100
119
|
className: classnames('edit-site-editor-canvas__block-list', {
|
|
101
120
|
'is-navigation-block': isTemplateTypeNavigation
|
|
@@ -103,7 +122,8 @@ function EditorCanvas({
|
|
|
103
122
|
renderAppender: showBlockAppender,
|
|
104
123
|
styles: styles,
|
|
105
124
|
iframeProps: {
|
|
106
|
-
|
|
125
|
+
scale,
|
|
126
|
+
frameSize,
|
|
107
127
|
className: classnames('edit-site-visual-editor__editor-canvas', {
|
|
108
128
|
'is-focused': isFocused && canvasMode === 'view'
|
|
109
129
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","store","blockEditorStore","useSelect","useDispatch","ENTER","SPACE","useState","useEffect","useMemo","__","privateApis","editorPrivateApis","unlock","editSiteStore","FOCUSABLE_ENTITIES","NAVIGATION_POST_TYPE","EditorCanvas","EditorCanvasRoot","enableResizing","settings","children","props","hasBlocks","isFocusMode","templateType","canvasMode","select","getBlockCount","getEditedPostType","getCanvasMode","_templateType","includes","setCanvasMode","isFocused","setIsFocused","viewModeIframeProps","title","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","preventDefault","
|
|
1
|
+
{"version":3,"names":["classnames","store","blockEditorStore","useSelect","useDispatch","ENTER","SPACE","useState","useEffect","useMemo","__","privateApis","editorPrivateApis","unlock","editSiteStore","FOCUSABLE_ENTITIES","NAVIGATION_POST_TYPE","computeIFrameScale","EditorCanvas","EditorCanvasRoot","enableResizing","settings","children","onClick","props","hasBlocks","isFocusMode","templateType","canvasMode","isZoomOutMode","select","getBlockCount","__unstableGetEditorMode","getEditedPostType","getCanvasMode","_templateType","includes","setCanvasMode","isFocused","setIsFocused","viewModeIframeProps","title","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","preventDefault","readonly","isTemplateTypeNavigation","isNavigationFocusMode","showBlockAppender","undefined","styles","css","frameSize","scale","contentWidth","width","createElement","className","renderAppender","iframeProps"],"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { ENTER, SPACE } from '@wordpress/keycodes';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tFOCUSABLE_ENTITIES,\n\tNAVIGATION_POST_TYPE,\n} from '../../utils/constants';\nimport { computeIFrameScale } from '../../utils/math';\n\nconst { EditorCanvas: EditorCanvasRoot } = unlock( editorPrivateApis );\n\nfunction EditorCanvas( {\n\tenableResizing,\n\tsettings,\n\tchildren,\n\tonClick,\n\t...props\n} ) {\n\tconst { hasBlocks, isFocusMode, templateType, canvasMode, isZoomOutMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getBlockCount, __unstableGetEditorMode } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\tconst { getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst _templateType = getEditedPostType();\n\n\t\t\treturn {\n\t\t\t\ttemplateType: _templateType,\n\t\t\t\tisFocusMode: FOCUSABLE_ENTITIES.includes( _templateType ),\n\t\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\thasBlocks: !! getBlockCount(),\n\t\t\t};\n\t\t}, [] );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst [ isFocused, setIsFocused ] = useState( false );\n\n\tuseEffect( () => {\n\t\tif ( canvasMode === 'edit' ) {\n\t\t\tsetIsFocused( false );\n\t\t}\n\t}, [ canvasMode ] );\n\n\t// In view mode, make the canvas iframe be perceived and behave as a button\n\t// to switch to edit mode, with a meaningful label and no title attribute.\n\tconst viewModeIframeProps = {\n\t\t'aria-label': __( 'Edit' ),\n\t\ttitle: null,\n\t\trole: 'button',\n\t\ttabIndex: 0,\n\t\tonFocus: () => setIsFocused( true ),\n\t\tonBlur: () => setIsFocused( false ),\n\t\tonKeyDown: ( event ) => {\n\t\t\tconst { keyCode } = event;\n\t\t\tif ( keyCode === ENTER || keyCode === SPACE ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t}\n\t\t},\n\t\tonClick: () => {\n\t\t\tif ( !! onClick ) {\n\t\t\t\tonClick();\n\t\t\t} else {\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t}\n\t\t},\n\t\treadonly: true,\n\t};\n\tconst isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;\n\tconst isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;\n\t// Hide the appender when:\n\t// - In navigation focus mode (should only allow the root Nav block).\n\t// - In view mode (i.e. not editing).\n\tconst showBlockAppender =\n\t\t( isNavigationFocusMode && hasBlocks ) || canvasMode === 'view'\n\t\t\t? false\n\t\t\t: undefined;\n\n\tconst styles = useMemo(\n\t\t() => [\n\t\t\t...settings.styles,\n\t\t\t{\n\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\n\t\t\t\tcss: `.is-root-container{display:flow-root;${\n\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\tenableResizing ? 'min-height:0!important;' : ''\n\t\t\t\t}}body{position:relative; ${\n\t\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t\t? 'cursor: pointer; min-height: 100vh;'\n\t\t\t\t\t\t: ''\n\t\t\t\t}}}`,\n\t\t\t},\n\t\t],\n\t\t[ settings.styles, enableResizing, canvasMode ]\n\t);\n\n\tconst frameSize = isZoomOutMode ? 20 : undefined;\n\n\tconst scale = isZoomOutMode\n\t\t? ( contentWidth ) =>\n\t\t\t\tcomputeIFrameScale(\n\t\t\t\t\t{ width: 1000, scale: 0.45 },\n\t\t\t\t\t{ width: 400, scale: 0.9 },\n\t\t\t\t\tcontentWidth\n\t\t\t\t)\n\t\t: undefined;\n\n\treturn (\n\t\t<EditorCanvasRoot\n\t\t\tclassName={ classnames( 'edit-site-editor-canvas__block-list', {\n\t\t\t\t'is-navigation-block': isTemplateTypeNavigation,\n\t\t\t} ) }\n\t\t\trenderAppender={ showBlockAppender }\n\t\t\tstyles={ styles }\n\t\t\tiframeProps={ {\n\t\t\t\tscale,\n\t\t\t\tframeSize,\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'edit-site-visual-editor__editor-canvas',\n\t\t\t\t\t{\n\t\t\t\t\t\t'is-focused': isFocused && canvasMode === 'view',\n\t\t\t\t\t}\n\t\t\t\t),\n\t\t\t\t...props,\n\t\t\t\t...( canvasMode === 'view' ? viewModeIframeProps : {} ),\n\t\t\t} }\n\t\t>\n\t\t\t{ children }\n\t\t</EditorCanvasRoot>\n\t);\n}\n\nexport default EditorCanvas;\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;;AAEnC;AACA;AACA;AACA,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,KAAK,EAAEC,KAAK,QAAQ,qBAAqB;AAClD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ACA;;IAEAC,GAAG,EAAG;IACL;IACA;IACApC,cAAc,GAAG,yBAAyB,GAAG,EAC7C,4BACAQ,UAAU,KAAK,MAAM,GAClB,qCAAqC,GACrC,EACH;EACF,CAAC,CACD,EACD,CAAEP,QAAQ,CAACkC,MAAM,EAAEnC,cAAc,EAAEQ,UAAU,CAC9C,CAAC;EAED,MAAM6B,SAAS,GAAG5B,aAAa,GAAG,EAAE,GAAGyB,SAAS;EAEhD,MAAMI,KAAK,GAAG7B,aAAa,GACtB8B,YAAY,IACd1C,kBAAkB,CACjB;IAAE2C,KAAK,EAAE,IAAI;IAAEF,KAAK,EAAE;EAAK,CAAC,EAC5B;IAAEE,KAAK,EAAE,GAAG;IAAEF,KAAK,EAAE;EAAI,CAAC,EAC1BC,YACD,CAAC,GACDL,SAAS;EAEZ,OACCO,aAAA,CAAC1C,gBAAgB;IAChB2C,SAAS,EAAG9D,UAAU,CAAE,qCAAqC,EAAE;MAC9D,qBAAqB,EAAEmD;IACxB,CAAE,CAAG;IACLY,cAAc,EAAGV,iBAAmB;IACpCE,MAAM,EAAGA,MAAQ;IACjBS,WAAW,EAAG;MACbN,KAAK;MACLD,SAAS;MACTK,SAAS,EAAE9D,UAAU,CACpB,wCAAwC,EACxC;QACC,YAAY,EAAEsC,SAAS,IAAIV,UAAU,KAAK;MAC3C,CACD,CAAC;MACD,GAAGJ,KAAK;MACR,IAAKI,UAAU,KAAK,MAAM,GAAGY,mBAAmB,GAAG,CAAC,CAAC;IACtD;EAAG,GAEDlB,QACe,CAAC;AAErB;AAEA,eAAeJ,YAAY"}
|
|
@@ -8,6 +8,7 @@ import classnames from 'classnames';
|
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
10
|
import { useViewportMatch, useResizeObserver } from '@wordpress/compose';
|
|
11
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Internal dependencies
|
|
@@ -23,22 +24,29 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
|
23
24
|
const {
|
|
24
25
|
useLocation
|
|
25
26
|
} = unlock(routerPrivateApis);
|
|
26
|
-
export default function SiteEditorCanvas(
|
|
27
|
+
export default function SiteEditorCanvas({
|
|
28
|
+
onClick
|
|
29
|
+
}) {
|
|
27
30
|
const location = useLocation();
|
|
28
31
|
const {
|
|
29
32
|
templateType,
|
|
30
33
|
isFocusableEntity,
|
|
31
|
-
isViewMode
|
|
34
|
+
isViewMode,
|
|
35
|
+
isZoomOutMode
|
|
32
36
|
} = useSelect(select => {
|
|
33
37
|
const {
|
|
34
38
|
getEditedPostType,
|
|
35
39
|
getCanvasMode
|
|
36
40
|
} = unlock(select(editSiteStore));
|
|
41
|
+
const {
|
|
42
|
+
__unstableGetEditorMode
|
|
43
|
+
} = select(blockEditorStore);
|
|
37
44
|
const _templateType = getEditedPostType();
|
|
38
45
|
return {
|
|
39
46
|
templateType: _templateType,
|
|
40
47
|
isFocusableEntity: FOCUSABLE_ENTITIES.includes(_templateType),
|
|
41
|
-
isViewMode: getCanvasMode() === 'view'
|
|
48
|
+
isViewMode: getCanvasMode() === 'view',
|
|
49
|
+
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out'
|
|
42
50
|
};
|
|
43
51
|
}, []);
|
|
44
52
|
const isFocusMode = location.params.focusMode || isFocusableEntity;
|
|
@@ -48,6 +56,8 @@ export default function SiteEditorCanvas() {
|
|
|
48
56
|
const enableResizing = isFocusMode && !isViewMode &&
|
|
49
57
|
// Disable resizing in mobile viewport.
|
|
50
58
|
!isMobileViewport &&
|
|
59
|
+
// Dsiable resizing in zoomed-out mode.
|
|
60
|
+
!isZoomOutMode &&
|
|
51
61
|
// Disable resizing when editing a template in focus mode.
|
|
52
62
|
templateType !== TEMPLATE_POST_TYPE;
|
|
53
63
|
const isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;
|
|
@@ -65,7 +75,8 @@ export default function SiteEditorCanvas() {
|
|
|
65
75
|
height: sizes.height && !forceFullHeight ? sizes.height : '100%'
|
|
66
76
|
}, createElement(EditorCanvas, {
|
|
67
77
|
enableResizing: enableResizing,
|
|
68
|
-
settings: settings
|
|
78
|
+
settings: settings,
|
|
79
|
+
onClick: onClick
|
|
69
80
|
}, resizeObserver))));
|
|
70
81
|
}
|
|
71
82
|
//# sourceMappingURL=site-editor-canvas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["classnames","useSelect","useViewportMatch","useResizeObserver","ResizableEditor","EditorCanvas","EditorCanvasContainer","useSiteEditorSettings","
|
|
1
|
+
{"version":3,"names":["classnames","useSelect","useViewportMatch","useResizeObserver","store","blockEditorStore","ResizableEditor","EditorCanvas","EditorCanvasContainer","useSiteEditorSettings","editSiteStore","FOCUSABLE_ENTITIES","NAVIGATION_POST_TYPE","TEMPLATE_POST_TYPE","unlock","privateApis","routerPrivateApis","useLocation","SiteEditorCanvas","onClick","location","templateType","isFocusableEntity","isViewMode","isZoomOutMode","select","getEditedPostType","getCanvasMode","__unstableGetEditorMode","_templateType","includes","isFocusMode","params","focusMode","resizeObserver","sizes","settings","isMobileViewport","enableResizing","isTemplateTypeNavigation","isNavigationFocusMode","forceFullHeight","createElement","Slot","editorCanvasView","className","height"],"sources":["@wordpress/edit-site/src/components/block-editor/site-editor-canvas.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useViewportMatch, useResizeObserver } from '@wordpress/compose';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ResizableEditor from './resizable-editor';\nimport EditorCanvas from './editor-canvas';\nimport EditorCanvasContainer from '../editor-canvas-container';\nimport useSiteEditorSettings from './use-site-editor-settings';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tFOCUSABLE_ENTITIES,\n\tNAVIGATION_POST_TYPE,\n\tTEMPLATE_POST_TYPE,\n} from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SiteEditorCanvas( { onClick } ) {\n\tconst location = useLocation();\n\tconst { templateType, isFocusableEntity, isViewMode, isZoomOutMode } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getEditedPostType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\t\tconst _templateType = getEditedPostType();\n\n\t\t\treturn {\n\t\t\t\ttemplateType: _templateType,\n\t\t\t\tisFocusableEntity: FOCUSABLE_ENTITIES.includes( _templateType ),\n\t\t\t\tisViewMode: getCanvasMode() === 'view',\n\t\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t\t};\n\t\t}, [] );\n\tconst isFocusMode = location.params.focusMode || isFocusableEntity;\n\tconst [ resizeObserver, sizes ] = useResizeObserver();\n\n\tconst settings = useSiteEditorSettings();\n\n\tconst isMobileViewport = useViewportMatch( 'small', '<' );\n\tconst enableResizing =\n\t\tisFocusMode &&\n\t\t! isViewMode &&\n\t\t// Disable resizing in mobile viewport.\n\t\t! isMobileViewport &&\n\t\t// Dsiable resizing in zoomed-out mode.\n\t\t! isZoomOutMode &&\n\t\t// Disable resizing when editing a template in focus mode.\n\t\ttemplateType !== TEMPLATE_POST_TYPE;\n\n\tconst isTemplateTypeNavigation = templateType === NAVIGATION_POST_TYPE;\n\tconst isNavigationFocusMode = isTemplateTypeNavigation && isFocusMode;\n\tconst forceFullHeight = isNavigationFocusMode;\n\n\treturn (\n\t\t<EditorCanvasContainer.Slot>\n\t\t\t{ ( [ editorCanvasView ] ) =>\n\t\t\t\teditorCanvasView ? (\n\t\t\t\t\t<div className=\"edit-site-visual-editor is-focus-mode\">\n\t\t\t\t\t\t{ editorCanvasView }\n\t\t\t\t\t</div>\n\t\t\t\t) : (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ classnames( 'edit-site-visual-editor', {\n\t\t\t\t\t\t\t'is-focus-mode': isFocusMode || !! editorCanvasView,\n\t\t\t\t\t\t\t'is-view-mode': isViewMode,\n\t\t\t\t\t\t} ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<ResizableEditor\n\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\tsizes.height && ! forceFullHeight\n\t\t\t\t\t\t\t\t\t? sizes.height\n\t\t\t\t\t\t\t\t\t: '100%'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<EditorCanvas\n\t\t\t\t\t\t\t\tenableResizing={ enableResizing }\n\t\t\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t\t\t\tonClick={ onClick }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ resizeObserver }\n\t\t\t\t\t\t\t</EditorCanvas>\n\t\t\t\t\t\t</ResizableEditor>\n\t\t\t\t\t</div>\n\t\t\t\t)\n\t\t\t}\n\t\t</EditorCanvasContainer.Slot>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,OAAOA,UAAU,MAAM,YAAY;AACnC;AACA;AACA;AACA,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,oBAAoB;AACxE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;;AAEnE;AACA;AACA;AACA,OAAOC,eAAe,MAAM,oBAAoB;AAChD,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,OAAOC,qBAAqB,MAAM,4BAA4B;AAC9D,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,SACCC,kBAAkB,EAClBC,oBAAoB,EACpBC,kBAAkB,QACZ,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,mBAAmB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AY,KAAKT,oBAAoB;EACtE,MAAM4B,qBAAqB,GAAGD,wBAAwB,IAAIR,WAAW;EACrE,MAAMU,eAAe,GAAGD,qBAAqB;EAE7C,OACCE,aAAA,CAAClC,qBAAqB,CAACmC,IAAI,QACxB,CAAE,CAAEC,gBAAgB,CAAE,KACvBA,gBAAgB,GACfF,aAAA;IAAKG,SAAS,EAAC;EAAuC,GACnDD,gBACE,CAAC,GAENF,aAAA;IACCG,SAAS,EAAG7C,UAAU,CAAE,yBAAyB,EAAE;MAClD,eAAe,EAAE+B,WAAW,IAAI,CAAC,CAAEa,gBAAgB;MACnD,cAAc,EAAErB;IACjB,CAAE;EAAG,GAELmB,aAAA,CAACpC,eAAe;IACfgC,cAAc,EAAGA,cAAgB;IACjCQ,MAAM,EACLX,KAAK,CAACW,MAAM,IAAI,CAAEL,eAAe,GAC9BN,KAAK,CAACW,MAAM,GACZ;EACH,GAEDJ,aAAA,CAACnC,YAAY;IACZ+B,cAAc,EAAGA,cAAgB;IACjCF,QAAQ,EAAGA,QAAU;IACrBjB,OAAO,EAAGA;EAAS,GAEjBe,cACW,CACE,CACb,CAGoB,CAAC;AAE/B"}
|
|
@@ -94,7 +94,7 @@ function useNavigateToPreviousEntityRecord() {
|
|
|
94
94
|
const history = useHistory();
|
|
95
95
|
const goBack = useMemo(() => {
|
|
96
96
|
const isFocusMode = location.params.focusMode || location.params.postId && FOCUSABLE_ENTITIES.includes(location.params.postType);
|
|
97
|
-
const didComeFromEditorCanvas = previousLocation?.params.
|
|
97
|
+
const didComeFromEditorCanvas = previousLocation?.params.canvas === 'edit';
|
|
98
98
|
const showBackButton = isFocusMode && didComeFromEditorCanvas;
|
|
99
99
|
return showBackButton ? () => history.back() : undefined;
|
|
100
100
|
// Disable reason: previousLocation changes when the component updates for any reason, not
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useMemo","store","coreStore","privateApis","editorPrivateApis","routerPrivateApis","usePrevious","editSiteStore","unlock","useNavigateToEntityRecord","FOCUSABLE_ENTITIES","useBlockEditorSettings","useLocation","useHistory","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","select","getEntityRecords","getTaxonomy","getAuthors","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useNavigateToPreviousEntityRecord","location","previousLocation","history","goBack","isFocusMode","params","focusMode","postId","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","archiveLabels","defaultRenderingMode","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","__unstableIsPreviewMode","useSiteEditorSettings"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.postId &&\n\t\t\tpreviousLocation?.params.postType &&\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// Disable reason: previousLocation changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { templateSlug, canvasMode, settings, postWithTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate\n\t\t? 'template-locked'\n\t\t: 'post-only';\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvasMode !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t\t__unstableIsPreviewMode: canvasMode === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvasMode,\n\t\tdefaultRenderingMode,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType: usedPostType,\n\t\t\tpostId: usedPostId,\n\t\t};\n\t}, [] );\n\treturn useBlockEditorSettings( defaultEditorSettings, postType, postId );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,SAASC,kBAAkB,QAAQ,uBAAuB;AAE1D,MAAM;EAAEC;AAAuB,CAAC,GAAGH,MAAM,CAAEJ,iBAAkB,CAAC;AAC9D,MAAM;EAAEQ,WAAW;EAAEC;AAAW,CAAC,GAAGL,MAAM,CAAEH,iBAAkB,CAAC;AAE/D,SAASS,eAAeA,CAAEC,YAAY,EAAG;EACxC,MAAMC,eAAe,GAAGD,YAAY,EAAEE,KAAK,CAC1C,8EACD,CAAC;EACD,IAAIC,QAAQ;EACZ,IAAIC,IAAI;EACR,IAAIC,QAAQ,GAAG,KAAK;EACpB,IAAIC,UAAU;EACd,IAAKL,eAAe,EAAG;IACtB;IACA,IAAKA,eAAe,CAAE,CAAC,CAAE,EAAG;MAC3BE,QAAQ,GAAGF,eAAe,CAAE,CAAC,CAAE,GAC5BA,eAAe,CAAE,CAAC,CAAE,GACpBA,eAAe,CAAE,CAAC,CAAE;IACxB;IACA;IAAA,KACK,IAAKA,eAAe,CAAE,CAAC,CAAE,EAAG;MAChCE,QAAQ,GAAGF,eAAe,CAAE,CAAC,CAAE,G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gB,EAC9BwC,aAAa,CAACvC,gBAAgB,CAC7B,CAAC;EAEH,OAAO0C,qBAAqB;AAC7B;AAEA,eAAe,SAASM,qBAAqBA,CAAA,EAAG;EAC/C,MAAMN,qBAAqB,GAAGlB,yBAAyB,CAAC,CAAC;EACzD,MAAM;IAAEN,QAAQ;IAAEF;EAAO,CAAC,GAAG7C,SAAS,CAAIwB,MAAM,IAAM;IACrD,MAAM;MAAEkC,iBAAiB;MAAEC;IAAgB,CAAC,GAAGlD,MAAM,CACpDe,MAAM,CAAEhB,aAAc,CACvB,CAAC;IACD,MAAMwD,YAAY,GAAGN,iBAAiB,CAAC,CAAC;IACxC,MAAMO,UAAU,GAAGN,eAAe,CAAC,CAAC;IACpC,OAAO;MACNZ,QAAQ,EAAEiB,YAAY;MACtBnB,MAAM,EAAEoB;IACT,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EACP,OAAOrD,sBAAsB,CAAE2D,qBAAqB,EAAExB,QAAQ,EAAEF,MAAO,CAAC;AACzE"}
|
|
1
|
+
{"version":3,"names":["useSelect","useMemo","store","coreStore","privateApis","editorPrivateApis","routerPrivateApis","usePrevious","editSiteStore","unlock","useNavigateToEntityRecord","FOCUSABLE_ENTITIES","useBlockEditorSettings","useLocation","useHistory","useArchiveLabel","templateSlug","taxonomyMatches","match","taxonomy","term","isAuthor","authorSlug","authorMatches","select","getEntityRecords","getTaxonomy","getAuthors","archiveTypeLabel","archiveNameLabel","labels","singular_name","records","slug","per_page","name","authorRecords","useNavigateToPreviousEntityRecord","location","previousLocation","history","goBack","isFocusMode","params","focusMode","postId","includes","postType","didComeFromEditorCanvas","canvas","showBackButton","back","undefined","useSpecificEditorSettings","onNavigateToEntityRecord","canvasMode","settings","postWithTemplate","getEditedPostType","getEditedPostId","getEditedPostContext","getCanvasMode","getSettings","getEditedEntityRecord","usedPostType","usedPostId","_record","_context","archiveLabels","defaultRenderingMode","onNavigateToPreviousEntityRecord","defaultEditorSettings","richEditingEnabled","supportsTemplateMode","__experimentalArchiveTitleTypeLabel","__experimentalArchiveTitleNameLabel","__unstableIsPreviewMode","useSiteEditorSettings"],"sources":["@wordpress/edit-site/src/components/block-editor/use-site-editor-settings.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { usePrevious } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport useNavigateToEntityRecord from './use-navigate-to-entity-record';\nimport { FOCUSABLE_ENTITIES } from '../../utils/constants';\n\nconst { useBlockEditorSettings } = unlock( editorPrivateApis );\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nfunction useArchiveLabel( templateSlug ) {\n\tconst taxonomyMatches = templateSlug?.match(\n\t\t/^(category|tag|taxonomy-([^-]+))$|^(((category|tag)|taxonomy-([^-]+))-(.+))$/\n\t);\n\tlet taxonomy;\n\tlet term;\n\tlet isAuthor = false;\n\tlet authorSlug;\n\tif ( taxonomyMatches ) {\n\t\t// If is for a all taxonomies of a type\n\t\tif ( taxonomyMatches[ 1 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 2 ]\n\t\t\t\t? taxonomyMatches[ 2 ]\n\t\t\t\t: taxonomyMatches[ 1 ];\n\t\t}\n\t\t// If is for a all taxonomies of a type\n\t\telse if ( taxonomyMatches[ 3 ] ) {\n\t\t\ttaxonomy = taxonomyMatches[ 6 ]\n\t\t\t\t? taxonomyMatches[ 6 ]\n\t\t\t\t: taxonomyMatches[ 4 ];\n\t\t\tterm = taxonomyMatches[ 7 ];\n\t\t}\n\t\ttaxonomy = taxonomy === 'tag' ? 'post_tag' : taxonomy;\n\n\t\t//getTaxonomy( 'category' );\n\t\t//wp.data.select('core').getEntityRecords( 'taxonomy', 'category', {slug: 'newcat'} );\n\t} else {\n\t\tconst authorMatches = templateSlug?.match( /^(author)$|^author-(.+)$/ );\n\t\tif ( authorMatches ) {\n\t\t\tisAuthor = true;\n\t\t\tif ( authorMatches[ 2 ] ) {\n\t\t\t\tauthorSlug = authorMatches[ 2 ];\n\t\t\t}\n\t\t}\n\t}\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecords, getTaxonomy, getAuthors } =\n\t\t\t\tselect( coreStore );\n\t\t\tlet archiveTypeLabel;\n\t\t\tlet archiveNameLabel;\n\t\t\tif ( taxonomy ) {\n\t\t\t\tarchiveTypeLabel =\n\t\t\t\t\tgetTaxonomy( taxonomy )?.labels?.singular_name;\n\t\t\t}\n\t\t\tif ( term ) {\n\t\t\t\tconst records = getEntityRecords( 'taxonomy', taxonomy, {\n\t\t\t\t\tslug: term,\n\t\t\t\t\tper_page: 1,\n\t\t\t\t} );\n\t\t\t\tif ( records && records[ 0 ] ) {\n\t\t\t\t\tarchiveNameLabel = records[ 0 ].name;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( isAuthor ) {\n\t\t\t\tarchiveTypeLabel = 'Author';\n\t\t\t\tif ( authorSlug ) {\n\t\t\t\t\tconst authorRecords = getAuthors( { slug: authorSlug } );\n\t\t\t\t\tif ( authorRecords && authorRecords[ 0 ] ) {\n\t\t\t\t\t\tarchiveNameLabel = authorRecords[ 0 ].name;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tarchiveTypeLabel,\n\t\t\t\tarchiveNameLabel,\n\t\t\t};\n\t\t},\n\t\t[ authorSlug, isAuthor, taxonomy, term ]\n\t);\n}\n\nfunction useNavigateToPreviousEntityRecord() {\n\tconst location = useLocation();\n\tconst previousLocation = usePrevious( location );\n\tconst history = useHistory();\n\tconst goBack = useMemo( () => {\n\t\tconst isFocusMode =\n\t\t\tlocation.params.focusMode ||\n\t\t\t( location.params.postId &&\n\t\t\t\tFOCUSABLE_ENTITIES.includes( location.params.postType ) );\n\t\tconst didComeFromEditorCanvas =\n\t\t\tpreviousLocation?.params.canvas === 'edit';\n\t\tconst showBackButton = isFocusMode && didComeFromEditorCanvas;\n\t\treturn showBackButton ? () => history.back() : undefined;\n\t\t// Disable reason: previousLocation changes when the component updates for any reason, not\n\t\t// just when location changes. Until this is fixed we can't add it to deps. See\n\t\t// https://github.com/WordPress/gutenberg/pull/58710#discussion_r1479219465.\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [ location, history ] );\n\treturn goBack;\n}\n\nexport function useSpecificEditorSettings() {\n\tconst onNavigateToEntityRecord = useNavigateToEntityRecord();\n\tconst { templateSlug, canvasMode, settings, postWithTemplate } = useSelect(\n\t\t( select ) => {\n\t\t\tconst {\n\t\t\t\tgetEditedPostType,\n\t\t\t\tgetEditedPostId,\n\t\t\t\tgetEditedPostContext,\n\t\t\t\tgetCanvasMode,\n\t\t\t\tgetSettings,\n\t\t\t} = unlock( select( editSiteStore ) );\n\t\t\tconst { getEditedEntityRecord } = select( coreStore );\n\t\t\tconst usedPostType = getEditedPostType();\n\t\t\tconst usedPostId = getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _context = getEditedPostContext();\n\t\t\treturn {\n\t\t\t\ttemplateSlug: _record.slug,\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tsettings: getSettings(),\n\t\t\t\tpostWithTemplate: _context?.postId,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst archiveLabels = useArchiveLabel( templateSlug );\n\tconst defaultRenderingMode = postWithTemplate\n\t\t? 'template-locked'\n\t\t: 'post-only';\n\tconst onNavigateToPreviousEntityRecord =\n\t\tuseNavigateToPreviousEntityRecord();\n\tconst defaultEditorSettings = useMemo( () => {\n\t\treturn {\n\t\t\t...settings,\n\n\t\t\trichEditingEnabled: true,\n\t\t\tsupportsTemplateMode: true,\n\t\t\tfocusMode: canvasMode !== 'view',\n\t\t\tdefaultRenderingMode,\n\t\t\tonNavigateToEntityRecord,\n\t\t\tonNavigateToPreviousEntityRecord,\n\t\t\t// I wonder if they should be set in the post editor too\n\t\t\t__experimentalArchiveTitleTypeLabel: archiveLabels.archiveTypeLabel,\n\t\t\t__experimentalArchiveTitleNameLabel: archiveLabels.archiveNameLabel,\n\t\t\t__unstableIsPreviewMode: canvasMode === 'view',\n\t\t};\n\t}, [\n\t\tsettings,\n\t\tcanvasMode,\n\t\tdefaultRenderingMode,\n\t\tonNavigateToEntityRecord,\n\t\tonNavigateToPreviousEntityRecord,\n\t\tarchiveLabels.archiveTypeLabel,\n\t\tarchiveLabels.archiveNameLabel,\n\t] );\n\n\treturn defaultEditorSettings;\n}\n\nexport default function useSiteEditorSettings() {\n\tconst defaultEditorSettings = useSpecificEditorSettings();\n\tconst { postType, postId } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst usedPostType = getEditedPostType();\n\t\tconst usedPostId = getEditedPostId();\n\t\treturn {\n\t\t\tpostType: usedPostType,\n\t\t\tpostId: usedPostId,\n\t\t};\n\t}, [] );\n\treturn useBlockEditorSettings( defaultEditorSettings, postType, postId );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,WAAW,QAAQ,oBAAoB;;AAEhD;AACA;AACA;AACA,SAASL,KAAK,IAAIM,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,yBAAyB,MAAM,iCAAi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+7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
/**
|
|
8
8
|
* WordPress dependencies
|
|
9
9
|
*/
|
|
10
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
11
|
import { Notice } from '@wordpress/components';
|
|
12
12
|
import { useInstanceId, useViewportMatch } from '@wordpress/compose';
|
|
13
13
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
@@ -52,7 +52,8 @@ const interfaceLabels = {
|
|
|
52
52
|
footer: __('Editor footer')
|
|
53
53
|
};
|
|
54
54
|
export default function Editor({
|
|
55
|
-
isLoading
|
|
55
|
+
isLoading,
|
|
56
|
+
onClick
|
|
56
57
|
}) {
|
|
57
58
|
const {
|
|
58
59
|
record: editedPost,
|
|
@@ -138,6 +139,9 @@ export default function Editor({
|
|
|
138
139
|
// action in <URLQueryController> from double-announcing.
|
|
139
140
|
useTitle(hasLoadedPost && title);
|
|
140
141
|
const loadingProgressId = useInstanceId(CanvasLoader, 'edit-site-editor__loading-progress');
|
|
142
|
+
const {
|
|
143
|
+
closeGeneralSidebar
|
|
144
|
+
} = useDispatch(editSiteStore);
|
|
141
145
|
const settings = useSpecificEditorSettings();
|
|
142
146
|
const isReady = !isLoading && (postWithTemplate && !!contextPost && !!editedPost || !postWithTemplate && !!editedPost);
|
|
143
147
|
return createElement(Fragment, null, !isReady ? createElement(CanvasLoader, {
|
|
@@ -159,8 +163,13 @@ export default function Editor({
|
|
|
159
163
|
notices: createElement(EditorSnackbars, null),
|
|
160
164
|
content: createElement(Fragment, null, createElement(GlobalStylesRenderer, null), isEditMode && createElement(EditorNotices, null), showVisualEditor && createElement(Fragment, null, createElement(TemplatePartConverter, null), createElement(SidebarInspectorFill, null, createElement(BlockInspector, null)), !isLargeViewport && createElement(BlockToolbar, {
|
|
161
165
|
hideDragHandle: true
|
|
162
|
-
}), createElement(SiteEditorCanvas,
|
|
163
|
-
|
|
166
|
+
}), createElement(SiteEditorCanvas, {
|
|
167
|
+
onClick: onClick
|
|
168
|
+
}), createElement(PatternModal, null)), editorMode === 'text' && isEditMode && createElement(CodeEditor, null), isEditMode && createElement(Fragment, null, createElement(KeyboardShortcutsEditMode, null), createElement(EditorKeyboardShortcutsRegister, null), createElement(EditorKeyboardShortcuts, null))),
|
|
169
|
+
secondarySidebar: isEditMode && (shouldShowInserter && createElement(InserterSidebar, {
|
|
170
|
+
closeGeneralSidebar: closeGeneralSidebar,
|
|
171
|
+
isRightSidebarOpen: isRightSidebarOpen
|
|
172
|
+
}) || shouldShowListView && createElement(ListViewSidebar, null)),
|
|
164
173
|
sidebar: !isDistractionFree && isEditMode && isRightSidebarOpen && !isDistractionFree && createElement(ComplementaryArea.Slot, {
|
|
165
174
|
scope: "core/edit-site"
|
|
166
175
|
}),
|