@wordpress/edit-site 5.26.0 → 5.27.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 +139 -36
- package/build/components/actions/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +1 -1
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/font-families.js +3 -2
- package/build/components/global-styles/font-families.js.map +1 -1
- package/build/components/global-styles/font-family-item.js +3 -4
- package/build/components/global-styles/font-family-item.js.map +1 -1
- package/build/components/global-styles/font-library-modal/context.js +80 -41
- package/build/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +49 -22
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/fonts-grid.js +4 -1
- package/build/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
- package/build/components/global-styles/font-library-modal/index.js +4 -4
- package/build/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +16 -8
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-card.js +1 -1
- package/build/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
- package/build/components/global-styles/font-library-modal/library-font-variant.js +2 -2
- package/build/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build/components/global-styles/font-library-modal/local-fonts.js +13 -4
- package/build/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/resolvers.js +49 -20
- package/build/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js +6 -2
- package/build/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
- package/build/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/index.js +103 -17
- package/build/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js +4 -3
- package/build/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build/components/global-styles/screen-block.js +10 -0
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -1
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/layout/hooks.js +6 -5
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +19 -28
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +135 -0
- package/build/components/layout/router.js.map +1 -0
- package/build/components/page-pages/index.js +92 -69
- package/build/components/page-pages/index.js.map +1 -1
- package/build/components/page-patterns/dataviews-pattern-actions.js +11 -6
- package/build/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build/components/page-patterns/index.js +295 -15
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +51 -23
- package/build/components/page-templates-template-parts/actions.js.map +1 -0
- package/build/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-templates-template-parts/index.js +395 -0
- package/build/components/page-templates-template-parts/index.js.map +1 -0
- package/build/components/preferences-modal/index.js +9 -134
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/revisions/index.js +1 -1
- package/build/components/revisions/index.js.map +1 -1
- package/build/components/save-button/index.js +4 -2
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-panel/index.js +6 -5
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +3 -1
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +4 -2
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-dataviews/index.js +2 -2
- package/build/components/sidebar-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +8 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +2 -10
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js +26 -3
- package/build/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +63 -8
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/content.js +76 -0
- package/build/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -12
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +33 -5
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +13 -6
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/hooks/template-part-edit.js +7 -6
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +1 -1
- package/build/index.js.map +1 -1
- package/build/store/actions.js +11 -29
- package/build/store/actions.js.map +1 -1
- package/build/store/private-actions.js +85 -1
- package/build/store/private-actions.js.map +1 -1
- package/build/store/selectors.js +2 -2
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/use-actual-current-theme.js +32 -0
- package/build/utils/use-actual-current-theme.js.map +1 -0
- package/build-module/components/actions/index.js +139 -36
- package/build-module/components/actions/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +1 -1
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/font-families.js +3 -2
- package/build-module/components/global-styles/font-families.js.map +1 -1
- package/build-module/components/global-styles/font-family-item.js +4 -5
- package/build-module/components/global-styles/font-family-item.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/context.js +82 -42
- package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +49 -22
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js +4 -1
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/index.js +4 -4
- package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +16 -8
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-card.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js +2 -2
- package/build-module/components/global-styles/font-library-modal/library-font-variant.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/local-fonts.js +13 -4
- package/build-module/components/global-styles/font-library-modal/local-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/resolvers.js +45 -18
- package/build-module/components/global-styles/font-library-modal/resolvers.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js +6 -2
- package/build-module/components/global-styles/font-library-modal/tab-panel-layout.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js +17 -2
- package/build-module/components/global-styles/font-library-modal/utils/filter-fonts.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/index.js +99 -16
- package/build-module/components/global-styles/font-library-modal/utils/index.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js +4 -3
- package/build-module/components/global-styles/font-library-modal/utils/preview-styles.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +10 -0
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +4 -1
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/layout/hooks.js +6 -5
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +19 -28
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +127 -0
- package/build-module/components/layout/router.js.map +1 -0
- package/build-module/components/page-pages/index.js +91 -70
- package/build-module/components/page-pages/index.js.map +1 -1
- package/build-module/components/page-patterns/dataviews-pattern-actions.js +11 -6
- package/build-module/components/page-patterns/dataviews-pattern-actions.js.map +1 -1
- package/build-module/components/page-patterns/index.js +296 -16
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +52 -24
- package/build-module/components/page-templates-template-parts/actions.js.map +1 -0
- package/build-module/components/page-templates-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-templates-template-parts/index.js +385 -0
- package/build-module/components/page-templates-template-parts/index.js.map +1 -0
- package/build-module/components/preferences-modal/index.js +12 -136
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/revisions/index.js +1 -1
- package/build-module/components/revisions/index.js.map +1 -1
- package/build-module/components/save-button/index.js +4 -2
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +7 -6
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +3 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +4 -2
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-dataviews/index.js +2 -2
- package/build-module/components/sidebar-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +8 -7
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -10
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js +27 -4
- package/build-module/components/sidebar-navigation-screen-pages-dataviews/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +64 -9
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js +68 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +9 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +47 -11
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +25 -2
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +33 -5
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +13 -6
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/hooks/template-part-edit.js +7 -6
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +13 -30
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/private-actions.js +83 -0
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/selectors.js +2 -2
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/use-actual-current-theme.js +24 -0
- package/build-module/utils/use-actual-current-theme.js.map +1 -0
- package/build-style/style-rtl.css +316 -215
- package/build-style/style.css +316 -215
- package/package.json +42 -42
- package/src/components/actions/index.js +236 -84
- package/src/components/editor-canvas-container/index.js +1 -1
- package/src/components/global-styles/font-families.js +14 -8
- package/src/components/global-styles/font-family-item.js +7 -4
- package/src/components/global-styles/font-library-modal/context.js +156 -50
- package/src/components/global-styles/font-library-modal/font-collection.js +56 -21
- package/src/components/global-styles/font-library-modal/fonts-grid.js +6 -2
- package/src/components/global-styles/font-library-modal/index.js +4 -4
- package/src/components/global-styles/font-library-modal/installed-fonts.js +18 -8
- package/src/components/global-styles/font-library-modal/library-font-card.js +2 -1
- package/src/components/global-styles/font-library-modal/library-font-variant.js +10 -9
- package/src/components/global-styles/font-library-modal/local-fonts.js +14 -4
- package/src/components/global-styles/font-library-modal/resolvers.js +50 -17
- package/src/components/global-styles/font-library-modal/style.scss +23 -35
- package/src/components/global-styles/font-library-modal/tab-panel-layout.js +30 -26
- package/src/components/global-styles/font-library-modal/utils/filter-fonts.js +19 -2
- package/src/components/global-styles/font-library-modal/utils/index.js +136 -29
- package/src/components/global-styles/font-library-modal/utils/preview-styles.js +7 -3
- package/src/components/global-styles/font-library-modal/utils/test/filter-fonts.spec.js +40 -10
- package/src/components/global-styles/font-library-modal/utils/test/preview-styles.spec.js +5 -5
- package/src/components/global-styles/screen-block.js +10 -0
- package/src/components/global-styles/screen-typography.js +9 -3
- package/src/components/global-styles/style.scss +4 -0
- package/src/components/header-edit-mode/style.scss +15 -5
- package/src/components/layout/hooks.js +6 -5
- package/src/components/layout/index.js +80 -96
- package/src/components/layout/router.js +121 -0
- package/src/components/layout/style.scss +13 -16
- package/src/components/page/style.scss +1 -8
- package/src/components/page-pages/index.js +142 -148
- package/src/components/page-pages/style.scss +41 -2
- package/src/components/page-patterns/dataviews-pattern-actions.js +11 -6
- package/src/components/page-patterns/index.js +392 -14
- package/src/components/page-patterns/style.scss +36 -2
- package/src/components/{page-templates/template-actions.js → page-templates-template-parts/actions.js} +90 -37
- package/src/components/{page-templates → page-templates-template-parts}/index.js +198 -169
- package/src/components/page-templates-template-parts/style.scss +44 -0
- package/src/components/preferences-modal/index.js +8 -211
- package/src/components/revisions/index.js +1 -1
- package/src/components/save-button/index.js +7 -4
- package/src/components/save-panel/index.js +13 -12
- package/src/components/sidebar/index.js +4 -5
- package/src/components/sidebar-dataviews/dataview-item.js +2 -1
- package/src/components/sidebar-dataviews/default-views.js +4 -2
- package/src/components/sidebar-dataviews/index.js +8 -6
- package/src/components/sidebar-navigation-item/style.scss +1 -1
- package/src/components/sidebar-navigation-screen/index.js +19 -10
- package/src/components/sidebar-navigation-screen-pages/index.js +2 -10
- package/src/components/sidebar-navigation-screen-pages-dataviews/index.js +32 -6
- package/src/components/sidebar-navigation-screen-templates/index.js +85 -28
- package/src/components/sidebar-navigation-screen-templates/style.scss +9 -0
- package/src/components/sidebar-navigation-screen-templates-browse/content.js +73 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +10 -1
- package/src/components/site-hub/index.js +4 -1
- package/src/components/site-hub/style.scss +1 -12
- package/src/components/site-icon/style.scss +1 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +40 -10
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +32 -0
- package/src/hooks/commands/use-edit-mode-commands.js +50 -3
- package/src/hooks/push-changes-to-global-styles/index.js +29 -23
- package/src/hooks/template-part-edit.js +12 -12
- package/src/index.js +1 -1
- package/src/store/actions.js +17 -51
- package/src/store/private-actions.js +133 -0
- package/src/store/selectors.js +2 -4
- package/src/style.scss +2 -1
- package/src/utils/get-is-list-page.js +3 -2
- package/src/utils/use-actual-current-theme.js +27 -0
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
- package/build/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
- package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -71
- package/build/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
- package/build/components/page-main/index.js +0 -44
- package/build/components/page-main/index.js.map +0 -1
- package/build/components/page-patterns/dataviews-patterns.js +0 -307
- package/build/components/page-patterns/dataviews-patterns.js.map +0 -1
- package/build/components/page-template-parts/add-new-template-part.js.map +0 -1
- package/build/components/page-template-parts/index.js +0 -81
- package/build/components/page-template-parts/index.js.map +0 -1
- package/build/components/page-templates/index.js +0 -352
- package/build/components/page-templates/index.js.map +0 -1
- package/build/components/page-templates/template-actions.js.map +0 -1
- package/build/components/post-preview/index.js +0 -29
- package/build/components/post-preview/index.js.map +0 -1
- package/build/components/preferences-modal/enable-feature.js +0 -36
- package/build/components/preferences-modal/enable-feature.js.map +0 -1
- package/build/components/preferences-modal/enable-panel-option.js +0 -33
- package/build/components/preferences-modal/enable-panel-option.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -52
- package/build-module/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -63
- package/build-module/components/global-styles/font-library-modal/utils/get-notice-from-response.js.map +0 -1
- package/build-module/components/page-main/index.js +0 -36
- package/build-module/components/page-main/index.js.map +0 -1
- package/build-module/components/page-patterns/dataviews-patterns.js +0 -299
- package/build-module/components/page-patterns/dataviews-patterns.js.map +0 -1
- package/build-module/components/page-template-parts/add-new-template-part.js.map +0 -1
- package/build-module/components/page-template-parts/index.js +0 -73
- package/build-module/components/page-template-parts/index.js.map +0 -1
- package/build-module/components/page-templates/index.js +0 -344
- package/build-module/components/page-templates/index.js.map +0 -1
- package/build-module/components/page-templates/template-actions.js.map +0 -1
- package/build-module/components/post-preview/index.js +0 -21
- package/build-module/components/post-preview/index.js.map +0 -1
- package/build-module/components/preferences-modal/enable-feature.js +0 -29
- package/build-module/components/preferences-modal/enable-feature.js.map +0 -1
- package/build-module/components/preferences-modal/enable-panel-option.js +0 -26
- package/build-module/components/preferences-modal/enable-panel-option.js.map +0 -1
- package/src/components/global-styles/font-library-modal/utils/get-intersecting-font-faces.js +0 -58
- package/src/components/global-styles/font-library-modal/utils/get-notice-from-response.js +0 -62
- package/src/components/global-styles/font-library-modal/utils/test/getIntersectingFontFaces.spec.js +0 -271
- package/src/components/global-styles/font-library-modal/utils/test/makeFormDataFromFontFamily.spec.js +0 -58
- package/src/components/page-main/index.js +0 -38
- package/src/components/page-patterns/dataviews-patterns.js +0 -380
- package/src/components/page-template-parts/index.js +0 -99
- package/src/components/page-templates/style.scss +0 -13
- package/src/components/post-preview/index.js +0 -16
- package/src/components/preferences-modal/enable-feature.js +0 -31
- package/src/components/preferences-modal/enable-panel-option.js +0 -23
- /package/build/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
- /package/build-module/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
- /package/src/components/{page-template-parts → page-templates-template-parts}/add-new-template-part.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","editorStore","setIsListViewOpened","setIsInserterOpened","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';\nimport { store as editorStore } from '@wordpress/editor';\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', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\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;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMG,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,MAAM,EAAE,uBAAwB,CAAC,IACxC,CAAEP,QAAQ,CACRK,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAE,MAAM,EAAE,iBAAkB,CAAC,EACjC;IACDP,QAAQ,CAACC,QAAQ,CAAEO,aAAY,CAAC,CAACC,mBAAmB,CAAE,IAAK,CAAC;EAC7D,CAAC,MAAM;IACNT,QAAQ,CAACC,QAAQ,CAAEO,aAAY,CAAC,CAACC,mBAAmB,CAAE,KAAM,CAAC;EAC9D;EACAT,QAAQ,CAACC,QAAQ,CAAEO,aAAY,CAAC,CAACE,mBAAmB,CAAE,KAAM,CAAC;AAC9D,CAAC;;AAEF;AACA;AACA;AACA;AACA;AAJAC,OAAA,CAAAb,aAAA,GAAAA,aAAA;AAKO,MAAMc,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEZ;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTG,IAAI,EAAE,kCAAkC;IACxCS;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA"}
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_preferences","_editor","_coreData","_notices","_i18n","_htmlEntities","_constants","setCanvasMode","mode","registry","dispatch","blockEditorStore","__unstableSetEditorMode","type","select","preferencesStore","get","editorStore","setIsListViewOpened","setIsInserterOpened","exports","setEditorCanvasContainerView","view","removeTemplates","items","isTemplate","TEMPLATE_POST_TYPE","promiseResult","Promise","allSettled","map","item","coreStore","deleteEntityRecord","id","force","throwOnError","every","status","successMessage","length","title","rendered","sprintf","__","decodeEntities","noticesStore","createSuccessNotice","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","createErrorNotice"],"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';\nimport { store as editorStore } from '@wordpress/editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { TEMPLATE_POST_TYPE } from '../utils/constants';\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', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\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\n/**\n * Action that removes an array of templates.\n *\n * @param {Array} items An array of template or template part objects to remove.\n */\nexport const removeTemplates =\n\t( items ) =>\n\tasync ( { registry } ) => {\n\t\tconst isTemplate = items[ 0 ].type === TEMPLATE_POST_TYPE;\n\t\tconst promiseResult = await Promise.allSettled(\n\t\t\titems.map( ( item ) => {\n\t\t\t\treturn registry\n\t\t\t\t\t.dispatch( coreStore )\n\t\t\t\t\t.deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\titem.type,\n\t\t\t\t\t\titem.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t} )\n\t\t);\n\n\t\t// If all the promises were fulfilled with sucess.\n\t\tif ( promiseResult.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\t\tlet successMessage;\n\n\t\t\tif ( items.length === 1 ) {\n\t\t\t\t// Depending on how the entity was retrieved its title might be\n\t\t\t\t// an object or simple string.\n\t\t\t\tconst title =\n\t\t\t\t\ttypeof items[ 0 ].title === 'string'\n\t\t\t\t\t\t? items[ 0 ].title\n\t\t\t\t\t\t: items[ 0 ].title?.rendered;\n\t\t\t\tsuccessMessage = sprintf(\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( title )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tsuccessMessage = isTemplate\n\t\t\t\t\t? __( 'Templates deleted.' )\n\t\t\t\t\t: __( 'Template parts deleted.' );\n\t\t\t}\n\n\t\t\tregistry\n\t\t\t\t.dispatch( noticesStore )\n\t\t\t\t.createSuccessNotice( successMessage, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'site-editor-template-deleted-success',\n\t\t\t\t} );\n\t\t} else {\n\t\t\t// If there was at lease one failure.\n\t\t\tlet errorMessage;\n\t\t\t// If we were trying to delete a single template.\n\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __( 'An error occurred while deleting the template.' )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template part.'\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t\t// If we were trying to delete a multiple templates\n\t\t\t} else {\n\t\t\t\tconst errorMessages = new Set();\n\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t);\n\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\terrorMessages.add( failedPromise.reason.message );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the templates.'\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts.'\n\t\t\t\t\t\t );\n\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t );\n\t\t\t\t} else {\n\t\t\t\t\terrorMessage = isTemplate\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the templates: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while deleting the template parts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t );\n\t\t\t\t}\n\t\t\t}\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"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAKA,IAAAO,UAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACO,MAAMQ,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,MAAM,EAAE,uBAAwB,CAAC,IACxC,CAAEP,QAAQ,CACRK,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,GAAG,CAAE,MAAM,EAAE,iBAAkB,CAAC,EACjC;IACDP,QAAQ,CAACC,QAAQ,CAAEO,aAAY,CAAC,CAACC,mBAAmB,CAAE,IAAK,CAAC;EAC7D,CAAC,M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,CAACM,IAAI,KAAK,CAAC,EAAG;QAC/BT,YAAY,GAAGvB,UAAU,GACtB,IAAAmB,QAAE,EACF,iDACA,CAAC,GACD,IAAAA,QAAE,EACF,sDACA,CAAC;MACL,CAAC,MAAM,IAAKO,aAAa,CAACM,IAAI,KAAK,CAAC,EAAG;QACtCT,YAAY,GAAGvB,UAAU,GACtB,IAAAkB,aAAO,GACP;QACA,IAAAC,QAAE,EACD,oDACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAAE,CAAC,CACvB,CAAC,GACD,IAAAR,aAAO,GACP;QACA,IAAAC,QAAE,EACD,yDACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAAE,CAAC,CACvB,CAAC;MACL,CAAC,MAAM;QACNH,YAAY,GAAGvB,UAAU,GACtB,IAAAkB,aAAO,GACP;QACA,IAAAC,QAAE,EACD,uDACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAACO,IAAI,CAAE,GAAI,CAC/B,CAAC,GACD,IAAAf,aAAO,GACP;QACA,IAAAC,QAAE,EACD,4DACD,CAAC,EACD,CAAE,GAAGO,aAAa,CAAE,CAACO,IAAI,CAAE,GAAI,CAC/B,CAAC;MACL;IACD;IACAjD,QAAQ,CACNC,QAAQ,CAAEoC,cAAa,CAAC,CACxBa,iBAAiB,CAAEX,YAAY,EAAE;MAAEnC,IAAI,EAAE;IAAW,CAAE,CAAC;EAC1D;AACD,CAAC;AAACO,OAAA,CAAAG,eAAA,GAAAA,eAAA"}
|
package/build/store/selectors.js
CHANGED
|
@@ -254,7 +254,7 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
|
|
|
254
254
|
const templateParts = select(_coreData.store).getEntityRecords('postType', _constants.TEMPLATE_PART_POST_TYPE, {
|
|
255
255
|
per_page: -1
|
|
256
256
|
});
|
|
257
|
-
const clientIds = select(_blockEditor.store).
|
|
257
|
+
const clientIds = select(_blockEditor.store).getBlocksByName('core/template-part');
|
|
258
258
|
const blocks = select(_blockEditor.store).getBlocksByClientId(clientIds);
|
|
259
259
|
return (0, _utils.getFilteredTemplatePartBlocks)(blocks, templateParts);
|
|
260
260
|
});
|
|
@@ -268,7 +268,7 @@ const getCurrentTemplateTemplateParts = (0, _data.createRegistrySelector)(select
|
|
|
268
268
|
*/
|
|
269
269
|
exports.getCurrentTemplateTemplateParts = getCurrentTemplateTemplateParts;
|
|
270
270
|
const getEditorMode = (0, _data.createRegistrySelector)(select => () => {
|
|
271
|
-
return select(_preferences.store).get('core
|
|
271
|
+
return select(_preferences.store).get('core', 'editorMode');
|
|
272
272
|
});
|
|
273
273
|
|
|
274
274
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","__experimentalGetGlobalBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).__experimentalGetGlobalBlocksByName(\n\t\t\t\t'core/template-part'\n\t\t\t);\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core/edit-site', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;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G;EAC/B,OAAO,CAAC,CAAEA,KAAK,CAACI,UAAU,CAACK,OAAO,EAAEuB,MAAM;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAA,EAAG;EACrC,IAAArD,mBAAU,EAAG,gDAA+C,EAAE;IAC7DC,KAAK,EAAE;EACR,CAAE,CAAC;EAEH,OAAO,KAAK;AACb"}
|
|
1
|
+
{"version":3,"names":["_coreData","require","_data","_deprecated","_interopRequireDefault","_element","_preferences","_blockEditor","_editor","_utils","_constants","_lockUnlock","isFeatureActive","createRegistrySelector","select","_","featureName","deprecated","since","alternative","preferencesStore","get","exports","__experimentalGetPreviewDeviceType","version","editorStore","getDeviceType","getCanUserCreateMedia","coreDataStore","canUser","getReusableBlocks","isWeb","Platform","OS","getEntityRecords","per_page","getSettings","state","settings","getHomeTemplateId","getEditedPostType","editedPost","postType","getEditedPostId","id","getEditedPostContext","context","getPage","isInserterOpened","__experimentalGetInsertionPoint","unlock","getInsertionPoint","isListViewOpened","isSaveViewOpened","saveViewPanel","getCurrentTemplateTemplateParts","templateParts","TEMPLATE_PART_POST_TYPE","clientIds","blockEditorStore","getBlocksByName","blocks","getBlocksByClientId","getFilteredTemplatePartBlocks","getEditorMode","getCurrentTemplateNavigationPanelSubMenu","getNavigationPanelActiveMenu","isNavigationOpened","isPage","postId","hasPageContentFocus"],"sources":["@wordpress/edit-site/src/store/selectors.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { createRegistrySelector } from '@wordpress/data';\nimport deprecated from '@wordpress/deprecated';\nimport { Platform } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { getFilteredTemplatePartBlocks } from './utils';\nimport { TEMPLATE_PART_POST_TYPE } from '../utils/constants';\nimport { unlock } from '../lock-unlock';\n\n/**\n * @typedef {'template'|'template_type'} TemplateType Template type.\n */\n\n/**\n * Returns whether the given feature is enabled or not.\n *\n * @deprecated\n * @param {Object} state Global application state.\n * @param {string} featureName Feature slug.\n *\n * @return {boolean} Is active.\n */\nexport const isFeatureActive = createRegistrySelector(\n\t( select ) => ( _, featureName ) => {\n\t\tdeprecated( `select( 'core/edit-site' ).isFeatureActive`, {\n\t\t\tsince: '6.0',\n\t\t\talternative: `select( 'core/preferences' ).get`,\n\t\t} );\n\n\t\treturn !! select( preferencesStore ).get(\n\t\t\t'core/edit-site',\n\t\t\tfeatureName\n\t\t);\n\t}\n);\n\n/**\n * Returns the current editing canvas device type.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Device type.\n */\nexport const __experimentalGetPreviewDeviceType = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetPreviewDeviceType`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t\talternative: `select( 'core/editor' ).getDeviceType`,\n\t\t\t}\n\t\t);\n\t\treturn select( editorStore ).getDeviceType();\n\t}\n);\n\n/**\n * Returns whether the current user can create media or not.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Whether the current user can create media or not.\n */\nexport const getCanUserCreateMedia = createRegistrySelector(\n\t( select ) => () => select( coreDataStore ).canUser( 'create', 'media' )\n);\n\n/**\n * Returns any available Reusable blocks.\n *\n * @param {Object} state Global application state.\n *\n * @return {Array} The available reusable blocks.\n */\nexport const getReusableBlocks = createRegistrySelector( ( select ) => () => {\n\tdeprecated(\n\t\t\"select( 'core/core' ).getEntityRecords( 'postType', 'wp_block' )\",\n\t\t{\n\t\t\tsince: '6.5',\n\t\t\tversion: '6.8',\n\t\t}\n\t);\n\tconst isWeb = Platform.OS === 'web';\n\treturn isWeb\n\t\t? select( coreDataStore ).getEntityRecords( 'postType', 'wp_block', {\n\t\t\t\tper_page: -1,\n\t\t } )\n\t\t: [];\n} );\n\n/**\n * Returns the site editor settings.\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} Settings.\n */\nexport function getSettings( state ) {\n\t// It is important that we don't inject anything into these settings locally.\n\t// The reason for this is that we have an effect in place that calls setSettings based on the previous value of getSettings.\n\t// If we add computed settings here, we'll be adding these computed settings to the state which is very unexpected.\n\treturn state.settings;\n}\n\n/**\n * @deprecated\n */\nexport function getHomeTemplateId() {\n\tdeprecated( \"select( 'core/edit-site' ).getHomeTemplateId\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Returns the current edited post type (wp_template or wp_template_part).\n *\n * @param {Object} state Global application state.\n *\n * @return {TemplateType?} Template type.\n */\nexport function getEditedPostType( state ) {\n\treturn state.editedPost.postType;\n}\n\n/**\n * Returns the ID of the currently edited template or template part.\n *\n * @param {Object} state Global application state.\n *\n * @return {string?} Post ID.\n */\nexport function getEditedPostId( state ) {\n\treturn state.editedPost.id;\n}\n\n/**\n * Returns the edited post's context object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getEditedPostContext( state ) {\n\treturn state.editedPost.context;\n}\n\n/**\n * Returns the current page object.\n *\n * @deprecated\n * @param {Object} state Global application state.\n *\n * @return {Object} Page.\n */\nexport function getPage( state ) {\n\treturn { context: state.editedPost.context };\n}\n\n/**\n * Returns true if the inserter is opened.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the inserter is opened.\n */\nexport const isInserterOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isInserterOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isInserterOpened`,\n\t} );\n\treturn select( editorStore ).isInserterOpened();\n} );\n\n/**\n * Get the insertion point for the inserter.\n *\n * @deprecated\n *\n * @param {Object} state Global application state.\n *\n * @return {Object} The root client ID, index to insert at and starting filter value.\n */\nexport const __experimentalGetInsertionPoint = createRegistrySelector(\n\t( select ) => () => {\n\t\tdeprecated(\n\t\t\t`select( 'core/edit-site' ).__experimentalGetInsertionPoint`,\n\t\t\t{\n\t\t\t\tsince: '6.5',\n\t\t\t\tversion: '6.7',\n\t\t\t}\n\t\t);\n\t\treturn unlock( select( editorStore ) ).getInsertionPoint();\n\t}\n);\n\n/**\n * Returns true if the list view is opened.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether the list view is opened.\n */\nexport const isListViewOpened = createRegistrySelector( ( select ) => () => {\n\tdeprecated( `select( 'core/edit-site' ).isListViewOpened`, {\n\t\tsince: '6.5',\n\t\talternative: `select( 'core/editor' ).isListViewOpened`,\n\t} );\n\treturn select( editorStore ).isListViewOpened();\n} );\n\n/**\n * Returns the current opened/closed state of the save panel.\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} True if the save panel should be open; false if closed.\n */\nexport function isSaveViewOpened( state ) {\n\treturn state.saveViewPanel;\n}\n\n/**\n * Returns the template parts and their blocks for the current edited template.\n *\n * @param {Object} state Global application state.\n * @return {Array} Template parts and their blocks in an array.\n */\nexport const getCurrentTemplateTemplateParts = createRegistrySelector(\n\t( select ) => () => {\n\t\tconst templateParts = select( coreDataStore ).getEntityRecords(\n\t\t\t'postType',\n\t\t\tTEMPLATE_PART_POST_TYPE,\n\t\t\t{ per_page: -1 }\n\t\t);\n\n\t\tconst clientIds =\n\t\t\tselect( blockEditorStore ).getBlocksByName( 'core/template-part' );\n\t\tconst blocks =\n\t\t\tselect( blockEditorStore ).getBlocksByClientId( clientIds );\n\n\t\treturn getFilteredTemplatePartBlocks( blocks, templateParts );\n\t}\n);\n\n/**\n * Returns the current editing mode.\n *\n * @param {Object} state Global application state.\n *\n * @return {string} Editing mode.\n */\nexport const getEditorMode = createRegistrySelector( ( select ) => () => {\n\treturn select( preferencesStore ).get( 'core', 'editorMode' );\n} );\n\n/**\n * @deprecated\n */\nexport function getCurrentTemplateNavigationPanelSubMenu() {\n\tdeprecated(\n\t\t\"dispatch( 'core/edit-site' ).getCurrentTemplateNavigationPanelSubMenu\",\n\t\t{\n\t\t\tsince: '6.2',\n\t\t\tversion: '6.4',\n\t\t}\n\t);\n}\n\n/**\n * @deprecated\n */\nexport function getNavigationPanelActiveMenu() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).getNavigationPanelActiveMenu\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * @deprecated\n */\nexport function isNavigationOpened() {\n\tdeprecated( \"dispatch( 'core/edit-site' ).isNavigationOpened\", {\n\t\tsince: '6.2',\n\t\tversion: '6.4',\n\t} );\n}\n\n/**\n * Whether or not the editor has a page loaded into it.\n *\n * @see setPage\n *\n * @param {Object} state Global application state.\n *\n * @return {boolean} Whether or not the editor has a page loaded into it.\n */\nexport function isPage( state ) {\n\treturn !! state.editedPost.context?.postId;\n}\n\n/**\n * Whether or not the editor allows only page content to be edited.\n *\n * @deprecated\n *\n * @return {boolean} Whether or not focus is on editing page content.\n */\nexport function hasPageContentFocus() {\n\tdeprecated( `select( 'core/edit-site' ).hasPageContentFocus`, {\n\t\tsince: '6.5',\n\t} );\n\n\treturn false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAKA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AACA,IAAAU,WAAA,GAAAV,OAAA;AAhBA;AACA;AACA;;AASA;AACA;AACA;;AAKA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMW,eAAe,GAAG,IAA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,CAAC;EAEH,OAAO,KAAK;AACb"}
|
|
@@ -20,7 +20,7 @@ function getIsListPage({
|
|
|
20
20
|
categoryType,
|
|
21
21
|
categoryId
|
|
22
22
|
}, isMobileViewport) {
|
|
23
|
-
return ['/wp_template/all', '/wp_template_part/all'].includes(path) || path === '/
|
|
23
|
+
return ['/wp_template/all', '/wp_template_part/all', '/pages'].includes(path) || path === '/patterns' && (
|
|
24
24
|
// Don't treat "/patterns" without categoryType and categoryId as a
|
|
25
25
|
// list page in mobile because the sidebar covers the whole page.
|
|
26
26
|
!isMobileViewport || !!categoryType && !!categoryId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"
|
|
1
|
+
{"version":3,"names":["getIsListPage","path","categoryType","categoryId","isMobileViewport","includes"],"sources":["@wordpress/edit-site/src/utils/get-is-list-page.js"],"sourcesContent":["/**\n * Returns if the params match the list page route.\n *\n * @param {Object} params The url params.\n * @param {string} params.path The current path.\n * @param {string} [params.categoryType] The current category type.\n * @param {string} [params.categoryId] The current category id.\n * @param {boolean} isMobileViewport Is mobile viewport.\n *\n * @return {boolean} Is list page or not.\n */\nexport default function getIsListPage(\n\t{ path, categoryType, categoryId },\n\tisMobileViewport\n) {\n\treturn (\n\t\t[ '/wp_template/all', '/wp_template_part/all', '/pages' ].includes(\n\t\t\tpath\n\t\t) ||\n\t\t( path === '/patterns' &&\n\t\t\t// Don't treat \"/patterns\" without categoryType and categoryId as a\n\t\t\t// list page in mobile because the sidebar covers the whole page.\n\t\t\t( ! isMobileViewport || ( !! categoryType && !! categoryId ) ) )\n\t);\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAASA,aAAaA,CACpC;EAAEC,IAAI;EAAEC,YAAY;EAAEC;AAAW,CAAC,EAClCC,gBAAgB,EACf;EACD,OACC,CAAE,kBAAkB,EAAE,uBAAuB,EAAE,QAAQ,CAAE,CAACC,QAAQ,CACjEJ,IACD,CAAC,IACCA,IAAI,KAAK,WAAW;EACrB;EACA;EACE,CAAEG,gBAAgB,IAAM,CAAC,CAAEF,YAAY,IAAI,CAAC,CAAEC,UAAY,CAAI;AAEnE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useActualCurrentTheme = useActualCurrentTheme;
|
|
8
|
+
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
9
|
+
var _element = require("@wordpress/element");
|
|
10
|
+
var _url = require("@wordpress/url");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
const ACTIVE_THEMES_URL = '/wp/v2/themes?status=active';
|
|
16
|
+
function useActualCurrentTheme() {
|
|
17
|
+
const [currentTheme, setCurrentTheme] = (0, _element.useState)();
|
|
18
|
+
(0, _element.useEffect)(() => {
|
|
19
|
+
// Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware.
|
|
20
|
+
const path = (0, _url.addQueryArgs)(ACTIVE_THEMES_URL, {
|
|
21
|
+
context: 'edit',
|
|
22
|
+
wp_theme_preview: ''
|
|
23
|
+
});
|
|
24
|
+
(0, _apiFetch.default)({
|
|
25
|
+
path
|
|
26
|
+
}).then(activeThemes => setCurrentTheme(activeThemes[0]))
|
|
27
|
+
// Do nothing
|
|
28
|
+
.catch(() => {});
|
|
29
|
+
}, []);
|
|
30
|
+
return currentTheme;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=use-actual-current-theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_element","_url","ACTIVE_THEMES_URL","useActualCurrentTheme","currentTheme","setCurrentTheme","useState","useEffect","path","addQueryArgs","context","wp_theme_preview","apiFetch","then","activeThemes","catch"],"sources":["@wordpress/edit-site/src/utils/use-actual-current-theme.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { useState, useEffect } from '@wordpress/element';\nimport { addQueryArgs } from '@wordpress/url';\n\nconst ACTIVE_THEMES_URL = '/wp/v2/themes?status=active';\n\nexport function useActualCurrentTheme() {\n\tconst [ currentTheme, setCurrentTheme ] = useState();\n\n\tuseEffect( () => {\n\t\t// Set the `wp_theme_preview` to empty string to bypass the createThemePreviewMiddleware.\n\t\tconst path = addQueryArgs( ACTIVE_THEMES_URL, {\n\t\t\tcontext: 'edit',\n\t\t\twp_theme_preview: '',\n\t\t} );\n\n\t\tapiFetch( { path } )\n\t\t\t.then( ( activeThemes ) => setCurrentTheme( activeThemes[ 0 ] ) )\n\t\t\t// Do nothing\n\t\t\t.catch( () => {} );\n\t}, [] );\n\n\treturn currentTheme;\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA,MAAMG,iBAAiB,GAAG,6BAA6B;AAEhD,SAASC,qBAAqBA,CAAA,EAAG;EACvC,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAG,IAAAC,iBAAQ,EAAC,CAAC;EAEpD,IAAAC,kBAAS,EAAE,MAAM;IAChB;IACA,MAAMC,IAAI,GAAG,IAAAC,iBAAY,EAAEP,iBAAiB,EAAE;MAC7CQ,OAAO,EAAE,MAAM;MACfC,gBAAgB,EAAE;IACnB,CAAE,CAAC;IAEH,IAAAC,iBAAQ,EAAE;MAAEJ;IAAK,CAAE,CAAC,CAClBK,IAAI,CAAIC,YAAY,IAAMT,eAAe,CAAES,YAAY,CAAE,CAAC,CAAG,CAAE;IAChE;IAAA,CACCC,KAAK,CAAE,MAAM,CAAC,CAAE,CAAC;EACpB,CAAC,EAAE,EAAG,CAAC;EAEP,OAAOX,YAAY;AACpB"}
|
|
@@ -30,10 +30,12 @@ export const trashPostAction = {
|
|
|
30
30
|
}) {
|
|
31
31
|
return status !== 'trash';
|
|
32
32
|
},
|
|
33
|
+
supportsBulk: true,
|
|
33
34
|
hideModalHeader: true,
|
|
34
35
|
RenderModal: ({
|
|
35
|
-
|
|
36
|
-
closeModal
|
|
36
|
+
items: posts,
|
|
37
|
+
closeModal,
|
|
38
|
+
onPerform
|
|
37
39
|
}) => {
|
|
38
40
|
const {
|
|
39
41
|
createSuccessNotice,
|
|
@@ -44,9 +46,11 @@ export const trashPostAction = {
|
|
|
44
46
|
} = useDispatch(coreStore);
|
|
45
47
|
return createElement(VStack, {
|
|
46
48
|
spacing: "5"
|
|
47
|
-
}, createElement(Text, null, sprintf(
|
|
49
|
+
}, createElement(Text, null, posts.length === 1 ? sprintf(
|
|
48
50
|
// translators: %s: The page's title.
|
|
49
|
-
__('Are you sure you want to delete "%s"?'), decodeEntities(
|
|
51
|
+
__('Are you sure you want to delete "%s"?'), decodeEntities(posts[0].title.rendered)) : sprintf(
|
|
52
|
+
// translators: %d: The number of pages (2 or more).
|
|
53
|
+
__('Are you sure you want to delete %d pages?'), posts.length)), createElement(HStack, {
|
|
50
54
|
justify: "right"
|
|
51
55
|
}, createElement(Button, {
|
|
52
56
|
variant: "tertiary",
|
|
@@ -54,21 +58,65 @@ export const trashPostAction = {
|
|
|
54
58
|
}, __('Cancel')), createElement(Button, {
|
|
55
59
|
variant: "primary",
|
|
56
60
|
onClick: async () => {
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
const promiseResult = await Promise.allSettled(posts.map(post => {
|
|
62
|
+
return deleteEntityRecord('postType', post.type, post.id, {}, {
|
|
59
63
|
throwOnError: true
|
|
60
64
|
});
|
|
61
|
-
|
|
62
|
-
|
|
65
|
+
}));
|
|
66
|
+
// If all the promises were fulfilled with success.
|
|
67
|
+
if (promiseResult.every(({
|
|
68
|
+
status
|
|
69
|
+
}) => status === 'fulfilled')) {
|
|
70
|
+
let successMessage;
|
|
71
|
+
if (promiseResult.length === 1) {
|
|
72
|
+
successMessage = sprintf( /* translators: The posts's title. */
|
|
73
|
+
__('"%s" moved to the Trash.'), decodeEntities(posts[0].title.rendered));
|
|
74
|
+
} else {
|
|
75
|
+
successMessage = __('Pages moved to the Trash.');
|
|
76
|
+
}
|
|
77
|
+
createSuccessNotice(successMessage, {
|
|
63
78
|
type: 'snackbar',
|
|
64
79
|
id: 'edit-site-page-trashed'
|
|
65
80
|
});
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
} else {
|
|
82
|
+
// If there was at lease one failure.
|
|
83
|
+
let errorMessage;
|
|
84
|
+
// If we were trying to move a single post to the trash.
|
|
85
|
+
if (promiseResult.length === 1) {
|
|
86
|
+
if (promiseResult[0].reason?.message) {
|
|
87
|
+
errorMessage = promiseResult[0].reason.message;
|
|
88
|
+
} else {
|
|
89
|
+
errorMessage = __('An error occurred while moving the post to the trash.');
|
|
90
|
+
}
|
|
91
|
+
// If we were trying to move multiple posts to the trash
|
|
92
|
+
} else {
|
|
93
|
+
const errorMessages = new Set();
|
|
94
|
+
const failedPromises = promiseResult.filter(({
|
|
95
|
+
status
|
|
96
|
+
}) => status === 'rejected');
|
|
97
|
+
for (const failedPromise of failedPromises) {
|
|
98
|
+
if (failedPromise.reason?.message) {
|
|
99
|
+
errorMessages.add(failedPromise.reason.message);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
if (errorMessages.size === 0) {
|
|
103
|
+
errorMessage = __('An error occurred while moving the posts to the trash.');
|
|
104
|
+
} else if (errorMessages.size === 1) {
|
|
105
|
+
errorMessage = sprintf( /* translators: %s: an error message */
|
|
106
|
+
__('An error occurred while moving the posts to the trash: %s'), [...errorMessages][0]);
|
|
107
|
+
} else {
|
|
108
|
+
errorMessage = sprintf( /* translators: %s: a list of comma separated error messages */
|
|
109
|
+
__('Some errors occurred while moving the pages to the trash: %s'), [...errorMessages].join(','));
|
|
110
|
+
}
|
|
111
|
+
createErrorNotice(errorMessage, {
|
|
112
|
+
type: 'snackbar'
|
|
113
|
+
});
|
|
114
|
+
}
|
|
71
115
|
}
|
|
116
|
+
if (onPerform) {
|
|
117
|
+
onPerform();
|
|
118
|
+
}
|
|
119
|
+
closeModal();
|
|
72
120
|
}
|
|
73
121
|
}, __('Delete'))));
|
|
74
122
|
}
|
|
@@ -86,28 +134,69 @@ export function usePermanentlyDeletePostAction() {
|
|
|
86
134
|
label: __('Permanently delete'),
|
|
87
135
|
isPrimary: true,
|
|
88
136
|
icon: trash,
|
|
137
|
+
supportsBulk: true,
|
|
89
138
|
isEligible({
|
|
90
139
|
status
|
|
91
140
|
}) {
|
|
92
141
|
return status === 'trash';
|
|
93
142
|
},
|
|
94
|
-
async callback(
|
|
95
|
-
|
|
96
|
-
|
|
143
|
+
async callback(posts) {
|
|
144
|
+
const promiseResult = await Promise.allSettled(posts.map(post => {
|
|
145
|
+
return deleteEntityRecord('postType', post.type, post.id, {
|
|
97
146
|
force: true
|
|
98
147
|
}, {
|
|
99
148
|
throwOnError: true
|
|
100
149
|
});
|
|
101
|
-
|
|
102
|
-
|
|
150
|
+
}));
|
|
151
|
+
// If all the promises were fulfilled with success.
|
|
152
|
+
if (promiseResult.every(({
|
|
153
|
+
status
|
|
154
|
+
}) => status === 'fulfilled')) {
|
|
155
|
+
let successMessage;
|
|
156
|
+
if (promiseResult.length === 1) {
|
|
157
|
+
successMessage = sprintf( /* translators: The posts's title. */
|
|
158
|
+
__('"%s" permanently deleted.'), decodeEntities(posts[0].title.rendered));
|
|
159
|
+
} else {
|
|
160
|
+
successMessage = __('The posts were permanently deleted.');
|
|
161
|
+
}
|
|
162
|
+
createSuccessNotice(successMessage, {
|
|
103
163
|
type: 'snackbar',
|
|
104
164
|
id: 'edit-site-post-permanently-deleted'
|
|
105
165
|
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
166
|
+
} else {
|
|
167
|
+
// If there was at lease one failure.
|
|
168
|
+
let errorMessage;
|
|
169
|
+
// If we were trying to permanently delete a single post.
|
|
170
|
+
if (promiseResult.length === 1) {
|
|
171
|
+
if (promiseResult[0].reason?.message) {
|
|
172
|
+
errorMessage = promiseResult[0].reason.message;
|
|
173
|
+
} else {
|
|
174
|
+
errorMessage = __('An error occurred while permanently deleting the post.');
|
|
175
|
+
}
|
|
176
|
+
// If we were trying to permanently delete multiple posts
|
|
177
|
+
} else {
|
|
178
|
+
const errorMessages = new Set();
|
|
179
|
+
const failedPromises = promiseResult.filter(({
|
|
180
|
+
status
|
|
181
|
+
}) => status === 'rejected');
|
|
182
|
+
for (const failedPromise of failedPromises) {
|
|
183
|
+
if (failedPromise.reason?.message) {
|
|
184
|
+
errorMessages.add(failedPromise.reason.message);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (errorMessages.size === 0) {
|
|
188
|
+
errorMessage = __('An error occurred while permanently deleting the posts.');
|
|
189
|
+
} else if (errorMessages.size === 1) {
|
|
190
|
+
errorMessage = sprintf( /* translators: %s: an error message */
|
|
191
|
+
__('An error occurred while permanently deleting the posts: %s'), [...errorMessages][0]);
|
|
192
|
+
} else {
|
|
193
|
+
errorMessage = sprintf( /* translators: %s: a list of comma separated error messages */
|
|
194
|
+
__('Some errors occurred while permanently deleting the posts: %s'), [...errorMessages].join(','));
|
|
195
|
+
}
|
|
196
|
+
createErrorNotice(errorMessage, {
|
|
197
|
+
type: 'snackbar'
|
|
198
|
+
});
|
|
199
|
+
}
|
|
111
200
|
}
|
|
112
201
|
}
|
|
113
202
|
}), [createSuccessNotice, createErrorNotice, deleteEntityRecord]);
|
|
@@ -126,26 +215,37 @@ export function useRestorePostAction() {
|
|
|
126
215
|
label: __('Restore'),
|
|
127
216
|
isPrimary: true,
|
|
128
217
|
icon: backup,
|
|
218
|
+
supportsBulk: true,
|
|
129
219
|
isEligible({
|
|
130
220
|
status
|
|
131
221
|
}) {
|
|
132
222
|
return status === 'trash';
|
|
133
223
|
},
|
|
134
|
-
async callback(
|
|
135
|
-
await editEntityRecord('postType', post.type, post.id, {
|
|
136
|
-
status: 'draft'
|
|
137
|
-
});
|
|
224
|
+
async callback(posts) {
|
|
138
225
|
try {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
226
|
+
for (const post of posts) {
|
|
227
|
+
await editEntityRecord('postType', post.type, post.id, {
|
|
228
|
+
status: 'draft'
|
|
229
|
+
});
|
|
230
|
+
await saveEditedEntityRecord('postType', post.type, post.id, {
|
|
231
|
+
throwOnError: true
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
createSuccessNotice(posts.length > 1 ? sprintf( /* translators: The number of posts. */
|
|
235
|
+
__('%d posts have been restored.'), posts.length) : sprintf( /* translators: The number of posts. */
|
|
236
|
+
__('"%s" has been restored.'), decodeEntities(posts[0].title.rendered)), {
|
|
144
237
|
type: 'snackbar',
|
|
145
238
|
id: 'edit-site-post-restored'
|
|
146
239
|
});
|
|
147
240
|
} catch (error) {
|
|
148
|
-
|
|
241
|
+
let errorMessage;
|
|
242
|
+
if (error.message && error.code !== 'unknown_error' && error.message) {
|
|
243
|
+
errorMessage = error.message;
|
|
244
|
+
} else if (posts.length > 1) {
|
|
245
|
+
errorMessage = __('An error occurred while restoring the posts.');
|
|
246
|
+
} else {
|
|
247
|
+
errorMessage = __('An error occurred while restoring the post.');
|
|
248
|
+
}
|
|
149
249
|
createErrorNotice(errorMessage, {
|
|
150
250
|
type: 'snackbar'
|
|
151
251
|
});
|
|
@@ -161,7 +261,8 @@ export const viewPostAction = {
|
|
|
161
261
|
isEligible(post) {
|
|
162
262
|
return post.status !== 'trash';
|
|
163
263
|
},
|
|
164
|
-
callback(
|
|
264
|
+
callback(posts) {
|
|
265
|
+
const post = posts[0];
|
|
165
266
|
document.location.href = post.link;
|
|
166
267
|
}
|
|
167
268
|
};
|
|
@@ -175,7 +276,8 @@ export function useEditPostAction() {
|
|
|
175
276
|
}) {
|
|
176
277
|
return status !== 'trash';
|
|
177
278
|
},
|
|
178
|
-
callback(
|
|
279
|
+
callback(posts) {
|
|
280
|
+
const post = posts[0];
|
|
179
281
|
history.push({
|
|
180
282
|
postId: post.id,
|
|
181
283
|
postType: post.type,
|
|
@@ -197,7 +299,8 @@ export const postRevisionsAction = {
|
|
|
197
299
|
const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
|
|
198
300
|
return lastRevisionId && revisionsCount > 1;
|
|
199
301
|
},
|
|
200
|
-
callback(
|
|
302
|
+
callback(posts) {
|
|
303
|
+
const post = posts[0];
|
|
201
304
|
const href = addQueryArgs('revision.php', {
|
|
202
305
|
revision: post?._links?.['predecessor-version']?.[0]?.id
|
|
203
306
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["external","trash","backup","addQueryArgs","useDispatch","decodeEntities","store","coreStore","__","sprintf","noticesStore","useMemo","privateApis","routerPrivateApis","Button","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","unlock","useHistory","trashPostAction","id","label","isPrimary","icon","isEligible","status","hideModalHeader","RenderModal","item","post","closeModal","createSuccessNotice","createErrorNotice","deleteEntityRecord","createElement","spacing","title","rendered","justify","variant","onClick","type","throwOnError","error","errorMessage","message","code","usePermanentlyDeletePostAction","callback","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","viewPostAction","document","location","href","link","useEditPostAction","history","push","postId","postType","canvas","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","revision"],"sources":["@wordpress/edit-site/src/components/actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport const trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\thideModalHeader: true,\n\tRenderModal: ( { item: post, closeModal } ) => {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ sprintf(\n\t\t\t\t\t\t// translators: %s: The page's title.\n\t\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The page's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t} catch ( error ) {\n\t\t\t\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\t\t\t\terror.message &&\n\t\t\t\t\t\t\t\t\terror.code !== 'unknown_error'\n\t\t\t\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the page to the trash.'\n\t\t\t\t\t\t\t\t\t\t );\n\n\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nexport function usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: trash,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( post ) {\n\t\t\t\ttry {\n\t\t\t\t\tawait deleteEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-permanently-deleted',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nexport function useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( post ) {\n\t\t\t\tawait editEntityRecord( 'postType', post.type, post.id, {\n\t\t\t\t\tstatus: 'draft',\n\t\t\t\t} );\n\t\t\t\ttry {\n\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t'postType',\n\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t);\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tsprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\tdecodeEntities( post.title.rendered )\n\t\t\t\t\t\t),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-restored',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tconst errorMessage =\n\t\t\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t\t\t? error.message\n\t\t\t\t\t\t\t: __(\n\t\t\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t\t );\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\n}\n\nexport const viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( post ) {\n\t\tdocument.location.href = post.link;\n\t},\n};\n\nexport function useEditPostAction() {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tcallback( post ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n}\nexport const postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( post ) {\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t},\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;AAC1D,SAASC,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SAASH,KAAK,IAAII,YAAY,QAAQ,oBAAoB;AAC1D,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SACCC,MAAM,EACNC,kBAAkB,IAAIC,IAAI,EAC1BC,oBAAoB,IAAIC,MAAM,EAC9BC,oBAAoB,IAAIC,MAAM,QACxB,uBAAuB;;AAE9B;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,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AAI,CAAE;QACbC,MAAM,EAAEhC,IAAI,CAACT,EAAE;QACf0C,QAAQ,EAAEjC,IAAI,CAACY,IAAI;QACnBsB,MAAM,EAAE;MACT,CAAE,CAAC;IACJ;EACD,CAAC,CAAE,EACH,CAAEJ,OAAO,CACV,CAAC;AACF;AACA,OAAO,MAAMK,mBAAmB,GAAG;EAClC5C,EAAE,EAAE,qBAAqB;EACzBC,KAAK,EAAEjB,EAAE,CAAE,gBAAiB,CAAC;EAC7BkB,SAAS,EAAE,KAAK;EAChBE,UAAU,EAAIK,IAAI,IAAM;IAAA,IAAAoC,qBAAA,EAAAC,oBAAA;IACvB,IAAKrC,IAAI,CAACJ,MAAM,KAAK,OAAO,EAAG;MAC9B,OAAO,KAAK;IACb;IACA,MAAM0C,cAAc,IAAAF,qBAAA,GACnBpC,IAAI,EAAEuC,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEhD,EAAE,cAAA6C,qBAAA,cAAAA,qBAAA,GAAI,IAAI;IAC3D,MAAMI,cAAc,IAAAH,oBAAA,GACnBrC,IAAI,EAAEuC,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEE,KAAK,cAAAJ,oBAAA,cAAAA,oBAAA,GAAI,CAAC;IACvD,OAAOC,cAAc,IAAIE,cAAc,GAAG,CAAC;EAC5C,CAAC;EACDrB,QAAQA,CAAEnB,IAAI,EAAG;IAChB,MAAM2B,IAAI,GAAGzD,YAAY,CAAE,cAAc,EAAE;MAC1CwE,QAAQ,EAAE1C,IAAI,EAAEuC,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEhD;IAC3D,CAAE,CAAC;IACHkC,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAGA,IAAI;EAC9B;AACD,CAAC"}
|
|
1
|
+
{"version":3,"names":["external","trash","backup","addQueryArgs","useDispatch","decodeEntities","store","coreStore","__","sprintf","noticesStore","useMemo","privateApis","routerPrivateApis","Button","__experimentalText","Text","__experimentalHStack","HStack","__experimentalVStack","VStack","unlock","useHistory","trashPostAction","id","label","isPrimary","icon","isEligible","status","supportsBulk","hideModalHeader","RenderModal","items","posts","closeModal","onPerform","createSuccessNotice","createErrorNotice","deleteEntityRecord","createElement","spacing","length","title","rendered","justify","variant","onClick","promiseResult","Promise","allSettled","map","post","type","throwOnError","every","successMessage","errorMessage","reason","message","errorMessages","Set","failedPromises","filter","failedPromise","add","size","join","usePermanentlyDeletePostAction","callback","force","useRestorePostAction","editEntityRecord","saveEditedEntityRecord","error","code","viewPostAction","document","location","href","link","useEditPostAction","history","push","postId","postType","canvas","postRevisionsAction","_post$_links$predeces","_post$_links$version","lastRevisionId","_links","revisionsCount","count","revision"],"sources":["@wordpress/edit-site/src/components/actions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { external, trash, backup } from '@wordpress/icons';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useDispatch } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useMemo } from '@wordpress/element';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tButton,\n\t__experimentalText as Text,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nexport const trashPostAction = {\n\tid: 'move-to-trash',\n\tlabel: __( 'Move to Trash' ),\n\tisPrimary: true,\n\ticon: trash,\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tsupportsBulk: true,\n\thideModalHeader: true,\n\tRenderModal: ( { items: posts, closeModal, onPerform } ) => {\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\t\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\t\treturn (\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<Text>\n\t\t\t\t\t{ posts.length === 1\n\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t// translators: %s: The page's title.\n\t\t\t\t\t\t\t\t__( 'Are you sure you want to delete \"%s\"?' ),\n\t\t\t\t\t\t\t\tdecodeEntities( posts[ 0 ].title.rendered )\n\t\t\t\t\t\t )\n\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t// translators: %d: The number of pages (2 or more).\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Are you sure you want to delete %d pages?'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t ) }\n\t\t\t\t</Text>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button variant=\"tertiary\" onClick={ closeModal }>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\tonClick={ async () => {\n\t\t\t\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t\t\t\t{},\n\t\t\t\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tlet successMessage;\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t\t\t\t__( '\"%s\" moved to the Trash.' ),\n\t\t\t\t\t\t\t\t\t\tdecodeEntities(\n\t\t\t\t\t\t\t\t\t\t\tposts[ 0 ].title.rendered\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t\t\t\t'Pages moved to the Trash.'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\tid: 'edit-site-page-trashed',\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t\t\t\t// If we were trying to move a single post to the trash.\n\t\t\t\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage =\n\t\t\t\t\t\t\t\t\t\t\tpromiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the post to the trash.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t// If we were trying to move multiple posts to the trash\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash.'\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'An error occurred while moving the posts to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t\t\t\t'Some errors occurred while moving the pages to the trash: %s'\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif ( onPerform ) {\n\t\t\t\t\t\t\t\tonPerform();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Delete' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t);\n\t},\n};\n\nexport function usePermanentlyDeletePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'permanently-delete',\n\t\t\tlabel: __( 'Permanently delete' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: trash,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts ) {\n\t\t\t\tconst promiseResult = await Promise.allSettled(\n\t\t\t\t\tposts.map( ( post ) => {\n\t\t\t\t\t\treturn deleteEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ force: true },\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t\t// If all the promises were fulfilled with success.\n\t\t\t\tif (\n\t\t\t\t\tpromiseResult.every(\n\t\t\t\t\t\t( { status } ) => status === 'fulfilled'\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tlet successMessage;\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tsuccessMessage = sprintf(\n\t\t\t\t\t\t\t/* translators: The posts's title. */\n\t\t\t\t\t\t\t__( '\"%s\" permanently deleted.' ),\n\t\t\t\t\t\t\tdecodeEntities( posts[ 0 ].title.rendered )\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsuccessMessage = __(\n\t\t\t\t\t\t\t'The posts were permanently deleted.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tcreateSuccessNotice( successMessage, {\n\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\tid: 'edit-site-post-permanently-deleted',\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\t// If there was at lease one failure.\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\t// If we were trying to permanently delete a single post.\n\t\t\t\t\tif ( promiseResult.length === 1 ) {\n\t\t\t\t\t\tif ( promiseResult[ 0 ].reason?.message ) {\n\t\t\t\t\t\t\terrorMessage = promiseResult[ 0 ].reason.message;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the post.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// If we were trying to permanently delete multiple posts\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst errorMessages = new Set();\n\t\t\t\t\t\tconst failedPromises = promiseResult.filter(\n\t\t\t\t\t\t\t( { status } ) => status === 'rejected'\n\t\t\t\t\t\t);\n\t\t\t\t\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\t\t\t\t\tif ( failedPromise.reason?.message ) {\n\t\t\t\t\t\t\t\terrorMessages.add(\n\t\t\t\t\t\t\t\t\tfailedPromise.reason.message\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif ( errorMessages.size === 0 ) {\n\t\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts.'\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else if ( errorMessages.size === 1 ) {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: an error message */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'An error occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ][ 0 ]\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terrorMessage = sprintf(\n\t\t\t\t\t\t\t\t/* translators: %s: a list of comma separated error messages */\n\t\t\t\t\t\t\t\t__(\n\t\t\t\t\t\t\t\t\t'Some errors occurred while permanently deleting the posts: %s'\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t[ ...errorMessages ].join( ',' )\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t} );\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[ createSuccessNotice, createErrorNotice, deleteEntityRecord ]\n\t);\n}\n\nexport function useRestorePostAction() {\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'restore',\n\t\t\tlabel: __( 'Restore' ),\n\t\t\tisPrimary: true,\n\t\t\ticon: backup,\n\t\t\tsupportsBulk: true,\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status === 'trash';\n\t\t\t},\n\t\t\tasync callback( posts ) {\n\t\t\t\ttry {\n\t\t\t\t\tfor ( const post of posts ) {\n\t\t\t\t\t\tawait editEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tstatus: 'draft',\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t);\n\t\t\t\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t\t\t\t'postType',\n\t\t\t\t\t\t\tpost.type,\n\t\t\t\t\t\t\tpost.id,\n\t\t\t\t\t\t\t{ throwOnError: true }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateSuccessNotice(\n\t\t\t\t\t\tposts.length > 1\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '%d posts have been restored.' ),\n\t\t\t\t\t\t\t\t\tposts.length\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: The number of posts. */\n\t\t\t\t\t\t\t\t\t__( '\"%s\" has been restored.' ),\n\t\t\t\t\t\t\t\t\tdecodeEntities( posts[ 0 ].title.rendered )\n\t\t\t\t\t\t\t ),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\t\t\tid: 'edit-site-post-restored',\n\t\t\t\t\t\t}\n\t\t\t\t\t);\n\t\t\t\t} catch ( error ) {\n\t\t\t\t\tlet errorMessage;\n\t\t\t\t\tif (\n\t\t\t\t\t\terror.message &&\n\t\t\t\t\t\terror.code !== 'unknown_error' &&\n\t\t\t\t\t\terror.message\n\t\t\t\t\t) {\n\t\t\t\t\t\terrorMessage = error.message;\n\t\t\t\t\t} else if ( posts.length > 1 ) {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the posts.'\n\t\t\t\t\t\t);\n\t\t\t\t\t} else {\n\t\t\t\t\t\terrorMessage = __(\n\t\t\t\t\t\t\t'An error occurred while restoring the post.'\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t\t}\n\t\t\t},\n\t\t} ),\n\t\t[\n\t\t\tcreateSuccessNotice,\n\t\t\tcreateErrorNotice,\n\t\t\teditEntityRecord,\n\t\t\tsaveEditedEntityRecord,\n\t\t]\n\t);\n}\n\nexport const viewPostAction = {\n\tid: 'view-post',\n\tlabel: __( 'View' ),\n\tisPrimary: true,\n\ticon: external,\n\tisEligible( post ) {\n\t\treturn post.status !== 'trash';\n\t},\n\tcallback( posts ) {\n\t\tconst post = posts[ 0 ];\n\t\tdocument.location.href = post.link;\n\t},\n};\n\nexport function useEditPostAction() {\n\tconst history = useHistory();\n\treturn useMemo(\n\t\t() => ( {\n\t\t\tid: 'edit-post',\n\t\t\tlabel: __( 'Edit' ),\n\t\t\tisEligible( { status } ) {\n\t\t\t\treturn status !== 'trash';\n\t\t\t},\n\t\t\tcallback( posts ) {\n\t\t\t\tconst post = posts[ 0 ];\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: post.id,\n\t\t\t\t\tpostType: post.type,\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} );\n\t\t\t},\n\t\t} ),\n\t\t[ history ]\n\t);\n}\nexport const postRevisionsAction = {\n\tid: 'view-post-revisions',\n\tlabel: __( 'View revisions' ),\n\tisPrimary: false,\n\tisEligible: ( post ) => {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t},\n};\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,KAAK,EAAEC,MAAM,QAAQ,kBAAkB;AAC1D,SAASC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QAAQ,EAAE1C,IAAI,EAAEuC,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEnE;IAC3D,CAAE,CAAC;IACHqD,QAAQ,CAACC,QAAQ,CAACC,IAAI,GAAGA,IAAI;EAC9B;AACD,CAAC"}
|
|
@@ -32,7 +32,7 @@ function getEditorCanvasContainerTitle(view) {
|
|
|
32
32
|
return __('Style Book');
|
|
33
33
|
case 'global-styles-revisions':
|
|
34
34
|
case 'global-styles-revisions:style-book':
|
|
35
|
-
return __('
|
|
35
|
+
return __('Style Revisions');
|
|
36
36
|
default:
|
|
37
37
|
return '';
|
|
38
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Children","cloneElement","useState","useMemo","Button","privateApis","componentsPrivateApis","__experimentalUseSlotFills","useSlotFills","ESCAPE","__","useDispatch","useSelect","closeSmall","useFocusOnMount","useFocusReturn","store","preferencesStore","editorStore","unlock","editSiteStore","ResizableEditor","getEditorCanvasContainerTitle","view","createPrivateSlotFill","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","select","_editorCanvasContainerView","getEditorCanvasContainerView","_showListViewByDefault","get","isClosed","setIsClosed","setEditorCanvasContainerView","setIsListViewOpened","focusOnMountRef","sectionFocusReturnRef","title","onCloseContainer","undefined","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","map","child","index","ref","shouldShowCloseButton","createElement","className","onKeyDown","icon","label","onClick","showTooltip","useHasEditorCanvasContainer","fills","length"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState, useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport ResizableEditor from '../block-editor/resizable-editor';\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {string} Translated string corresponding to value of view. Default is ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( '
|
|
1
|
+
{"version":3,"names":["Children","cloneElement","useState","useMemo","Button","privateApis","componentsPrivateApis","__experimentalUseSlotFills","useSlotFills","ESCAPE","__","useDispatch","useSelect","closeSmall","useFocusOnMount","useFocusReturn","store","preferencesStore","editorStore","unlock","editSiteStore","ResizableEditor","getEditorCanvasContainerTitle","view","createPrivateSlotFill","SLOT_FILL_NAME","privateKey","Slot","EditorCanvasContainerSlot","Fill","EditorCanvasContainerFill","EditorCanvasContainer","children","closeButtonLabel","onClose","enableResizing","editorCanvasContainerView","showListViewByDefault","select","_editorCanvasContainerView","getEditorCanvasContainerView","_showListViewByDefault","get","isClosed","setIsClosed","setEditorCanvasContainerView","setIsListViewOpened","focusOnMountRef","sectionFocusReturnRef","title","onCloseContainer","undefined","closeOnEscape","event","keyCode","defaultPrevented","preventDefault","childrenWithProps","Array","isArray","map","child","index","ref","shouldShowCloseButton","createElement","className","onKeyDown","icon","label","onClick","showTooltip","useHasEditorCanvasContainer","fills","length"],"sources":["@wordpress/edit-site/src/components/editor-canvas-container/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Children, cloneElement, useState, useMemo } from '@wordpress/element';\nimport {\n\tButton,\n\tprivateApis as componentsPrivateApis,\n\t__experimentalUseSlotFills as useSlotFills,\n} from '@wordpress/components';\nimport { ESCAPE } from '@wordpress/keycodes';\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { closeSmall } from '@wordpress/icons';\nimport { useFocusOnMount, useFocusReturn } from '@wordpress/compose';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport ResizableEditor from '../block-editor/resizable-editor';\n\n/**\n * Returns a translated string for the title of the editor canvas container.\n *\n * @param {string} view Editor canvas container view.\n *\n * @return {string} Translated string corresponding to value of view. Default is ''.\n */\nfunction getEditorCanvasContainerTitle( view ) {\n\tswitch ( view ) {\n\t\tcase 'style-book':\n\t\t\treturn __( 'Style Book' );\n\t\tcase 'global-styles-revisions':\n\t\tcase 'global-styles-revisions:style-book':\n\t\t\treturn __( 'Style Revisions' );\n\t\tdefault:\n\t\t\treturn '';\n\t}\n}\n\n// Creates a private slot fill.\nconst { createPrivateSlotFill } = unlock( componentsPrivateApis );\nconst SLOT_FILL_NAME = 'EditSiteEditorCanvasContainerSlot';\nconst {\n\tprivateKey,\n\tSlot: EditorCanvasContainerSlot,\n\tFill: EditorCanvasContainerFill,\n} = createPrivateSlotFill( SLOT_FILL_NAME );\n\nfunction EditorCanvasContainer( {\n\tchildren,\n\tcloseButtonLabel,\n\tonClose,\n\tenableResizing = false,\n} ) {\n\tconst { editorCanvasContainerView, showListViewByDefault } = useSelect(\n\t\t( select ) => {\n\t\t\tconst _editorCanvasContainerView = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t).getEditorCanvasContainerView();\n\n\t\t\tconst _showListViewByDefault = select( preferencesStore ).get(\n\t\t\t\t'core',\n\t\t\t\t'showListViewByDefault'\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\teditorCanvasContainerView: _editorCanvasContainerView,\n\t\t\t\tshowListViewByDefault: _showListViewByDefault,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst [ isClosed, setIsClosed ] = useState( false );\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { setIsListViewOpened } = useDispatch( editorStore );\n\n\tconst focusOnMountRef = useFocusOnMount( 'firstElement' );\n\tconst sectionFocusReturnRef = useFocusReturn();\n\tconst title = useMemo(\n\t\t() => getEditorCanvasContainerTitle( editorCanvasContainerView ),\n\t\t[ editorCanvasContainerView ]\n\t);\n\n\tfunction onCloseContainer() {\n\t\tsetIsListViewOpened( showListViewByDefault );\n\t\tsetEditorCanvasContainerView( undefined );\n\t\tsetIsClosed( true );\n\t\tif ( typeof onClose === 'function' ) {\n\t\t\tonClose();\n\t\t}\n\t}\n\n\tfunction closeOnEscape( event ) {\n\t\tif ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {\n\t\t\tevent.preventDefault();\n\t\t\tonCloseContainer();\n\t\t}\n\t}\n\n\tconst childrenWithProps = Array.isArray( children )\n\t\t? Children.map( children, ( child, index ) =>\n\t\t\t\tindex === 0\n\t\t\t\t\t? cloneElement( child, {\n\t\t\t\t\t\t\tref: sectionFocusReturnRef,\n\t\t\t\t\t } )\n\t\t\t\t\t: child\n\t\t )\n\t\t: cloneElement( children, {\n\t\t\t\tref: sectionFocusReturnRef,\n\t\t } );\n\n\tif ( isClosed ) {\n\t\treturn null;\n\t}\n\n\tconst shouldShowCloseButton = onClose || closeButtonLabel;\n\n\treturn (\n\t\t<EditorCanvasContainerFill>\n\t\t\t<ResizableEditor enableResizing={ enableResizing }>\n\t\t\t\t{ /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }\n\t\t\t\t<section\n\t\t\t\t\tclassName=\"edit-site-editor-canvas-container\"\n\t\t\t\t\tref={ shouldShowCloseButton ? focusOnMountRef : null }\n\t\t\t\t\tonKeyDown={ closeOnEscape }\n\t\t\t\t\taria-label={ title }\n\t\t\t\t>\n\t\t\t\t\t{ shouldShowCloseButton && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tclassName=\"edit-site-editor-canvas-container__close-button\"\n\t\t\t\t\t\t\ticon={ closeSmall }\n\t\t\t\t\t\t\tlabel={ closeButtonLabel || __( 'Close' ) }\n\t\t\t\t\t\t\tonClick={ onCloseContainer }\n\t\t\t\t\t\t\tshowTooltip={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t\t{ childrenWithProps }\n\t\t\t\t</section>\n\t\t\t</ResizableEditor>\n\t\t</EditorCanvasContainerFill>\n\t);\n}\nfunction useHasEditorCanvasContainer() {\n\tconst fills = useSlotFills( privateKey );\n\treturn !! fills?.length;\n}\n\nEditorCanvasContainer.Slot = EditorCanvasContainerSlot;\nexport default EditorCanvasContainer;\nexport { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,QAAQ,EAAEC,OAAO,QAAQ,oBAAoB;AAC9E,SACCC,MAAM,EACNC,WAAW,IAAIC,qBAAqB,EACpCC,0BAA0B,IAAIC,YAAY,QACpC,uBAAuB;AAC9B,SAASC,MAAM,QAAQ,qBAAqB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,eAAe,EAAEC,cAAc,QAAQ,oBAAoB;AACpE,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,wBAAwB;AAClE,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AACpD,OAAOC,eAA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