@wordpress/edit-site 5.34.0 → 5.35.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 +9 -3
- package/build/components/add-new-template/index.js +2 -2
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +4 -18
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +2 -2
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/dataviews-actions/index.js +46 -0
- package/build/components/dataviews-actions/index.js.map +1 -0
- package/build/components/editor/index.js +68 -12
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/background-panel.js +13 -1
- package/build/components/global-styles/background-panel.js.map +1 -1
- package/build/components/global-styles/color-indicator-wrapper.js +2 -2
- package/build/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +5 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +1 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/hooks.js +5 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/icon-with-current-color.js +2 -2
- package/build/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build/components/global-styles/preset-colors.js +29 -0
- package/build/components/global-styles/preset-colors.js.map +1 -0
- package/build/components/global-styles/preview-colors.js +3 -7
- package/build/components/global-styles/preview-colors.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +5 -5
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +1 -4
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/typography-example.js +5 -2
- package/build/components/global-styles/typography-example.js.map +1 -1
- package/build/components/global-styles/ui.js +4 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +12 -6
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +5 -5
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
- package/build/components/global-styles-sidebar/index.js.map +1 -0
- package/build/components/header-edit-mode/index.js +20 -120
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/layout/index.js +3 -6
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +69 -14
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page/index.js +2 -2
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-pages/index.js +4 -15
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +4 -80
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/index.js +9 -20
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/page-templates/index.js +6 -14
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +2 -2
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +11 -3
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/revisions/index.js +5 -2
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-panel/index.js +4 -4
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +61 -31
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +2 -2
- package/build/components/sidebar-button/index.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-navigation-item/index.js +5 -3
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +6 -32
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/build/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +4 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +2 -2
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +4 -9
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +4 -14
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +4 -1
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -3
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/site-icon/index.js +2 -2
- package/build/components/site-icon/index.js.map +1 -1
- package/build/components/style-book/index.js +10 -7
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/template-part-converter/index.js +18 -1
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +5 -2
- package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.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/use-activate-theme.js +9 -6
- package/build/utils/use-activate-theme.js.map +1 -1
- package/build-module/components/add-new-template/index.js +2 -2
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/app/index.js +4 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +4 -18
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +2 -2
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/dataviews-actions/index.js +38 -0
- package/build-module/components/dataviews-actions/index.js.map +1 -0
- package/build-module/components/editor/index.js +69 -13
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/background-panel.js +12 -1
- package/build-module/components/global-styles/background-panel.js.map +1 -1
- package/build-module/components/global-styles/color-indicator-wrapper.js +2 -2
- package/build-module/components/global-styles/color-indicator-wrapper.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +4 -2
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +1 -2
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +4 -1
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/icon-with-current-color.js +2 -2
- package/build-module/components/global-styles/icon-with-current-color.js.map +1 -1
- package/build-module/components/global-styles/preset-colors.js +22 -0
- package/build-module/components/global-styles/preset-colors.js.map +1 -0
- package/build-module/components/global-styles/preview-colors.js +3 -7
- package/build-module/components/global-styles/preview-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +5 -5
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +1 -4
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/typography-example.js +4 -1
- package/build-module/components/global-styles/typography-example.js.map +1 -1
- package/build-module/components/global-styles/ui.js +4 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +11 -5
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +6 -6
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -0
- package/build-module/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +8 -5
- package/build-module/components/global-styles-sidebar/index.js.map +1 -0
- package/build-module/components/header-edit-mode/index.js +20 -120
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/layout/index.js +3 -6
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +69 -15
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page/index.js +2 -2
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +4 -15
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +4 -80
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/index.js +10 -21
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/page-templates/index.js +6 -14
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +2 -2
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +12 -4
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/revisions/index.js +4 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +4 -4
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +62 -32
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +2 -2
- package/build-module/components/sidebar-button/index.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-navigation-item/index.js +5 -3
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +6 -32
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/build-module/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +10 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +16 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +16 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +2 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +2 -2
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +4 -9
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +4 -14
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -3
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/site-icon/index.js +2 -2
- package/build-module/components/site-icon/index.js.map +1 -1
- package/build-module/components/style-book/index.js +9 -6
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +18 -1
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +4 -1
- package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.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/use-activate-theme.js +9 -6
- package/build-module/utils/use-activate-theme.js.map +1 -1
- package/build-style/style-rtl.css +144 -374
- package/build-style/style.css +144 -374
- package/package.json +43 -45
- package/src/components/add-new-template/index.js +2 -2
- package/src/components/app/index.js +5 -2
- package/src/components/block-editor/editor-canvas.js +6 -26
- package/src/components/block-editor/site-editor-canvas.js +2 -2
- package/src/components/block-editor/style.scss +2 -2
- package/src/components/dataviews-actions/index.js +38 -0
- package/src/components/editor/index.js +76 -16
- package/src/components/editor/style.scss +0 -4
- package/src/components/global-styles/background-panel.js +17 -2
- package/src/components/global-styles/color-indicator-wrapper.js +2 -2
- package/src/components/global-styles/color-palette-panel.js +3 -4
- package/src/components/global-styles/gradients-palette-panel.js +1 -4
- package/src/components/global-styles/hooks.js +2 -1
- package/src/components/global-styles/icon-with-current-color.js +2 -2
- package/src/components/global-styles/preset-colors.js +18 -0
- package/src/components/global-styles/preview-colors.js +4 -7
- package/src/components/global-styles/screen-color-palette.js +4 -4
- package/src/components/global-styles/screen-colors.js +0 -2
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +2 -2
- package/src/components/global-styles/stories/index.story.js +2 -1
- package/src/components/global-styles/typography-example.js +2 -1
- package/src/components/global-styles/ui.js +5 -1
- package/src/components/global-styles/variations/style.scss +15 -31
- package/src/components/global-styles/variations/variation.js +13 -10
- package/src/components/global-styles/variations/variations-color.js +5 -8
- package/src/components/{sidebar-edit-mode/global-styles-sidebar.js → global-styles-sidebar/index.js} +7 -2
- package/src/components/{sidebar-edit-mode → global-styles-sidebar}/style.scss +0 -11
- package/src/components/header-edit-mode/index.js +25 -164
- package/src/components/header-edit-mode/style.scss +1 -199
- package/src/components/layout/index.js +3 -8
- package/src/components/layout/router.js +65 -15
- package/src/components/layout/style.scss +2 -1
- package/src/components/page/index.js +2 -2
- package/src/components/page-pages/index.js +8 -38
- package/src/components/page-pages/style.scss +0 -11
- package/src/components/page-patterns/dataviews-pattern-actions.js +3 -92
- package/src/components/page-patterns/index.js +16 -35
- package/src/components/page-templates/index.js +10 -29
- package/src/components/pagination/index.js +2 -2
- package/src/components/resizable-frame/index.js +16 -4
- package/src/components/revisions/index.js +2 -1
- package/src/components/save-panel/index.js +4 -4
- package/src/components/sidebar/index.js +61 -37
- package/src/components/sidebar-button/index.js +2 -5
- package/src/components/sidebar-dataviews/dataview-item.js +4 -7
- package/src/components/sidebar-navigation-item/index.js +3 -3
- package/src/components/sidebar-navigation-screen/index.js +7 -31
- package/src/components/sidebar-navigation-screen/style.scss +11 -9
- package/src/components/sidebar-navigation-screen-details-panel/sidebar-navigation-screen-details-panel-row.js +2 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +2 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +6 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +18 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +8 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +0 -10
- package/src/components/sidebar-navigation-screen-page/status-label.js +2 -2
- package/src/components/sidebar-navigation-screen-pattern/index.js +2 -8
- package/src/components/sidebar-navigation-screen-patterns/index.js +2 -13
- package/src/components/sidebar-navigation-screen-template/index.js +2 -1
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -1
- package/src/components/site-hub/index.js +3 -3
- package/src/components/site-icon/index.js +2 -2
- package/src/components/style-book/index.js +7 -6
- package/src/components/template-part-converter/index.js +16 -3
- package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +2 -1
- package/src/style.scss +1 -11
- package/src/utils/get-is-list-page.js +1 -3
- package/src/utils/use-activate-theme.js +4 -4
- package/build/components/global-styles/global-styles-provider.js +0 -129
- package/build/components/global-styles/global-styles-provider.js.map +0 -1
- package/build/components/header-edit-mode/document-tools/index.js +0 -68
- package/build/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build/components/sidebar-edit-mode/index.js +0 -147
- package/build/components/sidebar-edit-mode/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/index.js +0 -129
- package/build/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-content.js +0 -34
- package/build/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +0 -46
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +0 -42
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +0 -86
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-panel/index.js +0 -127
- package/build/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build/components/start-template-options/index.js +0 -191
- package/build/components/start-template-options/index.js.map +0 -1
- package/build/utils/math.js +0 -98
- package/build/utils/math.js.map +0 -1
- package/build-module/components/global-styles/global-styles-provider.js +0 -120
- package/build-module/components/global-styles/global-styles-provider.js.map +0 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +0 -61
- package/build-module/components/header-edit-mode/document-tools/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/index.js +0 -138
- package/build-module/components/sidebar-edit-mode/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/index.js +0 -121
- package/build-module/components/sidebar-edit-mode/page-panels/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js +0 -27
- package/build-module/components/sidebar-edit-mode/page-panels/page-content.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +0 -39
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +0 -35
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +0 -79
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-panel/index.js +0 -119
- package/build-module/components/sidebar-edit-mode/template-panel/index.js.map +0 -1
- package/build-module/components/start-template-options/index.js +0 -184
- package/build-module/components/start-template-options/index.js.map +0 -1
- package/build-module/utils/math.js +0 -92
- package/build-module/utils/math.js.map +0 -1
- package/src/components/global-styles/global-styles-provider.js +0 -162
- package/src/components/header-edit-mode/document-tools/index.js +0 -68
- package/src/components/sidebar-edit-mode/index.js +0 -173
- package/src/components/sidebar-edit-mode/page-panels/index.js +0 -133
- package/src/components/sidebar-edit-mode/page-panels/page-content.js +0 -29
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +0 -61
- package/src/components/sidebar-edit-mode/settings-header/index.js +0 -43
- package/src/components/sidebar-edit-mode/settings-header/style.scss +0 -14
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +0 -114
- package/src/components/sidebar-edit-mode/template-panel/index.js +0 -134
- package/src/components/sidebar-edit-mode/template-panel/style.scss +0 -16
- package/src/components/start-template-options/index.js +0 -231
- package/src/components/start-template-options/style.scss +0 -55
- package/src/utils/math.js +0 -93
- /package/build/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
- /package/build-module/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
- /package/src/components/{sidebar-edit-mode → global-styles-sidebar}/default-sidebar.js +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 5.35.0 (2024-05-16)
|
|
6
|
+
|
|
7
|
+
### Internal
|
|
8
|
+
|
|
9
|
+
- Replaced `classnames` package with the faster and smaller `clsx` package ([#61138](https://github.com/WordPress/gutenberg/pull/61138)).
|
|
10
|
+
|
|
5
11
|
## 5.34.0 (2024-05-02)
|
|
6
12
|
|
|
7
13
|
## 5.33.0 (2024-04-19)
|
|
@@ -47,6 +53,7 @@
|
|
|
47
53
|
## 5.13.0 (2023-06-23)
|
|
48
54
|
|
|
49
55
|
### Enhancements
|
|
56
|
+
|
|
50
57
|
- Site editor sidebar: add home template details and controls [#51223](https://github.com/WordPress/gutenberg/pull/51223).
|
|
51
58
|
- Site editor sidebar: add footer to template part and ensure nested template areas display [#51669](https://github.com/WordPress/gutenberg/pull/51669).
|
|
52
59
|
- Global styles: split styles menus into revisions and other styles actions ([#51318](https://github.com/WordPress/gutenberg/pull/51318)).
|
|
@@ -94,7 +101,6 @@
|
|
|
94
101
|
|
|
95
102
|
- Don't show block inserter when the canvas is view mode ([#46763](https://github.com/WordPress/gutenberg/pull/46763)).
|
|
96
103
|
|
|
97
|
-
|
|
98
104
|
## 4.19.0 (2022-11-16)
|
|
99
105
|
|
|
100
106
|
## 4.18.0 (2022-11-02)
|
|
@@ -159,8 +165,8 @@
|
|
|
159
165
|
|
|
160
166
|
### Breaking Changes
|
|
161
167
|
|
|
162
|
-
- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan
|
|
163
|
-
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at https://nodejs.org/en/about/releases
|
|
168
|
+
- Drop support for Internet Explorer 11 ([#31110](https://github.com/WordPress/gutenberg/pull/31110)). Learn more at <https://make.wordpress.org/core/2021/04/22/ie-11-support-phase-out-plan/>.
|
|
169
|
+
- Increase the minimum Node.js version to v12 matching Long Term Support releases ([#31270](https://github.com/WordPress/gutenberg/pull/31270)). Learn more at <https://nodejs.org/en/about/releases/>.
|
|
164
170
|
|
|
165
171
|
## 1.17.0 (2021-03-17)
|
|
166
172
|
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _components = require("@wordpress/components");
|
|
11
11
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
12
12
|
var _element = require("@wordpress/element");
|
|
@@ -186,7 +186,7 @@ function NewTemplateModal({
|
|
|
186
186
|
}
|
|
187
187
|
return (0, _react.createElement)(_components.Modal, {
|
|
188
188
|
title: modalTitle,
|
|
189
|
-
className: (0,
|
|
189
|
+
className: (0, _clsx.default)('edit-site-add-new-template__modal', {
|
|
190
190
|
'edit-site-add-new-template__modal_template_list': modalContent === modalContentMap.templatesList,
|
|
191
191
|
'edit-site-custom-template-modal': modalContent === modalContentMap.customTemplate
|
|
192
192
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_components","_htmlEntities","_element","_data","_coreData","_icons","_i18n","_notices","_router","_constants","_addCustomTemplateModalContent","_utils","_addCustomGenericTemplateModalContent","_lockUnlock","useHistory","unlock","routerPrivateApis","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","verse","single","pin","page","archive","search","notFound","index","list","category","author","commentAuthorAvatar","taxonomy","blockMeta","date","calendar","tag","attachment","media","TemplateListItem","title","direction","className","description","icon","onClick","children","_react","createElement","Button","label","showTooltip","Flex","as","spacing","align","justify","style","width","Icon","__experimentalVStack","alignment","__experimentalText","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","useState","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","homeUrl","useSelect","select","getUnstableBase","TEMPLATE_SHORT_DESCRIPTIONS","sprintf","__","Date","getFullYear","createTemplate","template","isWPSuggestion","slug","newTemplate","TEMPLATE_POST_TYPE","toString","status","is_wp_suggestion","throwOnError","push","postId","id","postType","canvas","decodeEntities","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","Modal","classnames","onRequestClose","overlayClassName","undefined","__experimentalGrid","columns","gap","map","key","layout","edit","default","onSelect","NewTemplate","showModal","setShowModal","getPostType","Fragment","variant","add_new_item","existingTemplates","useExistingTemplates","defaultTemplateTypes","useDefaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","useTaxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","usePostTypeMenuItems","authorMenuItem","useAuthorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf","usePostTypeArchiveMenuItems","_default","exports","memo"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { homeUrl } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: newTemplate.id,\n\t\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ classnames( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tonClose={ onModalClose }\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAkBA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAKA,IAAAU,UAAA,GAAAV,OAAA;AAKA,IAAAW,8BAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAQA,IAAAa,qCAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AA7DA;AACA;AACA;;AAGA;AACA;AACA;;AAoCA;AACA;AACA;;AAGA;AACA;AACA;;AAaA,MAAM;EAAEe;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElD,MAAMC,sBAAsB,GAAG,CAC9B,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,MAAM,EACN,OAAO,EACP,SAAS,EACT,QAAQ,EACR,UAAU,EACV,MAAM,EACN,KAAK,EACL,QAAQ,EACR,KAAK,CACL;AAED,MAAMC,cAAc,GAAG;EACtB,YAAY,EAAE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IAAI,CAAE,CAAEC,SAAS,EAAEC,SAAS,KAAM;IACtE,OACCvJ,sBAAsB,CAACwJ,OAAO,CAAEF,SAAS,CAACpE,IAAK,CAAC,GAChDlF,sBAAsB,CAACwJ,OAAO,CAAED,SAAS,CAACrE,IAAK,CAAC;EAElD,CAAE,CAAC;EACH,MAAMrB,gBAAgB,GAAG,CACxB,GAAG2E,mCAAmC,EACtC,GAAG,IAAAiB,kCAA2B,EAAC,CAAC,EAChC,GAAGZ,kBAAkB,EACrB,GAAGH,mBAAmB,CACtB;EACD,OAAO7E,gBAAgB;AACxB;AAAC,IAAA6F,QAAA,GAAAC,OAAA,CAAAtC,OAAA,GAEc,IAAAuC,aAAI,EAAErC,WAAY,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_components","_htmlEntities","_element","_data","_coreData","_icons","_i18n","_notices","_router","_constants","_addCustomTemplateModalContent","_utils","_addCustomGenericTemplateModalContent","_lockUnlock","useHistory","unlock","routerPrivateApis","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","home","verse","single","pin","page","archive","search","notFound","index","list","category","author","commentAuthorAvatar","taxonomy","blockMeta","date","calendar","tag","attachment","media","TemplateListItem","title","direction","className","description","icon","onClick","children","_react","createElement","Button","label","showTooltip","Flex","as","spacing","align","justify","style","width","Icon","__experimentalVStack","alignment","__experimentalText","weight","lineHeight","modalContentMap","templatesList","customTemplate","customGenericTemplate","NewTemplateModal","onClose","modalContent","setModalContent","useState","entityForSuggestions","setEntityForSuggestions","isSubmitting","setIsSubmitting","missingTemplates","useMissingTemplates","history","saveEntityRecord","useDispatch","coreStore","createErrorNotice","createSuccessNotice","noticesStore","homeUrl","useSelect","select","getUnstableBase","TEMPLATE_SHORT_DESCRIPTIONS","sprintf","__","Date","getFullYear","createTemplate","template","isWPSuggestion","slug","newTemplate","TEMPLATE_POST_TYPE","toString","status","is_wp_suggestion","throwOnError","push","postId","id","postType","canvas","decodeEntities","rendered","type","error","errorMessage","message","code","onModalClose","modalTitle","labels","singular_name","Modal","clsx","onRequestClose","overlayClassName","undefined","__experimentalGrid","columns","gap","map","key","layout","edit","default","onSelect","NewTemplate","showModal","setShowModal","getPostType","Fragment","variant","add_new_item","existingTemplates","useExistingTemplates","defaultTemplateTypes","useDefaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","useTaxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","usePostTypeMenuItems","authorMenuItem","useAuthorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf","usePostTypeArchiveMenuItems","_default","exports","memo"],"sources":["@wordpress/edit-site/src/components/add-new-template/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tModal,\n\t__experimentalGrid as Grid,\n\t__experimentalText as Text,\n\t__experimentalVStack as VStack,\n\tFlex,\n\tIcon,\n} from '@wordpress/components';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useState, memo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tarchive,\n\tblockMeta,\n\tcalendar,\n\tcategory,\n\tcommentAuthorAvatar,\n\tedit,\n\thome,\n\tlayout,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tpin,\n\tverse,\n\tsearch,\n\ttag,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModalContent from './add-custom-template-modal-content';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModalContent from './add-custom-generic-template-modal-content';\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'home',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\thome: verse,\n\tsingle: pin,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: commentAuthorAvatar,\n\ttaxonomy: blockMeta,\n\tdate: calendar,\n\ttag,\n\tattachment: media,\n};\n\nfunction TemplateListItem( {\n\ttitle,\n\tdirection,\n\tclassName,\n\tdescription,\n\ticon,\n\tonClick,\n\tchildren,\n} ) {\n\treturn (\n\t\t<Button\n\t\t\tclassName={ className }\n\t\t\tonClick={ onClick }\n\t\t\tlabel={ description }\n\t\t\tshowTooltip={ !! description }\n\t\t>\n\t\t\t<Flex\n\t\t\t\tas=\"span\"\n\t\t\t\tspacing={ 2 }\n\t\t\t\talign=\"center\"\n\t\t\t\tjustify=\"center\"\n\t\t\t\tstyle={ { width: '100%' } }\n\t\t\t\tdirection={ direction }\n\t\t\t>\n\t\t\t\t<div className=\"edit-site-add-new-template__template-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t\t<VStack\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-name\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 0 }\n\t\t\t\t>\n\t\t\t\t\t<Text\n\t\t\t\t\t\tweight={ 500 }\n\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t>\n\t\t\t\t\t\t{ title }\n\t\t\t\t\t</Text>\n\t\t\t\t\t{ children }\n\t\t\t\t</VStack>\n\t\t\t</Flex>\n\t\t</Button>\n\t);\n}\n\nconst modalContentMap = {\n\ttemplatesList: 1,\n\tcustomTemplate: 2,\n\tcustomGenericTemplate: 3,\n};\n\nfunction NewTemplateModal( { onClose } ) {\n\tconst [ modalContent, setModalContent ] = useState(\n\t\tmodalContentMap.templatesList\n\t);\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst missingTemplates = useMissingTemplates( setEntityForSuggestions, () =>\n\t\tsetModalContent( modalContentMap.customTemplate )\n\t);\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst { homeUrl } = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetUnstableBase, // Site index.\n\t\t} = select( coreStore );\n\n\t\treturn {\n\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t};\n\t}, [] );\n\n\tconst TEMPLATE_SHORT_DESCRIPTIONS = {\n\t\t'front-page': homeUrl,\n\t\tdate: sprintf(\n\t\t\t// translators: %s: The homepage url.\n\t\t\t__( 'E.g. %s' ),\n\t\t\thomeUrl + '/' + new Date().getFullYear()\n\t\t),\n\t};\n\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsSubmitting( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Navigate to the created template editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: newTemplate.id,\n\t\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\tdecodeEntities( newTemplate.title?.rendered || title )\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\tconst onModalClose = () => {\n\t\tonClose();\n\t\tsetModalContent( modalContentMap.templatesList );\n\t};\n\n\tlet modalTitle = __( 'Add template' );\n\tif ( modalContent === modalContentMap.customTemplate ) {\n\t\tmodalTitle = sprintf(\n\t\t\t// translators: %s: Name of the post type e.g: \"Post\".\n\t\t\t__( 'Add template: %s' ),\n\t\t\tentityForSuggestions.labels.singular_name\n\t\t);\n\t} else if ( modalContent === modalContentMap.customGenericTemplate ) {\n\t\tmodalTitle = __( 'Create custom template' );\n\t}\n\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle }\n\t\t\tclassName={ clsx( 'edit-site-add-new-template__modal', {\n\t\t\t\t'edit-site-add-new-template__modal_template_list':\n\t\t\t\t\tmodalContent === modalContentMap.templatesList,\n\t\t\t\t'edit-site-custom-template-modal':\n\t\t\t\t\tmodalContent === modalContentMap.customTemplate,\n\t\t\t} ) }\n\t\t\tonRequestClose={ onModalClose }\n\t\t\toverlayClassName={\n\t\t\t\tmodalContent === modalContentMap.customGenericTemplate\n\t\t\t\t\t? 'edit-site-custom-generic-template__modal'\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t>\n\t\t\t{ modalContent === modalContentMap.templatesList && (\n\t\t\t\t<Grid\n\t\t\t\t\tcolumns={ 3 }\n\t\t\t\t\tgap={ 4 }\n\t\t\t\t\talign=\"flex-start\"\n\t\t\t\t\tjustify=\"center\"\n\t\t\t\t\tclassName=\"edit-site-add-new-template__template-list__contents\"\n\t\t\t\t>\n\t\t\t\t\t<Flex className=\"edit-site-add-new-template__template-list__prompt\">\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Select what the new template should apply to:'\n\t\t\t\t\t\t) }\n\t\t\t\t\t</Flex>\n\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\tconst { title, slug, onClick } = template;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\ttitle={ title }\n\t\t\t\t\t\t\t\tdirection=\"column\"\n\t\t\t\t\t\t\t\tclassName=\"edit-site-add-new-template__template-button\"\n\t\t\t\t\t\t\t\tdescription={\n\t\t\t\t\t\t\t\t\tTEMPLATE_SHORT_DESCRIPTIONS[ slug ]\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\ticon={ TEMPLATE_ICONS[ slug ] || layout }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t);\n\t\t\t\t\t} ) }\n\t\t\t\t\t<TemplateListItem\n\t\t\t\t\t\ttitle={ __( 'Custom template' ) }\n\t\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\t\tclassName=\"edit-site-add-new-template__custom-template-button\"\n\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\tsetModalContent(\n\t\t\t\t\t\t\t\tmodalContentMap.customGenericTemplate\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t>\n\t\t\t\t\t\t<Text\n\t\t\t\t\t\t\tlineHeight={ 1.53846153846 } // 20px\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'A custom template can be manually applied to any post or page.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</Text>\n\t\t\t\t\t</TemplateListItem>\n\t\t\t\t</Grid>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customTemplate && (\n\t\t\t\t<AddCustomTemplateModalContent\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ modalContent === modalContentMap.customGenericTemplate && (\n\t\t\t\t<AddCustomGenericTemplateModalContent\n\t\t\t\t\tonClose={ onModalClose }\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</Modal>\n\t);\n}\n\nfunction NewTemplate() {\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst { postType } = useSelect( ( select ) => {\n\t\tconst { getPostType } = select( coreStore );\n\n\t\treturn {\n\t\t\tpostType: getPostType( TEMPLATE_POST_TYPE ),\n\t\t};\n\t}, [] );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => setShowModal( true ) }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new_item }\n\t\t\t</Button>\n\t\t\t{ showModal && (\n\t\t\t\t<NewTemplateModal onClose={ () => setShowModal( false ) } />\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates( setEntityForSuggestions, onClick ) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tonClick?.();\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n\nexport default memo( NewTemplate );\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AASA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAkBA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAKA,IAAAU,UAAA,GAAAV,OAAA;AAKA,IAAAW,8BAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,MAAA,GAAAZ,OAAA;AAQA,IAAAa,qCAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AA7DA;AACA;AACA;;AAGA;AACA;AACA;;AAoCA;AACA;AACA;;AAGA;AACA;AACA;;AAaA,MAAM;EAAEe;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElD,MAAMC,sBAAsB,GAAG,CAC9B,YAAY,EACZ,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,mCAAmC,CAAEW,UAAU,CAAE,GAAGD,QAAQ;IAC7D,CAAC,MAAM;MACNV,mCAAmC,CAAC/C,IAAI,CAAEyD,QAAS,CAAC;IACrD;EACD,CAAE,CAAC;EACH;EACAV,mCAAmC,EAAEa,IAAI,CAAE,CAAEC,SAAS,EAAEC,SAAS,KAAM;IACtE,OACCvJ,sBAAsB,CAACwJ,OAAO,CAAEF,SAAS,CAACpE,IAAK,CAAC,GAChDlF,sBAAsB,CAACwJ,OAAO,CAAED,SAAS,CAACrE,IAAK,CAAC;EAElD,CAAE,CAAC;EACH,MAAMrB,gBAAgB,GAAG,CACxB,GAAG2E,mCAAmC,EACtC,GAAG,IAAAiB,kCAA2B,EAAC,CAAC,EAChC,GAAGZ,kBAAkB,EACrB,GAAGH,mBAAmB,CACtB;EACD,OAAO7E,gBAAgB;AACxB;AAAC,IAAA6F,QAAA,GAAAC,OAAA,CAAAtC,OAAA,GAEc,IAAAuC,aAAI,EAAErC,WAAY,CAAC","ignoreList":[]}
|
|
@@ -14,7 +14,6 @@ var _i18n = require("@wordpress/i18n");
|
|
|
14
14
|
var _plugins = require("@wordpress/plugins");
|
|
15
15
|
var _router = require("@wordpress/router");
|
|
16
16
|
var _layout = _interopRequireDefault(require("../layout"));
|
|
17
|
-
var _globalStylesProvider = require("../global-styles/global-styles-provider");
|
|
18
17
|
var _lockUnlock = require("../../lock-unlock");
|
|
19
18
|
/**
|
|
20
19
|
* WordPress dependencies
|
|
@@ -27,6 +26,9 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
27
26
|
const {
|
|
28
27
|
RouterProvider
|
|
29
28
|
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
29
|
+
const {
|
|
30
|
+
GlobalStylesProvider
|
|
31
|
+
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
30
32
|
function App() {
|
|
31
33
|
const {
|
|
32
34
|
createErrorNotice
|
|
@@ -35,7 +37,7 @@ function App() {
|
|
|
35
37
|
createErrorNotice((0, _i18n.sprintf)( /* translators: %s: plugin name */
|
|
36
38
|
(0, _i18n.__)('The "%s" plugin has encountered an error and cannot be rendered.'), name));
|
|
37
39
|
}
|
|
38
|
-
return (0, _react.createElement)(_components.SlotFillProvider, null, (0, _react.createElement)(
|
|
40
|
+
return (0, _react.createElement)(_components.SlotFillProvider, null, (0, _react.createElement)(GlobalStylesProvider, null, (0, _react.createElement)(_editor.UnsavedChangesWarning, null), (0, _react.createElement)(RouterProvider, null, (0, _react.createElement)(_layout.default, null), (0, _react.createElement)(_plugins.PluginArea, {
|
|
39
41
|
onError: onPluginAreaError
|
|
40
42
|
}))));
|
|
41
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_editor","_notices","_data","_i18n","_plugins","_router","_layout","_interopRequireDefault","
|
|
1
|
+
{"version":3,"names":["_components","require","_editor","_notices","_data","_i18n","_plugins","_router","_layout","_interopRequireDefault","_lockUnlock","RouterProvider","unlock","routerPrivateApis","GlobalStylesProvider","editorPrivateApis","App","createErrorNotice","useDispatch","noticesStore","onPluginAreaError","name","sprintf","__","_react","createElement","SlotFillProvider","UnsavedChangesWarning","default","PluginArea","onError"],"sources":["@wordpress/edit-site/src/components/app/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider } from '@wordpress/components';\nimport {\n\tUnsavedChangesWarning,\n\tprivateApis as editorPrivateApis,\n} from '@wordpress/editor';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport Layout from '../layout';\nimport { unlock } from '../../lock-unlock';\n\nconst { RouterProvider } = unlock( routerPrivateApis );\nconst { GlobalStylesProvider } = unlock( editorPrivateApis );\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<SlotFillProvider>\n\t\t\t<GlobalStylesProvider>\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<RouterProvider>\n\t\t\t\t\t<Layout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</RouterProvider>\n\t\t\t</GlobalStylesProvider>\n\t\t</SlotFillProvider>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAKA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AAlBA;AACA;AACA;;AAYA;AACA;AACA;;AAIA,MAAM;EAAEU;AAAe,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AACtD,MAAM;EAAEC;AAAqB,CAAC,GAAG,IAAAF,kBAAM,EAAEG,mBAAkB,CAAC;AAE7C,SAASC,GAAGA,CAAA,EAAG;EAC7B,MAAM;IAAEC;EAAkB,CAAC,GAAG,IAAAC,iBAAW,EAAEC,cAAa,CAAC;EAEzD,SAASC,iBAAiBA,CAAEC,IAAI,EAAG;IAClCJ,iBAAiB,CAChB,IAAAK,aAAO,GACN;IACA,IAAAC,QAAE,EACD,kEACD,CAAC,EACDF,IACD,CACD,CAAC;EACF;EAEA,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACzB,WAAA,CAAA0B,gBAAgB,QAChB,IAAAF,MAAA,CAAAC,aAAA,EAACX,oBAAoB,QACpB,IAAAU,MAAA,CAAAC,aAAA,EAACvB,OAAA,CAAAyB,qBAAqB,MAAE,CAAC,EACzB,IAAAH,MAAA,CAAAC,aAAA,EAACd,cAAc,QACd,IAAAa,MAAA,CAAAC,aAAA,EAACjB,OAAA,CAAAoB,OAAM,MAAE,CAAC,EACV,IAAAJ,MAAA,CAAAC,aAAA,EAACnB,QAAA,CAAAuB,UAAU;IAACC,OAAO,EAAGV;EAAmB,CAAE,CAC5B,CACK,CACL,CAAC;AAErB","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _blockEditor = require("@wordpress/block-editor");
|
|
11
11
|
var _data = require("@wordpress/data");
|
|
12
12
|
var _keycodes = require("@wordpress/keycodes");
|
|
@@ -16,7 +16,6 @@ var _editor = require("@wordpress/editor");
|
|
|
16
16
|
var _lockUnlock = require("../../lock-unlock");
|
|
17
17
|
var _store = require("../../store");
|
|
18
18
|
var _constants = require("../../utils/constants");
|
|
19
|
-
var _math = require("../../utils/math");
|
|
20
19
|
/**
|
|
21
20
|
* External dependencies
|
|
22
21
|
*/
|
|
@@ -44,12 +43,10 @@ function EditorCanvas({
|
|
|
44
43
|
isFocusMode,
|
|
45
44
|
templateType,
|
|
46
45
|
canvasMode,
|
|
47
|
-
isZoomOutMode,
|
|
48
46
|
currentPostIsTrashed
|
|
49
47
|
} = (0, _data.useSelect)(select => {
|
|
50
48
|
const {
|
|
51
|
-
getBlockCount
|
|
52
|
-
__unstableGetEditorMode
|
|
49
|
+
getBlockCount
|
|
53
50
|
} = select(_blockEditor.store);
|
|
54
51
|
const {
|
|
55
52
|
getEditedPostType,
|
|
@@ -59,7 +56,6 @@ function EditorCanvas({
|
|
|
59
56
|
return {
|
|
60
57
|
templateType: _templateType,
|
|
61
58
|
isFocusMode: _constants.FOCUSABLE_ENTITIES.includes(_templateType),
|
|
62
|
-
isZoomOutMode: __unstableGetEditorMode() === 'zoom-out',
|
|
63
59
|
canvasMode: getCanvasMode(),
|
|
64
60
|
hasBlocks: !!getBlockCount(),
|
|
65
61
|
currentPostIsTrashed: select(_editor.store).getCurrentPostAttribute('status') === 'trash'
|
|
@@ -124,24 +120,14 @@ function EditorCanvas({
|
|
|
124
120
|
// which isn't a requirement in auto resize mode.
|
|
125
121
|
enableResizing ? 'min-height:0!important;' : ''}}body{position:relative; ${canvasMode === 'view' ? `min-height: 100vh; ${currentPostIsTrashed ? '' : 'cursor: pointer;'}` : ''}}}`
|
|
126
122
|
}], [settings.styles, enableResizing, canvasMode, currentPostIsTrashed]);
|
|
127
|
-
const frameSize = isZoomOutMode ? 20 : undefined;
|
|
128
|
-
const scale = isZoomOutMode ? contentWidth => (0, _math.computeIFrameScale)({
|
|
129
|
-
width: 1000,
|
|
130
|
-
scale: 0.55
|
|
131
|
-
}, {
|
|
132
|
-
width: 400,
|
|
133
|
-
scale: 0.9
|
|
134
|
-
}, contentWidth) : undefined;
|
|
135
123
|
return (0, _react.createElement)(EditorCanvasRoot, {
|
|
136
|
-
className: (0,
|
|
124
|
+
className: (0, _clsx.default)('edit-site-editor-canvas__block-list', {
|
|
137
125
|
'is-navigation-block': isTemplateTypeNavigation
|
|
138
126
|
}),
|
|
139
127
|
renderAppender: showBlockAppender,
|
|
140
128
|
styles: styles,
|
|
141
129
|
iframeProps: {
|
|
142
|
-
|
|
143
|
-
frameSize,
|
|
144
|
-
className: (0, _classnames.default)('edit-site-visual-editor__editor-canvas', {
|
|
130
|
+
className: (0, _clsx.default)('edit-site-visual-editor__editor-canvas', {
|
|
145
131
|
'is-focused': isFocused && canvasMode === 'view'
|
|
146
132
|
}),
|
|
147
133
|
...props,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_blockEditor","_data","_keycodes","_element","_i18n","_editor","_lockUnlock","_store","_constants","_math","EditorCanvas","EditorCanvasRoot","unlock","editorPrivateApis","enableResizing","settings","children","onClick","props","hasBlocks","isFocusMode","templateType","canvasMode","isZoomOutMode","currentPostIsTrashed","useSelect","select","getBlockCount","__unstableGetEditorMode","blockEditorStore","getEditedPostType","getCanvasMode","editSiteStore","_templateType","FOCUSABLE_ENTITIES","includes","editorStore","getCurrentPostAttribute","setCanvasMode","useDispatch","isFocused","setIsFocused","useState","useEffect","viewModeIframeProps","__","title","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","ENTER","SPACE","preventDefault","onClickCapture","stopPropagation","readonly","isTemplateTypeNavigation","NAVIGATION_POST_TYPE","isNavigationFocusMode","showBlockAppender","undefined","styles","useMemo","css","frameSize","scale","contentWidth","computeIFrameScale","width","_react","createElement","className","classnames","renderAppender","iframeProps","_default","exports","default"],"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 {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} 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 {\n\t\thasBlocks,\n\t\tisFocusMode,\n\t\ttemplateType,\n\t\tcanvasMode,\n\t\tisZoomOutMode,\n\t\tcurrentPostIsTrashed,\n\t} = useSelect( ( select ) => {\n\t\tconst { getBlockCount, __unstableGetEditorMode } =\n\t\t\tselect( blockEditorStore );\n\t\tconst { getEditedPostType, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst _templateType = getEditedPostType();\n\n\t\treturn {\n\t\t\ttemplateType: _templateType,\n\t\t\tisFocusMode: FOCUSABLE_ENTITIES.includes( _templateType ),\n\t\t\tisZoomOutMode: __unstableGetEditorMode() === 'zoom-out',\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\thasBlocks: !! getBlockCount(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t};\n\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\t'aria-disabled': currentPostIsTrashed,\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 (\n\t\t\t\t( keyCode === ENTER || keyCode === SPACE ) &&\n\t\t\t\t! currentPostIsTrashed\n\t\t\t) {\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\tonClickCapture: ( event ) => {\n\t\t\tif ( currentPostIsTrashed ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\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? `min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }`\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, currentPostIsTrashed ]\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.55 },\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":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AAQA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAIA,IAAAU,KAAA,GAAAV,OAAA;AA3BA;AACA;AACA;;AAGA;AACA;AACA;;AAWA;AACA;AACA;;AASA,MAAM;EAAEW,YAAY,EAAEC;AAAiB,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEtE,SAASH,YAAYA,CAAE;EACtBI,cAAc;EACdC,QAAQ;EACRC,QAAQ;EACRC,OAAO;EACP,GAAGC;AACJ,CAAC,EAAG;EACH,MAAM;IACLC,SAAS;IACTC,WAAW;I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QAAQ,CAACkD,MAAM,EAAEnD,cAAc,EAAEQ,UAAU,EAAEE,oBAAoB,CACpE,CAAC;EAED,MAAM4C,SAAS,GAAG7C,aAAa,GAAG,EAAE,GAAGyC,SAAS;EAEhD,MAAMK,KAAK,GAAG9C,aAAa,GACtB+C,YAAY,IACd,IAAAC,wBAAkB,EACjB;IAAEC,KAAK,EAAE,IAAI;IAAEH,KAAK,EAAE;EAAK,CAAC,EAC5B;IAAEG,KAAK,EAAE,GAAG;IAAEH,KAAK,EAAE;EAAI,CAAC,EAC1BC,YACD,CAAC,GACDN,SAAS;EAEZ,OACC,IAAAS,MAAA,CAAAC,aAAA,EAAC/D,gBAAgB;IAChBgE,SAAS,EAAG,IAAAC,mBAAU,EAAE,qCAAqC,EAAE;MAC9D,qBAAqB,EAAEhB;IACxB,CAAE,CAAG;IACLiB,cAAc,EAAGd,iBAAmB;IACpCE,MAAM,EAAGA,MAAQ;IACjBa,WAAW,EAAG;MACbT,KAAK;MACLD,SAAS;MACTO,SAAS,EAAE,IAAAC,mBAAU,EACpB,wCAAwC,EACxC;QACC,YAAY,EAAEpC,SAAS,IAAIlB,UAAU,KAAK;MAC3C,CACD,CAAC;MACD,GAAGJ,KAAK;MACR,IAAKI,UAAU,KAAK,MAAM,GAAGsB,mBAAmB,GAAG,CAAC,CAAC;IACtD;EAAG,GAED5B,QACe,CAAC;AAErB;AAAC,IAAA+D,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcvE,YAAY","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_blockEditor","_data","_keycodes","_element","_i18n","_editor","_lockUnlock","_store","_constants","EditorCanvas","EditorCanvasRoot","unlock","editorPrivateApis","enableResizing","settings","children","onClick","props","hasBlocks","isFocusMode","templateType","canvasMode","currentPostIsTrashed","useSelect","select","getBlockCount","blockEditorStore","getEditedPostType","getCanvasMode","editSiteStore","_templateType","FOCUSABLE_ENTITIES","includes","editorStore","getCurrentPostAttribute","setCanvasMode","useDispatch","isFocused","setIsFocused","useState","useEffect","viewModeIframeProps","__","title","role","tabIndex","onFocus","onBlur","onKeyDown","event","keyCode","ENTER","SPACE","preventDefault","onClickCapture","stopPropagation","readonly","isTemplateTypeNavigation","NAVIGATION_POST_TYPE","isNavigationFocusMode","showBlockAppender","undefined","styles","useMemo","css","_react","createElement","className","clsx","renderAppender","iframeProps","_default","exports","default"],"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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 {\n\tstore as editorStore,\n\tprivateApis as editorPrivateApis,\n} 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';\n\nconst { EditorCanvas: EditorCanvasRoot } = unlock( editorPrivateApis );\n\nfunction EditorCanvas( {\n\tenableResizing,\n\tsettings,\n\tchildren,\n\tonClick,\n\t...props\n} ) {\n\tconst {\n\t\thasBlocks,\n\t\tisFocusMode,\n\t\ttemplateType,\n\t\tcanvasMode,\n\t\tcurrentPostIsTrashed,\n\t} = useSelect( ( select ) => {\n\t\tconst { getBlockCount } = select( blockEditorStore );\n\t\tconst { getEditedPostType, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst _templateType = getEditedPostType();\n\n\t\treturn {\n\t\t\ttemplateType: _templateType,\n\t\t\tisFocusMode: FOCUSABLE_ENTITIES.includes( _templateType ),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\thasBlocks: !! getBlockCount(),\n\t\t\tcurrentPostIsTrashed:\n\t\t\t\tselect( editorStore ).getCurrentPostAttribute( 'status' ) ===\n\t\t\t\t'trash',\n\t\t};\n\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\t'aria-disabled': currentPostIsTrashed,\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 (\n\t\t\t\t( keyCode === ENTER || keyCode === SPACE ) &&\n\t\t\t\t! currentPostIsTrashed\n\t\t\t) {\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\tonClickCapture: ( event ) => {\n\t\t\tif ( currentPostIsTrashed ) {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tevent.stopPropagation();\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? `min-height: 100vh; ${\n\t\t\t\t\t\t\t\tcurrentPostIsTrashed ? '' : 'cursor: pointer;'\n\t\t\t\t\t\t }`\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, currentPostIsTrashed ]\n\t);\n\n\treturn (\n\t\t<EditorCanvasRoot\n\t\t\tclassName={ clsx( '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\tclassName: clsx( 'edit-site-visual-editor__editor-canvas', {\n\t\t\t\t\t'is-focused': isFocused && canvasMode === 'view',\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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,K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AAS,IAAMG,UAAU,KAAK,MAAM,GAC5D,KAAK,GACLwC,SAAS;EAEb,MAAMC,MAAM,GAAG,IAAAC,gBAAO,EACrB,MAAM,CACL,GAAGjD,QAAQ,CAACgD,MAAM,EAClB;IACC;IACA;;IAEAE,GAAG,EAAG;IACL;IACA;IACAnD,cAAc,GAAG,yBAAyB,GAAG,EAC7C,4BACAQ,UAAU,KAAK,MAAM,GACjB,sBACDC,oBAAoB,GAAG,EAAE,GAAG,kBAC3B,EAAC,GACF,EACH;EACF,CAAC,CACD,EACD,CAAER,QAAQ,CAACgD,MAAM,EAAEjD,cAAc,EAAEQ,UAAU,EAAEC,oBAAoB,CACpE,CAAC;EAED,OACC,IAAA2C,MAAA,CAAAC,aAAA,EAACxD,gBAAgB;IAChByD,SAAS,EAAG,IAAAC,aAAI,EAAE,qCAAqC,EAAE;MACxD,qBAAqB,EAAEX;IACxB,CAAE,CAAG;IACLY,cAAc,EAAGT,iBAAmB;IACpCE,MAAM,EAAGA,MAAQ;IACjBQ,WAAW,EAAG;MACbH,SAAS,EAAE,IAAAC,aAAI,EAAE,wCAAwC,EAAE;QAC1D,YAAY,EAAE/B,SAAS,IAAIhB,UAAU,KAAK;MAC3C,CAAE,CAAC;MACH,GAAGJ,KAAK;MACR,IAAKI,UAAU,KAAK,MAAM,GAAGoB,mBAAmB,GAAG,CAAC,CAAC;IACtD;EAAG,GAED1B,QACe,CAAC;AAErB;AAAC,IAAAwD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEchE,YAAY","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = SiteEditorCanvas;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
var _compose = require("@wordpress/compose");
|
|
12
12
|
var _blockEditor = require("@wordpress/block-editor");
|
|
@@ -75,7 +75,7 @@ function SiteEditorCanvas({
|
|
|
75
75
|
return (0, _react.createElement)(_editorCanvasContainer.default.Slot, null, ([editorCanvasView]) => editorCanvasView ? (0, _react.createElement)("div", {
|
|
76
76
|
className: "edit-site-visual-editor is-focus-mode"
|
|
77
77
|
}, editorCanvasView) : (0, _react.createElement)("div", {
|
|
78
|
-
className: (0,
|
|
78
|
+
className: (0, _clsx.default)('edit-site-visual-editor', {
|
|
79
79
|
'is-focus-mode': isFocusMode || !!editorCanvasView,
|
|
80
80
|
'is-view-mode': isViewMode
|
|
81
81
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_compose","_blockEditor","_resizableEditor","_editorCanvas","_editorCanvasContainer","_useSiteEditorSettings","_store","_constants","_lockUnlock","_router","useLocation","unlock","routerPrivateApis","SiteEditorCanvas","onClick","location","templateType","isFocusableEntity","isViewMode","isZoomOutMode","useSelect","select","getEditedPostType","getCanvasMode","editSiteStore","__unstableGetEditorMode","blockEditorStore","_templateType","FOCUSABLE_ENTITIES","includes","isFocusMode","params","focusMode","resizeObserver","sizes","useResizeObserver","settings","useSiteEditorSettings","isMobileViewport","useViewportMatch","enableResizing","TEMPLATE_POST_TYPE","isTemplateTypeNavigation","NAVIGATION_POST_TYPE","isNavigationFocusMode","forceFullHeight","_react","createElement","default","Slot","editorCanvasView","className","clsx","height"],"sources":["@wordpress/edit-site/src/components/block-editor/site-editor-canvas.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\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={ clsx( '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{\n\t\t\t\t\t\t\t\t\t// Avoid resize listeners when not needed,\n\t\t\t\t\t\t\t\t\t// these will trigger unnecessary re-renders\n\t\t\t\t\t\t\t\t\t// when animating the iframe width.\n\t\t\t\t\t\t\t\t\tenableResizing && resizeObserver\n\t\t\t\t\t\t\t\t}\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":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAIA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,gBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAA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|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useEditPostAction = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _icons = require("@wordpress/icons");
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _router = require("@wordpress/router");
|
|
11
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internal dependencies
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
useHistory
|
|
22
|
+
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
23
|
+
const useEditPostAction = () => {
|
|
24
|
+
const history = useHistory();
|
|
25
|
+
return (0, _element.useMemo)(() => ({
|
|
26
|
+
id: 'edit-post',
|
|
27
|
+
label: (0, _i18n.__)('Edit'),
|
|
28
|
+
isPrimary: true,
|
|
29
|
+
icon: _icons.edit,
|
|
30
|
+
isEligible({
|
|
31
|
+
status
|
|
32
|
+
}) {
|
|
33
|
+
return status !== 'trash';
|
|
34
|
+
},
|
|
35
|
+
callback(items) {
|
|
36
|
+
const post = items[0];
|
|
37
|
+
history.push({
|
|
38
|
+
postId: post.id,
|
|
39
|
+
postType: post.type,
|
|
40
|
+
canvas: 'edit'
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}), [history]);
|
|
44
|
+
};
|
|
45
|
+
exports.useEditPostAction = useEditPostAction;
|
|
46
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_icons","_element","_router","_lockUnlock","useHistory","unlock","routerPrivateApis","useEditPostAction","history","useMemo","id","label","__","isPrimary","icon","edit","isEligible","status","callback","items","post","push","postId","postType","type","canvas","exports"],"sources":["@wordpress/edit-site/src/components/dataviews-actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { edit } from '@wordpress/icons';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport const useEditPostAction = () => {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: edit,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tcallback( items ) {\n\t\t\t\tconst post = items[ 0 ];\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n};\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AAXA;AACA;AACA;;AAMA;AACA;AACA;;AAGA,MAAM;EAAEK;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAE3C,MAAMC,iBAAiB,GAAGA,CAAA,KAAM;EACtC,MAAMC,OAAO,GAAGJ,UAAU,CAAC,CAAC;EAC5B,OAAO,IAAAK,gBAAO,EACb,OAAQ;IACPC,EAAE,EAAE,WAAW;IACfC,KAAK,EAAE,IAAAC,QAAE,EAAE,MAAO,CAAC;IACnBC,SAAS,EAAE,IAAI;IACfC,IAAI,EAAEC,WAAI;IACVC,UAAUA,CAAE;MAAEC;IAAO,CAAC,EAAG;MACxB,OAAOA,MAAM,KAAK,OAAO;IAC1B,CAAC;IACDC,QAAQA,CAAEC,KAAK,EAAG;MACjB,MAAMC,IAAI,GAAGD,KAAK,CAAE,CAAC,CAAE;MACvBX,OAAO,CAACa,IAAI,CAAE;QACbC,MAAM,EAAEF,IAAI,CAACV,EAAE;QACfa,QAAQ,EAAEH,IAAI,CAACI,IAAI;QACnBC,MAAM,EAAE;MACT,CAAE,CAAC;IACJ;EACD,CAAC,CAAE,EACH,CAAEjB,OAAO,CACV,CAAC;AACF,CAAC;AAACkB,OAAA,CAAAnB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = Editor;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
10
10
|
var _data = require("@wordpress/data");
|
|
11
11
|
var _components = require("@wordpress/components");
|
|
12
12
|
var _compose = require("@wordpress/compose");
|
|
@@ -17,11 +17,11 @@ var _i18n = require("@wordpress/i18n");
|
|
|
17
17
|
var _coreData = require("@wordpress/core-data");
|
|
18
18
|
var _blockLibrary = require("@wordpress/block-library");
|
|
19
19
|
var _element = require("@wordpress/element");
|
|
20
|
-
var
|
|
20
|
+
var _notices = require("@wordpress/notices");
|
|
21
|
+
var _router = require("@wordpress/router");
|
|
21
22
|
var _codeEditor = _interopRequireDefault(require("../code-editor"));
|
|
22
23
|
var _headerEditMode = _interopRequireDefault(require("../header-edit-mode"));
|
|
23
24
|
var _welcomeGuide = _interopRequireDefault(require("../welcome-guide"));
|
|
24
|
-
var _startTemplateOptions = _interopRequireDefault(require("../start-template-options"));
|
|
25
25
|
var _store = require("../../store");
|
|
26
26
|
var _globalStylesRenderer = require("../global-styles-renderer");
|
|
27
27
|
var _useTitle = _interopRequireDefault(require("../routes/use-title"));
|
|
@@ -33,6 +33,8 @@ var _constants = require("../../utils/constants");
|
|
|
33
33
|
var _siteEditorCanvas = _interopRequireDefault(require("../block-editor/site-editor-canvas"));
|
|
34
34
|
var _templatePartConverter = _interopRequireDefault(require("../template-part-converter"));
|
|
35
35
|
var _useSiteEditorSettings = require("../block-editor/use-site-editor-settings");
|
|
36
|
+
var _pluginTemplateSettingPanel = _interopRequireDefault(require("../plugin-template-setting-panel"));
|
|
37
|
+
var _globalStylesSidebar = _interopRequireDefault(require("../global-styles-sidebar"));
|
|
36
38
|
/**
|
|
37
39
|
* External dependencies
|
|
38
40
|
*/
|
|
@@ -52,8 +54,12 @@ const {
|
|
|
52
54
|
InterfaceSkeleton,
|
|
53
55
|
ComplementaryArea,
|
|
54
56
|
interfaceStore,
|
|
55
|
-
SavePublishPanels
|
|
57
|
+
SavePublishPanels,
|
|
58
|
+
Sidebar
|
|
56
59
|
} = (0, _lockUnlock.unlock)(_editor.privateApis);
|
|
60
|
+
const {
|
|
61
|
+
useHistory
|
|
62
|
+
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
57
63
|
const {
|
|
58
64
|
BlockKeyboardShortcuts
|
|
59
65
|
} = (0, _lockUnlock.unlock)(_blockLibrary.privateApis);
|
|
@@ -96,14 +102,17 @@ function Editor({
|
|
|
96
102
|
isDistractionFree,
|
|
97
103
|
showIconLabels,
|
|
98
104
|
showBlockBreadcrumbs,
|
|
99
|
-
postTypeLabel
|
|
105
|
+
postTypeLabel,
|
|
106
|
+
isEditingPage,
|
|
107
|
+
supportsGlobalStyles
|
|
100
108
|
} = (0, _data.useSelect)(select => {
|
|
101
109
|
const {
|
|
102
110
|
get
|
|
103
111
|
} = select(_preferences.store);
|
|
104
112
|
const {
|
|
105
113
|
getEditedPostContext,
|
|
106
|
-
getCanvasMode
|
|
114
|
+
getCanvasMode,
|
|
115
|
+
isPage
|
|
107
116
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
108
117
|
const {
|
|
109
118
|
__unstableGetEditorMode
|
|
@@ -112,7 +121,8 @@ function Editor({
|
|
|
112
121
|
getActiveComplementaryArea
|
|
113
122
|
} = select(interfaceStore);
|
|
114
123
|
const {
|
|
115
|
-
getEntityRecord
|
|
124
|
+
getEntityRecord,
|
|
125
|
+
getCurrentTheme
|
|
116
126
|
} = select(_coreData.store);
|
|
117
127
|
const {
|
|
118
128
|
isInserterOpened,
|
|
@@ -136,7 +146,9 @@ function Editor({
|
|
|
136
146
|
isDistractionFree: get('core', 'distractionFree'),
|
|
137
147
|
showBlockBreadcrumbs: get('core', 'showBlockBreadcrumbs'),
|
|
138
148
|
showIconLabels: get('core', 'showIconLabels'),
|
|
139
|
-
postTypeLabel: getPostTypeLabel()
|
|
149
|
+
postTypeLabel: getPostTypeLabel(),
|
|
150
|
+
isEditingPage: isPage(),
|
|
151
|
+
supportsGlobalStyles: getCurrentTheme()?.is_block_theme
|
|
140
152
|
};
|
|
141
153
|
}, []);
|
|
142
154
|
const isViewMode = canvasMode === 'view';
|
|
@@ -173,6 +185,47 @@ function Editor({
|
|
|
173
185
|
}
|
|
174
186
|
setEntitiesSavedStatesCallback(false);
|
|
175
187
|
}, [entitiesSavedStatesCallback]);
|
|
188
|
+
const {
|
|
189
|
+
createSuccessNotice
|
|
190
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
191
|
+
const history = useHistory();
|
|
192
|
+
const onActionPerformed = (0, _element.useCallback)((actionId, items) => {
|
|
193
|
+
switch (actionId) {
|
|
194
|
+
case 'move-to-trash':
|
|
195
|
+
{
|
|
196
|
+
history.push({
|
|
197
|
+
path: '/' + items[0].type,
|
|
198
|
+
postId: undefined,
|
|
199
|
+
postType: undefined,
|
|
200
|
+
canvas: 'view'
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
break;
|
|
204
|
+
case 'duplicate-post':
|
|
205
|
+
{
|
|
206
|
+
const newItem = items[0];
|
|
207
|
+
const _title = typeof newItem.title === 'string' ? newItem.title : newItem.title?.rendered;
|
|
208
|
+
createSuccessNotice((0, _i18n.sprintf)(
|
|
209
|
+
// translators: %s: Title of the created post e.g: "Post 1".
|
|
210
|
+
(0, _i18n.__)('"%s" successfully created.'), _title), {
|
|
211
|
+
type: 'snackbar',
|
|
212
|
+
id: 'duplicate-post-action',
|
|
213
|
+
actions: [{
|
|
214
|
+
label: (0, _i18n.__)('Edit'),
|
|
215
|
+
onClick: () => {
|
|
216
|
+
history.push({
|
|
217
|
+
path: undefined,
|
|
218
|
+
postId: newItem.id,
|
|
219
|
+
postType: newItem.type,
|
|
220
|
+
canvas: 'edit'
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}]
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
}, [history, createSuccessNotice]);
|
|
176
229
|
const isReady = !isLoading && (postWithTemplate && !!contextPost && !!editedPost || !postWithTemplate && !!editedPost);
|
|
177
230
|
return (0, _react.createElement)(_react.Fragment, null, !isReady ? (0, _react.createElement)(_canvasLoader.default, {
|
|
178
231
|
id: loadingProgressId
|
|
@@ -184,10 +237,10 @@ function Editor({
|
|
|
184
237
|
__unstableTemplate: postWithTemplate ? editedPost : undefined,
|
|
185
238
|
settings: settings,
|
|
186
239
|
useSubRegistry: false
|
|
187
|
-
}, (0, _react.createElement)(
|
|
240
|
+
}, (0, _react.createElement)(InterfaceSkeleton, {
|
|
188
241
|
isDistractionFree: isDistractionFree,
|
|
189
242
|
enableRegionNavigation: false,
|
|
190
|
-
className: (0,
|
|
243
|
+
className: (0, _clsx.default)('edit-site-editor__interface-skeleton', {
|
|
191
244
|
'show-icon-labels': showIconLabels,
|
|
192
245
|
'is-entity-save-view-open': !!entitiesSavedStatesCallback
|
|
193
246
|
}),
|
|
@@ -219,7 +272,7 @@ function Editor({
|
|
|
219
272
|
setEntitiesSavedStatesCallback: setEntitiesSavedStatesCallback
|
|
220
273
|
}),
|
|
221
274
|
notices: (0, _react.createElement)(_editor.EditorSnackbars, null),
|
|
222
|
-
content: (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_globalStylesRenderer.GlobalStylesRenderer, null), isEditMode && (0, _react.createElement)(_editor.EditorNotices, null), showVisualEditor && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_templatePartConverter.default, null),
|
|
275
|
+
content: (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_globalStylesRenderer.GlobalStylesRenderer, null), isEditMode && (0, _react.createElement)(_editor.EditorNotices, null), showVisualEditor && (0, _react.createElement)(_react.Fragment, null, (0, _react.createElement)(_templatePartConverter.default, null), !isLargeViewport && (0, _react.createElement)(_blockEditor.BlockToolbar, {
|
|
223
276
|
hideDragHandle: true
|
|
224
277
|
}), (0, _react.createElement)(_siteEditorCanvas.default, {
|
|
225
278
|
onClick: onClick
|
|
@@ -238,6 +291,9 @@ function Editor({
|
|
|
238
291
|
...interfaceLabels,
|
|
239
292
|
secondarySidebar: secondarySidebarLabel
|
|
240
293
|
}
|
|
241
|
-
}))
|
|
294
|
+
}), (0, _react.createElement)(Sidebar, {
|
|
295
|
+
onActionPerformed: onActionPerformed,
|
|
296
|
+
extraPanels: !isEditingPage && (0, _react.createElement)(_pluginTemplateSettingPanel.default.Slot, null)
|
|
297
|
+
}), supportsGlobalStyles && (0, _react.createElement)(_globalStylesSidebar.default, null)));
|
|
242
298
|
}
|
|
243
299
|
//# sourceMappingURL=index.js.map
|