@wordpress/edit-site 5.23.0 → 5.24.1
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 +56 -38
- package/build/components/actions/index.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +7 -2
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/dataviews/add-filter.js +21 -20
- package/build/components/dataviews/add-filter.js.map +1 -1
- package/build/components/dataviews/constants.js +14 -0
- package/build/components/dataviews/constants.js.map +1 -0
- package/build/components/dataviews/dataviews.js +9 -7
- package/build/components/dataviews/dataviews.js.map +1 -1
- package/build/components/dataviews/filter-summary.js +62 -0
- package/build/components/dataviews/filter-summary.js.map +1 -0
- package/build/components/dataviews/filters.js +15 -30
- package/build/components/dataviews/filters.js.map +1 -1
- package/build/components/dataviews/item-actions.js +84 -30
- package/build/components/dataviews/item-actions.js.map +1 -1
- package/build/components/dataviews/pagination.js +4 -0
- package/build/components/dataviews/pagination.js.map +1 -1
- package/build/components/dataviews/view-actions.js +24 -24
- package/build/components/dataviews/view-actions.js.map +1 -1
- package/build/components/dataviews/view-grid.js +48 -25
- package/build/components/dataviews/view-grid.js.map +1 -1
- package/build/components/dataviews/view-list.js +28 -33
- package/build/components/dataviews/view-list.js.map +1 -1
- package/build/components/editor/index.js +23 -27
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +15 -2
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/header.js +4 -2
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +22 -16
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +26 -5
- package/build/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +52 -24
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +9 -3
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build/components/global-styles/ui.js +28 -36
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +21 -16
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +2 -1
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +1 -1
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/list/added-by.js +43 -54
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +9 -8
- package/build/components/page-content-focus-notifications/back-to-page-notification.js.map +1 -0
- package/build/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/build/components/page-content-focus-notifications/edit-template-notification.js.map +1 -0
- package/build/components/page-content-focus-notifications/index.js +22 -0
- package/build/components/page-content-focus-notifications/index.js.map +1 -0
- package/build/components/page-pages/index.js +9 -15
- package/build/components/page-pages/index.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 +166 -51
- package/build/components/page-templates/dataviews-templates.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/save-button/index.js +9 -6
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +14 -0
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js +3 -1
- package/build/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +7 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +6 -5
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js +15 -26
- package/build/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/hooks.js +22 -8
- package/build/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-status.js +8 -5
- package/build/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build/components/sidebar-edit-mode/page-panels/page-summary.js +4 -8
- 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 +2 -2
- package/build/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +10 -6
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/index.js +23 -4
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build/components/style-book/index.js +22 -12
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +41 -9
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/welcome-guide/page.js +2 -2
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +6 -3
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +24 -14
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/store/actions.js +4 -1
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +2 -27
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +0 -23
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +1 -40
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +8 -4
- package/build/store/selectors.js.map +1 -1
- package/build/utils/constants.js +1 -12
- package/build/utils/constants.js.map +1 -1
- package/build-module/components/actions/index.js +55 -36
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +7 -2
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/dataviews/add-filter.js +21 -20
- package/build-module/components/dataviews/add-filter.js.map +1 -1
- package/build-module/components/dataviews/constants.js +6 -0
- package/build-module/components/dataviews/constants.js.map +1 -0
- package/build-module/components/dataviews/dataviews.js +9 -7
- package/build-module/components/dataviews/dataviews.js.map +1 -1
- package/build-module/components/dataviews/filter-summary.js +55 -0
- package/build-module/components/dataviews/filter-summary.js.map +1 -0
- package/build-module/components/dataviews/filters.js +15 -28
- package/build-module/components/dataviews/filters.js.map +1 -1
- package/build-module/components/dataviews/item-actions.js +84 -30
- package/build-module/components/dataviews/item-actions.js.map +1 -1
- package/build-module/components/dataviews/pagination.js +4 -0
- package/build-module/components/dataviews/pagination.js.map +1 -1
- package/build-module/components/dataviews/view-actions.js +24 -24
- package/build-module/components/dataviews/view-actions.js.map +1 -1
- package/build-module/components/dataviews/view-grid.js +49 -26
- package/build-module/components/dataviews/view-grid.js.map +1 -1
- package/build-module/components/dataviews/view-list.js +28 -33
- package/build-module/components/dataviews/view-list.js.map +1 -1
- package/build-module/components/editor/index.js +26 -30
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +14 -2
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/header.js +4 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +23 -17
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +27 -6
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +51 -24
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +9 -3
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -1
- package/build-module/components/global-styles/ui.js +28 -36
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +21 -16
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +2 -1
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/list/added-by.js +44 -55
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +9 -8
- package/build-module/components/page-content-focus-notifications/back-to-page-notification.js.map +1 -0
- package/build-module/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/build-module/components/page-content-focus-notifications/edit-template-notification.js.map +1 -0
- package/build-module/components/page-content-focus-notifications/index.js +14 -0
- package/build-module/components/page-content-focus-notifications/index.js.map +1 -0
- package/build-module/components/page-pages/index.js +10 -16
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +1 -1
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates/dataviews-templates.js +168 -53
- package/build-module/components/page-templates/dataviews-templates.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/save-button/index.js +11 -8
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +14 -0
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js +3 -1
- package/build-module/components/sidebar-dataviews/custom-dataviews-list.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +7 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +6 -5
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js +16 -27
- package/build-module/components/sidebar-edit-mode/page-panels/edit-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js +21 -7
- package/build-module/components/sidebar-edit-mode/page-panels/hooks.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js +9 -6
- package/build-module/components/sidebar-edit-mode/page-panels/page-status.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/page-panels/page-summary.js +5 -9
- 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 +3 -3
- package/build-module/components/sidebar-edit-mode/page-panels/reset-default-template.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +10 -6
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/index.js +23 -4
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -1
- package/build-module/components/style-book/index.js +22 -12
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +41 -9
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +2 -2
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +6 -3
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +24 -14
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/store/actions.js +4 -1
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +1 -25
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +0 -22
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +1 -38
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +8 -4
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/constants.js +0 -10
- package/build-module/utils/constants.js.map +1 -1
- package/build-style/style-rtl.css +152 -62
- package/build-style/style.css +152 -62
- package/package.json +41 -41
- package/src/components/actions/index.js +76 -48
- package/src/components/block-editor/site-editor-canvas.js +8 -2
- package/src/components/dataviews/README.md +14 -11
- package/src/components/dataviews/add-filter.js +21 -24
- package/src/components/dataviews/constants.js +5 -0
- package/src/components/dataviews/dataviews.js +10 -10
- package/src/components/dataviews/filter-summary.js +79 -0
- package/src/components/dataviews/filters.js +18 -35
- package/src/components/dataviews/item-actions.js +106 -42
- package/src/components/dataviews/pagination.js +4 -0
- package/src/components/dataviews/style.scss +84 -8
- package/src/components/dataviews/view-actions.js +39 -41
- package/src/components/dataviews/view-grid.js +63 -38
- package/src/components/dataviews/view-list.js +50 -57
- package/src/components/editor/index.js +18 -34
- package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +1 -1
- package/src/components/global-styles/font-library-modal/utils/index.js +20 -9
- package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +46 -15
- package/src/components/global-styles/font-library-modal/utils/test/wpKebabCase.spec.js +28 -0
- package/src/components/global-styles/header.js +2 -1
- package/src/components/global-styles/screen-block-list.js +37 -26
- package/src/components/global-styles/screen-revisions/index.js +39 -10
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +65 -45
- package/src/components/global-styles/screen-revisions/style.scss +52 -28
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +15 -6
- package/src/components/global-styles/style.scss +0 -11
- package/src/components/global-styles/ui.js +59 -74
- package/src/components/header-edit-mode/document-actions/index.js +20 -18
- package/src/components/header-edit-mode/index.js +1 -0
- package/src/components/header-edit-mode/more-menu/index.js +1 -1
- package/src/components/list/added-by.js +23 -63
- package/src/components/list/style.scss +11 -13
- package/src/components/{page-content-focus-manager → page-content-focus-notifications}/back-to-page-notification.js +12 -13
- package/src/components/{page-content-focus-manager → page-content-focus-notifications}/edit-template-notification.js +9 -13
- package/src/components/page-content-focus-notifications/index.js +14 -0
- package/src/components/page-pages/index.js +15 -20
- package/src/components/page-patterns/use-patterns.js +1 -1
- package/src/components/page-templates/dataviews-templates.js +169 -48
- package/src/components/page-templates/style.scss +13 -0
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/save-button/index.js +37 -24
- package/src/components/save-hub/index.js +15 -0
- package/src/components/save-hub/style.scss +7 -0
- package/src/components/sidebar-dataviews/custom-dataviews-list.js +2 -0
- package/src/components/sidebar-dataviews/default-views.js +7 -2
- package/src/components/sidebar-dataviews/style.scss +7 -0
- package/src/components/sidebar-edit-mode/index.js +13 -9
- package/src/components/sidebar-edit-mode/page-panels/edit-template.js +33 -52
- package/src/components/sidebar-edit-mode/page-panels/hooks.js +20 -9
- package/src/components/sidebar-edit-mode/page-panels/page-status.js +6 -6
- package/src/components/sidebar-edit-mode/page-panels/page-summary.js +8 -9
- package/src/components/sidebar-edit-mode/page-panels/reset-default-template.js +3 -3
- package/src/components/sidebar-edit-mode/page-panels/style.scss +9 -19
- package/src/components/sidebar-edit-mode/settings-header/index.js +8 -9
- package/src/components/sidebar-navigation-screen/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-page/index.js +24 -3
- package/src/components/sidebar-navigation-screen-template/style.scss +6 -1
- package/src/components/style-book/index.js +48 -35
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +69 -17
- package/src/components/welcome-guide/page.js +2 -2
- package/src/components/welcome-guide/template.js +4 -2
- package/src/hooks/commands/use-edit-mode-commands.js +22 -16
- package/src/store/actions.js +5 -1
- package/src/store/private-actions.js +1 -24
- package/src/store/private-selectors.js +0 -22
- package/src/store/reducer.js +0 -39
- package/src/store/selectors.js +12 -4
- package/src/store/test/actions.js +3 -32
- package/src/store/test/reducer.js +0 -62
- package/src/store/test/selectors.js +0 -35
- package/src/style.scss +1 -0
- package/src/utils/constants.js +0 -10
- package/build/components/dataviews/in-filter.js +0 -51
- package/build/components/dataviews/in-filter.js.map +0 -1
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +0 -1
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -63
- package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +0 -1
- package/build/components/page-content-focus-manager/edit-template-notification.js.map +0 -1
- package/build/components/page-content-focus-manager/index.js +0 -61
- package/build/components/page-content-focus-manager/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js +0 -87
- package/build/components/sidebar-edit-mode/page-panels/publish-date.js.map +0 -1
- package/build-module/components/dataviews/in-filter.js +0 -42
- package/build-module/components/dataviews/in-filter.js.map +0 -1
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +0 -1
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -56
- package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +0 -1
- package/build-module/components/page-content-focus-manager/edit-template-notification.js.map +0 -1
- package/build-module/components/page-content-focus-manager/index.js +0 -52
- package/build-module/components/page-content-focus-manager/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js +0 -80
- package/build-module/components/sidebar-edit-mode/page-panels/publish-date.js.map +0 -1
- package/src/components/dataviews/in-filter.js +0 -63
- package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +0 -57
- package/src/components/page-content-focus-manager/index.js +0 -51
- package/src/components/sidebar-edit-mode/page-panels/publish-date.js +0 -94
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { createElement, Fragment } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { useEffect } from '@wordpress/element';
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
|
-
import { store as editSiteStore } from '../../store';
|
|
11
|
-
import DisableNonPageContentBlocks from './disable-non-page-content-blocks';
|
|
12
|
-
import EditTemplateNotification from './edit-template-notification';
|
|
13
|
-
import BackToPageNotification from './back-to-page-notification';
|
|
14
|
-
import { unlock } from '../../lock-unlock';
|
|
15
|
-
export default function PageContentFocusManager({
|
|
16
|
-
contentRef
|
|
17
|
-
}) {
|
|
18
|
-
const {
|
|
19
|
-
hasPageContentFocus,
|
|
20
|
-
pageContentFocusType,
|
|
21
|
-
canvasMode
|
|
22
|
-
} = useSelect(select => {
|
|
23
|
-
const {
|
|
24
|
-
getPageContentFocusType,
|
|
25
|
-
getCanvasMode
|
|
26
|
-
} = unlock(select(editSiteStore));
|
|
27
|
-
const _canvasMode = getCanvasMode();
|
|
28
|
-
return {
|
|
29
|
-
canvasMode: _canvasMode,
|
|
30
|
-
pageContentFocusType: getPageContentFocusType(),
|
|
31
|
-
hasPageContentFocus: select(editSiteStore).hasPageContentFocus()
|
|
32
|
-
};
|
|
33
|
-
}, []);
|
|
34
|
-
const {
|
|
35
|
-
setPageContentFocusType
|
|
36
|
-
} = unlock(useDispatch(editSiteStore));
|
|
37
|
-
|
|
38
|
-
/*
|
|
39
|
-
* Ensure that the page content focus type is set to `disableTemplate` when
|
|
40
|
-
* the canvas mode is not `edit`. This makes the experience consistent with
|
|
41
|
-
* refreshing the page, which resets the page content focus type.
|
|
42
|
-
*/
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (canvasMode !== 'edit' && !!pageContentFocusType) {
|
|
45
|
-
setPageContentFocusType(null);
|
|
46
|
-
}
|
|
47
|
-
}, [canvasMode, pageContentFocusType]);
|
|
48
|
-
return createElement(Fragment, null, hasPageContentFocus && createElement(DisableNonPageContentBlocks, null), createElement(EditTemplateNotification, {
|
|
49
|
-
contentRef: contentRef
|
|
50
|
-
}), createElement(BackToPageNotification, null));
|
|
51
|
-
}
|
|
52
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","useEffect","store","editSiteStore","DisableNonPageContentBlocks","EditTemplateNotification","BackToPageNotification","unlock","PageContentFocusManager","contentRef","hasPageContentFocus","pageContentFocusType","canvasMode","select","getPageContentFocusType","getCanvasMode","_canvasMode","setPageContentFocusType","createElement","Fragment"],"sources":["@wordpress/edit-site/src/components/page-content-focus-manager/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { useEffect } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport DisableNonPageContentBlocks from './disable-non-page-content-blocks';\nimport EditTemplateNotification from './edit-template-notification';\nimport BackToPageNotification from './back-to-page-notification';\nimport { unlock } from '../../lock-unlock';\n\nexport default function PageContentFocusManager( { contentRef } ) {\n\tconst { hasPageContentFocus, pageContentFocusType, canvasMode } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPageContentFocusType, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst _canvasMode = getCanvasMode();\n\t\t\treturn {\n\t\t\t\tcanvasMode: _canvasMode,\n\t\t\t\tpageContentFocusType: getPageContentFocusType(),\n\t\t\t\thasPageContentFocus:\n\t\t\t\t\tselect( editSiteStore ).hasPageContentFocus(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { setPageContentFocusType } = unlock( useDispatch( editSiteStore ) );\n\n\t/*\n\t * Ensure that the page content focus type is set to `disableTemplate` when\n\t * the canvas mode is not `edit`. This makes the experience consistent with\n\t * refreshing the page, which resets the page content focus type.\n\t */\n\tuseEffect( () => {\n\t\tif ( canvasMode !== 'edit' && !! pageContentFocusType ) {\n\t\t\tsetPageContentFocusType( null );\n\t\t}\n\t}, [ canvasMode, pageContentFocusType ] );\n\n\treturn (\n\t\t<>\n\t\t\t{ hasPageContentFocus && <DisableNonPageContentBlocks /> }\n\t\t\t<EditTemplateNotification contentRef={ contentRef } />\n\t\t\t<BackToPageNotification />\n\t\t</>\n\t);\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,oBAAoB;AAC9C;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,OAAOC,2BAA2B,MAAM,mCAAmC;AAC3E,OAAOC,wBAAwB,MAAM,8BAA8B;AACnE,OAAOC,sBAAsB,MAAM,6BAA6B;AAChE,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,eAAe,SAASC,uBAAuBA,CAAE;EAAEC;AAAW,CAAC,EAAG;EACjE,MAAM;IAAEC,mBAAmB;IAAEC,oBAAoB;IAAEC;EAAW,CAAC,GAAGb,SAAS,CACxEc,MAAM,IAAM;IACb,MAAM;MAAEC,uBAAuB;MAAEC;IAAc,CAAC,GAAGR,MAAM,CACxDM,MAAM,CAAEV,aAAc,CACvB,CAAC;IACD,MAAMa,WAAW,GAAGD,aAAa,CAAC,CAAC;IACnC,OAAO;MACNH,UAAU,EAAEI,WAAW;MACvBL,oBAAoB,EAAEG,uBAAuB,CAAC,CAAC;MAC/CJ,mBAAmB,EAClBG,MAAM,CAAEV,aAAc,CAAC,CAACO,mBAAmB,CAAC;IAC9C,CAAC;EACF,CAAC,EACD,EACD,CAAC;EACD,MAAM;IAAEO;EAAwB,CAAC,GAAGV,MAAM,CAAEP,WAAW,CAAEG,aAAc,CAAE,CAAC;;EAE1E;AACD;AACA;AACA;AACA;EACCF,SAAS,CAAE,MAAM;IAChB,IAAKW,UAAU,KAAK,MAAM,IAAI,CAAC,CAAED,oBAAoB,EAAG;MACvDM,uBAAuB,CAAE,IAAK,CAAC;IAChC;EACD,CAAC,EAAE,CAAEL,UAAU,EAAED,oBAAoB,CAAG,CAAC;EAEzC,OACCO,aAAA,CAAAC,QAAA,QACGT,mBAAmB,IAAIQ,aAAA,CAACd,2BAA2B,MAAE,CAAC,EACxDc,aAAA,CAACb,wBAAwB;IAACI,UAAU,EAAGA;EAAY,CAAE,CAAC,EACtDS,aAAA,CAACZ,sBAAsB,MAAE,CACxB,CAAC;AAEL"}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* WordPress dependencies
|
|
4
|
-
*/
|
|
5
|
-
import { Button, Dropdown, __experimentalText as Text, __experimentalHStack as HStack } from '@wordpress/components';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { useDispatch } from '@wordpress/data';
|
|
8
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
9
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
11
|
-
import { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';
|
|
12
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
13
|
-
export default function ChangeStatus({
|
|
14
|
-
postType,
|
|
15
|
-
postId,
|
|
16
|
-
status,
|
|
17
|
-
date
|
|
18
|
-
}) {
|
|
19
|
-
const {
|
|
20
|
-
editEntityRecord
|
|
21
|
-
} = useDispatch(coreStore);
|
|
22
|
-
const {
|
|
23
|
-
createErrorNotice
|
|
24
|
-
} = useDispatch(noticesStore);
|
|
25
|
-
const [popoverAnchor, setPopoverAnchor] = useState(null);
|
|
26
|
-
// Memoize popoverProps to avoid returning a new object every time.
|
|
27
|
-
const popoverProps = useMemo(() => ({
|
|
28
|
-
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
29
|
-
// move around when the label changes.
|
|
30
|
-
anchor: popoverAnchor,
|
|
31
|
-
'aria-label': __('Change publish date'),
|
|
32
|
-
placement: 'bottom-end'
|
|
33
|
-
}), [popoverAnchor]);
|
|
34
|
-
const saveDate = async newDate => {
|
|
35
|
-
try {
|
|
36
|
-
let newStatus = status;
|
|
37
|
-
if (status === 'future' && new Date(newDate) < new Date()) {
|
|
38
|
-
newStatus = 'publish';
|
|
39
|
-
} else if (status === 'publish' && new Date(newDate) > new Date()) {
|
|
40
|
-
newStatus = 'future';
|
|
41
|
-
}
|
|
42
|
-
await editEntityRecord('postType', postType, postId, {
|
|
43
|
-
status: newStatus,
|
|
44
|
-
date: newDate
|
|
45
|
-
});
|
|
46
|
-
} catch (error) {
|
|
47
|
-
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while updating the status');
|
|
48
|
-
createErrorNotice(errorMessage, {
|
|
49
|
-
type: 'snackbar'
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
const relateToNow = date ? humanTimeDiff(date) : __('Immediately');
|
|
54
|
-
return createElement(HStack, {
|
|
55
|
-
className: "edit-site-summary-field"
|
|
56
|
-
}, createElement(Text, {
|
|
57
|
-
className: "edit-site-summary-field__label"
|
|
58
|
-
}, __('Publish')), createElement(Dropdown, {
|
|
59
|
-
contentClassName: "edit-site-change-status__content",
|
|
60
|
-
popoverProps: popoverProps,
|
|
61
|
-
focusOnMount: true,
|
|
62
|
-
ref: setPopoverAnchor,
|
|
63
|
-
renderToggle: ({
|
|
64
|
-
onToggle
|
|
65
|
-
}) => createElement(Button, {
|
|
66
|
-
className: "edit-site-summary-field__trigger",
|
|
67
|
-
variant: "tertiary",
|
|
68
|
-
onClick: onToggle
|
|
69
|
-
}, relateToNow),
|
|
70
|
-
renderContent: ({
|
|
71
|
-
onClose
|
|
72
|
-
}) => createElement(PublishDateTimePicker, {
|
|
73
|
-
currentDate: date,
|
|
74
|
-
is12Hour: true,
|
|
75
|
-
onClose: onClose,
|
|
76
|
-
onChange: saveDate
|
|
77
|
-
})
|
|
78
|
-
}));
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=publish-date.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["Button","Dropdown","__experimentalText","Text","__experimentalHStack","HStack","__","useDispatch","useState","useMemo","store","coreStore","noticesStore","__experimentalPublishDateTimePicker","PublishDateTimePicker","humanTimeDiff","ChangeStatus","postType","postId","status","date","editEntityRecord","createErrorNotice","popoverAnchor","setPopoverAnchor","popoverProps","anchor","placement","saveDate","newDate","newStatus","Date","error","errorMessage","message","code","type","relateToNow","createElement","className","contentClassName","focusOnMount","ref","renderToggle","onToggle","variant","onClick","renderContent","onClose","currentDate","is12Hour","onChange"],"sources":["@wordpress/edit-site/src/components/sidebar-edit-mode/page-panels/publish-date.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tDropdown,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useState, useMemo } from '@wordpress/element';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';\nimport { humanTimeDiff } from '@wordpress/date';\n\nexport default function ChangeStatus( { postType, postId, status, date } ) {\n\tconst { editEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tconst [ popoverAnchor, setPopoverAnchor ] = useState( null );\n\t// Memoize popoverProps to avoid returning a new object every time.\n\tconst popoverProps = useMemo(\n\t\t() => ( {\n\t\t\t// Anchor the popover to the middle of the entire row so that it doesn't\n\t\t\t// move around when the label changes.\n\t\t\tanchor: popoverAnchor,\n\t\t\t'aria-label': __( 'Change publish date' ),\n\t\t\tplacement: 'bottom-end',\n\t\t} ),\n\t\t[ popoverAnchor ]\n\t);\n\n\tconst saveDate = async ( newDate ) => {\n\t\ttry {\n\t\t\tlet newStatus = status;\n\t\t\tif ( status === 'future' && new Date( newDate ) < new Date() ) {\n\t\t\t\tnewStatus = 'publish';\n\t\t\t} else if (\n\t\t\t\tstatus === 'publish' &&\n\t\t\t\tnew Date( newDate ) > new Date()\n\t\t\t) {\n\t\t\t\tnewStatus = 'future';\n\t\t\t}\n\t\t\tawait editEntityRecord( 'postType', postType, postId, {\n\t\t\t\tstatus: newStatus,\n\t\t\t\tdate: newDate,\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while updating the status' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t};\n\n\tconst relateToNow = date ? humanTimeDiff( date ) : __( 'Immediately' );\n\n\treturn (\n\t\t<HStack className=\"edit-site-summary-field\">\n\t\t\t<Text className=\"edit-site-summary-field__label\">\n\t\t\t\t{ __( 'Publish' ) }\n\t\t\t</Text>\n\t\t\t<Dropdown\n\t\t\t\tcontentClassName=\"edit-site-change-status__content\"\n\t\t\t\tpopoverProps={ popoverProps }\n\t\t\t\tfocusOnMount\n\t\t\t\tref={ setPopoverAnchor }\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\n\t\t\t\t\t<Button\n\t\t\t\t\t\tclassName=\"edit-site-summary-field__trigger\"\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ relateToNow }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onClose } ) => (\n\t\t\t\t\t<PublishDateTimePicker\n\t\t\t\t\t\tcurrentDate={ date }\n\t\t\t\t\t\tis12Hour\n\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\tonChange={ saveDate }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t/>\n\t\t</HStack>\n\t);\n}\n"],"mappings":"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"}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,
|
|
6
|
-
SelectControl,
|
|
7
|
-
} from '@wordpress/components';
|
|
8
|
-
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
-
|
|
10
|
-
export const OPERATOR_IN = 'in';
|
|
11
|
-
|
|
12
|
-
export default ( { filter, view, onChangeView } ) => {
|
|
13
|
-
const valueFound = view.filters.find(
|
|
14
|
-
( f ) => f.field === filter.field && f.operator === OPERATOR_IN
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const activeValue =
|
|
18
|
-
! valueFound || ! valueFound.hasOwnProperty( 'value' )
|
|
19
|
-
? ''
|
|
20
|
-
: valueFound.value;
|
|
21
|
-
|
|
22
|
-
const id = `dataviews__filters-in-${ filter.field }`;
|
|
23
|
-
|
|
24
|
-
return (
|
|
25
|
-
<SelectControl
|
|
26
|
-
id={ id }
|
|
27
|
-
__nextHasNoMarginBottom
|
|
28
|
-
value={ activeValue }
|
|
29
|
-
prefix={
|
|
30
|
-
<InputControlPrefixWrapper
|
|
31
|
-
as="label"
|
|
32
|
-
htmlFor={ id }
|
|
33
|
-
className="dataviews__select-control-prefix"
|
|
34
|
-
>
|
|
35
|
-
{ sprintf(
|
|
36
|
-
/* translators: filter name. */
|
|
37
|
-
__( '%s:' ),
|
|
38
|
-
filter.name
|
|
39
|
-
) }
|
|
40
|
-
</InputControlPrefixWrapper>
|
|
41
|
-
}
|
|
42
|
-
options={ filter.elements }
|
|
43
|
-
onChange={ ( value ) => {
|
|
44
|
-
const filters = view.filters.filter(
|
|
45
|
-
( f ) =>
|
|
46
|
-
f.field !== filter.field || f.operator !== OPERATOR_IN
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
filters.push( {
|
|
50
|
-
field: filter.field,
|
|
51
|
-
operator: OPERATOR_IN,
|
|
52
|
-
value,
|
|
53
|
-
} );
|
|
54
|
-
|
|
55
|
-
onChangeView( ( currentView ) => ( {
|
|
56
|
-
...currentView,
|
|
57
|
-
page: 1,
|
|
58
|
-
filters,
|
|
59
|
-
} ) );
|
|
60
|
-
} }
|
|
61
|
-
/>
|
|
62
|
-
);
|
|
63
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import {
|
|
6
|
-
useBlockEditingMode,
|
|
7
|
-
store as blockEditorStore,
|
|
8
|
-
} from '@wordpress/block-editor';
|
|
9
|
-
import { useEffect } from '@wordpress/element';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { PAGE_CONTENT_BLOCK_TYPES } from '../../utils/constants';
|
|
15
|
-
|
|
16
|
-
function DisableBlock( { clientId } ) {
|
|
17
|
-
const isDescendentOfQueryLoop = useSelect(
|
|
18
|
-
( select ) => {
|
|
19
|
-
const { getBlockParentsByBlockName } = select( blockEditorStore );
|
|
20
|
-
return (
|
|
21
|
-
getBlockParentsByBlockName( clientId, 'core/query' ).length !==
|
|
22
|
-
0
|
|
23
|
-
);
|
|
24
|
-
},
|
|
25
|
-
[ clientId ]
|
|
26
|
-
);
|
|
27
|
-
const mode = isDescendentOfQueryLoop ? undefined : 'contentOnly';
|
|
28
|
-
const { setBlockEditingMode, unsetBlockEditingMode } =
|
|
29
|
-
useDispatch( blockEditorStore );
|
|
30
|
-
useEffect( () => {
|
|
31
|
-
if ( mode ) {
|
|
32
|
-
setBlockEditingMode( clientId, mode );
|
|
33
|
-
return () => {
|
|
34
|
-
unsetBlockEditingMode( clientId );
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}, [ clientId, mode, setBlockEditingMode, unsetBlockEditingMode ] );
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Component that when rendered, makes it so that the site editor allows only
|
|
42
|
-
* page content to be edited.
|
|
43
|
-
*/
|
|
44
|
-
export default function DisableNonPageContentBlocks() {
|
|
45
|
-
useBlockEditingMode( 'disabled' );
|
|
46
|
-
const clientIds = useSelect( ( select ) => {
|
|
47
|
-
const { __experimentalGetGlobalBlocksByName } =
|
|
48
|
-
select( blockEditorStore );
|
|
49
|
-
return __experimentalGetGlobalBlocksByName(
|
|
50
|
-
Object.keys( PAGE_CONTENT_BLOCK_TYPES )
|
|
51
|
-
);
|
|
52
|
-
}, [] );
|
|
53
|
-
|
|
54
|
-
return clientIds.map( ( clientId ) => {
|
|
55
|
-
return <DisableBlock key={ clientId } clientId={ clientId } />;
|
|
56
|
-
} );
|
|
57
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { useEffect } from '@wordpress/element';
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { store as editSiteStore } from '../../store';
|
|
10
|
-
import DisableNonPageContentBlocks from './disable-non-page-content-blocks';
|
|
11
|
-
import EditTemplateNotification from './edit-template-notification';
|
|
12
|
-
import BackToPageNotification from './back-to-page-notification';
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
export default function PageContentFocusManager( { contentRef } ) {
|
|
16
|
-
const { hasPageContentFocus, pageContentFocusType, canvasMode } = useSelect(
|
|
17
|
-
( select ) => {
|
|
18
|
-
const { getPageContentFocusType, getCanvasMode } = unlock(
|
|
19
|
-
select( editSiteStore )
|
|
20
|
-
);
|
|
21
|
-
const _canvasMode = getCanvasMode();
|
|
22
|
-
return {
|
|
23
|
-
canvasMode: _canvasMode,
|
|
24
|
-
pageContentFocusType: getPageContentFocusType(),
|
|
25
|
-
hasPageContentFocus:
|
|
26
|
-
select( editSiteStore ).hasPageContentFocus(),
|
|
27
|
-
};
|
|
28
|
-
},
|
|
29
|
-
[]
|
|
30
|
-
);
|
|
31
|
-
const { setPageContentFocusType } = unlock( useDispatch( editSiteStore ) );
|
|
32
|
-
|
|
33
|
-
/*
|
|
34
|
-
* Ensure that the page content focus type is set to `disableTemplate` when
|
|
35
|
-
* the canvas mode is not `edit`. This makes the experience consistent with
|
|
36
|
-
* refreshing the page, which resets the page content focus type.
|
|
37
|
-
*/
|
|
38
|
-
useEffect( () => {
|
|
39
|
-
if ( canvasMode !== 'edit' && !! pageContentFocusType ) {
|
|
40
|
-
setPageContentFocusType( null );
|
|
41
|
-
}
|
|
42
|
-
}, [ canvasMode, pageContentFocusType ] );
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
{ hasPageContentFocus && <DisableNonPageContentBlocks /> }
|
|
47
|
-
<EditTemplateNotification contentRef={ contentRef } />
|
|
48
|
-
<BackToPageNotification />
|
|
49
|
-
</>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
Dropdown,
|
|
7
|
-
__experimentalText as Text,
|
|
8
|
-
__experimentalHStack as HStack,
|
|
9
|
-
} from '@wordpress/components';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import { useDispatch } from '@wordpress/data';
|
|
12
|
-
import { useState, useMemo } from '@wordpress/element';
|
|
13
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
14
|
-
import { store as noticesStore } from '@wordpress/notices';
|
|
15
|
-
import { __experimentalPublishDateTimePicker as PublishDateTimePicker } from '@wordpress/block-editor';
|
|
16
|
-
import { humanTimeDiff } from '@wordpress/date';
|
|
17
|
-
|
|
18
|
-
export default function ChangeStatus( { postType, postId, status, date } ) {
|
|
19
|
-
const { editEntityRecord } = useDispatch( coreStore );
|
|
20
|
-
const { createErrorNotice } = useDispatch( noticesStore );
|
|
21
|
-
|
|
22
|
-
const [ popoverAnchor, setPopoverAnchor ] = useState( null );
|
|
23
|
-
// Memoize popoverProps to avoid returning a new object every time.
|
|
24
|
-
const popoverProps = useMemo(
|
|
25
|
-
() => ( {
|
|
26
|
-
// Anchor the popover to the middle of the entire row so that it doesn't
|
|
27
|
-
// move around when the label changes.
|
|
28
|
-
anchor: popoverAnchor,
|
|
29
|
-
'aria-label': __( 'Change publish date' ),
|
|
30
|
-
placement: 'bottom-end',
|
|
31
|
-
} ),
|
|
32
|
-
[ popoverAnchor ]
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
const saveDate = async ( newDate ) => {
|
|
36
|
-
try {
|
|
37
|
-
let newStatus = status;
|
|
38
|
-
if ( status === 'future' && new Date( newDate ) < new Date() ) {
|
|
39
|
-
newStatus = 'publish';
|
|
40
|
-
} else if (
|
|
41
|
-
status === 'publish' &&
|
|
42
|
-
new Date( newDate ) > new Date()
|
|
43
|
-
) {
|
|
44
|
-
newStatus = 'future';
|
|
45
|
-
}
|
|
46
|
-
await editEntityRecord( 'postType', postType, postId, {
|
|
47
|
-
status: newStatus,
|
|
48
|
-
date: newDate,
|
|
49
|
-
} );
|
|
50
|
-
} catch ( error ) {
|
|
51
|
-
const errorMessage =
|
|
52
|
-
error.message && error.code !== 'unknown_error'
|
|
53
|
-
? error.message
|
|
54
|
-
: __( 'An error occurred while updating the status' );
|
|
55
|
-
|
|
56
|
-
createErrorNotice( errorMessage, {
|
|
57
|
-
type: 'snackbar',
|
|
58
|
-
} );
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const relateToNow = date ? humanTimeDiff( date ) : __( 'Immediately' );
|
|
63
|
-
|
|
64
|
-
return (
|
|
65
|
-
<HStack className="edit-site-summary-field">
|
|
66
|
-
<Text className="edit-site-summary-field__label">
|
|
67
|
-
{ __( 'Publish' ) }
|
|
68
|
-
</Text>
|
|
69
|
-
<Dropdown
|
|
70
|
-
contentClassName="edit-site-change-status__content"
|
|
71
|
-
popoverProps={ popoverProps }
|
|
72
|
-
focusOnMount
|
|
73
|
-
ref={ setPopoverAnchor }
|
|
74
|
-
renderToggle={ ( { onToggle } ) => (
|
|
75
|
-
<Button
|
|
76
|
-
className="edit-site-summary-field__trigger"
|
|
77
|
-
variant="tertiary"
|
|
78
|
-
onClick={ onToggle }
|
|
79
|
-
>
|
|
80
|
-
{ relateToNow }
|
|
81
|
-
</Button>
|
|
82
|
-
) }
|
|
83
|
-
renderContent={ ( { onClose } ) => (
|
|
84
|
-
<PublishDateTimePicker
|
|
85
|
-
currentDate={ date }
|
|
86
|
-
is12Hour
|
|
87
|
-
onClose={ onClose }
|
|
88
|
-
onChange={ saveDate }
|
|
89
|
-
/>
|
|
90
|
-
) }
|
|
91
|
-
/>
|
|
92
|
-
</HStack>
|
|
93
|
-
);
|
|
94
|
-
}
|