@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 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_htmlEntities","_router","_preferences","_interface","_notices","_store","_useEditedEntityRecord","_interopRequireDefault","_isTemplateRemovable","_isTemplateRevertable","_keyboardShortcutHelpModal","_preferencesModal","_patternModal","_lockUnlock","_constants","useHistory","unlock","routerPrivateApis","usePageContentFocusCommands","record","template","useEditedEntityRecord","isPage","canvasMode","hasPageContentFocus","useSelect","select","editSiteStore","getCanvasMode","setHasPageContentFocus","useDispatch","isLoading","commands","push","name","label","sprintf","decodeEntities","title","icon","layout","callback","close","__","page","useEditorModeCommands","switchEditorMode","editorMode","getEditorMode","code","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isTemplateRevertable","type","TEMPLATE_POST_TYPE","isRTL","rotateRight","rotateLeft","isTemplateRemovable","path","trash","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","toggleDistractionFree","setIsListViewOpened","activeSidebar","showBlockBreadcrumbs","isListViewOpen","isDistractionFree","isListViewOpened","interfaceStore","getActiveComplementaryArea","preferencesStore","get","openModal","toggle","createInfoNotice","noticesStore","drawerLeft","drawerRight","blockDefault","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","id","listView","usePatternCommands","pattern","edit","PATTERN_MODALS","rename","symbol","duplicate","useEditModeCommands","useCommandLoader","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tedit,\n\ttrash,\n\trotateLeft,\n\trotateRight,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcode,\n\tkeyboard,\n\tlistView,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { PATTERN_MODALS } from '../../components/pattern-modal';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, hasPageContentFocus } = useSelect(\n\t\t( select ) => ( {\n\t\t\tisPage: select( editSiteStore ).isPage(),\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\thasPageContentFocus: select( editSiteStore ).hasPageContentFocus(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setHasPageContentFocus } = useDispatch( editSiteStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( hasPageContentFocus ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t/* translators: %1$s: template title */\n\t\t\tlabel: sprintf(\n\t\t\t\t'Edit template: %s',\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( false );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetHasPageContentFocus( true );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useEditorModeCommands() {\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\tconst { canvasMode, editorMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tif ( canvasMode !== 'edit' || editorMode !== 'text' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( editorMode === 'text' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/exit-code-editor',\n\t\t\tlabel: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst hasPageContentFocus = useSelect(\n\t\t( select ) => select( editSiteStore ).hasPageContentFocus(),\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! hasPageContentFocus ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tconst path =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleDistractionFree,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t} = useDispatch( editSiteStore );\n\tconst {\n\t\tcanvasMode,\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tshowBlockBreadcrumbs,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t} = useSelect( ( select ) => {\n\t\tconst { isListViewOpened, getEditorMode } = select( editSiteStore );\n\t\treturn {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\teditSiteStore.name,\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tif ( editorMode === 'visual' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel: __( 'Open code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'text' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction usePatternCommands() {\n\tconst { isLoaded, record: pattern } = useEditedEntityRecord();\n\tconst { openModal } = useDispatch( interfaceStore );\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( pattern?.type === 'wp_block' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.rename );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.duplicate );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/exit-code-editor',\n\t\thook: useEditorModeCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/patterns',\n\t\thook: usePatternCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAeA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAKA,IAAAS,MAAA,GAAAT,OAAA;AACA,IAAAU,sBAAA,GAAAC,sBAAA,CAAAX,OAAA;AACA,IAAAY,oBAAA,GAAAD,sBAAA,CAAAX,OAAA;AACA,IAAAa,qBAAA,GAAAF,sBAAA,CAAAX,OAAA;AACA,IAAAc,0BAAA,GAAAd,OAAA;AACA,IAAAe,iBAAA,GAAAf,OAAA;AACA,IAAAgB,aAAA,GAAAhB,OAAA;AACA,IAAAiB,WAAA,GAAAjB,OAAA;AACA,IAAAkB,UAAA,GAAAlB,OAAA;AAtCA;AACA;AACA;;AAyBA;AACA;AACA;;AAWA,MAAM;EAAEmB;AAAW,CAAC,GAAG,IAAAC,kBAAM,EAAEC,mBAAkB,CAAC;AAElD,SAASC,2BAA2BA,CAAA,EAAG;EACtC,MAAM;IAAEC,MAAM,EAAEC;EAAS,CAAC,GAAG,IAAAC,8BAAqB,EAAC,CAAC;EACpD,MAAM;IAAEC,MAAM;IAAEC,UAAU;IAAEC;EAAoB,CAAC,GAAG,IAAAC,eAAS,EAC1DC,MAAM,KAAQ;IACfJ,MAAM,EAAEI,MAAM,CAAEC,YAAc,CAAC,CAACL,MAAM,CAAC,CAAC;IACxCC,UAAU,EAAE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AF,0BAAgB,EAAE;IACjBhE,IAAI,EAAE,mCAAmC;IACzCiE,IAAI,EAAEjF,2BAA2B;IACjCkF,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,IAAAF,0BAAgB,EAAE;IACjBhE,IAAI,EAAE,oCAAoC;IAC1CiE,IAAI,EAAEjD;EACP,CAAE,CAAC;EAEH,IAAAgD,0BAAgB,EAAE;IACjBhE,IAAI,EAAE,yBAAyB;IAC/BiE,IAAI,EAAET,kBAAkB;IACxBU,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,IAAAF,0BAAgB,EAAE;IACjBhE,IAAI,EAAE,wBAAwB;IAC9BiE,IAAI,EAAEnC;EACP,CAAE,CAAC;AACJ"}
|
|
1
|
+
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_htmlEntities","_router","_preferences","_interface","_notices","_editor","_store","_useEditedEntityRecord","_interopRequireDefault","_isTemplateRemovable","_isTemplateRevertable","_keyboardShortcutHelpModal","_preferencesModal","_patternModal","_lockUnlock","_constants","useHistory","unlock","routerPrivateApis","usePageContentFocusCommands","record","template","useEditedEntityRecord","isPage","canvasMode","renderingMode","useSelect","select","_isPage","getCanvasMode","editSiteStore","getRenderingMode","editorStore","setRenderingMode","useDispatch","isLoading","commands","push","name","label","sprintf","decodeEntities","title","icon","layout","callback","close","__","page","useEditorModeCommands","switchEditorMode","editorMode","getEditorMode","code","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","isTemplateRevertable","type","TEMPLATE_POST_TYPE","isRTL","rotateRight","rotateLeft","isTemplateRemovable","path","trash","useEditUICommands","openGeneralSidebar","closeGeneralSidebar","toggleDistractionFree","setIsListViewOpened","activeSidebar","showBlockBreadcrumbs","isListViewOpen","isDistractionFree","isListViewOpened","interfaceStore","getActiveComplementaryArea","preferencesStore","get","openModal","toggle","createInfoNotice","noticesStore","drawerLeft","drawerRight","blockDefault","PREFERENCES_MODAL_NAME","keyboard","KEYBOARD_SHORTCUT_HELP_MODAL_NAME","id","listView","usePatternCommands","pattern","edit","PATTERN_MODALS","rename","symbol","duplicate","useEditModeCommands","useCommandLoader","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport {\n\tedit,\n\ttrash,\n\trotateLeft,\n\trotateRight,\n\tlayout,\n\tpage,\n\tdrawerLeft,\n\tdrawerRight,\n\tblockDefault,\n\tcode,\n\tkeyboard,\n\tlistView,\n\tsymbol,\n} from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';\nimport { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';\nimport { PATTERN_MODALS } from '../../components/pattern-modal';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, renderingMode } = useSelect( ( select ) => {\n\t\tconst { isPage: _isPage, getCanvasMode } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\tconst { getRenderingMode } = select( editorStore );\n\t\treturn {\n\t\t\tisPage: _isPage(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\trenderingMode: getRenderingMode(),\n\t\t};\n\t}, [] );\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( renderingMode !== 'template-only' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\t/* translators: %1$s: template title */\n\t\t\tlabel: sprintf(\n\t\t\t\t'Edit template: %s',\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-only' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useEditorModeCommands() {\n\tconst { switchEditorMode } = useDispatch( editSiteStore );\n\tconst { canvasMode, editorMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: select( editSiteStore ).getEditorMode(),\n\t\t} ),\n\t\t[]\n\t);\n\n\tif ( canvasMode !== 'edit' || editorMode !== 'text' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( editorMode === 'text' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/exit-code-editor',\n\t\t\tlabel: __( 'Exit code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'visual' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getRenderingMode() !== 'template-only',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Reset template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? /* translators: %1$s: template title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: /* translators: %1$s: template part title */\n\t\t\t\t sprintf(\n\t\t\t\t\t\t'Delete template part: %s',\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tconst path =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? '/wp_template'\n\t\t\t\t: '/wp_template_part/all';\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpath,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nfunction useEditUICommands() {\n\tconst {\n\t\topenGeneralSidebar,\n\t\tcloseGeneralSidebar,\n\t\ttoggleDistractionFree,\n\t\tsetIsListViewOpened,\n\t\tswitchEditorMode,\n\t} = useDispatch( editSiteStore );\n\tconst {\n\t\tcanvasMode,\n\t\teditorMode,\n\t\tactiveSidebar,\n\t\tshowBlockBreadcrumbs,\n\t\tisListViewOpen,\n\t\tisDistractionFree,\n\t} = useSelect( ( select ) => {\n\t\tconst { isListViewOpened, getEditorMode } = select( editSiteStore );\n\t\treturn {\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tactiveSidebar: select( interfaceStore ).getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowBlockBreadcrumbs: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showBlockBreadcrumbs'\n\t\t\t),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisDistractionFree: select( preferencesStore ).get(\n\t\t\t\teditSiteStore.name,\n\t\t\t\t'distractionFree'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { openModal } = useDispatch( interfaceStore );\n\tconst { toggle } = useDispatch( preferencesStore );\n\tconst { createInfoNotice } = useDispatch( noticesStore );\n\n\tif ( canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tcommands.push( {\n\t\tname: 'core/open-settings-sidebar',\n\t\tlabel: __( 'Toggle settings sidebar' ),\n\t\ticon: isRTL() ? drawerLeft : drawerRight,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/template' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/template' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-block-inspector',\n\t\tlabel: __( 'Toggle block inspector' ),\n\t\ticon: blockDefault,\n\t\tcallback: ( { close } ) => {\n\t\t\tclose();\n\t\t\tif ( activeSidebar === 'edit-site/block-inspector' ) {\n\t\t\t\tcloseGeneralSidebar();\n\t\t\t} else {\n\t\t\t\topenGeneralSidebar( 'edit-site/block-inspector' );\n\t\t\t}\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-spotlight-mode',\n\t\tlabel: __( 'Toggle spotlight mode' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'focusMode' );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-distraction-free',\n\t\tlabel: __( 'Toggle distraction free' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggleDistractionFree();\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-top-toolbar',\n\t\tlabel: __( 'Toggle top toolbar' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'fixedToolbar' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\ttoggleDistractionFree();\n\t\t\t}\n\t\t\tclose();\n\t\t},\n\t} );\n\n\tif ( editorMode === 'visual' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/toggle-code-editor',\n\t\t\tlabel: __( 'Open code editor' ),\n\t\t\ticon: code,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tswitchEditorMode( 'text' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tcommands.push( {\n\t\tname: 'core/open-preferences',\n\t\tlabel: __( 'Editor preferences' ),\n\t\tcallback: () => {\n\t\t\topenModal( PREFERENCES_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/open-shortcut-help',\n\t\tlabel: __( 'Keyboard shortcuts' ),\n\t\ticon: keyboard,\n\t\tcallback: () => {\n\t\t\topenModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-breadcrumbs',\n\t\tlabel: showBlockBreadcrumbs\n\t\t\t? __( 'Hide block breadcrumbs' )\n\t\t\t: __( 'Show block breadcrumbs' ),\n\t\tcallback: ( { close } ) => {\n\t\t\ttoggle( 'core/edit-site', 'showBlockBreadcrumbs' );\n\t\t\tclose();\n\t\t\tcreateInfoNotice(\n\t\t\t\tshowBlockBreadcrumbs\n\t\t\t\t\t? __( 'Breadcrumbs hidden.' )\n\t\t\t\t\t: __( 'Breadcrumbs visible.' ),\n\t\t\t\t{\n\t\t\t\t\tid: 'core/edit-site/toggle-breadcrumbs/notice',\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t},\n\t} );\n\n\tcommands.push( {\n\t\tname: 'core/toggle-list-view',\n\t\tlabel: __( 'Toggle list view' ),\n\t\ticon: listView,\n\t\tcallback: ( { close } ) => {\n\t\t\tsetIsListViewOpened( ! isListViewOpen );\n\t\t\tclose();\n\t\t},\n\t} );\n\n\treturn {\n\t\tisLoading: false,\n\t\tcommands,\n\t};\n}\n\nfunction usePatternCommands() {\n\tconst { isLoaded, record: pattern } = useEditedEntityRecord();\n\tconst { openModal } = useDispatch( interfaceStore );\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( pattern?.type === 'wp_block' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/rename-pattern',\n\t\t\tlabel: __( 'Rename pattern' ),\n\t\t\ticon: edit,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.rename );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t\tcommands.push( {\n\t\t\tname: 'core/duplicate-pattern',\n\t\t\tlabel: __( 'Duplicate pattern' ),\n\t\t\ticon: symbol,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\topenModal( PATTERN_MODALS.duplicate );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/exit-code-editor',\n\t\thook: useEditorModeCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/patterns',\n\t\thook: usePatternCommands,\n\t\tcontext: 'site-editor-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/edit-ui',\n\t\thook: useEditUICommands,\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAeA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AAKA,IAAAU,MAAA,GAAAV,OAAA;AACA,IA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BjE,IAAI,EAAE,wBAAwB;IAC9BkE,IAAI,EAAEnC;EACP,CAAE,CAAC;AACJ"}
|
package/build/store/actions.js
CHANGED
|
@@ -519,6 +519,9 @@ const setHasPageContentFocus = hasPageContentFocus => ({
|
|
|
519
519
|
dispatch,
|
|
520
520
|
registry
|
|
521
521
|
}) => {
|
|
522
|
+
(0, _deprecated.default)(`dispatch( 'core/edit-site' ).setHasPageContentFocus`, {
|
|
523
|
+
since: '6.5'
|
|
524
|
+
});
|
|
522
525
|
if (hasPageContentFocus) {
|
|
523
526
|
registry.dispatch(_blockEditor.store).clearSelectedBlock();
|
|
524
527
|
}
|
|
@@ -541,7 +544,7 @@ const toggleDistractionFree = () => ({
|
|
|
541
544
|
const isDistractionFree = registry.select(_preferences.store).get('core/edit-site', 'distractionFree');
|
|
542
545
|
if (!isDistractionFree) {
|
|
543
546
|
registry.batch(() => {
|
|
544
|
-
registry.dispatch(_preferences.store).set('core/edit-site', 'fixedToolbar',
|
|
547
|
+
registry.dispatch(_preferences.store).set('core/edit-site', 'fixedToolbar', true);
|
|
545
548
|
dispatch.setIsInserterOpened(false);
|
|
546
549
|
dispatch.setIsListViewOpened(false);
|
|
547
550
|
dispatch.closeGeneralSidebar();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_blocks","_deprecated","_url","_i18n","_notices","_coreData","_interface","_blockEditor","_a11y","_preferences","_htmlEntities","_constants","_isTemplateRevertable","_constants2","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","version","hint","addTemplate","template","newTemplate","coreStore","saveEntityRecord","TEMPLATE_POST_TYPE","content","editEntityRecord","id","blocks","parse","undoIgnore","postType","exports","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","templateTitle","title","rendered","noticesStore","createSuccessNotice","sprintf","__","decodeEntities","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","TEMPLATE_PART_POST_TYPE","setNavigationMenu","navigationMenuId","NAVIGATION_POST_TYPE","setEditedEntity","postId","context","setHomeTemplateId","setEditedPostContext","setPage","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","isDistractionFree","get","toggleDistractionFree","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","isTemplateRevertable","templateEntityConfig","getEntityConfig","fileTemplatePath","addQueryArgs","baseURL","source","fileTemplate","apiFetch","path","serializeBlocks","blocksForSerialization","__unstableSerializeAndClean","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","speak","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @deprecated\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\t// Depending on how the entity was retrieved it's title might be\n\t\t\t// an object or simple string.\n\t\t\tconst templateTitle =\n\t\t\t\ttypeof template.title === 'string'\n\t\t\t\t\t? template.title\n\t\t\t\t\t: template.title?.rendered;\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( templateTitle )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\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 deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @deprecated\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree && isOpen ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\t\tisOpen,\n\t\t} );\n\t};\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\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: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core/edit-site', 'fixedToolbar', false );\n\t\t\t\tdispatch.setIsInserterOpened( false );\n\t\t\t\tdispatch.setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'distractionFree',\n\t\t\t\t\t! isDistractionFree\n\t\t\t\t);\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAKA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,qBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AArBA;AAC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AAc,EAAE,KAAM,CAAC;MAChDpG,QAAQ,CAACyD,mBAAmB,CAAE,KAAM,CAAC;MACrCzD,QAAQ,CAAC6D,mBAAmB,CAAE,KAAM,CAAC;MACrC7D,QAAQ,CAACgG,mBAAmB,CAAC,CAAC;IAC/B,CAAE,CAAC;EACJ;EACApG,QAAQ,CAAC8G,KAAK,CAAE,MAAM;IACrB9G,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5BmG,GAAG,CACH,gBAAgB,EAChB,iBAAiB,EACjB,CAAErC,iBACH,CAAC;IACFnE,QAAQ,CACNI,QAAQ,CAAEgC,cAAa,CAAC,CACxB2E,gBAAgB,CAChB5C,iBAAiB,GACd,IAAA5B,QAAE,EAAE,uBAAwB,CAAC,GAC7B,IAAAA,QAAE,EAAE,sBAAuB,CAAC,EAC/B;MACClB,EAAE,EAAE,6CAA6C;MACjDZ,IAAI,EAAE;IACP,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC;AAACiB,OAAA,CAAA2C,qBAAA,GAAAA,qBAAA"}
|
|
1
|
+
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_blocks","_deprecated","_url","_i18n","_notices","_coreData","_interface","_blockEditor","_a11y","_preferences","_htmlEntities","_constants","_isTemplateRevertable","_constants2","toggleFeature","featureName","registry","deprecated","since","alternative","dispatch","preferencesStore","toggle","__experimentalSetPreviewDeviceType","deviceType","type","setTemplate","version","hint","addTemplate","template","newTemplate","coreStore","saveEntityRecord","TEMPLATE_POST_TYPE","content","editEntityRecord","id","blocks","parse","undoIgnore","postType","exports","removeTemplate","deleteEntityRecord","force","lastError","select","getLastEntityDeleteError","templateTitle","title","rendered","noticesStore","createSuccessNotice","sprintf","__","decodeEntities","error","errorMessage","message","code","createErrorNotice","setTemplatePart","templatePartId","TEMPLATE_PART_POST_TYPE","setNavigationMenu","navigationMenuId","NAVIGATION_POST_TYPE","setEditedEntity","postId","context","setHomeTemplateId","setEditedPostContext","setPage","setNavigationPanelActiveMenu","openNavigationPanelToMenu","setIsNavigationPanelOpened","setIsInserterOpened","value","updateSettings","settings","setIsListViewOpened","isOpen","isDistractionFree","get","toggleDistractionFree","setIsSaveViewOpened","revertTemplate","allowUndo","noticeId","removeNotice","isTemplateRevertable","templateEntityConfig","getEntityConfig","fileTemplatePath","addQueryArgs","baseURL","source","fileTemplate","apiFetch","path","serializeBlocks","blocksForSerialization","__unstableSerializeAndClean","edited","getEditedEntityRecord","raw","undoRevert","actions","label","onClick","openGeneralSidebar","name","interfaceStore","enableComplementaryArea","editSiteStoreName","closeGeneralSidebar","disableComplementaryArea","switchEditorMode","mode","set","blockEditorStore","clearSelectedBlock","speak","setHasPageContentFocus","hasPageContentFocus","batch","createInfoNotice"],"sources":["@wordpress/edit-site/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { parse, __unstableSerializeAndClean } from '@wordpress/blocks';\nimport deprecated from '@wordpress/deprecated';\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as interfaceStore } from '@wordpress/interface';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { speak } from '@wordpress/a11y';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME as editSiteStoreName } from './constants';\nimport isTemplateRevertable from '../utils/is-template-revertable';\nimport {\n\tTEMPLATE_POST_TYPE,\n\tTEMPLATE_PART_POST_TYPE,\n\tNAVIGATION_POST_TYPE,\n} from '../utils/constants';\n/**\n * Dispatches an action that toggles a feature flag.\n *\n * @param {string} featureName Feature name.\n */\nexport function toggleFeature( featureName ) {\n\treturn function ( { registry } ) {\n\t\tdeprecated(\n\t\t\t\"dispatch( 'core/edit-site' ).toggleFeature( featureName )\",\n\t\t\t{\n\t\t\t\tsince: '6.0',\n\t\t\t\talternative:\n\t\t\t\t\t\"dispatch( 'core/preferences').toggle( 'core/edit-site', featureName )\",\n\t\t\t}\n\t\t);\n\n\t\tregistry\n\t\t\t.dispatch( preferencesStore )\n\t\t\t.toggle( 'core/edit-site', featureName );\n\t};\n}\n\n/**\n * Action that changes the width of the editing canvas.\n *\n * @param {string} deviceType\n *\n * @return {Object} Action object.\n */\nexport function __experimentalSetPreviewDeviceType( deviceType ) {\n\treturn {\n\t\ttype: 'SET_PREVIEW_DEVICE_TYPE',\n\t\tdeviceType,\n\t};\n}\n\n/**\n * Action that sets a template, optionally fetching it from REST API.\n *\n * @return {Object} Action object.\n */\nexport function setTemplate() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setTemplate\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setTemplate is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Action that adds a new template and sets it as the current template.\n *\n * @param {Object} template The template.\n *\n * @deprecated\n *\n * @return {Object} Action object used to set the current template.\n */\nexport const addTemplate =\n\t( template ) =>\n\tasync ( { dispatch, registry } ) => {\n\t\tdeprecated( \"dispatch( 'core/edit-site' ).addTemplate\", {\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t\thint: 'use saveEntityRecord directly',\n\t\t} );\n\n\t\tconst newTemplate = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', TEMPLATE_POST_TYPE, template );\n\n\t\tif ( template.content ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tTEMPLATE_POST_TYPE,\n\t\t\t\t\tnewTemplate.id,\n\t\t\t\t\t{ blocks: parse( template.content ) },\n\t\t\t\t\t{ undoIgnore: true }\n\t\t\t\t);\n\t\t}\n\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITED_POST',\n\t\t\tpostType: TEMPLATE_POST_TYPE,\n\t\t\tid: newTemplate.id,\n\t\t} );\n\t};\n\n/**\n * Action that removes a template.\n *\n * @param {Object} template The template object.\n */\nexport const removeTemplate =\n\t( template ) =>\n\tasync ( { registry } ) => {\n\t\ttry {\n\t\t\tawait registry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.deleteEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\t\tforce: true,\n\t\t\t\t} );\n\n\t\t\tconst lastError = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getLastEntityDeleteError(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\t// Depending on how the entity was retrieved it's title might be\n\t\t\t// an object or simple string.\n\t\t\tconst templateTitle =\n\t\t\t\ttypeof template.title === 'string'\n\t\t\t\t\t? template.title\n\t\t\t\t\t: template.title?.rendered;\n\n\t\t\tregistry.dispatch( noticesStore ).createSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: The template/part's name. */\n\t\t\t\t\t__( '\"%s\" deleted.' ),\n\t\t\t\t\tdecodeEntities( templateTitle )\n\t\t\t\t),\n\t\t\t\t{ type: 'snackbar', id: 'site-editor-template-deleted-success' }\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 deleting the template.' );\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n\n/**\n * Action that sets a template part.\n *\n * @param {string} templatePartId The template part ID.\n *\n * @return {Object} Action object.\n */\nexport function setTemplatePart( templatePartId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: TEMPLATE_PART_POST_TYPE,\n\t\tid: templatePartId,\n\t};\n}\n\n/**\n * Action that sets a navigation menu.\n *\n * @param {string} navigationMenuId The Navigation Menu Post ID.\n *\n * @return {Object} Action object.\n */\nexport function setNavigationMenu( navigationMenuId ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType: NAVIGATION_POST_TYPE,\n\t\tid: navigationMenuId,\n\t};\n}\n\n/**\n * Action that sets an edited entity.\n *\n * @param {string} postType The entity's post type.\n * @param {string} postId The entity's ID.\n * @param {Object} context The entity's context.\n *\n * @return {Object} Action object.\n */\nexport function setEditedEntity( postType, postId, context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST',\n\t\tpostType,\n\t\tid: postId,\n\t\tcontext,\n\t};\n}\n\n/**\n * @deprecated\n */\nexport function setHomeTemplateId() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn {\n\t\ttype: 'NOTHING',\n\t};\n}\n\n/**\n * Set's the current block editor context.\n *\n * @param {Object} context The context object.\n *\n * @return {Object} Action object.\n */\nexport function setEditedPostContext( context ) {\n\treturn {\n\t\ttype: 'SET_EDITED_POST_CONTEXT',\n\t\tcontext,\n\t};\n}\n\n/**\n * Resolves the template for a page and displays both. If no path is given, attempts\n * to use the postId to generate a path like `?p=${ postId }`.\n *\n * @deprecated\n *\n * @return {number} The resolved template ID for the page route.\n */\nexport function setPage() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setPage\", {\n\t\tsince: '6.5',\n\t\tversion: '6.8',\n\t\thint: 'The setPage is not needed anymore, the correct entity is resolved from the URL automatically.',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Action that sets the active navigation panel menu.\n *\n * @deprecated\n *\n * @return {Object} Action object.\n */\nexport function setNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens the navigation panel and sets its active menu at the same time.\n *\n * @deprecated\n */\nexport function openNavigationPanelToMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).openNavigationPanelToMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Sets whether the navigation panel should be open.\n *\n * @deprecated\n */\nexport function setIsNavigationPanelOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).setIsNavigationPanelOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n\n\treturn { type: 'NOTHING' };\n}\n\n/**\n * Opens or closes the inserter.\n *\n * @param {boolean|Object} value Whether the inserter should be\n * opened (true) or closed (false).\n * To specify an insertion point,\n * use an object.\n * @param {string} value.rootClientId The root client ID to insert at.\n * @param {number} value.insertionIndex The index to insert at.\n *\n * @return {Object} Action object.\n */\nexport function setIsInserterOpened( value ) {\n\treturn {\n\t\ttype: 'SET_IS_INSERTER_OPENED',\n\t\tvalue,\n\t};\n}\n\n/**\n * Returns an action object used to update the settings.\n *\n * @param {Object} settings New settings.\n *\n * @return {Object} Action object.\n */\nexport function updateSettings( settings ) {\n\treturn {\n\t\ttype: 'UPDATE_SETTINGS',\n\t\tsettings,\n\t};\n}\n\n/**\n * Sets whether the list view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the list view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport const setIsListViewOpened =\n\t( isOpen ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree && isOpen ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_IS_LIST_VIEW_OPENED',\n\t\t\tisOpen,\n\t\t} );\n\t};\n\n/**\n * Sets whether the save view panel should be open.\n *\n * @param {boolean} isOpen If true, opens the save view. If false, closes it.\n * It does not toggle the state, but sets it directly.\n */\nexport function setIsSaveViewOpened( isOpen ) {\n\treturn {\n\t\ttype: 'SET_IS_SAVE_VIEW_OPENED',\n\t\tisOpen,\n\t};\n}\n\n/**\n * Reverts a template to its original theme-provided file.\n *\n * @param {Object} template The template to revert.\n * @param {Object} [options]\n * @param {boolean} [options.allowUndo] Whether to allow the user to undo\n * reverting the template. Default true.\n */\nexport const revertTemplate =\n\t( template, { allowUndo = true } = {} ) =>\n\tasync ( { registry } ) => {\n\t\tconst noticeId = 'edit-site-template-reverted';\n\t\tregistry.dispatch( noticesStore ).removeNotice( noticeId );\n\t\tif ( ! isTemplateRevertable( template ) ) {\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( __( 'This template is not revertable.' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templateEntityConfig = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEntityConfig( 'postType', template.type );\n\n\t\t\tif ( ! templateEntityConfig ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst fileTemplatePath = addQueryArgs(\n\t\t\t\t`${ templateEntityConfig.baseURL }/${ template.id }`,\n\t\t\t\t{ context: 'edit', source: 'theme' }\n\t\t\t);\n\n\t\t\tconst fileTemplate = await apiFetch( { path: fileTemplatePath } );\n\t\t\tif ( ! fileTemplate ) {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createErrorNotice(\n\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t'The editor has encountered an unexpected error. Please reload.'\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{ type: 'snackbar' }\n\t\t\t\t\t);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst serializeBlocks = ( {\n\t\t\t\tblocks: blocksForSerialization = [],\n\t\t\t} ) => __unstableSerializeAndClean( blocksForSerialization );\n\n\t\t\tconst edited = registry\n\t\t\t\t.select( coreStore )\n\t\t\t\t.getEditedEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\ttemplate.type,\n\t\t\t\t\ttemplate.id\n\t\t\t\t);\n\n\t\t\t// We are fixing up the undo level here to make sure we can undo\n\t\t\t// the revert in the header toolbar correctly.\n\t\t\tregistry.dispatch( coreStore ).editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id,\n\t\t\t\t{\n\t\t\t\t\tcontent: serializeBlocks, // Required to make the `undo` behave correctly.\n\t\t\t\t\tblocks: edited.blocks, // Required to revert the blocks in the editor.\n\t\t\t\t\tsource: 'custom', // required to avoid turning the editor into a dirty state\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tundoIgnore: true, // Required to merge this edit with the last undo level.\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst blocks = parse( fileTemplate?.content?.raw );\n\t\t\tregistry\n\t\t\t\t.dispatch( coreStore )\n\t\t\t\t.editEntityRecord( 'postType', template.type, fileTemplate.id, {\n\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\tblocks,\n\t\t\t\t\tsource: 'theme',\n\t\t\t\t} );\n\n\t\t\tif ( allowUndo ) {\n\t\t\t\tconst undoRevert = () => {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t\t.editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\ttemplate.type,\n\t\t\t\t\t\t\tedited.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcontent: serializeBlocks,\n\t\t\t\t\t\t\t\tblocks: edited.blocks,\n\t\t\t\t\t\t\t\tsource: 'custom',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t};\n\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t\t.createSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: noticeId,\n\t\t\t\t\t\tactions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\t\tonClick: undoRevert,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t} );\n\t\t\t}\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: __( 'Template revert failed. Please reload.' );\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t};\n/**\n * Action that opens an editor sidebar.\n *\n * @param {?string} name Sidebar name to be opened.\n */\nexport const openGeneralSidebar =\n\t( name ) =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( isDistractionFree ) {\n\t\t\tdispatch.toggleDistractionFree();\n\t\t}\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.enableComplementaryArea( editSiteStoreName, name );\n\t};\n\n/**\n * Action that closes the sidebar.\n */\nexport const closeGeneralSidebar =\n\t() =>\n\t( { registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( interfaceStore )\n\t\t\t.disableComplementaryArea( editSiteStoreName );\n\t};\n\nexport const switchEditorMode =\n\t( mode ) =>\n\t( { dispatch, registry } ) => {\n\t\tregistry\n\t\t\t.dispatch( 'core/preferences' )\n\t\t\t.set( 'core/edit-site', 'editorMode', mode );\n\n\t\t// Unselect blocks when we switch to a non visual mode.\n\t\tif ( mode !== 'visual' ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\n\t\tif ( mode === 'visual' ) {\n\t\t\tspeak( __( 'Visual editor selected' ), 'assertive' );\n\t\t} else if ( mode === 'text' ) {\n\t\t\tconst isDistractionFree = registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\t\tif ( isDistractionFree ) {\n\t\t\t\tdispatch.toggleDistractionFree();\n\t\t\t}\n\t\t\tspeak( __( 'Code editor selected' ), 'assertive' );\n\t\t}\n\t};\n\n/**\n * Sets whether or not the editor allows only page content to be edited.\n *\n * @param {boolean} hasPageContentFocus True to allow only page content to be\n * edited, false to allow template to be\n * edited.\n */\nexport const setHasPageContentFocus =\n\t( hasPageContentFocus ) =>\n\t( { dispatch, registry } ) => {\n\t\tdeprecated( `dispatch( 'core/edit-site' ).setHasPageContentFocus`, {\n\t\t\tsince: '6.5',\n\t\t} );\n\n\t\tif ( hasPageContentFocus ) {\n\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t}\n\t\tdispatch( {\n\t\t\ttype: 'SET_HAS_PAGE_CONTENT_FOCUS',\n\t\t\thasPageContentFocus,\n\t\t} );\n\t};\n\n/**\n * Action that toggles Distraction free mode.\n * Distraction free mode expects there are no sidebars, as due to the\n * z-index values set, you can't close sidebars.\n */\nexport const toggleDistractionFree =\n\t() =>\n\t( { dispatch, registry } ) => {\n\t\tconst isDistractionFree = registry\n\t\t\t.select( preferencesStore )\n\t\t\t.get( 'core/edit-site', 'distractionFree' );\n\t\tif ( ! isDistractionFree ) {\n\t\t\tregistry.batch( () => {\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t\t.set( 'core/edit-site', 'fixedToolbar', true );\n\t\t\t\tdispatch.setIsInserterOpened( false );\n\t\t\t\tdispatch.setIsListViewOpened( false );\n\t\t\t\tdispatch.closeGeneralSidebar();\n\t\t\t} );\n\t\t}\n\t\tregistry.batch( () => {\n\t\t\tregistry\n\t\t\t\t.dispatch( preferencesStore )\n\t\t\t\t.set(\n\t\t\t\t\t'core/edit-site',\n\t\t\t\t\t'distractionFree',\n\t\t\t\t\t! isDistractionFree\n\t\t\t\t);\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createInfoNotice(\n\t\t\t\t\tisDistractionFree\n\t\t\t\t\t\t? __( 'Distraction free off.' )\n\t\t\t\t\t\t: __( 'Distraction free on.' ),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: 'core/edit-site/distraction-free-mode/notice',\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t}\n\t\t\t\t);\n\t\t} );\n\t};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,YAAA,GAAAR,OAAA;AACA,IAAAS,KAAA,GAAAT,OAAA;AACA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAKA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,qBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,WAAA,GAAAd,OAAA;AArBA;AACA;AACA;;AAcA;AACA;AACA;;AAQA;AACA;AACA;AAC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5BmG,GAAG,CAAE,gBAAgB,EAAE,cAAc,EAAE,IAAK,CAAC;MAC/CpG,QAAQ,CAACyD,mBAAmB,CAAE,KAAM,CAAC;MACrCzD,QAAQ,CAAC6D,mBAAmB,CAAE,KAAM,CAAC;MACrC7D,QAAQ,CAACgG,mBAAmB,CAAC,CAAC;IAC/B,CAAE,CAAC;EACJ;EACApG,QAAQ,CAAC8G,KAAK,CAAE,MAAM;IACrB9G,QAAQ,CACNI,QAAQ,CAAEC,kBAAiB,CAAC,CAC5BmG,GAAG,CACH,gBAAgB,EAChB,iBAAiB,EACjB,CAAErC,iBACH,CAAC;IACFnE,QAAQ,CACNI,QAAQ,CAAEgC,cAAa,CAAC,CACxB2E,gBAAgB,CAChB5C,iBAAiB,GACd,IAAA5B,QAAE,EAAE,uBAAwB,CAAC,GAC7B,IAAAA,QAAE,EAAE,sBAAuB,CAAC,EAC/B;MACClB,EAAE,EAAE,6CAA6C;MACjDZ,IAAI,EAAE;IACP,CACD,CAAC;EACH,CAAE,CAAC;AACJ,CAAC;AAACiB,OAAA,CAAA2C,qBAAA,GAAAA,qBAAA"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.setEditorCanvasContainerView = exports.setCanvasMode = void 0;
|
|
7
7
|
var _blockEditor = require("@wordpress/block-editor");
|
|
8
8
|
var _preferences = require("@wordpress/preferences");
|
|
9
9
|
/**
|
|
@@ -17,8 +17,7 @@ var _preferences = require("@wordpress/preferences");
|
|
|
17
17
|
*/
|
|
18
18
|
const setCanvasMode = mode => ({
|
|
19
19
|
registry,
|
|
20
|
-
dispatch
|
|
21
|
-
select
|
|
20
|
+
dispatch
|
|
22
21
|
}) => {
|
|
23
22
|
registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
|
|
24
23
|
dispatch({
|
|
@@ -30,10 +29,6 @@ const setCanvasMode = mode => ({
|
|
|
30
29
|
if (mode === 'edit' && registry.select(_preferences.store).get('core/edit-site', 'showListViewByDefault') && !registry.select(_preferences.store).get('core/edit-site', 'distractionFree')) {
|
|
31
30
|
dispatch.setIsListViewOpened(true);
|
|
32
31
|
}
|
|
33
|
-
// Switch focus away from editing the template when switching to view mode.
|
|
34
|
-
if (mode === 'view' && select.isPage()) {
|
|
35
|
-
dispatch.setHasPageContentFocus(true);
|
|
36
|
-
}
|
|
37
32
|
};
|
|
38
33
|
|
|
39
34
|
/**
|
|
@@ -50,25 +45,5 @@ const setEditorCanvasContainerView = view => ({
|
|
|
50
45
|
view
|
|
51
46
|
});
|
|
52
47
|
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Sets the type of page content focus. Can be one of:
|
|
56
|
-
*
|
|
57
|
-
* - `'disableTemplate'`: Disable the blocks belonging to the page's template.
|
|
58
|
-
* - `'hideTemplate'`: Hide the blocks belonging to the page's template.
|
|
59
|
-
*
|
|
60
|
-
* @param {'disableTemplate'|'hideTemplate'} pageContentFocusType The type of page content focus.
|
|
61
|
-
*
|
|
62
|
-
* @return {Object} Action object.
|
|
63
|
-
*/
|
|
64
48
|
exports.setEditorCanvasContainerView = setEditorCanvasContainerView;
|
|
65
|
-
const setPageContentFocusType = pageContentFocusType => ({
|
|
66
|
-
dispatch
|
|
67
|
-
}) => {
|
|
68
|
-
dispatch({
|
|
69
|
-
type: 'SET_PAGE_CONTENT_FOCUS_TYPE',
|
|
70
|
-
pageContentFocusType
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
exports.setPageContentFocusType = setPageContentFocusType;
|
|
74
49
|
//# sourceMappingURL=private-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_preferences","setCanvasMode","mode","registry","dispatch","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_preferences","setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","setIsListViewOpened","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\tif (\n\t\t\tmode === 'edit' &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core/edit-site', 'distractionFree' )\n\t\t) {\n\t\t\tdispatch.setIsListViewOpened( true );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACO,MAAME,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7BD,QAAQ,CAACC,QAAQ,CAAEC,kBAAiB,CAAC,CAACC,uBAAuB,CAAE,MAAO,CAAC;EACvEF,QAAQ,CAAE;IACTG,IAAI,EAAE,iBAAiB;IACvBL;EACD,CAAE,CAAC;EACH;EACA;EACA,IACCA,IAAI,KAAK,MAAM,IACfC,QAAQ,CACNK,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAE,gBAAgB,EAAE,uBAAwB,CAAC,IAClD,CAAEP,QAAQ,CACRK,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAE,gBAAgB,EAAE,iBAAkB,CAAC,EAC3C;IACDN,QAAQ,CAACO,mBAAmB,CAAE,IAAK,CAAC;EACrC;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAX,aAAA,GAAAA,aAAA;AAKO,MAAMY,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEV;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTG,IAAI,EAAE,kCAAkC;IACxCO;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
|
|
@@ -5,12 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getCanvasMode = getCanvasMode;
|
|
7
7
|
exports.getEditorCanvasContainerView = getEditorCanvasContainerView;
|
|
8
|
-
exports.getPageContentFocusType = getPageContentFocusType;
|
|
9
|
-
var _selectors = require("./selectors");
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
8
|
/**
|
|
15
9
|
* Returns the current canvas mode.
|
|
16
10
|
*
|
|
@@ -32,21 +26,4 @@ function getCanvasMode(state) {
|
|
|
32
26
|
function getEditorCanvasContainerView(state) {
|
|
33
27
|
return state.editorCanvasContainerView;
|
|
34
28
|
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Returns the type of the current page content focus, or null if there is no
|
|
38
|
-
* page content focus.
|
|
39
|
-
*
|
|
40
|
-
* Possible values are:
|
|
41
|
-
*
|
|
42
|
-
* - `'disableTemplate'`: Disable the blocks belonging to the page's template.
|
|
43
|
-
* - `'hideTemplate'`: Hide the blocks belonging to the page's template.
|
|
44
|
-
*
|
|
45
|
-
* @param {Object} state Global application state.
|
|
46
|
-
*
|
|
47
|
-
* @return {'disableTemplate'|'hideTemplate'|null} Type of the current page content focus.
|
|
48
|
-
*/
|
|
49
|
-
function getPageContentFocusType(state) {
|
|
50
|
-
return (0, _selectors.hasPageContentFocus)(state) ? state.pageContentFocusType : null;
|
|
51
|
-
}
|
|
52
29
|
//# sourceMappingURL=private-selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["getCanvasMode","state","canvasMode","getEditorCanvasContainerView","editorCanvasContainerView"],"sources":["@wordpress/edit-site/src/store/private-selectors.js"],"sourcesContent":["/**\n * Returns the current canvas mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Canvas mode.\n */\nexport function getCanvasMode( state ) {\n\treturn state.canvasMode;\n}\n\n/**\n * Returns the editor canvas container view.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editor canvas container view.\n */\nexport function getEditorCanvasContainerView( state ) {\n\treturn state.editorCanvasContainerView;\n}\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAAEC,KAAK,EAAG;EACtC,OAAOA,KAAK,CAACC,UAAU;AACxB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,4BAA4BA,CAAEF,KAAK,EAAG;EACrD,OAAOA,KAAK,CAACG,yBAAyB;AACvC"}
|
package/build/store/reducer.js
CHANGED
|
@@ -7,9 +7,7 @@ exports.blockInserterPanel = blockInserterPanel;
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
exports.deviceType = deviceType;
|
|
9
9
|
exports.editedPost = editedPost;
|
|
10
|
-
exports.hasPageContentFocus = hasPageContentFocus;
|
|
11
10
|
exports.listViewPanel = listViewPanel;
|
|
12
|
-
exports.pageContentFocusType = pageContentFocusType;
|
|
13
11
|
exports.saveViewPanel = saveViewPanel;
|
|
14
12
|
exports.settings = settings;
|
|
15
13
|
var _data = require("@wordpress/data");
|
|
@@ -165,41 +163,6 @@ function editorCanvasContainerView(state = undefined, action) {
|
|
|
165
163
|
}
|
|
166
164
|
return state;
|
|
167
165
|
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Reducer used to track whether the editor allows only page content to be
|
|
171
|
-
* edited.
|
|
172
|
-
*
|
|
173
|
-
* @param {boolean} state Current state.
|
|
174
|
-
* @param {Object} action Dispatched action.
|
|
175
|
-
*
|
|
176
|
-
* @return {boolean} Updated state.
|
|
177
|
-
*/
|
|
178
|
-
function hasPageContentFocus(state = false, action) {
|
|
179
|
-
switch (action.type) {
|
|
180
|
-
case 'SET_EDITED_POST':
|
|
181
|
-
return !!action.context?.postId;
|
|
182
|
-
case 'SET_HAS_PAGE_CONTENT_FOCUS':
|
|
183
|
-
return action.hasPageContentFocus;
|
|
184
|
-
}
|
|
185
|
-
return state;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Reducer used to track the type of page content focus.
|
|
190
|
-
*
|
|
191
|
-
* @param {string} state Current state.
|
|
192
|
-
* @param {Object} action Dispatched action.
|
|
193
|
-
*
|
|
194
|
-
* @return {string} Updated state.
|
|
195
|
-
*/
|
|
196
|
-
function pageContentFocusType(state = 'disableTemplate', action) {
|
|
197
|
-
switch (action.type) {
|
|
198
|
-
case 'SET_PAGE_CONTENT_FOCUS_TYPE':
|
|
199
|
-
return action.pageContentFocusType;
|
|
200
|
-
}
|
|
201
|
-
return state;
|
|
202
|
-
}
|
|
203
166
|
var _default = (0, _data.combineReducers)({
|
|
204
167
|
deviceType,
|
|
205
168
|
settings,
|
|
@@ -208,9 +171,7 @@ var _default = (0, _data.combineReducers)({
|
|
|
208
171
|
listViewPanel,
|
|
209
172
|
saveViewPanel,
|
|
210
173
|
canvasMode,
|
|
211
|
-
editorCanvasContainerView
|
|
212
|
-
hasPageContentFocus,
|
|
213
|
-
pageContentFocusType
|
|
174
|
+
editorCanvasContainerView
|
|
214
175
|
});
|
|
215
176
|
exports.default = _default;
|
|
216
177
|
//# sourceMappingURL=reducer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","deviceType","state","action","type","settings","editedPost","postType","id","context","blockInserterPanel","isOpen","value","listViewPanel","saveViewPanel","canvasMode","mode","editorCanvasContainerView","undefined","view","
|
|
1
|
+
{"version":3,"names":["_data","require","deviceType","state","action","type","settings","editedPost","postType","id","context","blockInserterPanel","isOpen","value","listViewPanel","saveViewPanel","canvasMode","mode","editorCanvasContainerView","undefined","view","_default","combineReducers","exports","default"],"sources":["@wordpress/edit-site/src/store/reducer.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer returning the editing canvas device type.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function deviceType( state = 'Desktop', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_PREVIEW_DEVICE_TYPE':\n\t\t\treturn action.deviceType;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning the settings.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function settings( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'UPDATE_SETTINGS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.settings,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the currently edited Post Type,\n * Post Id and the context provided to fill the content of the block editor.\n *\n * @param {Object} state Current edited post.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function editedPost( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITED_POST':\n\t\t\treturn {\n\t\t\t\tpostType: action.postType,\n\t\t\t\tid: action.id,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t\tcase 'SET_EDITED_POST_CONTEXT':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\tcontext: action.context,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer to set the block inserter panel open or closed.\n *\n * Note: this reducer interacts with the navigation and list view panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {boolean|Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen ? false : state;\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the list view panel open or closed.\n *\n * Note: this reducer interacts with the navigation and inserter panels reducers\n * to make sure that only one of the three panels is open at the same time.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function listViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value ? false : state;\n\t\tcase 'SET_IS_LIST_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer to set the save view panel open or closed.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nexport function saveViewPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_SAVE_VIEW_OPENED':\n\t\t\treturn action.isOpen;\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn false;\n\t}\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas mode (edit or view).\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction canvasMode( state = 'init', action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_CANVAS_MODE':\n\t\t\treturn action.mode;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer used to track the site editor canvas container view.\n * Default is `undefined`, denoting the default, visual block editor.\n * This could be, for example, `'style-book'` (the style book).\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n */\nfunction editorCanvasContainerView( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_EDITOR_CANVAS_CONTAINER_VIEW':\n\t\t\treturn action.view;\n\t}\n\n\treturn state;\n}\n\nexport default combineReducers( {\n\tdeviceType,\n\tsettings,\n\teditedPost,\n\tblockInserterPanel,\n\tlistViewPanel,\n\tsaveViewPanel,\n\tcanvasMode,\n\teditorCanvasContainerView,\n} );\n"],"mappings":";;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAAEC,KAAK,GAAG,SAAS,EAAEC,MAAM,EAAG;EACvD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,yBAAyB;MAC7B,OAAOD,MAAM,CAACF,UAAU;EAC1B;EAEA,OAAOC,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,QAAQA,CAAEH,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAC9C,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACN,GAAGF,KAAK;QACR,GAAGC,MAAM,CAACE;MACX,CAAC;EACH;EAEA,OAAOH,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASI,UAAUA,CAAEJ,KAAK,GAAG,CAAC,CAAC,EAAEC,MAAM,EAAG;EAChD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAO;QACNG,QAAQ,EAAEJ,MAAM,CAACI,QAAQ;QACzBC,EAAE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C,IAAI;IACnB,KAAK,iBAAiB;MACrB,OAAOD,MAAM,CAACa,IAAI;EACpB;EAEA,OAAOd,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASe,yBAAyBA,CAAEf,KAAK,GAAGgB,SAAS,EAAEf,MAAM,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,kCAAkC;MACtC,OAAOD,MAAM,CAACgB,IAAI;EACpB;EAEA,OAAOjB,KAAK;AACb;AAAC,IAAAkB,QAAA,GAEc,IAAAC,qBAAe,EAAE;EAC/BpB,UAAU;EACVI,QAAQ;EACRC,UAAU;EACVI,kBAAkB;EAClBG,aAAa;EACbC,aAAa;EACbC,UAAU;EACVE;AACD,CAAE,CAAC;AAAAK,OAAA,CAAAC,OAAA,GAAAH,QAAA"}
|
package/build/store/selectors.js
CHANGED
|
@@ -31,6 +31,7 @@ var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
|
|
|
31
31
|
var _element = require("@wordpress/element");
|
|
32
32
|
var _preferences = require("@wordpress/preferences");
|
|
33
33
|
var _blockEditor = require("@wordpress/block-editor");
|
|
34
|
+
var _editor = require("@wordpress/editor");
|
|
34
35
|
var _utils = require("./utils");
|
|
35
36
|
var _constants = require("../utils/constants");
|
|
36
37
|
/**
|
|
@@ -206,7 +207,7 @@ const __experimentalGetInsertionPoint = (0, _data.createRegistrySelector)(select
|
|
|
206
207
|
filterValue
|
|
207
208
|
};
|
|
208
209
|
}
|
|
209
|
-
if (
|
|
210
|
+
if (isPage(state) && select(_editor.store).getRenderingMode() !== 'template-only') {
|
|
210
211
|
const [postContentClientId] = select(_blockEditor.store).__experimentalGetGlobalBlocksByName('core/post-content');
|
|
211
212
|
if (postContentClientId) {
|
|
212
213
|
return {
|
|
@@ -320,11 +321,14 @@ function isPage(state) {
|
|
|
320
321
|
/**
|
|
321
322
|
* Whether or not the editor allows only page content to be edited.
|
|
322
323
|
*
|
|
323
|
-
* @
|
|
324
|
+
* @deprecated
|
|
324
325
|
*
|
|
325
326
|
* @return {boolean} Whether or not focus is on editing page content.
|
|
326
327
|
*/
|
|
327
|
-
function hasPageContentFocus(
|
|
328
|
-
|
|
328
|
+
function hasPageContentFocus() {
|
|
329
|
+
(0, _deprecated.default)(`select( 'core/edit-site' ).hasPageContentFocus`, {
|
|
330
|
+
since: '6.5'
|
|
331
|
+
});
|
|
332
|
+
return false;
|
|
329
333
|
}
|
|
330
334
|
//# sourceMappingURL=selectors.js.map
|