@wordpress/edit-site 5.22.0 → 5.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/build/components/actions/index.js +86 -4
- package/build/components/actions/index.js.map +1 -1
- package/build/components/add-new-template/new-template.js +0 -7
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +54 -63
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/dataviews/add-filter.js +90 -0
- package/build/components/dataviews/add-filter.js.map +1 -0
- package/build/components/dataviews/dataviews.js +23 -4
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filters.js +36 -32
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/in-filter.js +22 -20
- package/build/components/dataviews/in-filter.js.map +1 -1
- package/build/components/dataviews/index.js +9 -2
- package/build/components/dataviews/index.js.map +1 -1
- package/build/components/dataviews/item-actions.js +81 -13
- package/build/components/dataviews/item-actions.js.map +1 -1
- package/build/components/dataviews/pagination.js +3 -2
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/reset-filters.js +33 -0
- package/build/components/dataviews/reset-filters.js.map +1 -0
- package/build/components/dataviews/search.js +1 -0
- package/build/components/dataviews/search.js.map +1 -1
- package/build/components/dataviews/view-actions.js +27 -10
- package/build/components/dataviews/view-actions.js.map +1 -1
- package/build/components/dataviews/view-list.js +126 -5
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/dataviews/view-side-by-side.js +20 -0
- package/build/components/dataviews/view-side-by-side.js.map +1 -0
- package/build/components/editor/index.js +53 -53
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +42 -21
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-root.js +3 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/ui.js +3 -3
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +1 -1
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/document-tools/index.js +160 -0
- package/build/components/header-edit-mode/document-tools/index.js.map +1 -0
- package/build/components/header-edit-mode/index.js +48 -116
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/build/components/header-edit-mode/more-menu/site-export.js.map +1 -1
- package/build/components/layout/index.js +4 -19
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +1 -0
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/page-content-focus-manager/back-to-page-notification.js +5 -10
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build/components/page-main/index.js +2 -1
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/page-pages/index.js +133 -78
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-pages/side-editor.js +25 -0
- package/build/components/page-pages/side-editor.js.map +1 -0
- package/build/components/page-patterns/grid-item.js +2 -2
- package/build/components/page-patterns/grid-item.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +3 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +1 -1
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates/dataviews-templates.js +201 -0
- package/build/components/page-templates/dataviews-templates.js.map +1 -0
- package/build/components/page-templates/template-actions.js +168 -0
- package/build/components/page-templates/template-actions.js.map +1 -0
- package/build/components/sidebar/index.js +1 -2
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/add-new-view.js +124 -0
- package/build/components/sidebar-dataviews/add-new-view.js.map +1 -0
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +189 -0
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
- package/build/components/sidebar-dataviews/dataview-item.js +71 -0
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -0
- package/build/components/sidebar-dataviews/default-views.js +60 -0
- package/build/components/sidebar-dataviews/default-views.js.map +1 -0
- package/build/components/sidebar-dataviews/index.js +21 -38
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/default-sidebar.js +2 -6
- package/build/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +11 -11
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +2 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js +4 -12
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js +4 -12
- package/build/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
- package/build/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/template-panel/hooks.js +3 -3
- package/build/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +3 -11
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build/components/site-hub/index.js +18 -6
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +12 -16
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -49
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +1 -1
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +3 -1
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +6 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +0 -3
- package/build/index.js.map +1 -1
- package/build/store/actions.js +35 -82
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +25 -63
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +3 -3
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/actions/index.js +85 -5
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +0 -7
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +54 -62
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/dataviews/add-filter.js +83 -0
- package/build-module/components/dataviews/add-filter.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +22 -4
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filters.js +34 -32
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/in-filter.js +20 -19
- package/build-module/components/dataviews/in-filter.js.map +1 -1
- package/build-module/components/dataviews/index.js +1 -1
- package/build-module/components/dataviews/index.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +84 -16
- package/build-module/components/dataviews/item-actions.js.map +1 -1
- package/build-module/components/dataviews/pagination.js +3 -2
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/reset-filters.js +26 -0
- package/build-module/components/dataviews/reset-filters.js.map +1 -0
- package/build-module/components/dataviews/search.js +1 -0
- package/build-module/components/dataviews/search.js.map +1 -1
- package/build-module/components/dataviews/view-actions.js +28 -11
- package/build-module/components/dataviews/view-actions.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +128 -7
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/dataviews/view-side-by-side.js +12 -0
- package/build-module/components/dataviews/view-side-by-side.js.map +1 -0
- package/build-module/components/editor/index.js +57 -57
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +42 -21
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/ui.js +3 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +1 -1
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/document-tools/index.js +152 -0
- package/build-module/components/header-edit-mode/document-tools/index.js.map +1 -0
- package/build-module/components/header-edit-mode/index.js +52 -120
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/build-module/components/header-edit-mode/more-menu/site-export.js.map +1 -1
- package/build-module/components/layout/index.js +5 -20
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +1 -1
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +5 -10
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +36 -23
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
- package/build-module/components/page-main/index.js +2 -1
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/page-pages/index.js +137 -80
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-pages/side-editor.js +17 -0
- package/build-module/components/page-pages/side-editor.js.map +1 -0
- package/build-module/components/page-patterns/grid-item.js +2 -2
- package/build-module/components/page-patterns/grid-item.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +4 -4
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +2 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/dataviews-templates.js +193 -0
- package/build-module/components/page-templates/dataviews-templates.js.map +1 -0
- package/build-module/components/page-templates/template-actions.js +157 -0
- package/build-module/components/page-templates/template-actions.js.map +1 -0
- package/build-module/components/sidebar/index.js +1 -2
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/add-new-view.js +116 -0
- package/build-module/components/sidebar-dataviews/add-new-view.js.map +1 -0
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +180 -0
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js +63 -0
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -0
- package/build-module/components/sidebar-dataviews/default-views.js +52 -0
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -0
- package/build-module/components/sidebar-dataviews/index.js +22 -39
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/default-sidebar.js +2 -6
- package/build-module/components/sidebar-edit-mode/default-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +12 -12
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +3 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js +5 -13
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js +5 -13
- package/build-module/components/sidebar-edit-mode/page-panels/swap-template-button.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js +2 -6
- package/build-module/components/sidebar-edit-mode/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js +4 -4
- package/build-module/components/sidebar-edit-mode/template-panel/hooks.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +3 -11
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -1
- package/build-module/components/site-hub/index.js +19 -7
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +13 -16
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +112 -50
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +4 -2
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +6 -2
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +0 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +33 -79
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +19 -58
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +1 -1
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +69 -119
- package/build-style/style.css +69 -119
- package/package.json +41 -41
- package/src/components/actions/index.js +113 -5
- package/src/components/add-new-template/new-template.js +0 -5
- package/src/components/block-editor/style.scss +0 -87
- package/src/components/block-editor/use-site-editor-settings.js +68 -89
- package/src/components/dataviews/README.md +77 -83
- package/src/components/dataviews/add-filter.js +111 -0
- package/src/components/dataviews/dataviews.js +20 -2
- package/src/components/dataviews/filters.js +56 -49
- package/src/components/dataviews/in-filter.js +35 -17
- package/src/components/dataviews/index.js +1 -1
- package/src/components/dataviews/item-actions.js +95 -20
- package/src/components/dataviews/pagination.js +5 -4
- package/src/components/dataviews/reset-filters.js +26 -0
- package/src/components/dataviews/search.js +1 -0
- package/src/components/dataviews/style.scss +5 -1
- package/src/components/dataviews/view-actions.js +39 -9
- package/src/components/dataviews/view-list.js +174 -3
- package/src/components/dataviews/view-side-by-side.js +9 -0
- package/src/components/editor/index.js +149 -121
- package/src/components/global-styles/screen-revisions/index.js +52 -25
- package/src/components/global-styles/screen-root.js +2 -1
- package/src/components/global-styles/ui.js +1 -1
- package/src/components/global-styles-renderer/index.js +1 -1
- package/src/components/header-edit-mode/document-tools/index.js +201 -0
- package/src/components/header-edit-mode/index.js +86 -184
- package/src/components/header-edit-mode/more-menu/site-export.js +2 -6
- package/src/components/header-edit-mode/style.scss +35 -2
- package/src/components/layout/index.js +4 -11
- package/src/components/layout/style.scss +6 -18
- package/src/components/list/added-by.js +1 -1
- package/src/components/page-content-focus-manager/back-to-page-notification.js +4 -15
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +38 -33
- package/src/components/page-main/index.js +6 -1
- package/src/components/page-pages/index.js +162 -81
- package/src/components/page-pages/side-editor.js +14 -0
- package/src/components/page-patterns/grid-item.js +3 -3
- package/src/components/page-patterns/patterns-list.js +10 -4
- package/src/components/page-patterns/use-patterns.js +3 -2
- package/src/components/page-templates/dataviews-templates.js +224 -0
- package/src/components/page-templates/template-actions.js +209 -0
- package/src/components/sidebar/index.js +1 -2
- package/src/components/sidebar-dataviews/add-new-view.js +141 -0
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +227 -0
- package/src/components/sidebar-dataviews/dataview-item.js +67 -0
- package/src/components/sidebar-dataviews/default-views.js +54 -0
- package/src/components/sidebar-dataviews/index.js +36 -45
- package/src/components/sidebar-dataviews/style.scss +22 -0
- package/src/components/sidebar-edit-mode/default-sidebar.js +6 -6
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +14 -21
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +3 -0
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +10 -9
- package/src/components/sidebar-edit-mode/page-panels/style.scss +5 -0
- package/src/components/sidebar-edit-mode/page-panels/swap-template-button.js +10 -9
- package/src/components/sidebar-edit-mode/plugin-sidebar/index.js +6 -6
- package/src/components/sidebar-edit-mode/template-panel/hooks.js +11 -7
- package/src/components/sidebar-navigation-screen-global-styles/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js +1 -1
- package/src/components/sidebar-navigation-screen-page/page-details.js +4 -17
- package/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js +2 -2
- package/src/components/site-hub/index.js +9 -8
- package/src/components/start-template-options/index.js +14 -12
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +117 -50
- package/src/components/template-part-converter/convert-to-regular.js +1 -1
- package/src/hooks/push-changes-to-global-styles/index.js +13 -6
- package/src/hooks/template-part-edit.js +4 -2
- package/src/index.js +0 -8
- package/src/store/actions.js +37 -95
- package/src/store/selectors.js +31 -91
- package/src/store/test/actions.js +11 -137
- package/src/store/test/selectors.js +0 -82
- package/src/style.scss +1 -0
- package/src/utils/constants.js +1 -1
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -77
- package/build/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/index.js +0 -31
- package/build/components/block-editor/block-editor-provider/index.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -110
- package/build/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -84
- package/build/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
- package/build/components/block-editor/index.js +0 -30
- package/build/components/block-editor/index.js.map +0 -1
- package/build/components/page-pages/default-views.js +0 -62
- package/build/components/page-pages/default-views.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -69
- package/build-module/components/block-editor/block-editor-provider/default-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/index.js +0 -23
- package/build-module/components/block-editor/block-editor-provider/index.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -102
- package/build-module/components/block-editor/block-editor-provider/navigation-block-editor-provider.js.map +0 -1
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -78
- package/build-module/components/block-editor/block-editor-provider/use-page-content-blocks.js.map +0 -1
- package/build-module/components/block-editor/index.js +0 -22
- package/build-module/components/block-editor/index.js.map +0 -1
- package/build-module/components/page-pages/default-views.js +0 -55
- package/build-module/components/page-pages/default-views.js.map +0 -1
- package/src/components/block-editor/block-editor-provider/default-block-editor-provider.js +0 -75
- package/src/components/block-editor/block-editor-provider/index.js +0 -29
- package/src/components/block-editor/block-editor-provider/navigation-block-editor-provider.js +0 -114
- package/src/components/block-editor/block-editor-provider/test/use-page-content-blocks.js +0 -116
- package/src/components/block-editor/block-editor-provider/use-page-content-blocks.js +0 -90
- package/src/components/block-editor/index.js +0 -28
- package/src/components/page-pages/default-views.js +0 -60
package/build/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_blockEditor","_blocks","_lockUnlock","_store","_navigationMenuContent","_interopRequireDefault","noop","NavigationMenuEditor","navigationMenuId","storedSettings","useSelect","select","getSettings","unlock","editSiteStore","blocks","useMemo","createBlock","ref","length","_react","createElement","BlockEditorProvider","settings","value","onChange","onInput","className","default","rootClientId","clientId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport NavigationMenuContent from '../sidebar-navigation-screen-navigation-menus/navigation-menu-content';\n\nconst noop = () => {};\n\nexport default function NavigationMenuEditor( { navigationMenuId } ) {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_blockEditor","_blocks","_lockUnlock","_store","_navigationMenuContent","_interopRequireDefault","noop","NavigationMenuEditor","navigationMenuId","storedSettings","useSelect","select","getSettings","unlock","editSiteStore","blocks","useMemo","createBlock","ref","length","_react","createElement","BlockEditorProvider","settings","value","onChange","onInput","className","default","rootClientId","clientId"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/navigation-menu-editor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport NavigationMenuContent from '../sidebar-navigation-screen-navigation-menus/navigation-menu-content';\n\nconst noop = () => {};\n\nexport default function NavigationMenuEditor( { navigationMenuId } ) {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings(),\n\t\t};\n\t}, [] );\n\n\tconst blocks = useMemo( () => {\n\t\tif ( ! navigationMenuId ) {\n\t\t\treturn [];\n\t\t}\n\n\t\treturn [ createBlock( 'core/navigation', { ref: navigationMenuId } ) ];\n\t}, [ navigationMenuId ] );\n\n\tif ( ! navigationMenuId || ! blocks?.length ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t<NavigationMenuContent rootClientId={ blocks[ 0 ].clientId } />\n\t\t\t</div>\n\t\t</BlockEditorProvider>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAC,sBAAA,CAAAP,OAAA;AAbA;AACA;AACA;;AAMA;AACA;AACA;;AAKA,MAAMQ,IAAI,GAAGA,CAAA,KAAM,CAAC,CAAC;AAEN,SAASC,oBAAoBA,CAAE;EAAEC;AAAiB,CAAC,EAAG;EACpE,MAAM;IAAEC;EAAe,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACnD,MAAM;MAAEC;IAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEF,MAAM,CAAEG,YAAc,CAAE,CAAC;IAEzD,OAAO;MACNL,cAAc,EAAEG,WAAW,CAAC;IAC7B,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMG,MAAM,GAAG,IAAAC,gBAAO,EAAE,MAAM;IAC7B,IAAK,CAAER,gBAAgB,EAAG;MACzB,OAAO,EAAE;IACV;IAEA,OAAO,CAAE,IAAAS,mBAAW,EAAE,iBAAiB,EAAE;MAAEC,GAAG,EAAEV;IAAiB,CAAE,CAAC,CAAE;EACvE,CAAC,EAAE,CAAEA,gBAAgB,CAAG,CAAC;EAEzB,IAAK,CAAEA,gBAAgB,IAAI,CAAEO,MAAM,EAAEI,MAAM,EAAG;IAC7C,OAAO,IAAI;EACZ;EAEA,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACrB,YAAA,CAAAsB,mBAAmB;IACnBC,QAAQ,EAAGd,cAAgB;IAC3Be,KAAK,EAAGT,MAAQ;IAChBU,QAAQ,EAAGnB,IAAM;IACjBoB,OAAO,EAAGpB;EAAM,GAEhB,IAAAc,MAAA,CAAAC,aAAA;IAAKM,SAAS,EAAC;EAA+D,GAC7E,IAAAP,MAAA,CAAAC,aAAA,EAACjB,sBAAA,CAAAwB,OAAqB;IAACC,YAAY,EAAGd,MAAM,CAAE,CAAC,CAAE,CAACe;EAAU,CAAE,CAC1D,CACe,CAAC;AAExB"}
|
|
@@ -90,18 +90,10 @@ function PageDetails({
|
|
|
90
90
|
isPostsPage
|
|
91
91
|
} = (0, _data.useSelect)(select => {
|
|
92
92
|
const {
|
|
93
|
-
|
|
93
|
+
getEditedPostId
|
|
94
94
|
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
per_page: -1
|
|
98
|
-
});
|
|
99
|
-
// Template title.
|
|
100
|
-
const templateSlug =
|
|
101
|
-
// Checks that the post type matches the current theme's post type, otherwise
|
|
102
|
-
// the templateSlug returns 'home'.
|
|
103
|
-
postContext?.postType === 'page' ? postContext?.templateSlug : null;
|
|
104
|
-
const _templateTitle = templates && templateSlug ? templates.find(template => template.slug === templateSlug)?.title?.rendered : null;
|
|
95
|
+
const template = select(_coreData.store).getEntityRecord('postType', _constants.TEMPLATE_POST_TYPE, getEditedPostId());
|
|
96
|
+
const _templateTitle = template?.title?.rendered;
|
|
105
97
|
|
|
106
98
|
// Parent page title.
|
|
107
99
|
const _parentTitle = record?.parent ? select(_coreData.store).getEntityRecord('postType', 'page', record.parent, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_wordcount","_data","_htmlEntities","_coreData","_url","_statusLabel","_interopRequireDefault","_lockUnlock","_store","_sidebarNavigationScreenDetailsPanel","_constants","AVERAGE_READING_RATE","getPageDetails","page","details","label","__","value","_react","createElement","default","status","password","date","short","__experimentalTruncate","numberOfLines","safeDecodeURIComponent","slug","generated_slug","templateTitle","push","decodeEntities","parentTitle","wordCountType","_x","wordsCounted","content","rendered","wordCount","readingTime","Math","round","isPostsPage","toLocaleString","sprintf","PageDetails","id","record","useEntityRecord","useSelect","select","getEditedPostContext","unlock","editSiteStore","postContext","templates","coreStore","getEntityRecords","TEMPLATE_POST_TYPE","per_page","templateSlug","postType","_templateTitle","find","template","title","_parentTitle","parent","getEntityRecord","_fields","siteSettings","page_for_posts","SidebarNavigationScreenDetailsPanel","spacing","map","SidebarNavigationScreenDetailsPanelRow","key","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent(\n\t\t\t\t\t\tpage.slug || page.generated_slug\n\t\t\t\t\t) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted && ! page?.isPostsPage ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle, isPostsPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostContext } = unlock( select( editSiteStore ) );\n\t\t\tconst postContext = getEditedPostContext();\n\t\t\tconst templates = select( coreStore ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t{ per_page: -1 }\n\t\t\t);\n\t\t\t// Template title.\n\t\t\tconst templateSlug =\n\t\t\t\t// Checks that the post type matches the current theme's post type, otherwise\n\t\t\t\t// the templateSlug returns 'home'.\n\t\t\t\tpostContext?.postType === 'page'\n\t\t\t\t\t? postContext?.templateSlug\n\t\t\t\t\t: null;\n\t\t\tconst _templateTitle =\n\t\t\t\ttemplates && templateSlug\n\t\t\t\t\t? templates.find(\n\t\t\t\t\t\t\t( template ) => template.slug === templateSlug\n\t\t\t\t\t )?.title?.rendered\n\t\t\t\t\t: null;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t\tisPostsPage: record?.id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent, record?.id ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\tisPostsPage,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAKA,IAAAO,YAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,WAAA,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AU;EAAG,GAEvBJ,cAAc,CAAE;IACjBqB,WAAW;IACXH,aAAa;IACba,WAAW;IACX,GAAGK;EACJ,CAAE,CAAC,CAAC2B,GAAG,CAAE,CAAE;IAAE5D,KAAK;IAAEE;EAAM,CAAC,KAC1B,IAAAC,MAAA,CAAAC,aAAA,EAACV,oCAAA,CAAAmE,sCAAsC;IAACC,GAAG,EAAG9D;EAAO,GACpD,IAAAG,MAAA,CAAAC,aAAA,EAACV,oCAAA,CAAAqE,wCAAwC,QACtC/D,KACuC,CAAC,EAC3C,IAAAG,MAAA,CAAAC,aAAA,EAACV,oCAAA,CAAAsE,wCAAwC,QACtC9D,KACuC,CACH,CACvC,CACkC,CAAC;AAExC"}
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_wordcount","_data","_htmlEntities","_coreData","_url","_statusLabel","_interopRequireDefault","_lockUnlock","_store","_sidebarNavigationScreenDetailsPanel","_constants","AVERAGE_READING_RATE","getPageDetails","page","details","label","__","value","_react","createElement","default","status","password","date","short","__experimentalTruncate","numberOfLines","safeDecodeURIComponent","slug","generated_slug","templateTitle","push","decodeEntities","parentTitle","wordCountType","_x","wordsCounted","content","rendered","wordCount","readingTime","Math","round","isPostsPage","toLocaleString","sprintf","PageDetails","id","record","useEntityRecord","useSelect","select","getEditedPostId","unlock","editSiteStore","template","coreStore","getEntityRecord","TEMPLATE_POST_TYPE","_templateTitle","title","_parentTitle","parent","_fields","siteSettings","page_for_posts","SidebarNavigationScreenDetailsPanel","spacing","map","SidebarNavigationScreenDetailsPanelRow","key","SidebarNavigationScreenDetailsPanelLabel","SidebarNavigationScreenDetailsPanelValue"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-page/page-details.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x, sprintf } from '@wordpress/i18n';\nimport { __experimentalTruncate as Truncate } from '@wordpress/components';\nimport { count as wordCount } from '@wordpress/wordcount';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore, useEntityRecord } from '@wordpress/core-data';\nimport { safeDecodeURIComponent } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport StatusLabel from './status-label';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport {\n\tSidebarNavigationScreenDetailsPanel,\n\tSidebarNavigationScreenDetailsPanelRow,\n\tSidebarNavigationScreenDetailsPanelLabel,\n\tSidebarNavigationScreenDetailsPanelValue,\n} from '../sidebar-navigation-screen-details-panel';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\n// Taken from packages/editor/src/components/time-to-read/index.js.\nconst AVERAGE_READING_RATE = 189;\n\nfunction getPageDetails( page ) {\n\tif ( ! page ) {\n\t\treturn [];\n\t}\n\n\tconst details = [\n\t\t{\n\t\t\tlabel: __( 'Status' ),\n\t\t\tvalue: (\n\t\t\t\t<StatusLabel\n\t\t\t\t\tstatus={ page?.password ? 'protected' : page.status }\n\t\t\t\t\tdate={ page?.date }\n\t\t\t\t\tshort\n\t\t\t\t/>\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tlabel: __( 'Slug' ),\n\t\t\tvalue: (\n\t\t\t\t<Truncate numberOfLines={ 1 }>\n\t\t\t\t\t{ safeDecodeURIComponent(\n\t\t\t\t\t\tpage.slug || page.generated_slug\n\t\t\t\t\t) }\n\t\t\t\t</Truncate>\n\t\t\t),\n\t\t},\n\t];\n\n\tif ( page?.templateTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Template' ),\n\t\t\tvalue: decodeEntities( page.templateTitle ),\n\t\t} );\n\t}\n\n\tif ( page?.parentTitle ) {\n\t\tdetails.push( {\n\t\t\tlabel: __( 'Parent' ),\n\t\t\tvalue: decodeEntities( page.parentTitle || __( '(no title)' ) ),\n\t\t} );\n\t}\n\n\t/*\n\t * translators: If your word count is based on single characters (e.g. East Asian characters),\n\t * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.\n\t * Do not translate into your own language.\n\t */\n\tconst wordCountType = _x( 'words', 'Word count type. Do not translate!' );\n\tconst wordsCounted = page?.content?.rendered\n\t\t? wordCount( page.content.rendered, wordCountType )\n\t\t: 0;\n\tconst readingTime = Math.round( wordsCounted / AVERAGE_READING_RATE );\n\n\tif ( wordsCounted && ! page?.isPostsPage ) {\n\t\tdetails.push(\n\t\t\t{\n\t\t\t\tlabel: __( 'Words' ),\n\t\t\t\tvalue: wordsCounted.toLocaleString() || __( 'Unknown' ),\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: __( 'Time to read' ),\n\t\t\t\tvalue:\n\t\t\t\t\treadingTime > 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: is the number of minutes. */\n\t\t\t\t\t\t\t\t__( '%s mins' ),\n\t\t\t\t\t\t\t\treadingTime.toLocaleString()\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __( '< 1 min' ),\n\t\t\t}\n\t\t);\n\t}\n\treturn details;\n}\n\nexport default function PageDetails( { id } ) {\n\tconst { record } = useEntityRecord( 'postType', 'page', id );\n\tconst { parentTitle, templateTitle, isPostsPage } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostId } = unlock( select( editSiteStore ) );\n\t\t\tconst template = select( coreStore ).getEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\tgetEditedPostId()\n\t\t\t);\n\t\t\tconst _templateTitle = template?.title?.rendered;\n\n\t\t\t// Parent page title.\n\t\t\tconst _parentTitle = record?.parent\n\t\t\t\t? select( coreStore ).getEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t'page',\n\t\t\t\t\t\trecord.parent,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t_fields: [ 'title' ],\n\t\t\t\t\t\t}\n\t\t\t\t )?.title?.rendered\n\t\t\t\t: null;\n\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\tconst siteSettings = getEntityRecord( 'root', 'site' );\n\n\t\t\treturn {\n\t\t\t\tparentTitle: _parentTitle,\n\t\t\t\ttemplateTitle: _templateTitle,\n\t\t\t\tisPostsPage: record?.id === siteSettings?.page_for_posts,\n\t\t\t};\n\t\t},\n\t\t[ record?.parent, record?.id ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreenDetailsPanel\n\t\t\tspacing={ 5 }\n\t\t\ttitle={ __( 'Details' ) }\n\t\t>\n\t\t\t{ getPageDetails( {\n\t\t\t\tparentTitle,\n\t\t\t\ttemplateTitle,\n\t\t\t\tisPostsPage,\n\t\t\t\t...record,\n\t\t\t} ).map( ( { label, value } ) => (\n\t\t\t\t<SidebarNavigationScreenDetailsPanelRow key={ label }>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t\t{ label }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelLabel>\n\t\t\t\t\t<SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t\t\t{ value }\n\t\t\t\t\t</SidebarNavigationScreenDetailsPanelValue>\n\t\t\t\t</SidebarNavigationScreenDetailsPanelRow>\n\t\t\t) ) }\n\t\t</SidebarNavigationScreenDetailsPanel>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AACA,IAAAM,IAAA,GAAAN,OAAA;AAKA,IAAAO,YAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,GAAAV,OAAA;AACA,IAAAW,oCAAA,GAAAX,OAAA;AAMA,IAAAY,UAAA,GAAAZ,OAAA;AAvBA;AACA;AACA;;AASA;AACA;AACA;;AAYA;AACA,MAAMa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28,7 @@ function useThemePatterns() {
|
|
|
28
28
|
return (_getSettings$__experi = getSettings().__experimentalAdditionalBlockPatterns) !== null && _getSettings$__experi !== void 0 ? _getSettings$__experi : getSettings().__experimentalBlockPatterns;
|
|
29
29
|
});
|
|
30
30
|
const restBlockPatterns = (0, _data.useSelect)(select => select(_coreData.store).getBlockPatterns());
|
|
31
|
-
const patterns = (0, _element.useMemo)(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !_constants.
|
|
31
|
+
const patterns = (0, _element.useMemo)(() => [...(blockPatterns || []), ...(restBlockPatterns || [])].filter(pattern => !_constants.EXCLUDED_PATTERN_SOURCES.includes(pattern.source)).filter(_utils.filterOutDuplicatesByName).filter(pattern => pattern.inserter !== false), [blockPatterns, restBlockPatterns]);
|
|
32
32
|
return patterns;
|
|
33
33
|
}
|
|
34
34
|
//# sourceMappingURL=use-theme-patterns.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_data","_element","_utils","_constants","_lockUnlock","_store","useThemePatterns","blockPatterns","useSelect","select","_getSettings$__experi","getSettings","unlock","editSiteStore","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","coreStore","getBlockPatterns","patterns","useMemo","filter","pattern","
|
|
1
|
+
{"version":3,"names":["_coreData","require","_data","_element","_utils","_constants","_lockUnlock","_store","useThemePatterns","blockPatterns","useSelect","select","_getSettings$__experi","getSettings","unlock","editSiteStore","__experimentalAdditionalBlockPatterns","__experimentalBlockPatterns","restBlockPatterns","coreStore","getBlockPatterns","patterns","useMemo","filter","pattern","EXCLUDED_PATTERN_SOURCES","includes","source","filterOutDuplicatesByName","inserter"],"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-patterns/use-theme-patterns.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { filterOutDuplicatesByName } from '../page-patterns/utils';\nimport { EXCLUDED_PATTERN_SOURCES } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function useThemePatterns() {\n\tconst blockPatterns = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn (\n\t\t\tgetSettings().__experimentalAdditionalBlockPatterns ??\n\t\t\tgetSettings().__experimentalBlockPatterns\n\t\t);\n\t} );\n\n\tconst restBlockPatterns = useSelect( ( select ) =>\n\t\tselect( coreStore ).getBlockPatterns()\n\t);\n\n\tconst patterns = useMemo(\n\t\t() =>\n\t\t\t[ ...( blockPatterns || [] ), ...( restBlockPatterns || [] ) ]\n\t\t\t\t.filter(\n\t\t\t\t\t( pattern ) =>\n\t\t\t\t\t\t! EXCLUDED_PATTERN_SOURCES.includes( pattern.source )\n\t\t\t\t)\n\t\t\t\t.filter( filterOutDuplicatesByName )\n\t\t\t\t.filter( ( pattern ) => pattern.inserter !== false ),\n\t\t[ blockPatterns, restBlockPatterns ]\n\t);\n\n\treturn patterns;\n}\n"],"mappings":";;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,UAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAKA;AACA;AACA;;AAMe,SAASO,gBAAgBA,CAAA,EAAG;EAC1C,MAAMC,aAAa,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IAAA,IAAAC,qBAAA;IAC9C,MAAM;MAAEC;IAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEH,MAAM,CAAEI,YAAc,CAAE,CAAC;IAEzD,QAAAH,qBAAA,GACCC,WAAW,CAAC,CAAC,CAACG,qCAAqC,cAAAJ,qBAAA,cAAAA,qBAAA,GACnDC,WAAW,CAAC,CAAC,CAACI,2BAA2B;EAE3C,CAAE,CAAC;EAEH,MAAMC,iBAAiB,GAAG,IAAAR,eAAS,EAAIC,MAAM,IAC5CA,MAAM,CAAEQ,eAAU,CAAC,CAACC,gBAAgB,CAAC,CACtC,CAAC;EAED,MAAMC,QAAQ,GAAG,IAAAC,gBAAO,EACvB,MACC,CAAE,IAAKb,aAAa,IAAI,EAAE,CAAE,EAAE,IAAKS,iBAAiB,IAAI,EAAE,CAAE,CAAE,CAC5DK,MAAM,CACJC,OAAO,IACR,CAAEC,mCAAwB,CAACC,QAAQ,CAAEF,OAAO,CAACG,MAAO,CACtD,CAAC,CACAJ,MAAM,CAAEK,gCAA0B,CAAC,CACnCL,MAAM,CAAIC,OAAO,IAAMA,OAAO,CAACK,QAAQ,KAAK,KAAM,CAAC,EACtD,CAAEpB,aAAa,EAAES,iBAAiB,CACnC,CAAC;EAED,OAAOG,QAAQ;AAChB"}
|
|
@@ -34,10 +34,10 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
34
34
|
*/
|
|
35
35
|
|
|
36
36
|
const HUB_ANIMATION_DURATION = 0.3;
|
|
37
|
-
const SiteHub = (0, _element.
|
|
37
|
+
const SiteHub = (0, _element.memo)(({
|
|
38
38
|
isTransparent,
|
|
39
|
-
|
|
40
|
-
}
|
|
39
|
+
className
|
|
40
|
+
}) => {
|
|
41
41
|
const {
|
|
42
42
|
canvasMode,
|
|
43
43
|
dashboardLink,
|
|
@@ -89,9 +89,21 @@ const SiteHub = (0, _element.forwardRef)(({
|
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
91
|
return (0, _react.createElement)(_components.__unstableMotion.div, {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
className: (0, _classnames.default)('edit-site-site-hub', className),
|
|
93
|
+
variants: {
|
|
94
|
+
isDistractionFree: {
|
|
95
|
+
x: '-100%'
|
|
96
|
+
},
|
|
97
|
+
isDistractionFreeHovering: {
|
|
98
|
+
x: 0
|
|
99
|
+
},
|
|
100
|
+
view: {
|
|
101
|
+
x: 0
|
|
102
|
+
},
|
|
103
|
+
edit: {
|
|
104
|
+
x: 0
|
|
105
|
+
}
|
|
106
|
+
},
|
|
95
107
|
initial: false,
|
|
96
108
|
transition: {
|
|
97
109
|
type: 'tween',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_classnames","_interopRequireDefault","require","_data","_components","_compose","_i18n","_blockEditor","_coreData","_htmlEntities","_element","_icons","_commands","_keycodes","_store","_siteIcon","_lockUnlock","HUB_ANIMATION_DURATION","SiteHub","forwardRef","isTransparent","restProps","ref","canvasMode","dashboardLink","homeUrl","siteTitle","useSelect","select","getCanvasMode","getSettings","unlock","editSiteStore","getSite","getUnstableBase","coreStore","__experimentalDashboardLink","home","title","open","openCommandCenter","useDispatch","commandsStore","disableMotion","useReducedMotion","setCanvasMode","__experimentalSetPreviewDeviceType","setPreviewDeviceType","clearSelectedBlock","blockEditorStore","isBackToDashboardButton","siteIconButtonProps","href","label","__","role","onClick","event","preventDefault","_react","createElement","__unstableMotion","div","className","classnames","initial","transition","type","duration","ease","__experimentalHStack","justify","alignment","spacing","layout","Button","animate","scale","whileHover","default","__unstableAnimatePresence","opacity","exit","delay","decodeEntities","target","icon","external","search","shortcut","displayShortcut","primary","_default","exports"],"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { forwardRef } from '@wordpress/element';\nimport { search, external } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../lock-unlock';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef( ( { isTransparent, ...restProps }, ref ) => {\n\tconst { canvasMode, dashboardLink, homeUrl, siteTitle } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\tconst {\n\t\t\t\tgetSite,\n\t\t\t\tgetUnstableBase, // Site index.\n\t\t\t} = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tdashboardLink:\n\t\t\t\t\tgetSettings().__experimentalDashboardLink || 'index.php',\n\t\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\t\tsiteTitle: getSite()?.title,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tconst disableMotion = useReducedMotion();\n\tconst {\n\t\tsetCanvasMode,\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t} = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink,\n\t\t\t\tlabel: __( 'Go to the Dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\thref: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.\n\t\t\t\trole: 'button',\n\t\t\t\tlabel: __( 'Open Navigation' ),\n\t\t\t\tonClick: ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( canvasMode === 'edit' ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetPreviewDeviceType( 'Desktop' );\n\t\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t };\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ ref }\n\t\t\t{ ...restProps }\n\t\t\tclassName={ classnames(\n\t\t\t\t'edit-site-site-hub',\n\t\t\t\trestProps.className\n\t\t\t) }\n\t\t\tinitial={ false }\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"space-between\"\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"edit-site-site-hub__container\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\t\tspacing=\"0\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-site-hub__view-mode-toggle-container',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'has-transparent-background': isTransparent,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlayout\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 1,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\twhileHover={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 0.96,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ canvasMode === 'edit' }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: canvasMode === 'view' ? 1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-site-hub__site-title',\n\t\t\t\t\t\t\t\t{ 'is-transparent': isTransparent }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\tdelay: canvasMode === 'view' ? 0.1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\tlabel={ __( 'View site (opens in a new tab)' ) }\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'View site (opens in a new tab)'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__site-view-link\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-site-hub_toggle-command-center',\n\t\t\t\t\t\t\t{ 'is-transparent': isTransparent }\n\t\t\t\t\t\t) }\n\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\t\tlabel={ __( 'Open command palette' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR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AE;IACV,CAAG;IACHlB,SAAS,EAAG,IAAAC,mBAAU,EACrB,gCAAgC,EAChC;MAAE,gBAAgB,EAAE5C;IAAc,CACnC,CAAG;IACH8C,UAAU,EAAG;MACZC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAEzB,aAAa,GAAG,CAAC,GAAG,GAAG;MACjC0B,IAAI,EAAE,SAAS;MACfc,KAAK,EAAE5D,UAAU,KAAK,MAAM,GAAG,GAAG,GAAG;IACtC;EAAG,GAED,IAAA6D,4BAAc,EAAE1D,SAAU,CACjB,CACI,CAAC,EAChBH,UAAU,KAAK,MAAM,IACtB,IAAAoC,MAAA,CAAAC,aAAA,EAACxD,WAAA,CAAAuE,MAAM;IACNvB,IAAI,EAAG3B,OAAS;IAChB4D,MAAM,EAAC,QAAQ;IACfhC,KAAK,EAAG,IAAAC,QAAE,EAAE,gCAAiC,CAAG;IAChD,cAAa,IAAAA,QAAE,EACd,gCACD,CAAG;IACHgC,IAAI,EAAGC,eAAU;IACjBxB,SAAS,EAAC;EAAoC,CAC9C,CAEK,CAAC,EACPxC,UAAU,KAAK,MAAM,IACtB,IAAAoC,MAAA,CAAAC,aAAA,EAACxD,WAAA,CAAAuE,MAAM;IACNZ,SAAS,EAAG,IAAAC,mBAAU,EACrB,0CAA0C,EAC1C;MAAE,gBAAgB,EAAE5C;IAAc,CACnC,CAAG;IACHkE,IAAI,EAAGE,aAAQ;IACfhC,OAAO,EAAGA,CAAA,KAAMhB,iBAAiB,CAAC,CAAG;IACrCa,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB,CAAG;IACtCmC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;EAAG,CAC3C,CAEK,CACG,CAAC;AAEf,CAAE,CAAC;AAAC,IAAAC,QAAA,GAEW1E,OAAO;AAAA2E,OAAA,CAAAd,OAAA,GAAAa,QAAA"}
|
|
1
|
+
{"version":3,"names":["_classnames","_interopRequireDefault","require","_data","_components","_compose","_i18n","_blockEditor","_coreData","_htmlEntities","_element","_icons","_commands","_keycodes","_store","_siteIcon","_lockUnlock","HUB_ANIMATION_DURATION","SiteHub","memo","isTransparent","className","canvasMode","dashboardLink","homeUrl","siteTitle","useSelect","select","getCanvasMode","getSettings","unlock","editSiteStore","getSite","getUnstableBase","coreStore","__experimentalDashboardLink","home","title","open","openCommandCenter","useDispatch","commandsStore","disableMotion","useReducedMotion","setCanvasMode","__experimentalSetPreviewDeviceType","setPreviewDeviceType","clearSelectedBlock","blockEditorStore","isBackToDashboardButton","siteIconButtonProps","href","label","__","role","onClick","event","preventDefault","_react","createElement","__unstableMotion","div","classnames","variants","isDistractionFree","x","isDistractionFreeHovering","view","edit","initial","transition","type","duration","ease","__experimentalHStack","justify","alignment","spacing","layout","Button","animate","scale","whileHover","default","__unstableAnimatePresence","opacity","exit","delay","decodeEntities","target","icon","external","search","shortcut","displayShortcut","primary","_default","exports"],"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { memo } from '@wordpress/element';\nimport { search, external } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { displayShortcut } from '@wordpress/keycodes';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../lock-unlock';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = memo( ( { isTransparent, className } ) => {\n\tconst { canvasMode, dashboardLink, homeUrl, siteTitle } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\tconst {\n\t\t\t\tgetSite,\n\t\t\t\tgetUnstableBase, // Site index.\n\t\t\t} = select( coreStore );\n\n\t\t\treturn {\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tdashboardLink:\n\t\t\t\t\tgetSettings().__experimentalDashboardLink || 'index.php',\n\t\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\t\tsiteTitle: getSite()?.title,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tconst disableMotion = useReducedMotion();\n\tconst {\n\t\tsetCanvasMode,\n\t\t__experimentalSetPreviewDeviceType: setPreviewDeviceType,\n\t} = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink,\n\t\t\t\tlabel: __( 'Go to the Dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\thref: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.\n\t\t\t\trole: 'button',\n\t\t\t\tlabel: __( 'Open Navigation' ),\n\t\t\t\tonClick: ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( canvasMode === 'edit' ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetPreviewDeviceType( 'Desktop' );\n\t\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t };\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={ classnames( 'edit-site-site-hub', className ) }\n\t\t\tvariants={ {\n\t\t\t\tisDistractionFree: { x: '-100%' },\n\t\t\t\tisDistractionFreeHovering: { x: 0 },\n\t\t\t\tview: { x: 0 },\n\t\t\t\tedit: { x: 0 },\n\t\t\t} }\n\t\t\tinitial={ false }\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"space-between\"\n\t\t\t\talignment=\"center\"\n\t\t\t\tclassName=\"edit-site-site-hub__container\"\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tjustify=\"flex-start\"\n\t\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\t\tspacing=\"0\"\n\t\t\t\t>\n\t\t\t\t\t<motion.div\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-site-hub__view-mode-toggle-container',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'has-transparent-background': isTransparent,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tlayout\n\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 1,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\twhileHover={ {\n\t\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 0.96,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</motion.div>\n\n\t\t\t\t\t<AnimatePresence>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tlayout={ canvasMode === 'edit' }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: canvasMode === 'view' ? 1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ {\n\t\t\t\t\t\t\t\topacity: 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t\t'edit-site-site-hub__site-title',\n\t\t\t\t\t\t\t\t{ 'is-transparent': isTransparent }\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\tdelay: canvasMode === 'view' ? 0.1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</AnimatePresence>\n\t\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\tlabel={ __( 'View site (opens in a new tab)' ) }\n\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t'View site (opens in a new tab)'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__site-view-link\"\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</HStack>\n\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t\t'edit-site-site-hub_toggle-command-center',\n\t\t\t\t\t\t\t{ 'is-transparent': isTransparent }\n\t\t\t\t\t\t) }\n\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\t\tlabel={ __( 'Open command palette' ) }\n\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,SAAA,GAAAV,OAAA;AACA,IAAAW,SAAA,GAAAX,OAAA;AAKA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,SAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AA9BA;AACA;AACA;;AAGA;AACA;AACA;;AA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gB,EAAE1C;IAAc,CACnC,CAAG;IACHkD,UAAU,EAAG;MACZC,IAAI,EAAE,OAAO;MACbC,QAAQ,EAAE9B,aAAa,GAAG,CAAC,GAAG,GAAG;MACjC+B,IAAI,EAAE,SAAS;MACfc,KAAK,EAAEjE,UAAU,KAAK,MAAM,GAAG,GAAG,GAAG;IACtC;EAAG,GAED,IAAAkE,4BAAc,EAAE/D,SAAU,CACjB,CACI,CAAC,EAChBH,UAAU,KAAK,MAAM,IACtB,IAAAoC,MAAA,CAAAC,aAAA,EAACvD,WAAA,CAAA2E,MAAM;IACN5B,IAAI,EAAG3B,OAAS;IAChBiE,MAAM,EAAC,QAAQ;IACfrC,KAAK,EAAG,IAAAC,QAAE,EAAE,gCAAiC,CAAG;IAChD,cAAa,IAAAA,QAAE,EACd,gCACD,CAAG;IACHqC,IAAI,EAAGC,eAAU;IACjBtE,SAAS,EAAC;EAAoC,CAC9C,CAEK,CAAC,EACPC,UAAU,KAAK,MAAM,IACtB,IAAAoC,MAAA,CAAAC,aAAA,EAACvD,WAAA,CAAA2E,MAAM;IACN1D,SAAS,EAAG,IAAAyC,mBAAU,EACrB,0CAA0C,EAC1C;MAAE,gBAAgB,EAAE1C;IAAc,CACnC,CAAG;IACHsE,IAAI,EAAGE,aAAQ;IACfrC,OAAO,EAAGA,CAAA,KAAMhB,iBAAiB,CAAC,CAAG;IACrCa,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB,CAAG;IACtCwC,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;EAAG,CAC3C,CAEK,CACG,CAAC;AAEf,CAAE,CAAC;AAAC,IAAAC,QAAA,GAEW9E,OAAO;AAAA+E,OAAA,CAAAd,OAAA,GAAAa,QAAA"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
@@ -15,8 +14,6 @@ var _compose = require("@wordpress/compose");
|
|
|
15
14
|
var _preferences = require("@wordpress/preferences");
|
|
16
15
|
var _blocks = require("@wordpress/blocks");
|
|
17
16
|
var _coreData = require("@wordpress/core-data");
|
|
18
|
-
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
19
|
-
var _url = require("@wordpress/url");
|
|
20
17
|
var _store = require("../../store");
|
|
21
18
|
var _constants = require("../../utils/constants");
|
|
22
19
|
/**
|
|
@@ -28,19 +25,18 @@ var _constants = require("../../utils/constants");
|
|
|
28
25
|
*/
|
|
29
26
|
|
|
30
27
|
function useFallbackTemplateContent(slug, isCustom = false) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}, [
|
|
43
|
-
return templateContent;
|
|
28
|
+
return (0, _data.useSelect)(select => {
|
|
29
|
+
const {
|
|
30
|
+
getEntityRecord,
|
|
31
|
+
getDefaultTemplateId
|
|
32
|
+
} = select(_coreData.store);
|
|
33
|
+
const templateId = getDefaultTemplateId({
|
|
34
|
+
slug,
|
|
35
|
+
is_custom: isCustom,
|
|
36
|
+
ignore_empty: true
|
|
37
|
+
});
|
|
38
|
+
return templateId ? getEntityRecord('postType', _constants.TEMPLATE_POST_TYPE, templateId)?.content?.raw : undefined;
|
|
39
|
+
}, [slug, isCustom]);
|
|
44
40
|
}
|
|
45
41
|
function useStartPatterns(fallbackContent) {
|
|
46
42
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_compose","_preferences","_blocks","_coreData","_apiFetch","_interopRequireDefault","_url","_store","_constants","useFallbackTemplateContent","slug","isCustom","templateContent","setTemplateContent","useState","useEffect","apiFetch","path","addQueryArgs","is_custom","ignore_empty","then","content","raw","useStartPatterns","fallbackContent","patterns","useSelect","select","getEditedPostType","getEditedPostId","editSiteStore","getEntityRecord","coreStore","postId","postType","record","getSettings","blockEditorStore","__experimentalBlockPatterns","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","undefined","useMemo","blocks","parse","title","__","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","useEntityBlockEditor","blockPatterns","shownBlockPatterns","useAsyncList","_react","createElement","__experimentalBlockPatternsList","shownPatterns","onClickPattern","selection","StartModal","onClose","Modal","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","Flex","justify","expanded","FlexItem","Button","variant","onClick","START_TEMPLATE_MODAL_STATES","INITIAL","CLOSED","StartTemplateOptions","modalState","setModalState","shouldOpenModal","_postType","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits","TEMPLATE_POST_TYPE","preferencesStore","get"],"sources":["@wordpress/edit-site/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useEffect, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\tconst [ templateContent, setTemplateContent ] = useState( '' );\n\n\tuseEffect( () => {\n\t\tapiFetch( {\n\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} ),\n\t\t} ).then( ( { content } ) => setTemplateContent( content.raw ) );\n\t}, [ isCustom, slug ] );\n\treturn templateContent;\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst postId = getEditedPostId();\n\t\tconst postType = getEditedPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getSettings().__experimentalBlockPatterns,\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen={ true }\n\t\t>\n\t\t\t<div className=\"edit-site-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"edit-site-start-template-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nconst START_TEMPLATE_MODAL_STATES = {\n\tINITIAL: 'INITIAL',\n\tCLOSED: 'CLOSED',\n};\n\nexport default function StartTemplateOptions() {\n\tconst [ modalState, setModalState ] = useState(\n\t\tSTART_TEMPLATE_MODAL_STATES.INITIAL\n\t);\n\tconst { shouldOpenModal, slug, isCustom, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst _postType = getEditedPostType();\n\t\t\tconst postId = getEditedPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType &&\n\t\t\t\t\t! select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t),\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&\n\t\t\t! shouldOpenModal ) ||\n\t\tmodalState === START_TEMPLATE_MODAL_STATES.CLOSED\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () =>\n\t\t\t\tsetModalState( START_TEMPLATE_MODAL_STATES.CLOSED )\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,IAAA,GAAAX,OAAA;AAKA,IAAAY,MAAA,GAAAZ,OAAA;AACA,IAAAa,UAAA,GAAAb,OAAA;AAtBA;AACA;AACA;;AAgBA;AACA;AACA;;AAIA,SAASc,0BAA0BA,CAAEC,IAAI,EAAEC,QAAQ,GAAG,KAAK,EAAG;EAC7D,MAAM,CAAEC,eAAe,EAAEC,kBAAkB,CAAE,GAAG,IAAA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ACpB,MAAMuE,cAAc,GAAGF,qBAAqB,CAC3C,UAAU,EACVD,SAAS,EACTnE,MACD,CAAC;IACD,MAAMuE,QAAQ,GAAGF,uBAAuB,CACvC,UAAU,EACVF,SAAS,EACTnE,MACD,CAAC;IAED,OAAO;MACNkE,eAAe,EACd,CAAEK,QAAQ,IACV,EAAE,KAAKD,cAAc,CAAClF,OAAO,IAC7BoF,6BAAkB,KAAKL,SAAS,IAChC,CAAEzE,MAAM,CAAE+E,kBAAiB,CAAC,CAACC,GAAG,CAC/B,gBAAgB,EAChB,cACD,CAAC;MACFlG,IAAI,EAAE8F,cAAc,CAAC9F,IAAI;MACzBC,QAAQ,EAAE6F,cAAc,CAACrF,SAAS;MAClCgB,QAAQ,EAAEkE;IACX,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,IACGH,UAAU,KAAKJ,2BAA2B,CAACC,OAAO,IACnD,CAAEK,eAAe,IAClBF,UAAU,KAAKJ,2BAA2B,CAACE,MAAM,EAChD;IACD,OAAO,IAAI;EACZ;EAEA,OACC,IAAAvB,MAAA,CAAAC,aAAA,EAACK,UAAU;IACVrE,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBwB,QAAQ,EAAGA,QAAU;IACrB6C,OAAO,EAAGA,CAAA,KACTmB,aAAa,CAAEL,2BAA2B,CAACE,MAAO;EAClD,CACD,CAAC;AAEJ"}
|
|
1
|
+
{"version":3,"names":["_components","require","_i18n","_element","_blockEditor","_data","_compose","_preferences","_blocks","_coreData","_store","_constants","useFallbackTemplateContent","slug","isCustom","useSelect","select","getEntityRecord","getDefaultTemplateId","coreStore","templateId","is_custom","ignore_empty","TEMPLATE_POST_TYPE","content","raw","undefined","useStartPatterns","fallbackContent","patterns","getEditedPostType","getEditedPostId","editSiteStore","postId","postType","record","getSettings","blockEditorStore","__experimentalBlockPatterns","currentThemeStylesheet","getCurrentTheme","stylesheet","injectThemeAttributeInBlockTemplateContent","block","innerBlocks","find","innerBlock","name","map","attributes","theme","useMemo","blocks","parse","title","__","filter","pattern","Array","isArray","templateTypes","some","templateType","startsWith","PatternSelection","onChoosePattern","onChange","useEntityBlockEditor","blockPatterns","shownBlockPatterns","useAsyncList","_react","createElement","__experimentalBlockPatternsList","shownPatterns","onClickPattern","selection","StartModal","onClose","Modal","className","closeLabel","focusOnMount","onRequestClose","isFullScreen","Flex","justify","expanded","FlexItem","Button","variant","onClick","START_TEMPLATE_MODAL_STATES","INITIAL","CLOSED","StartTemplateOptions","modalState","setModalState","useState","shouldOpenModal","_postType","getEditedEntityRecord","hasEditsForEntityRecord","templateRecord","hasEdits","preferencesStore","get"],"sources":["@wordpress/edit-site/src/components/start-template-options/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Modal, Flex, FlexItem, Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo } from '@wordpress/element';\nimport {\n\t__experimentalBlockPatternsList as BlockPatternsList,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\nimport { useAsyncList } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { parse } from '@wordpress/blocks';\nimport { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nfunction useFallbackTemplateContent( slug, isCustom = false ) {\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord, getDefaultTemplateId } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateId = getDefaultTemplateId( {\n\t\t\t\tslug,\n\t\t\t\tis_custom: isCustom,\n\t\t\t\tignore_empty: true,\n\t\t\t} );\n\t\t\treturn templateId\n\t\t\t\t? getEntityRecord( 'postType', TEMPLATE_POST_TYPE, templateId )\n\t\t\t\t\t\t?.content?.raw\n\t\t\t\t: undefined;\n\t\t},\n\t\t[ slug, isCustom ]\n\t);\n}\n\nfunction useStartPatterns( fallbackContent ) {\n\tconst { slug, patterns } = useSelect( ( select ) => {\n\t\tconst { getEditedPostType, getEditedPostId } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst postId = getEditedPostId();\n\t\tconst postType = getEditedPostType();\n\t\tconst record = getEntityRecord( 'postType', postType, postId );\n\t\tconst { getSettings } = select( blockEditorStore );\n\t\treturn {\n\t\t\tslug: record.slug,\n\t\t\tpatterns: getSettings().__experimentalBlockPatterns,\n\t\t};\n\t}, [] );\n\n\tconst currentThemeStylesheet = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme().stylesheet\n\t);\n\n\t// Duplicated from packages/block-library/src/pattern/edit.js.\n\tfunction injectThemeAttributeInBlockTemplateContent( block ) {\n\t\tif (\n\t\t\tblock.innerBlocks.find(\n\t\t\t\t( innerBlock ) => innerBlock.name === 'core/template-part'\n\t\t\t)\n\t\t) {\n\t\t\tblock.innerBlocks = block.innerBlocks.map( ( innerBlock ) => {\n\t\t\t\tif (\n\t\t\t\t\tinnerBlock.name === 'core/template-part' &&\n\t\t\t\t\tinnerBlock.attributes.theme === undefined\n\t\t\t\t) {\n\t\t\t\t\tinnerBlock.attributes.theme = currentThemeStylesheet;\n\t\t\t\t}\n\t\t\t\treturn innerBlock;\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tblock.name === 'core/template-part' &&\n\t\t\tblock.attributes.theme === undefined\n\t\t) {\n\t\t\tblock.attributes.theme = currentThemeStylesheet;\n\t\t}\n\t\treturn block;\n\t}\n\n\treturn useMemo( () => {\n\t\t// filter patterns that are supposed to be used in the current template being edited.\n\t\treturn [\n\t\t\t{\n\t\t\t\tname: 'fallback',\n\t\t\t\tblocks: parse( fallbackContent ),\n\t\t\t\ttitle: __( 'Fallback content' ),\n\t\t\t},\n\t\t\t...patterns\n\t\t\t\t.filter( ( pattern ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tArray.isArray( pattern.templateTypes ) &&\n\t\t\t\t\t\tpattern.templateTypes.some( ( templateType ) =>\n\t\t\t\t\t\t\tslug.startsWith( templateType )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t\t.map( ( pattern ) => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...pattern,\n\t\t\t\t\t\tblocks: parse( pattern.content ).map( ( block ) =>\n\t\t\t\t\t\t\tinjectThemeAttributeInBlockTemplateContent( block )\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t} ),\n\t\t];\n\t}, [ fallbackContent, slug, patterns ] );\n}\n\nfunction PatternSelection( { fallbackContent, onChoosePattern, postType } ) {\n\tconst [ , , onChange ] = useEntityBlockEditor( 'postType', postType );\n\tconst blockPatterns = useStartPatterns( fallbackContent );\n\tconst shownBlockPatterns = useAsyncList( blockPatterns );\n\treturn (\n\t\t<BlockPatternsList\n\t\t\tblockPatterns={ blockPatterns }\n\t\t\tshownPatterns={ shownBlockPatterns }\n\t\t\tonClickPattern={ ( pattern, blocks ) => {\n\t\t\t\tonChange( blocks, { selection: undefined } );\n\t\t\t\tonChoosePattern();\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction StartModal( { slug, isCustom, onClose, postType } ) {\n\tconst fallbackContent = useFallbackTemplateContent( slug, isCustom );\n\tif ( ! fallbackContent ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<Modal\n\t\t\tclassName=\"edit-site-start-template-options__modal\"\n\t\t\ttitle={ __( 'Choose a pattern' ) }\n\t\t\tcloseLabel={ __( 'Cancel' ) }\n\t\t\tfocusOnMount=\"firstElement\"\n\t\t\tonRequestClose={ onClose }\n\t\t\tisFullScreen={ true }\n\t\t>\n\t\t\t<div className=\"edit-site-start-template-options__modal-content\">\n\t\t\t\t<PatternSelection\n\t\t\t\t\tfallbackContent={ fallbackContent }\n\t\t\t\t\tslug={ slug }\n\t\t\t\t\tisCustom={ isCustom }\n\t\t\t\t\tpostType={ postType }\n\t\t\t\t\tonChoosePattern={ () => {\n\t\t\t\t\t\tonClose();\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<Flex\n\t\t\t\tclassName=\"edit-site-start-template-options__modal__actions\"\n\t\t\t\tjustify=\"flex-end\"\n\t\t\t\texpanded={ false }\n\t\t\t>\n\t\t\t\t<FlexItem>\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t{ __( 'Skip' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</FlexItem>\n\t\t\t</Flex>\n\t\t</Modal>\n\t);\n}\n\nconst START_TEMPLATE_MODAL_STATES = {\n\tINITIAL: 'INITIAL',\n\tCLOSED: 'CLOSED',\n};\n\nexport default function StartTemplateOptions() {\n\tconst [ modalState, setModalState ] = useState(\n\t\tSTART_TEMPLATE_MODAL_STATES.INITIAL\n\t);\n\tconst { shouldOpenModal, slug, isCustom, postType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst _postType = getEditedPostType();\n\t\t\tconst postId = getEditedPostId();\n\t\t\tconst { getEditedEntityRecord, hasEditsForEntityRecord } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst templateRecord = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\t\t\tconst hasEdits = hasEditsForEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t_postType,\n\t\t\t\tpostId\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tshouldOpenModal:\n\t\t\t\t\t! hasEdits &&\n\t\t\t\t\t'' === templateRecord.content &&\n\t\t\t\t\tTEMPLATE_POST_TYPE === _postType &&\n\t\t\t\t\t! select( preferencesStore ).get(\n\t\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t\t'welcomeGuide'\n\t\t\t\t\t),\n\t\t\t\tslug: templateRecord.slug,\n\t\t\t\tisCustom: templateRecord.is_custom,\n\t\t\t\tpostType: _postType,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tif (\n\t\t( modalState === START_TEMPLATE_MODAL_STATES.INITIAL &&\n\t\t\t! shouldOpenModal ) ||\n\t\tmodalState === START_TEMPLATE_MODAL_STATES.CLOSED\n\t) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<StartModal\n\t\t\tslug={ slug }\n\t\t\tisCustom={ isCustom }\n\t\t\tpostType={ postType }\n\t\t\tonClose={ () =>\n\t\t\t\tsetModalState( START_TEMPLATE_MODAL_STATES.CLOSED )\n\t\t\t}\n\t\t/>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,UAAA,GAAAV,OAAA;AApBA;AACA;AACA;;AAcA;AACA;AACA;;AAIA,SAASW,0BAA0BA,CAAEC,IAAI,EAAEC,QAAQ,GAAG,KAAK,EAAG;EAC7D,OAAO,IAAAC,eAAS,EACbC,MAAM,IAAM;IACb,MAAM;MAAEC,eAAe;MAAEC;IAAqB,CAAC,GAC9CF,MAAM,CAAEG,eAAU,CAAC;IACpB,MAAMC,UAAU,GAAGF,oBAAoB,CAAE;MACxCL,IAAI;MACJQ,SAAS,EAAEP,QAAQ;MACnBQ,YAAY,EAAE;IACf,CAAE,CAAC;IACH,OAAOF,UAAU,GACdH,eAAe,CAAE,UAAU,EAAEM,6BAAkB,EAAEH,UAAW,CAAC,EAC3DI,OAAO,EAAEC,GAAG,GACdC,S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AAgB,EAChB,cACD,CAAC;MACF7F,IAAI,EAAE0F,cAAc,CAAC1F,IAAI;MACzBC,QAAQ,EAAEyF,cAAc,CAAClF,SAAS;MAClCa,QAAQ,EAAEkE;IACX,CAAC;EACF,CAAC,EACD,EACD,CAAC;EAED,IACGJ,UAAU,KAAKJ,2BAA2B,CAACC,OAAO,IACnD,CAAEM,eAAe,IAClBH,UAAU,KAAKJ,2BAA2B,CAACE,MAAM,EAChD;IACD,OAAO,IAAI;EACZ;EAEA,OACC,IAAAvB,MAAA,CAAAC,aAAA,EAACK,UAAU;IACVhE,IAAI,EAAGA,IAAM;IACbC,QAAQ,EAAGA,QAAU;IACrBoB,QAAQ,EAAGA,QAAU;IACrB4C,OAAO,EAAGA,CAAA,KACTmB,aAAa,CAAEL,2BAA2B,CAACE,MAAO;EAClD,CACD,CAAC;AAEJ"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = useInitEditedEntityFromURL;
|
|
7
|
+
exports.useInitEditedEntity = useInitEditedEntity;
|
|
7
8
|
var _element = require("@wordpress/element");
|
|
8
9
|
var _data = require("@wordpress/data");
|
|
9
10
|
var _coreData = require("@wordpress/core-data");
|
|
@@ -22,13 +23,11 @@ var _constants = require("../../utils/constants");
|
|
|
22
23
|
const {
|
|
23
24
|
useLocation
|
|
24
25
|
} = (0, _lockUnlock.unlock)(_router.privateApis);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
} = {}
|
|
31
|
-
} = useLocation();
|
|
26
|
+
const postTypesWithoutParentTemplate = [_constants.TEMPLATE_POST_TYPE, _constants.TEMPLATE_PART_POST_TYPE, _constants.NAVIGATION_POST_TYPE, _constants.PATTERN_TYPES.user];
|
|
27
|
+
function useResolveEditedEntityAndContext({
|
|
28
|
+
postId,
|
|
29
|
+
postType
|
|
30
|
+
}) {
|
|
32
31
|
const {
|
|
33
32
|
isRequestingSite,
|
|
34
33
|
homepageId,
|
|
@@ -46,52 +45,116 @@ function useInitEditedEntityFromURL() {
|
|
|
46
45
|
url: base?.home
|
|
47
46
|
};
|
|
48
47
|
}, []);
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
case _constants.NAVIGATION_POST_TYPE:
|
|
66
|
-
setNavigationMenu(postId);
|
|
67
|
-
break;
|
|
68
|
-
case _constants.PATTERN_TYPES.user:
|
|
69
|
-
setEditedEntity(postType, postId);
|
|
70
|
-
break;
|
|
71
|
-
default:
|
|
72
|
-
setPage({
|
|
73
|
-
context: {
|
|
74
|
-
postType,
|
|
75
|
-
postId
|
|
76
|
-
}
|
|
77
|
-
});
|
|
48
|
+
const resolvedTemplateId = (0, _data.useSelect)(select => {
|
|
49
|
+
// If we're rendering a post type that doesn't have a template
|
|
50
|
+
// no need to resolve its template.
|
|
51
|
+
if (postTypesWithoutParentTemplate.includes(postType)) {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
const {
|
|
55
|
+
getEditedEntityRecord,
|
|
56
|
+
getEntityRecords,
|
|
57
|
+
getDefaultTemplateId,
|
|
58
|
+
__experimentalGetTemplateForLink
|
|
59
|
+
} = select(_coreData.store);
|
|
60
|
+
function resolveTemplateForPostTypeAndId(postTypeToResolve, postIdToResolve) {
|
|
61
|
+
const editedEntity = getEditedEntityRecord('postType', postTypeToResolve, postIdToResolve);
|
|
62
|
+
if (!editedEntity) {
|
|
63
|
+
return undefined;
|
|
78
64
|
}
|
|
79
|
-
|
|
65
|
+
// First see if the post/page has an assigned template and fetch it.
|
|
66
|
+
const currentTemplateSlug = editedEntity.template;
|
|
67
|
+
if (currentTemplateSlug) {
|
|
68
|
+
const currentTemplate = getEntityRecords('postType', _constants.TEMPLATE_POST_TYPE, {
|
|
69
|
+
per_page: -1
|
|
70
|
+
})?.find(({
|
|
71
|
+
slug
|
|
72
|
+
}) => slug === currentTemplateSlug);
|
|
73
|
+
if (currentTemplate) {
|
|
74
|
+
return currentTemplate.id;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// If no template is assigned, use the default template.
|
|
79
|
+
return getDefaultTemplateId({
|
|
80
|
+
slug: `${postTypeToResolve}-${editedEntity?.slug}`
|
|
81
|
+
});
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
//
|
|
84
|
+
// If we're rendering a specific page, post... we need to resolve its template.
|
|
85
|
+
if (postType && postId) {
|
|
86
|
+
return resolveTemplateForPostTypeAndId(postType, postId);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// If we're rendering the home page, and we have a static home page, resolve its template.
|
|
83
90
|
if (homepageId) {
|
|
84
|
-
|
|
85
|
-
context: {
|
|
86
|
-
postType: 'page',
|
|
87
|
-
postId: homepageId
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
} else if (!isRequestingSite) {
|
|
91
|
-
setPage({
|
|
92
|
-
path: url
|
|
93
|
-
});
|
|
91
|
+
return resolveTemplateForPostTypeAndId('page', homepageId);
|
|
94
92
|
}
|
|
95
|
-
|
|
93
|
+
|
|
94
|
+
// If we're not rendering a specific page, use the front page template.
|
|
95
|
+
if (!isRequestingSite && url) {
|
|
96
|
+
const template = __experimentalGetTemplateForLink(url);
|
|
97
|
+
return template?.id;
|
|
98
|
+
}
|
|
99
|
+
}, [homepageId, isRequestingSite, url, postId, postType]);
|
|
100
|
+
const context = (0, _element.useMemo)(() => {
|
|
101
|
+
if (postTypesWithoutParentTemplate.includes(postType)) {
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
if (postType && postId) {
|
|
105
|
+
return {
|
|
106
|
+
postType,
|
|
107
|
+
postId
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
if (homepageId) {
|
|
111
|
+
return {
|
|
112
|
+
postType: 'page',
|
|
113
|
+
postId: homepageId
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return {};
|
|
117
|
+
}, [homepageId, postType, postId]);
|
|
118
|
+
if (postTypesWithoutParentTemplate.includes(postType)) {
|
|
119
|
+
return {
|
|
120
|
+
isReady: true,
|
|
121
|
+
postType,
|
|
122
|
+
postId,
|
|
123
|
+
context
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (postType && postId || homepageId || !isRequestingSite) {
|
|
127
|
+
return {
|
|
128
|
+
isReady: resolvedTemplateId !== undefined,
|
|
129
|
+
postType: _constants.TEMPLATE_POST_TYPE,
|
|
130
|
+
postId: resolvedTemplateId,
|
|
131
|
+
context
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
return {
|
|
135
|
+
isReady: false
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
function useInitEditedEntity(params) {
|
|
139
|
+
const {
|
|
140
|
+
postType,
|
|
141
|
+
postId,
|
|
142
|
+
context,
|
|
143
|
+
isReady
|
|
144
|
+
} = useResolveEditedEntityAndContext(params);
|
|
145
|
+
const {
|
|
146
|
+
setEditedEntity
|
|
147
|
+
} = (0, _data.useDispatch)(_store.store);
|
|
148
|
+
(0, _element.useEffect)(() => {
|
|
149
|
+
if (isReady) {
|
|
150
|
+
setEditedEntity(postType, postId, context);
|
|
151
|
+
}
|
|
152
|
+
}, [isReady, postType, postId, context, setEditedEntity]);
|
|
153
|
+
}
|
|
154
|
+
function useInitEditedEntityFromURL() {
|
|
155
|
+
const {
|
|
156
|
+
params = {}
|
|
157
|
+
} = useLocation();
|
|
158
|
+
return useInitEditedEntity(params);
|
|
96
159
|
}
|
|
97
160
|
//# sourceMappingURL=use-init-edited-entity-from-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_data","_coreData","_router","_store","_lockUnlock","_constants","useLocation","unlock","routerPrivateApis","
|
|
1
|
+
{"version":3,"names":["_element","require","_data","_coreData","_router","_store","_lockUnlock","_constants","useLocation","unlock","routerPrivateApis","postTypesWithoutParentTemplate","TEMPLATE_POST_TYPE","TEMPLATE_PART_POST_TYPE","NAVIGATION_POST_TYPE","PATTERN_TYPES","user","useResolveEditedEntityAndContext","postId","postType","isRequestingSite","homepageId","url","useSelect","select","getSite","getUnstableBase","coreDataStore","siteData","base","show_on_front","page_on_front","home","resolvedTemplateId","includes","undefined","getEditedEntityRecord","getEntityRecords","getDefaultTemplateId","__experimentalGetTemplateForLink","resolveTemplateForPostTypeAndId","postTypeToResolve","postIdToResolve","editedEntity","currentTemplateSlug","template","currentTemplate","per_page","find","slug","id","context","useMemo","isReady","useInitEditedEntity","params","setEditedEntity","useDispatch","editSiteStore","useEffect","useInitEditedEntityFromURL"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES,\n} from '../../utils/constants';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst postTypesWithoutParentTemplate = [\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n\tPATTERN_TYPES.user,\n];\n\nfunction useResolveEditedEntityAndContext( { postId, postType } ) {\n\tconst { isRequestingSite, homepageId, url } = useSelect( ( select ) => {\n\t\tconst { getSite, getUnstableBase } = select( coreDataStore );\n\t\tconst siteData = getSite();\n\t\tconst base = getUnstableBase();\n\n\t\treturn {\n\t\t\tisRequestingSite: ! base,\n\t\t\thomepageId:\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? siteData.page_on_front\n\t\t\t\t\t: null,\n\t\t\turl: base?.home,\n\t\t};\n\t}, [] );\n\n\tconst resolvedTemplateId = useSelect(\n\t\t( select ) => {\n\t\t\t// If we're rendering a post type that doesn't have a template\n\t\t\t// no need to resolve its template.\n\t\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\tconst {\n\t\t\t\tgetEditedEntityRecord,\n\t\t\t\tgetEntityRecords,\n\t\t\t\tgetDefaultTemplateId,\n\t\t\t\t__experimentalGetTemplateForLink,\n\t\t\t} = select( coreDataStore );\n\n\t\t\tfunction resolveTemplateForPostTypeAndId(\n\t\t\t\tpostTypeToResolve,\n\t\t\t\tpostIdToResolve\n\t\t\t) {\n\t\t\t\tconst editedEntity = getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostTypeToResolve,\n\t\t\t\t\tpostIdToResolve\n\t\t\t\t);\n\t\t\t\tif ( ! editedEntity ) {\n\t\t\t\t\treturn undefined;\n\t\t\t\t}\n\t\t\t\t// First see if the post/page has an assigned template and fetch it.\n\t\t\t\tconst currentTemplateSlug = editedEntity.template;\n\t\t\t\tif ( currentTemplateSlug ) {\n\t\t\t\t\tconst currentTemplate = getEntityRecords(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\t}\n\t\t\t\t\t)?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\t\t\tif ( currentTemplate ) {\n\t\t\t\t\t\treturn currentTemplate.id;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// If no template is assigned, use the default template.\n\t\t\t\treturn getDefaultTemplateId( {\n\t\t\t\t\tslug: `${ postTypeToResolve }-${ editedEntity?.slug }`,\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\t// If we're rendering a specific page, post... we need to resolve its template.\n\t\t\tif ( postType && postId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( postType, postId );\n\t\t\t}\n\n\t\t\t// If we're rendering the home page, and we have a static home page, resolve its template.\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn resolveTemplateForPostTypeAndId( 'page', homepageId );\n\t\t\t}\n\n\t\t\t// If we're not rendering a specific page, use the front page template.\n\t\t\tif ( ! isRequestingSite && url ) {\n\t\t\t\tconst template = __experimentalGetTemplateForLink( url );\n\t\t\t\treturn template?.id;\n\t\t\t}\n\t\t},\n\t\t[ homepageId, isRequestingSite, url, postId, postType ]\n\t);\n\n\tconst context = useMemo( () => {\n\t\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif ( postType && postId ) {\n\t\t\treturn { postType, postId };\n\t\t}\n\n\t\tif ( homepageId ) {\n\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t}\n\n\t\treturn {};\n\t}, [ homepageId, postType, postId ] );\n\n\tif ( postTypesWithoutParentTemplate.includes( postType ) ) {\n\t\treturn { isReady: true, postType, postId, context };\n\t}\n\n\tif ( ( postType && postId ) || homepageId || ! isRequestingSite ) {\n\t\treturn {\n\t\t\tisReady: resolvedTemplateId !== undefined,\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tpostId: resolvedTemplateId,\n\t\t\tcontext,\n\t\t};\n\t}\n\n\treturn { isReady: false };\n}\n\nexport function useInitEditedEntity( params ) {\n\tconst { postType, postId, context, isReady } =\n\t\tuseResolveEditedEntityAndContext( params );\n\n\tconst { setEditedEntity } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( isReady ) {\n\t\t\tsetEditedEntity( postType, postId, context );\n\t\t}\n\t}, [ isReady, postType, postId, context, setEditedEntity ] );\n}\n\nexport default function useInitEditedEntityFromURL() {\n\tconst { params = {} } = useLocation();\n\treturn useInitEditedEntity( params );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAMA;AACA;AACA;;AAUA,MAAM;EAAEO;AAAY,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAEnD,MAAMC,8BAA8B,GAAG,CACtCC,6BAAkB,EAClBC,kCAAuB,EACvBC,+BAAoB,EACpBC,wBAAa,CAACC,IAAI,CAClB;AAED,SAASC,gCAAgCA,CAAE;EAAEC,MAAM;EAAEC;AAAS,CAAC,EAAG;EACjE,MAAM;IAAEC,gBAAgB;IAAEC,UAAU;IAAEC;EAAI,CAAC,GAAG,IAAAC,eAAS,EAAIC,MAAM,IAAM;IACtE,MAAM;MAAEC,OAAO;MAAEC;IAAgB,CAAC,GAAGF,MAAM,CAAEG,eAAc,CAAC;IAC5D,MAAMC,QAAQ,GAAGH,OAAO,CAAC,CAAC;IAC1B,MAAMI,IAAI,GAAGH,eAAe,CAAC,CAAC;IAE9B,OAAO;MACNN,gBAAgB,EAAE,CAAES,IAAI;MACxBR,UAAU,EACTO,QAAQ,EAAEE,aAAa,KAAK,MAAM,GAC/BF,QAAQ,CAACG,aAAa,GACtB,IAAI;MACRT,GAAG,EAAEO,IAAI,EAAEG;IACZ,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,MAAMC,kBAAkB,GAAG,IAAAV,eAAS,EACjCC,MAAM,IAAM;IACb;IACA;IACA,IAAKb,8BAA8B,CAACuB,QAAQ,CAAEf,QAAS,CAAC,EAAG;MAC1D,O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AAElC,QAAQ,EAAED,MAAM,EAAEiC,OAAO,EAAEK,eAAe,CAAG,CAAC;AAC7D;AAEe,SAASI,0BAA0BA,CAAA,EAAG;EACpD,MAAM;IAAEL,MAAM,GAAG,CAAC;EAAE,CAAC,GAAG/C,WAAW,CAAC,CAAC;EACrC,OAAO8C,mBAAmB,CAAEC,MAAO,CAAC;AACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_blockEditor","_components","_i18n","ConvertToRegularBlocks","clientId","onClose","getBlocks","useSelect","blockEditorStore","replaceBlocks","useDispatch","canRemove","select","canRemoveBlock","_react","createElement","MenuItem","onClick","__"],"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-regular.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function ConvertToRegularBlocks( { clientId, onClose } ) {\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst canRemove = useSelect(\n\t\t( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tif ( ! canRemove ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\treplaceBlocks( clientId, getBlocks( clientId ) );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Detach
|
|
1
|
+
{"version":3,"names":["_data","require","_blockEditor","_components","_i18n","ConvertToRegularBlocks","clientId","onClose","getBlocks","useSelect","blockEditorStore","replaceBlocks","useDispatch","canRemove","select","canRemoveBlock","_react","createElement","MenuItem","onClick","__"],"sources":["@wordpress/edit-site/src/components/template-part-converter/convert-to-regular.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function ConvertToRegularBlocks( { clientId, onClose } ) {\n\tconst { getBlocks } = useSelect( blockEditorStore );\n\tconst { replaceBlocks } = useDispatch( blockEditorStore );\n\n\tconst canRemove = useSelect(\n\t\t( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\tif ( ! canRemove ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\treplaceBlocks( clientId, getBlocks( clientId ) );\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t>\n\t\t\t{ __( 'Detach' ) }\n\t\t</MenuItem>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AANA;AACA;AACA;;AAMe,SAASI,sBAAsBA,CAAE;EAAEC,QAAQ;EAAEC;AAAQ,CAAC,EAAG;EACvE,MAAM;IAAEC;EAAU,CAAC,GAAG,IAAAC,eAAS,EAAEC,kBAAiB,CAAC;EACnD,MAAM;IAAEC;EAAc,CAAC,GAAG,IAAAC,iBAAW,EAAEF,kBAAiB,CAAC;EAEzD,MAAMG,SAAS,GAAG,IAAAJ,eAAS,EACxBK,MAAM,IAAMA,MAAM,CAAEJ,kBAAiB,CAAC,CAACK,cAAc,CAAET,QAAS,CAAC,EACnE,CAAEA,QAAQ,CACX,CAAC;EAED,IAAK,CAAEO,SAAS,EAAG;IAClB,OAAO,IAAI;EACZ;EAEA,OACC,IAAAG,MAAA,CAAAC,aAAA,EAACd,WAAA,CAAAe,QAAQ;IACRC,OAAO,EAAGA,CAAA,KAAM;MACfR,aAAa,CAAEL,QAAQ,EAAEE,SAAS,CAAEF,QAAS,CAAE,CAAC;MAChDC,OAAO,CAAC,CAAC;IACV;EAAG,GAED,IAAAa,QAAE,EAAE,QAAS,CACN,CAAC;AAEb"}
|