@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
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useMemo } from '@wordpress/element';
|
|
5
|
-
import { createBlock } from '@wordpress/blocks';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { PAGE_CONTENT_BLOCK_TYPES } from '../../../utils/constants';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Helper method to iterate through all blocks, recursing into allowed inner blocks.
|
|
14
|
-
* Returns a flattened object of transformed blocks.
|
|
15
|
-
*
|
|
16
|
-
* @param {Array} blocks Blocks to flatten.
|
|
17
|
-
* @param {Function} transform Transforming function to be applied to each block. If transform returns `undefined`, the block is skipped.
|
|
18
|
-
*
|
|
19
|
-
* @return {Array} Flattened object.
|
|
20
|
-
*/
|
|
21
|
-
function flattenBlocks( blocks, transform ) {
|
|
22
|
-
const result = [];
|
|
23
|
-
for ( let i = 0; i < blocks.length; i++ ) {
|
|
24
|
-
// Since the Query Block could contain PAGE_CONTENT_BLOCK_TYPES block types,
|
|
25
|
-
// we skip it because we only want to render stand-alone page content blocks in the block list.
|
|
26
|
-
if ( [ 'core/query' ].includes( blocks[ i ].name ) ) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const transformedBlock = transform( blocks[ i ] );
|
|
30
|
-
if ( transformedBlock ) {
|
|
31
|
-
result.push( transformedBlock );
|
|
32
|
-
}
|
|
33
|
-
result.push( ...flattenBlocks( blocks[ i ].innerBlocks, transform ) );
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Returns a memoized array of blocks that contain only page content blocks,
|
|
41
|
-
* surrounded by an optional group block to mimic the post editor.
|
|
42
|
-
*
|
|
43
|
-
* @param {Object} props The argument for the function.
|
|
44
|
-
* @param {Array} props.blocks Block list.
|
|
45
|
-
* @param {boolean} props.isPageContentFocused Whether the page content has focus (and the surrounding template is inert). If `true` return page content blocks. Default `false`.
|
|
46
|
-
* @param {boolean} props.wrapPageContent Whether to wrap the page content blocks in a group block to mimic the post editor. Default `false`.
|
|
47
|
-
* @return {Array} Page content blocks.
|
|
48
|
-
*/
|
|
49
|
-
export default function usePageContentBlocks( {
|
|
50
|
-
blocks = [],
|
|
51
|
-
isPageContentFocused = false,
|
|
52
|
-
wrapPageContent = false,
|
|
53
|
-
} ) {
|
|
54
|
-
return useMemo( () => {
|
|
55
|
-
if ( ! isPageContentFocused || ! blocks?.length ) {
|
|
56
|
-
return [];
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const innerBlocks = flattenBlocks( blocks, ( block ) =>
|
|
60
|
-
PAGE_CONTENT_BLOCK_TYPES[ block.name ]
|
|
61
|
-
? createBlock( block.name )
|
|
62
|
-
: undefined
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
if ( ! innerBlocks.length ) {
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if ( ! wrapPageContent ) {
|
|
70
|
-
return innerBlocks;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return [
|
|
74
|
-
createBlock(
|
|
75
|
-
'core/group',
|
|
76
|
-
{
|
|
77
|
-
layout: { type: 'constrained' },
|
|
78
|
-
style: {
|
|
79
|
-
spacing: {
|
|
80
|
-
margin: {
|
|
81
|
-
top: '4em', // Mimics the post editor.
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
innerBlocks
|
|
87
|
-
),
|
|
88
|
-
];
|
|
89
|
-
}, [ blocks, isPageContentFocused ] );
|
|
90
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { BlockInspector } from '@wordpress/block-editor';
|
|
5
|
-
import { privateApis as editPatternsPrivateApis } from '@wordpress/patterns';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import TemplatePartConverter from '../template-part-converter';
|
|
11
|
-
import { SidebarInspectorFill } from '../sidebar-edit-mode';
|
|
12
|
-
import SiteEditorCanvas from './site-editor-canvas';
|
|
13
|
-
import BlockEditorProvider from './block-editor-provider';
|
|
14
|
-
|
|
15
|
-
import { unlock } from '../../lock-unlock';
|
|
16
|
-
const { PatternsMenuItems } = unlock( editPatternsPrivateApis );
|
|
17
|
-
export default function BlockEditor() {
|
|
18
|
-
return (
|
|
19
|
-
<BlockEditorProvider>
|
|
20
|
-
<TemplatePartConverter />
|
|
21
|
-
<SidebarInspectorFill>
|
|
22
|
-
<BlockInspector />
|
|
23
|
-
</SidebarInspectorFill>
|
|
24
|
-
<SiteEditorCanvas />
|
|
25
|
-
<PatternsMenuItems />
|
|
26
|
-
</BlockEditorProvider>
|
|
27
|
-
);
|
|
28
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { trash } from '@wordpress/icons';
|
|
6
|
-
|
|
7
|
-
// DEFAULT_STATUSES is intentionally sorted. Items do not have spaces in between them.
|
|
8
|
-
// The reason for that is to match the default statuses coming from the endpoint
|
|
9
|
-
// (entity request and useEffect to update the view).
|
|
10
|
-
export const DEFAULT_STATUSES = 'draft,future,pending,private,publish'; // All statuses but 'trash'.
|
|
11
|
-
|
|
12
|
-
const DEFAULT_PAGE_BASE = {
|
|
13
|
-
type: 'list',
|
|
14
|
-
search: '',
|
|
15
|
-
filters: {
|
|
16
|
-
status: DEFAULT_STATUSES,
|
|
17
|
-
},
|
|
18
|
-
page: 1,
|
|
19
|
-
perPage: 5,
|
|
20
|
-
sort: {
|
|
21
|
-
field: 'date',
|
|
22
|
-
direction: 'desc',
|
|
23
|
-
},
|
|
24
|
-
visibleFilters: [ 'author', 'status' ],
|
|
25
|
-
// All fields are visible by default, so it's
|
|
26
|
-
// better to keep track of the hidden ones.
|
|
27
|
-
hiddenFields: [ 'date', 'featured-image' ],
|
|
28
|
-
layout: {},
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const DEFAULT_VIEWS = [
|
|
32
|
-
{
|
|
33
|
-
title: __( 'All' ),
|
|
34
|
-
slug: 'all',
|
|
35
|
-
view: DEFAULT_PAGE_BASE,
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
title: __( 'Drafts' ),
|
|
39
|
-
slug: 'drafts',
|
|
40
|
-
view: {
|
|
41
|
-
...DEFAULT_PAGE_BASE,
|
|
42
|
-
filters: {
|
|
43
|
-
status: 'draft',
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
title: __( 'Trash' ),
|
|
49
|
-
slug: 'trash',
|
|
50
|
-
icon: trash,
|
|
51
|
-
view: {
|
|
52
|
-
...DEFAULT_PAGE_BASE,
|
|
53
|
-
filters: {
|
|
54
|
-
status: 'trash',
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
];
|
|
59
|
-
|
|
60
|
-
export default DEFAULT_VIEWS;
|