@wordpress/edit-site 6.10.0 → 6.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/add-new-post/index.js +1 -1
- package/build/components/add-new-post/index.js.map +1 -1
- package/build/components/add-new-template/index.js +1 -1
- package/build/components/add-new-template/index.js.map +1 -1
- package/build/components/add-new-template/utils.js +8 -8
- package/build/components/add-new-template/utils.js.map +1 -1
- package/build/components/app/index.js +2 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/use-editor-iframe-props.js +29 -22
- package/build/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +10 -8
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/editor/index.js +32 -14
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-adapt-editor-to-canvas.js +49 -0
- package/build/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
- package/build/components/editor/use-editor-title.js +30 -13
- package/build/components/editor/use-editor-title.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-size.js +6 -6
- package/build/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-sizes-count.js +0 -1
- package/build/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
- package/build/components/global-styles/font-sizes/font-sizes.js +4 -4
- package/build/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build/components/global-styles/palette.js +16 -13
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/root-menu.js +0 -4
- package/build/components/global-styles/root-menu.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +0 -4
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +26 -24
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/screen-root.js +0 -3
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +5 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/shadows-edit-panel.js +11 -13
- package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build/components/global-styles/shadows-panel.js +0 -3
- package/build/components/global-styles/shadows-panel.js.map +1 -1
- package/build/components/global-styles/typography-elements.js +1 -4
- package/build/components/global-styles/typography-elements.js.map +1 -1
- package/build/components/global-styles/ui.js +49 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations/variation.js +2 -2
- package/build/components/global-styles/variations/variation.js.map +1 -1
- package/build/components/global-styles/variations/variations-panel.js +0 -1
- package/build/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +6 -8
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/global-styles-sidebar/default-sidebar.js +0 -1
- package/build/components/global-styles-sidebar/default-sidebar.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +43 -30
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/animation.js +1 -3
- package/build/components/layout/animation.js.map +1 -1
- package/build/components/layout/hooks.js +1 -10
- package/build/components/layout/hooks.js.map +1 -1
- package/build/components/layout/index.js +23 -35
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +17 -140
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/delete-category-menu-item.js +3 -3
- package/build/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build/components/page-patterns/fields.js +3 -7
- package/build/components/page-patterns/fields.js.map +1 -1
- package/build/components/page-patterns/use-pattern-settings.js +1 -1
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build/components/page-templates/fields.js +1 -2
- package/build/components/page-templates/fields.js.map +1 -1
- package/build/components/page-templates/index.js +1 -2
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/pagination/index.js +1 -1
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/post-edit/index.js +15 -5
- package/build/components/post-edit/index.js.map +1 -1
- package/build/components/post-fields/index.js +4 -244
- package/build/components/post-fields/index.js.map +1 -1
- package/build/components/post-list/index.js +12 -2
- package/build/components/post-list/index.js.map +1 -1
- package/build/components/posts-app/index.js.map +1 -1
- package/build/components/posts-app/router.js +4 -4
- package/build/components/posts-app/router.js.map +1 -1
- package/build/components/resizable-frame/index.js +21 -9
- package/build/components/resizable-frame/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-keyboard-shortcut/index.js +78 -0
- package/build/components/save-keyboard-shortcut/index.js.map +1 -0
- package/build/components/save-panel/index.js +17 -6
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +11 -3
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-dataviews/default-views.js +2 -5
- package/build/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build/components/sidebar-global-styles-wrapper/index.js +129 -0
- package/build/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen/index.js +2 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +33 -71
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +43 -42
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +7 -12
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/site-editor-routes/home-edit.js +26 -0
- package/build/components/site-editor-routes/home-edit.js.map +1 -0
- package/build/components/site-editor-routes/home-view.js +25 -0
- package/build/components/site-editor-routes/home-view.js.map +1 -0
- package/build/components/site-editor-routes/index.js +49 -0
- package/build/components/site-editor-routes/index.js.map +1 -0
- package/build/components/site-editor-routes/navigation-edit.js +29 -0
- package/build/components/site-editor-routes/navigation-edit.js.map +1 -0
- package/build/components/site-editor-routes/navigation-item-edit.js +31 -0
- package/build/components/site-editor-routes/navigation-item-edit.js.map +1 -0
- package/build/components/site-editor-routes/navigation-item-view.js +30 -0
- package/build/components/site-editor-routes/navigation-item-view.js.map +1 -0
- package/build/components/site-editor-routes/navigation-view.js +28 -0
- package/build/components/site-editor-routes/navigation-view.js.map +1 -0
- package/build/components/site-editor-routes/pages-edit.js +43 -0
- package/build/components/site-editor-routes/pages-edit.js.map +1 -0
- package/build/components/site-editor-routes/pages-list-view-quick-edit.js +64 -0
- package/build/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
- package/build/components/site-editor-routes/pages-list-view.js +47 -0
- package/build/components/site-editor-routes/pages-list-view.js.map +1 -0
- package/build/components/site-editor-routes/pages-view-quick-edit.js +61 -0
- package/build/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
- package/build/components/site-editor-routes/pages-view.js +42 -0
- package/build/components/site-editor-routes/pages-view.js.map +1 -0
- package/build/components/site-editor-routes/patterns-edit.js +31 -0
- package/build/components/site-editor-routes/patterns-edit.js.map +1 -0
- package/build/components/site-editor-routes/patterns-view.js +29 -0
- package/build/components/site-editor-routes/patterns-view.js.map +1 -0
- package/build/components/site-editor-routes/styles-edit.js +33 -0
- package/build/components/site-editor-routes/styles-edit.js.map +1 -0
- package/build/components/site-editor-routes/styles-view.js +33 -0
- package/build/components/site-editor-routes/styles-view.js.map +1 -0
- package/build/components/site-editor-routes/templates-edit.js +31 -0
- package/build/components/site-editor-routes/templates-edit.js.map +1 -0
- package/build/components/site-editor-routes/templates-list-view.js +34 -0
- package/build/components/site-editor-routes/templates-list-view.js.map +1 -0
- package/build/components/site-editor-routes/templates-view.js +29 -0
- package/build/components/site-editor-routes/templates-view.js.map +1 -0
- package/build/components/site-hub/index.js +22 -8
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/color-examples.js +46 -0
- package/build/components/style-book/color-examples.js.map +1 -0
- package/build/components/style-book/constants.js +85 -13
- package/build/components/style-book/constants.js.map +1 -1
- package/build/components/style-book/duotone-examples.js +55 -0
- package/build/components/style-book/duotone-examples.js.map +1 -0
- package/build/components/style-book/examples.js +116 -3
- package/build/components/style-book/examples.js.map +1 -1
- package/build/components/style-book/index.js +161 -46
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/style-book/types.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +38 -33
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/welcome-guide/index.js +4 -2
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +1 -9
- package/build/components/welcome-guide/page.js.map +1 -1
- package/build/components/welcome-guide/template.js +1 -12
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +61 -45
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-set-command-context.js +12 -15
- package/build/hooks/commands/use-set-command-context.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/posts.js +1 -0
- package/build/posts.js.map +1 -1
- package/build/store/private-actions.js +8 -60
- package/build/store/private-actions.js.map +1 -1
- package/build/store/private-selectors.js +4 -12
- package/build/store/private-selectors.js.map +1 -1
- package/build/store/reducer.js +9 -18
- package/build/store/reducer.js.map +1 -1
- package/build-module/components/add-new-post/index.js +1 -1
- package/build-module/components/add-new-post/index.js.map +1 -1
- package/build-module/components/add-new-template/index.js +1 -1
- package/build-module/components/add-new-template/index.js.map +1 -1
- package/build-module/components/add-new-template/utils.js +9 -9
- package/build-module/components/add-new-template/utils.js.map +1 -1
- package/build-module/components/app/index.js +4 -4
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/use-editor-iframe-props.js +30 -23
- package/build-module/components/block-editor/use-editor-iframe-props.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +10 -8
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/editor/index.js +32 -14
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-adapt-editor-to-canvas.js +42 -0
- package/build-module/components/editor/use-adapt-editor-to-canvas.js.map +1 -0
- package/build-module/components/editor/use-editor-title.js +31 -14
- package/build-module/components/editor/use-editor-title.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-size.js +6 -6
- package/build-module/components/global-styles/font-sizes/font-size.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js +0 -1
- package/build-module/components/global-styles/font-sizes/font-sizes-count.js.map +1 -1
- package/build-module/components/global-styles/font-sizes/font-sizes.js +4 -4
- package/build-module/components/global-styles/font-sizes/font-sizes.js.map +1 -1
- package/build-module/components/global-styles/palette.js +17 -14
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +0 -4
- package/build-module/components/global-styles/root-menu.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +0 -4
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +27 -25
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +0 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +5 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/shadows-edit-panel.js +11 -13
- package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
- package/build-module/components/global-styles/shadows-panel.js +0 -3
- package/build-module/components/global-styles/shadows-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-elements.js +2 -5
- package/build-module/components/global-styles/typography-elements.js.map +1 -1
- package/build-module/components/global-styles/ui.js +50 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations/variation.js +3 -3
- package/build-module/components/global-styles/variations/variation.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-panel.js +0 -1
- package/build-module/components/global-styles/variations/variations-panel.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +6 -8
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js +0 -1
- package/build-module/components/global-styles-sidebar/default-sidebar.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +44 -31
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/animation.js +1 -3
- package/build-module/components/layout/animation.js.map +1 -1
- package/build-module/components/layout/hooks.js +1 -9
- package/build-module/components/layout/hooks.js.map +1 -1
- package/build-module/components/layout/index.js +23 -35
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +17 -139
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/delete-category-menu-item.js +4 -4
- package/build-module/components/page-patterns/delete-category-menu-item.js.map +1 -1
- package/build-module/components/page-patterns/fields.js +4 -8
- package/build-module/components/page-patterns/fields.js.map +1 -1
- package/build-module/components/page-patterns/use-pattern-settings.js +1 -1
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -1
- package/build-module/components/page-templates/fields.js +1 -2
- package/build-module/components/page-templates/fields.js.map +1 -1
- package/build-module/components/page-templates/index.js +1 -2
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/pagination/index.js +1 -1
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/post-edit/index.js +15 -5
- package/build-module/components/post-edit/index.js.map +1 -1
- package/build-module/components/post-fields/index.js +7 -246
- package/build-module/components/post-fields/index.js.map +1 -1
- package/build-module/components/post-list/index.js +12 -2
- package/build-module/components/post-list/index.js.map +1 -1
- package/build-module/components/posts-app/index.js +2 -2
- package/build-module/components/posts-app/index.js.map +1 -1
- package/build-module/components/posts-app/router.js +3 -3
- package/build-module/components/posts-app/router.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +21 -10
- package/build-module/components/resizable-frame/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-keyboard-shortcut/index.js +71 -0
- package/build-module/components/save-keyboard-shortcut/index.js.map +1 -0
- package/build-module/components/save-panel/index.js +17 -6
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +11 -3
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/default-views.js +2 -5
- package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
- package/build-module/components/sidebar-global-styles-wrapper/index.js +121 -0
- package/build-module/components/sidebar-global-styles-wrapper/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen/index.js +2 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +34 -72
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +43 -43
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +8 -13
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/site-editor-routes/home-edit.js +18 -0
- package/build-module/components/site-editor-routes/home-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/home-view.js +17 -0
- package/build-module/components/site-editor-routes/home-view.js.map +1 -0
- package/build-module/components/site-editor-routes/index.js +42 -0
- package/build-module/components/site-editor-routes/index.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-edit.js +21 -0
- package/build-module/components/site-editor-routes/navigation-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-item-edit.js +23 -0
- package/build-module/components/site-editor-routes/navigation-item-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-item-view.js +22 -0
- package/build-module/components/site-editor-routes/navigation-item-view.js.map +1 -0
- package/build-module/components/site-editor-routes/navigation-view.js +20 -0
- package/build-module/components/site-editor-routes/navigation-view.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-edit.js +35 -0
- package/build-module/components/site-editor-routes/pages-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
- package/build-module/components/site-editor-routes/pages-list-view-quick-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-list-view.js +39 -0
- package/build-module/components/site-editor-routes/pages-list-view.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-view-quick-edit.js +53 -0
- package/build-module/components/site-editor-routes/pages-view-quick-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/pages-view.js +34 -0
- package/build-module/components/site-editor-routes/pages-view.js.map +1 -0
- package/build-module/components/site-editor-routes/patterns-edit.js +23 -0
- package/build-module/components/site-editor-routes/patterns-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/patterns-view.js +21 -0
- package/build-module/components/site-editor-routes/patterns-view.js.map +1 -0
- package/build-module/components/site-editor-routes/styles-edit.js +25 -0
- package/build-module/components/site-editor-routes/styles-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/styles-view.js +25 -0
- package/build-module/components/site-editor-routes/styles-view.js.map +1 -0
- package/build-module/components/site-editor-routes/templates-edit.js +23 -0
- package/build-module/components/site-editor-routes/templates-edit.js.map +1 -0
- package/build-module/components/site-editor-routes/templates-list-view.js +26 -0
- package/build-module/components/site-editor-routes/templates-list-view.js.map +1 -0
- package/build-module/components/site-editor-routes/templates-view.js +21 -0
- package/build-module/components/site-editor-routes/templates-view.js.map +1 -0
- package/build-module/components/site-hub/index.js +22 -8
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/color-examples.js +38 -0
- package/build-module/components/style-book/color-examples.js.map +1 -0
- package/build-module/components/style-book/constants.js +84 -12
- package/build-module/components/style-book/constants.js.map +1 -1
- package/build-module/components/style-book/duotone-examples.js +48 -0
- package/build-module/components/style-book/duotone-examples.js.map +1 -0
- package/build-module/components/style-book/examples.js +117 -3
- package/build-module/components/style-book/examples.js.map +1 -1
- package/build-module/components/style-book/index.js +164 -49
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/style-book/types.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +38 -33
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +4 -2
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +1 -9
- package/build-module/components/welcome-guide/page.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +1 -11
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +61 -45
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-set-command-context.js +12 -15
- package/build-module/hooks/commands/use-set-command-context.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/posts.js +1 -0
- package/build-module/posts.js.map +1 -1
- package/build-module/store/private-actions.js +6 -58
- package/build-module/store/private-actions.js.map +1 -1
- package/build-module/store/private-selectors.js +3 -11
- package/build-module/store/private-selectors.js.map +1 -1
- package/build-module/store/reducer.js +9 -18
- package/build-module/store/reducer.js.map +1 -1
- package/build-style/posts-rtl.css +60 -14
- package/build-style/posts.css +60 -14
- package/build-style/style-rtl.css +232 -50
- package/build-style/style.css +232 -50
- package/package.json +42 -41
- package/src/components/add-new-post/index.js +1 -1
- package/src/components/add-new-template/index.js +1 -1
- package/src/components/add-new-template/utils.js +12 -9
- package/src/components/app/index.js +4 -4
- package/src/components/block-editor/use-editor-iframe-props.js +23 -20
- package/src/components/block-editor/use-site-editor-settings.js +12 -10
- package/src/components/editor/index.js +50 -17
- package/src/components/editor/use-adapt-editor-to-canvas.js +53 -0
- package/src/components/editor/use-editor-title.js +40 -16
- package/src/components/editor-canvas-container/style.scss +0 -1
- package/src/components/global-styles/font-sizes/font-size.js +11 -15
- package/src/components/global-styles/font-sizes/font-sizes-count.js +1 -4
- package/src/components/global-styles/font-sizes/font-sizes.js +7 -9
- package/src/components/global-styles/palette.js +21 -18
- package/src/components/global-styles/root-menu.js +3 -16
- package/src/components/global-styles/screen-block-list.js +0 -7
- package/src/components/global-styles/screen-css.js +1 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +30 -33
- package/src/components/global-styles/screen-revisions/style.scss +11 -17
- package/src/components/global-styles/screen-root.js +3 -12
- package/src/components/global-styles/screen-style-variations.js +4 -1
- package/src/components/global-styles/shadows-edit-panel.js +16 -15
- package/src/components/global-styles/shadows-panel.js +0 -4
- package/src/components/global-styles/typography-elements.js +3 -11
- package/src/components/global-styles/ui.js +53 -2
- package/src/components/global-styles/variations/variation.js +3 -3
- package/src/components/global-styles/variations/variations-panel.js +0 -1
- package/src/components/global-styles-renderer/index.js +4 -10
- package/src/components/global-styles-sidebar/default-sidebar.js +0 -1
- package/src/components/global-styles-sidebar/index.js +86 -65
- package/src/components/global-styles-sidebar/style.scss +6 -0
- package/src/components/layout/animation.js +0 -1
- package/src/components/layout/hooks.js +1 -7
- package/src/components/layout/index.js +22 -35
- package/src/components/layout/router.js +18 -133
- package/src/components/layout/style.scss +2 -2
- package/src/components/page-patterns/delete-category-menu-item.js +4 -4
- package/src/components/page-patterns/fields.js +6 -12
- package/src/components/page-patterns/style.scss +0 -5
- package/src/components/page-patterns/use-pattern-settings.js +1 -1
- package/src/components/page-templates/fields.js +2 -3
- package/src/components/page-templates/index.js +0 -1
- package/src/components/pagination/index.js +1 -1
- package/src/components/post-edit/index.js +45 -6
- package/src/components/post-edit/style.scss +7 -0
- package/src/components/post-fields/index.js +22 -323
- package/src/components/post-fields/style.scss +3 -0
- package/src/components/post-list/index.js +10 -4
- package/src/components/post-list/style.scss +30 -4
- package/src/components/posts-app/index.js +2 -2
- package/src/components/posts-app/router.js +3 -3
- package/src/components/resizable-frame/index.js +19 -10
- package/src/components/revisions/index.js +4 -1
- package/src/components/save-keyboard-shortcut/index.js +69 -0
- package/src/components/save-panel/index.js +30 -32
- package/src/components/sidebar/index.js +23 -7
- package/src/components/sidebar-dataviews/default-views.js +2 -5
- package/src/components/sidebar-global-styles-wrapper/index.js +150 -0
- package/src/components/sidebar-global-styles-wrapper/style.scss +35 -0
- package/src/components/sidebar-navigation-item/style.scss +2 -2
- package/src/components/sidebar-navigation-screen/index.js +2 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +42 -99
- package/src/components/sidebar-navigation-screen-main/index.js +46 -45
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +4 -4
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +11 -13
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +1 -1
- package/src/components/site-editor-routes/README.md +20 -0
- package/src/components/site-editor-routes/home-edit.js +17 -0
- package/src/components/site-editor-routes/home-view.js +16 -0
- package/src/components/site-editor-routes/index.js +60 -0
- package/src/components/site-editor-routes/navigation-edit.js +22 -0
- package/src/components/site-editor-routes/navigation-item-edit.js +26 -0
- package/src/components/site-editor-routes/navigation-item-view.js +25 -0
- package/src/components/site-editor-routes/navigation-view.js +21 -0
- package/src/components/site-editor-routes/pages-edit.js +35 -0
- package/src/components/site-editor-routes/pages-list-view-quick-edit.js +56 -0
- package/src/components/site-editor-routes/pages-list-view.js +44 -0
- package/src/components/site-editor-routes/pages-view-quick-edit.js +53 -0
- package/src/components/site-editor-routes/pages-view.js +39 -0
- package/src/components/site-editor-routes/patterns-edit.js +24 -0
- package/src/components/site-editor-routes/patterns-view.js +22 -0
- package/src/components/site-editor-routes/styles-edit.js +26 -0
- package/src/components/site-editor-routes/styles-view.js +26 -0
- package/src/components/site-editor-routes/templates-edit.js +22 -0
- package/src/components/site-editor-routes/templates-list-view.js +28 -0
- package/src/components/site-editor-routes/templates-view.js +22 -0
- package/src/components/site-hub/index.js +35 -18
- package/src/components/site-hub/style.scss +4 -0
- package/src/components/site-icon/style.scss +16 -0
- package/src/components/style-book/color-examples.tsx +44 -0
- package/src/components/style-book/constants.ts +94 -13
- package/src/components/style-book/duotone-examples.tsx +53 -0
- package/src/components/style-book/examples.tsx +217 -0
- package/src/components/style-book/index.js +235 -60
- package/src/components/style-book/style.scss +12 -14
- package/src/components/style-book/test/categories.js +0 -5
- package/src/components/style-book/types.ts +34 -1
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +65 -65
- package/src/components/welcome-guide/index.js +3 -3
- package/src/components/welcome-guide/page.js +1 -7
- package/src/components/welcome-guide/template.js +1 -8
- package/src/hooks/commands/use-common-commands.js +257 -230
- package/src/hooks/commands/use-set-command-context.js +7 -9
- package/src/index.js +1 -0
- package/src/posts.js +1 -0
- package/src/store/private-actions.js +7 -79
- package/src/store/private-selectors.js +4 -11
- package/src/store/reducer.js +10 -18
- package/src/style.scss +3 -1
- package/build/components/async/index.js +0 -51
- package/build/components/async/index.js.map +0 -1
- package/build/components/keyboard-shortcuts/global.js +0 -53
- package/build/components/keyboard-shortcuts/global.js.map +0 -1
- package/build/components/keyboard-shortcuts/register.js +0 -34
- package/build/components/keyboard-shortcuts/register.js.map +0 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -69
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
- package/build/components/use-edited-entity-record/index.js +0 -60
- package/build/components/use-edited-entity-record/index.js.map +0 -1
- package/build/hooks/commands/use-edit-mode-commands.js +0 -175
- package/build/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/build-module/components/async/index.js +0 -44
- package/build-module/components/async/index.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/global.js +0 -46
- package/build-module/components/keyboard-shortcuts/global.js.map +0 -1
- package/build-module/components/keyboard-shortcuts/register.js +0 -27
- package/build-module/components/keyboard-shortcuts/register.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -62
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +0 -1
- package/build-module/components/use-edited-entity-record/index.js +0 -53
- package/build-module/components/use-edited-entity-record/index.js.map +0 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +0 -167
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +0 -1
- package/src/components/async/index.js +0 -43
- package/src/components/keyboard-shortcuts/global.js +0 -47
- package/src/components/keyboard-shortcuts/register.js +0 -27
- package/src/components/style-book/examples.ts +0 -63
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +0 -73
- package/src/components/use-edited-entity-record/index.js +0 -58
- package/src/hooks/commands/use-edit-mode-commands.js +0 -172
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_i18n","_icons","_commands","_htmlEntities","_router","_editor","_store","_useEditedEntityRecord","_interopRequireDefault","_isTemplateRemovable","_isTemplateRevertable","_lockUnlock","_constants","_link","useHistory","unlock","routerPrivateApis","usePageContentFocusCommands","record","template","useEditedEntityRecord","isPage","canvasMode","templateId","currentPostType","useSelect","select","_isPage","getCanvasMode","editSiteStore","getCurrentPostType","getCurrentTemplateId","editorStore","onClick","editTemplate","useLink","postType","postId","setRenderingMode","useDispatch","isLoading","commands","push","name","label","sprintf","__","decodeEntities","title","icon","layout","callback","close","page","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","isTemplateRevertable","type","TEMPLATE_POST_TYPE","isRTL","rotateRight","rotateLeft","isTemplateRemovable","trash","useEditModeCommands","useCommandLoader","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport { trash, rotateLeft, rotateRight, layout, page } from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { useLink } from '../../components/routes/link';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, templateId, currentPostType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isPage: _isPage, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getCurrentPostType, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisPage: _isPage(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\tcurrentPostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { onClick: editTemplate } = useLink( {\n\t\tpostType: 'wp_template',\n\t\tpostId: templateId,\n\t} );\n\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( currentPostType !== 'wp_template' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: sprintf(\n\t\t\t\t/* translators: %s: template title */\n\t\t\t\t__( 'Edit template: %s' ),\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\teditTemplate();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getCurrentPostType() !== 'wp_template',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Reset template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Reset template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Delete template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Delete template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: template.type,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC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K,GACVzB,QAAQ,CAAC0C,IAAI,KAAKC,6BAAkB,GACjC,IAAAjB,aAAO,EACP;IACA,IAAAC,QAAE,EAAE,qBAAsB,CAAC,EAC3B,IAAAC,4BAAc,EAAE5B,QAAQ,CAAC6B,KAAM,CAC/B,CAAC,GACD,IAAAH,aAAO,EACP;IACA,IAAAC,QAAE,EAAE,0BAA2B,CAAC,EAChC,IAAAC,4BAAc,EAAE5B,QAAQ,CAAC6B,KAAM,CAC/B,CAAC;IACLP,QAAQ,CAACC,IAAI,CAAE;MACdC,IAAI,EAAE,sBAAsB;MAC5BC,KAAK;MACLK,IAAI,EAAEkB,YAAK;MACXhB,QAAQ,EAAEA,CAAE;QAAEC;MAAM,CAAC,KAAM;QAC1BI,cAAc,CAAErC,QAAS,CAAC;QAC1B;QACAuC,OAAO,CAAChB,IAAI,CAAE;UACbN,QAAQ,EAAEjB,QAAQ,CAAC0C;QACpB,CAAE,CAAC;QACHT,KAAK,CAAC,CAAC;MACR;IACD,CAAE,CAAC;EACJ;EAEA,OAAO;IACNZ,SAAS,EAAE,CAAEe,QAAQ;IACrBd;EACD,CAAC;AACF;AAEO,SAAS2B,mBAAmBA,CAAA,EAAG;EACrC,IAAAC,0BAAgB,EAAE;IACjB1B,IAAI,EAAE,mCAAmC;IACzC2B,IAAI,EAAErD,2BAA2B;IACjCsD,OAAO,EAAE;EACV,CAAE,CAAC;EAEH,IAAAF,0BAAgB,EAAE;IACjB1B,IAAI,EAAE,oCAAoC;IAC1C2B,IAAI,EAAEhB;EACP,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect, useState, flushSync } from '@wordpress/element';
|
|
5
|
-
import { createQueue } from '@wordpress/priority-queue';
|
|
6
|
-
const blockPreviewQueue = createQueue();
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Renders a component at the next idle time.
|
|
10
|
-
* @param {*} props
|
|
11
|
-
*/
|
|
12
|
-
export function Async({
|
|
13
|
-
children,
|
|
14
|
-
placeholder
|
|
15
|
-
}) {
|
|
16
|
-
const [shouldRender, setShouldRender] = useState(false);
|
|
17
|
-
|
|
18
|
-
// In the future, we could try to use startTransition here, but currently
|
|
19
|
-
// react will batch all transitions, which means all previews will be
|
|
20
|
-
// rendered at the same time.
|
|
21
|
-
// https://react.dev/reference/react/startTransition#caveats
|
|
22
|
-
// > If there are multiple ongoing Transitions, React currently batches them
|
|
23
|
-
// > together. This is a limitation that will likely be removed in a future
|
|
24
|
-
// > release.
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
const context = {};
|
|
28
|
-
blockPreviewQueue.add(context, () => {
|
|
29
|
-
// Synchronously run all renders so it consumes timeRemaining.
|
|
30
|
-
// See https://github.com/WordPress/gutenberg/pull/48238
|
|
31
|
-
flushSync(() => {
|
|
32
|
-
setShouldRender(true);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
return () => {
|
|
36
|
-
blockPreviewQueue.cancel(context);
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
|
-
if (!shouldRender) {
|
|
40
|
-
return placeholder;
|
|
41
|
-
}
|
|
42
|
-
return children;
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","flushSync","createQueue","blockPreviewQueue","Async","children","placeholder","shouldRender","setShouldRender","context","add","cancel"],"sources":["@wordpress/edit-site/src/components/async/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useState, flushSync } from '@wordpress/element';\nimport { createQueue } from '@wordpress/priority-queue';\n\nconst blockPreviewQueue = createQueue();\n\n/**\n * Renders a component at the next idle time.\n * @param {*} props\n */\nexport function Async( { children, placeholder } ) {\n\tconst [ shouldRender, setShouldRender ] = useState( false );\n\n\t// In the future, we could try to use startTransition here, but currently\n\t// react will batch all transitions, which means all previews will be\n\t// rendered at the same time.\n\t// https://react.dev/reference/react/startTransition#caveats\n\t// > If there are multiple ongoing Transitions, React currently batches them\n\t// > together. This is a limitation that will likely be removed in a future\n\t// > release.\n\n\tuseEffect( () => {\n\t\tconst context = {};\n\t\tblockPreviewQueue.add( context, () => {\n\t\t\t// Synchronously run all renders so it consumes timeRemaining.\n\t\t\t// See https://github.com/WordPress/gutenberg/pull/48238\n\t\t\tflushSync( () => {\n\t\t\t\tsetShouldRender( true );\n\t\t\t} );\n\t\t} );\n\t\treturn () => {\n\t\t\tblockPreviewQueue.cancel( context );\n\t\t};\n\t}, [] );\n\n\tif ( ! shouldRender ) {\n\t\treturn placeholder;\n\t}\n\n\treturn children;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,oBAAoB;AACnE,SAASC,WAAW,QAAQ,2BAA2B;AAEvD,MAAMC,iBAAiB,GAAGD,WAAW,CAAC,CAAC;;AAEvC;AACA;AACA;AACA;AACA,OAAO,SAASE,KAAKA,CAAE;EAAEC,QAAQ;EAAEC;AAAY,CAAC,EAAG;EAClD,MAAM,CAAEC,YAAY,EAAEC,eAAe,CAAE,GAAGR,QAAQ,CAAE,KAAM,CAAC;;EAE3D;EACA;EACA;EACA;EACA;EACA;EACA;;EAEAD,SAAS,CAAE,MAAM;IAChB,MAAMU,OAAO,GAAG,CAAC,CAAC;IAClBN,iBAAiB,CAACO,GAAG,CAAED,OAAO,EAAE,MAAM;MACrC;MACA;MACAR,SAAS,CAAE,MAAM;QAChBO,eAAe,CAAE,IAAK,CAAC;MACxB,CAAE,CAAC;IACJ,CAAE,CAAC;IACH,OAAO,MAAM;MACZL,iBAAiB,CAACQ,MAAM,CAAEF,OAAQ,CAAC;IACpC,CAAC;EACF,CAAC,EAAE,EAAG,CAAC;EAEP,IAAK,CAAEF,YAAY,EAAG;IACrB,OAAOD,WAAW;EACnB;EAEA,OAAOD,QAAQ;AAChB","ignoreList":[]}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import { store as editSiteStore } from '../../store';
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
function KeyboardShortcutsGlobal() {
|
|
15
|
-
const {
|
|
16
|
-
__experimentalGetDirtyEntityRecords,
|
|
17
|
-
isSavingEntityRecord
|
|
18
|
-
} = useSelect(coreStore);
|
|
19
|
-
const {
|
|
20
|
-
hasNonPostEntityChanges
|
|
21
|
-
} = useSelect(editorStore);
|
|
22
|
-
const {
|
|
23
|
-
getCanvasMode
|
|
24
|
-
} = unlock(useSelect(editSiteStore));
|
|
25
|
-
const {
|
|
26
|
-
setIsSaveViewOpened
|
|
27
|
-
} = useDispatch(editSiteStore);
|
|
28
|
-
useShortcut('core/edit-site/save', event => {
|
|
29
|
-
event.preventDefault();
|
|
30
|
-
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
31
|
-
const hasDirtyEntities = !!dirtyEntityRecords.length;
|
|
32
|
-
const isSaving = dirtyEntityRecords.some(record => isSavingEntityRecord(record.kind, record.name, record.key));
|
|
33
|
-
const _hasNonPostEntityChanges = hasNonPostEntityChanges();
|
|
34
|
-
const isViewMode = getCanvasMode() === 'view';
|
|
35
|
-
if ((!hasDirtyEntities || !_hasNonPostEntityChanges || isSaving) && !isViewMode) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
// At this point, we know that there are dirty entities, other than
|
|
39
|
-
// the edited post, and we're not in the process of saving, so open
|
|
40
|
-
// save view.
|
|
41
|
-
setIsSaveViewOpened(true);
|
|
42
|
-
});
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
export default KeyboardShortcutsGlobal;
|
|
46
|
-
//# sourceMappingURL=global.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useShortcut","useDispatch","useSelect","store","coreStore","editorStore","editSiteStore","unlock","KeyboardShortcutsGlobal","__experimentalGetDirtyEntityRecords","isSavingEntityRecord","hasNonPostEntityChanges","getCanvasMode","setIsSaveViewOpened","event","preventDefault","dirtyEntityRecords","hasDirtyEntities","length","isSaving","some","record","kind","name","key","_hasNonPostEntityChanges","isViewMode"],"sources":["@wordpress/edit-site/src/components/keyboard-shortcuts/global.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nfunction KeyboardShortcutsGlobal() {\n\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\tuseSelect( coreStore );\n\tconst { hasNonPostEntityChanges } = useSelect( editorStore );\n\tconst { getCanvasMode } = unlock( useSelect( editSiteStore ) );\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\n\tuseShortcut( 'core/edit-site/save', ( event ) => {\n\t\tevent.preventDefault();\n\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst hasDirtyEntities = !! dirtyEntityRecords.length;\n\t\tconst isSaving = dirtyEntityRecords.some( ( record ) =>\n\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t);\n\t\tconst _hasNonPostEntityChanges = hasNonPostEntityChanges();\n\t\tconst isViewMode = getCanvasMode() === 'view';\n\t\tif (\n\t\t\t( ! hasDirtyEntities || ! _hasNonPostEntityChanges || isSaving ) &&\n\t\t\t! isViewMode\n\t\t) {\n\t\t\treturn;\n\t\t}\n\t\t// At this point, we know that there are dirty entities, other than\n\t\t// the edited post, and we're not in the process of saving, so open\n\t\t// save view.\n\t\tsetIsSaveViewOpened( true );\n\t} );\n\n\treturn null;\n}\n\nexport default KeyboardShortcutsGlobal;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,WAAW,QAAQ,+BAA+B;AAC3D,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASF,KAAK,IAAIG,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,SAASC,uBAAuBA,CAAA,EAAG;EAClC,MAAM;IAAEC,mCAAmC;IAAEC;EAAqB,CAAC,GAClER,SAAS,CAAEE,SAAU,CAAC;EACvB,MAAM;IAAEO;EAAwB,CAAC,GAAGT,SAAS,CAAEG,WAAY,CAAC;EAC5D,MAAM;IAAEO;EAAc,CAAC,GAAGL,MAAM,CAAEL,SAAS,CAAEI,aAAc,CAAE,CAAC;EAC9D,MAAM;IAAEO;EAAoB,CAAC,GAAGZ,WAAW,CAAEK,aAAc,CAAC;EAE5DN,WAAW,CAAE,qBAAqB,EAAIc,KAAK,IAAM;IAChDA,KAAK,CAACC,cAAc,CAAC,CAAC;IAEtB,MAAMC,kBAAkB,GAAGP,mCAAmC,CAAC,CAAC;IAChE,MAAMQ,gBAAgB,GAAG,CAAC,CAAED,kBAAkB,CAACE,MAAM;IACrD,MAAMC,QAAQ,GAAGH,kBAAkB,CAACI,IAAI,CAAIC,MAAM,IACjDX,oBAAoB,CAAEW,MAAM,CAACC,IAAI,EAAED,MAAM,CAACE,IAAI,EAAEF,MAAM,CAACG,GAAI,CAC5D,CAAC;IACD,MAAMC,wBAAwB,GAAGd,uBAAuB,CAAC,CAAC;IAC1D,MAAMe,UAAU,GAAGd,aAAa,CAAC,CAAC,KAAK,MAAM;IAC7C,IACC,CAAE,CAAEK,gBAAgB,IAAI,CAAEQ,wBAAwB,IAAIN,QAAQ,KAC9D,CAAEO,UAAU,EACX;MACD;IACD;IACA;IACA;IACA;IACAb,mBAAmB,CAAE,IAAK,CAAC;EAC5B,CAAE,CAAC;EAEH,OAAO,IAAI;AACZ;AAEA,eAAeL,uBAAuB","ignoreList":[]}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
6
|
-
import { useDispatch } from '@wordpress/data';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
function KeyboardShortcutsRegister() {
|
|
9
|
-
// Registering the shortcuts.
|
|
10
|
-
const {
|
|
11
|
-
registerShortcut
|
|
12
|
-
} = useDispatch(keyboardShortcutsStore);
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
registerShortcut({
|
|
15
|
-
name: 'core/edit-site/save',
|
|
16
|
-
category: 'global',
|
|
17
|
-
description: __('Save your changes.'),
|
|
18
|
-
keyCombination: {
|
|
19
|
-
modifier: 'primary',
|
|
20
|
-
character: 's'
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}, [registerShortcut]);
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
export default KeyboardShortcutsRegister;
|
|
27
|
-
//# sourceMappingURL=register.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","store","keyboardShortcutsStore","useDispatch","__","KeyboardShortcutsRegister","registerShortcut","name","category","description","keyCombination","modifier","character"],"sources":["@wordpress/edit-site/src/components/keyboard-shortcuts/register.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { useDispatch } from '@wordpress/data';\nimport { __ } from '@wordpress/i18n';\n\nfunction KeyboardShortcutsRegister() {\n\t// Registering the shortcuts.\n\tconst { registerShortcut } = useDispatch( keyboardShortcutsStore );\n\tuseEffect( () => {\n\t\tregisterShortcut( {\n\t\t\tname: 'core/edit-site/save',\n\t\t\tcategory: 'global',\n\t\t\tdescription: __( 'Save your changes.' ),\n\t\t\tkeyCombination: {\n\t\t\t\tmodifier: 'primary',\n\t\t\t\tcharacter: 's',\n\t\t\t},\n\t\t} );\n\t}, [ registerShortcut ] );\n\n\treturn null;\n}\n\nexport default KeyboardShortcutsRegister;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,KAAK,IAAIC,sBAAsB,QAAQ,+BAA+B;AAC/E,SAASC,WAAW,QAAQ,iBAAiB;AAC7C,SAASC,EAAE,QAAQ,iBAAiB;AAEpC,SAASC,yBAAyBA,CAAA,EAAG;EACpC;EACA,MAAM;IAAEC;EAAiB,CAAC,GAAGH,WAAW,CAAED,sBAAuB,CAAC;EAClEF,SAAS,CAAE,MAAM;IAChBM,gBAAgB,CAAE;MACjBC,IAAI,EAAE,qBAAqB;MAC3BC,QAAQ,EAAE,QAAQ;MAClBC,WAAW,EAAEL,EAAE,CAAE,oBAAqB,CAAC;MACvCM,cAAc,EAAE;QACfC,QAAQ,EAAE,SAAS;QACnBC,SAAS,EAAE;MACZ;IACD,CAAE,CAAC;EACJ,CAAC,EAAE,CAAEN,gBAAgB,CAAG,CAAC;EAEzB,OAAO,IAAI;AACZ;AAEA,eAAeD,yBAAyB","ignoreList":[]}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect, useRef } from '@wordpress/element';
|
|
5
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
6
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
import { store as editSiteStore } from '../../store';
|
|
12
|
-
import { unlock } from '../../lock-unlock';
|
|
13
|
-
const {
|
|
14
|
-
useLocation,
|
|
15
|
-
useHistory
|
|
16
|
-
} = unlock(routerPrivateApis);
|
|
17
|
-
export default function useSyncCanvasModeWithURL() {
|
|
18
|
-
const history = useHistory();
|
|
19
|
-
const {
|
|
20
|
-
params
|
|
21
|
-
} = useLocation();
|
|
22
|
-
const canvasMode = useSelect(select => unlock(select(editSiteStore)).getCanvasMode(), []);
|
|
23
|
-
const {
|
|
24
|
-
setCanvasMode
|
|
25
|
-
} = unlock(useDispatch(editSiteStore));
|
|
26
|
-
const currentCanvasModeRef = useRef(canvasMode);
|
|
27
|
-
const {
|
|
28
|
-
canvas: canvasInUrl
|
|
29
|
-
} = params;
|
|
30
|
-
const currentCanvasInUrlRef = useRef(canvasInUrl);
|
|
31
|
-
const currentUrlParamsRef = useRef(params);
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
currentUrlParamsRef.current = params;
|
|
34
|
-
}, [params]);
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
currentCanvasModeRef.current = canvasMode;
|
|
37
|
-
if (canvasMode === 'init') {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (canvasMode === 'edit' && currentCanvasInUrlRef.current !== canvasMode) {
|
|
41
|
-
history.push({
|
|
42
|
-
...currentUrlParamsRef.current,
|
|
43
|
-
canvas: 'edit'
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
if (canvasMode === 'view' && currentCanvasInUrlRef.current !== undefined) {
|
|
47
|
-
history.push({
|
|
48
|
-
...currentUrlParamsRef.current,
|
|
49
|
-
canvas: undefined
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}, [canvasMode, history]);
|
|
53
|
-
useEffect(() => {
|
|
54
|
-
currentCanvasInUrlRef.current = canvasInUrl;
|
|
55
|
-
if (canvasInUrl !== 'edit' && currentCanvasModeRef.current !== 'view') {
|
|
56
|
-
setCanvasMode('view');
|
|
57
|
-
} else if (canvasInUrl === 'edit' && currentCanvasModeRef.current !== 'edit') {
|
|
58
|
-
setCanvasMode('edit');
|
|
59
|
-
}
|
|
60
|
-
}, [canvasInUrl, setCanvasMode]);
|
|
61
|
-
}
|
|
62
|
-
//# sourceMappingURL=use-sync-canvas-mode-with-url.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useRef","useSelect","useDispatch","privateApis","routerPrivateApis","store","editSiteStore","unlock","useLocation","useHistory","useSyncCanvasModeWithURL","history","params","canvasMode","select","getCanvasMode","setCanvasMode","currentCanvasModeRef","canvas","canvasInUrl","currentCanvasInUrlRef","currentUrlParamsRef","current","push","undefined"],"sources":["@wordpress/edit-site/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function useSyncCanvasModeWithURL() {\n\tconst history = useHistory();\n\tconst { params } = useLocation();\n\tconst canvasMode = useSelect(\n\t\t( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst currentCanvasModeRef = useRef( canvasMode );\n\tconst { canvas: canvasInUrl } = params;\n\tconst currentCanvasInUrlRef = useRef( canvasInUrl );\n\tconst currentUrlParamsRef = useRef( params );\n\tuseEffect( () => {\n\t\tcurrentUrlParamsRef.current = params;\n\t}, [ params ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasModeRef.current = canvasMode;\n\t\tif ( canvasMode === 'init' ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'edit' &&\n\t\t\tcurrentCanvasInUrlRef.current !== canvasMode\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParamsRef.current,\n\t\t\t\tcanvas: 'edit',\n\t\t\t} );\n\t\t}\n\n\t\tif (\n\t\t\tcanvasMode === 'view' &&\n\t\t\tcurrentCanvasInUrlRef.current !== undefined\n\t\t) {\n\t\t\thistory.push( {\n\t\t\t\t...currentUrlParamsRef.current,\n\t\t\t\tcanvas: undefined,\n\t\t\t} );\n\t\t}\n\t}, [ canvasMode, history ] );\n\n\tuseEffect( () => {\n\t\tcurrentCanvasInUrlRef.current = canvasInUrl;\n\t\tif (\n\t\t\tcanvasInUrl !== 'edit' &&\n\t\t\tcurrentCanvasModeRef.current !== 'view'\n\t\t) {\n\t\t\tsetCanvasMode( 'view' );\n\t\t} else if (\n\t\t\tcanvasInUrl === 'edit' &&\n\t\t\tcurrentCanvasModeRef.current !== 'edit'\n\t\t) {\n\t\t\tsetCanvasMode( 'edit' );\n\t\t}\n\t}, [ canvasInUrl, setCanvasMode ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,MAAM,QAAQ,oBAAoB;AACtD,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,KAAK,IAAIC,aAAa,QAAQ,aAAa;AACpD,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,WAAW;EAAEC;AAAW,CAAC,GAAGF,MAAM,CAAEH,iBAAkB,CAAC;AAE/D,eAAe,SAASM,wBAAwBA,CAAA,EAAG;EAClD,MAAMC,OAAO,GAAGF,UAAU,CAAC,CAA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W;IAC3C,IACCA,WAAW,KAAK,MAAM,IACtBF,oBAAoB,CAACK,OAAO,KAAK,MAAM,EACtC;MACDN,aAAa,CAAE,MAAO,CAAC;IACxB,CAAC,MAAM,IACNG,WAAW,KAAK,MAAM,IACtBF,oBAAoB,CAACK,OAAO,KAAK,MAAM,EACtC;MACDN,aAAa,CAAE,MAAO,CAAC;IACxB;EACD,CAAC,EAAE,CAAEG,WAAW,EAAEH,aAAa,CAAG,CAAC;AACpC","ignoreList":[]}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect } from '@wordpress/data';
|
|
5
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import { store as editSiteStore } from '../../store';
|
|
13
|
-
export default function useEditedEntityRecord(postType, postId) {
|
|
14
|
-
const {
|
|
15
|
-
record,
|
|
16
|
-
title,
|
|
17
|
-
description,
|
|
18
|
-
isLoaded,
|
|
19
|
-
icon
|
|
20
|
-
} = useSelect(select => {
|
|
21
|
-
const {
|
|
22
|
-
getEditedPostType,
|
|
23
|
-
getEditedPostId
|
|
24
|
-
} = select(editSiteStore);
|
|
25
|
-
const {
|
|
26
|
-
getEditedEntityRecord,
|
|
27
|
-
hasFinishedResolution
|
|
28
|
-
} = select(coreStore);
|
|
29
|
-
const {
|
|
30
|
-
__experimentalGetTemplateInfo: getTemplateInfo
|
|
31
|
-
} = select(editorStore);
|
|
32
|
-
const usedPostType = postType !== null && postType !== void 0 ? postType : getEditedPostType();
|
|
33
|
-
const usedPostId = postId !== null && postId !== void 0 ? postId : getEditedPostId();
|
|
34
|
-
const _record = getEditedEntityRecord('postType', usedPostType, usedPostId);
|
|
35
|
-
const _isLoaded = usedPostId && hasFinishedResolution('getEditedEntityRecord', ['postType', usedPostType, usedPostId]);
|
|
36
|
-
const templateInfo = getTemplateInfo(_record);
|
|
37
|
-
return {
|
|
38
|
-
record: _record,
|
|
39
|
-
title: templateInfo.title,
|
|
40
|
-
description: templateInfo.description,
|
|
41
|
-
isLoaded: _isLoaded,
|
|
42
|
-
icon: templateInfo.icon
|
|
43
|
-
};
|
|
44
|
-
}, [postType, postId]);
|
|
45
|
-
return {
|
|
46
|
-
isLoaded,
|
|
47
|
-
icon,
|
|
48
|
-
record,
|
|
49
|
-
getTitle: () => title ? decodeEntities(title) : null,
|
|
50
|
-
getDescription: () => description ? decodeEntities(description) : null
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","store","coreStore","editorStore","decodeEntities","editSiteStore","useEditedEntityRecord","postType","postId","record","title","description","isLoaded","icon","select","getEditedPostType","getEditedPostId","getEditedEntityRecord","hasFinishedResolution","__experimentalGetTemplateInfo","getTemplateInfo","usedPostType","usedPostId","_record","_isLoaded","templateInfo","getTitle","getDescription"],"sources":["@wordpress/edit-site/src/components/use-edited-entity-record/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\nexport default function useEditedEntityRecord( postType, postId ) {\n\tconst { record, title, description, isLoaded, icon } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEditedPostType, getEditedPostId } =\n\t\t\t\tselect( editSiteStore );\n\t\t\tconst { getEditedEntityRecord, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\t\t\tconst { __experimentalGetTemplateInfo: getTemplateInfo } =\n\t\t\t\tselect( editorStore );\n\t\t\tconst usedPostType = postType ?? getEditedPostType();\n\t\t\tconst usedPostId = postId ?? getEditedPostId();\n\t\t\tconst _record = getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tusedPostType,\n\t\t\t\tusedPostId\n\t\t\t);\n\t\t\tconst _isLoaded =\n\t\t\t\tusedPostId &&\n\t\t\t\thasFinishedResolution( 'getEditedEntityRecord', [\n\t\t\t\t\t'postType',\n\t\t\t\t\tusedPostType,\n\t\t\t\t\tusedPostId,\n\t\t\t\t] );\n\t\t\tconst templateInfo = getTemplateInfo( _record );\n\n\t\t\treturn {\n\t\t\t\trecord: _record,\n\t\t\t\ttitle: templateInfo.title,\n\t\t\t\tdescription: templateInfo.description,\n\t\t\t\tisLoaded: _isLoaded,\n\t\t\t\ticon: templateInfo.icon,\n\t\t\t};\n\t\t},\n\t\t[ postType, postId ]\n\t);\n\n\treturn {\n\t\tisLoaded,\n\t\ticon,\n\t\trecord,\n\t\tgetTitle: () => ( title ? decodeEntities( title ) : null ),\n\t\tgetDescription: () =>\n\t\t\tdescription ? decodeEntities( description ) : null,\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASD,KAAK,IAAIE,WAAW,QAAQ,mBAAmB;AACxD,SAASC,cAAc,QAAQ,0BAA0B;;AAEzD;AACA;AACA;AACA,SAASH,KAAK,IAAII,aAAa,QAAQ,aAAa;AAEpD,eAAe,SAASC,qBAAqBA,CAAEC,QAAQ,EAAEC,MAAM,EAAG;EACjE,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC,WAAW;IAAEC,QAAQ;IAAEC;EAAK,CAAC,GAAGb,SAAS,CAC7Dc,MAAM,IAAM;IACb,MAAM;MAAEC,iBAAiB;MAAEC;IAAgB,CAAC,GAC3CF,MAAM,CAAET,aAAc,CAAC;IACxB,MAAM;MAAEY,qBAAqB;MAAEC;IAAsB,CAAC,GACrDJ,MAAM,CAAEZ,SAAU,CAAC;IACpB,MAAM;MAAEiB,6BAA6B,EAAEC;IAAgB,CAAC,GACvDN,MAAM,CAAEX,WAAY,CAAC;IACtB,MAAMkB,YAAY,GAAGd,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIQ,iBAAiB,CAAC,CAAC;IACpD,MAAMO,UAAU,GAAGd,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIQ,eAAe,CAAC,CAAC;IAC9C,MAAMO,OAAO,GAAGN,qBAAqB,CACpC,UAAU,EACVI,YAAY,EACZC,UACD,CAAC;IACD,MAAME,SAAS,GACdF,UAAU,IACVJ,qBAAqB,CAAE,uBAAuB,EAAE,CAC/C,UAAU,EACVG,YAAY,EACZC,UAAU,CACT,CAAC;IACJ,MAAMG,YAAY,GAAGL,eAAe,CAAEG,OAAQ,CAAC;IAE/C,OAAO;MACNd,MAAM,EAAEc,OAAO;MACfb,KAAK,EAAEe,YAAY,CAACf,KAAK;MACzBC,WAAW,EAAEc,YAAY,CAACd,WAAW;MACrCC,QAAQ,EAAEY,SAAS;MACnBX,IAAI,EAAEY,YAAY,CAACZ;IACpB,CAAC;EACF,CAAC,EACD,CAAEN,QAAQ,EAAEC,MAAM,CACnB,CAAC;EAED,OAAO;IACNI,QAAQ;IACRC,IAAI;IACJJ,MAAM;IACNiB,QAAQ,EAAEA,CAAA,KAAQhB,KAAK,GAAGN,cAAc,CAAEM,KAAM,CAAC,GAAG,IAAM;IAC1DiB,cAAc,EAAEA,CAAA,KACfhB,WAAW,GAAGP,cAAc,CAAEO,WAAY,CAAC,GAAG;EAChD,CAAC;AACF","ignoreList":[]}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
-
import { __, sprintf, isRTL } from '@wordpress/i18n';
|
|
6
|
-
import { trash, rotateLeft, rotateRight, layout, page } from '@wordpress/icons';
|
|
7
|
-
import { useCommandLoader } from '@wordpress/commands';
|
|
8
|
-
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
|
-
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
10
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Internal dependencies
|
|
14
|
-
*/
|
|
15
|
-
import { store as editSiteStore } from '../../store';
|
|
16
|
-
import useEditedEntityRecord from '../../components/use-edited-entity-record';
|
|
17
|
-
import isTemplateRemovable from '../../utils/is-template-removable';
|
|
18
|
-
import isTemplateRevertable from '../../utils/is-template-revertable';
|
|
19
|
-
import { unlock } from '../../lock-unlock';
|
|
20
|
-
import { TEMPLATE_POST_TYPE } from '../../utils/constants';
|
|
21
|
-
import { useLink } from '../../components/routes/link';
|
|
22
|
-
const {
|
|
23
|
-
useHistory
|
|
24
|
-
} = unlock(routerPrivateApis);
|
|
25
|
-
function usePageContentFocusCommands() {
|
|
26
|
-
const {
|
|
27
|
-
record: template
|
|
28
|
-
} = useEditedEntityRecord();
|
|
29
|
-
const {
|
|
30
|
-
isPage,
|
|
31
|
-
canvasMode,
|
|
32
|
-
templateId,
|
|
33
|
-
currentPostType
|
|
34
|
-
} = useSelect(select => {
|
|
35
|
-
const {
|
|
36
|
-
isPage: _isPage,
|
|
37
|
-
getCanvasMode
|
|
38
|
-
} = unlock(select(editSiteStore));
|
|
39
|
-
const {
|
|
40
|
-
getCurrentPostType,
|
|
41
|
-
getCurrentTemplateId
|
|
42
|
-
} = select(editorStore);
|
|
43
|
-
return {
|
|
44
|
-
isPage: _isPage(),
|
|
45
|
-
canvasMode: getCanvasMode(),
|
|
46
|
-
templateId: getCurrentTemplateId(),
|
|
47
|
-
currentPostType: getCurrentPostType()
|
|
48
|
-
};
|
|
49
|
-
}, []);
|
|
50
|
-
const {
|
|
51
|
-
onClick: editTemplate
|
|
52
|
-
} = useLink({
|
|
53
|
-
postType: 'wp_template',
|
|
54
|
-
postId: templateId
|
|
55
|
-
});
|
|
56
|
-
const {
|
|
57
|
-
setRenderingMode
|
|
58
|
-
} = useDispatch(editorStore);
|
|
59
|
-
if (!isPage || canvasMode !== 'edit') {
|
|
60
|
-
return {
|
|
61
|
-
isLoading: false,
|
|
62
|
-
commands: []
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
const commands = [];
|
|
66
|
-
if (currentPostType !== 'wp_template') {
|
|
67
|
-
commands.push({
|
|
68
|
-
name: 'core/switch-to-template-focus',
|
|
69
|
-
label: sprintf(/* translators: %s: template title */
|
|
70
|
-
__('Edit template: %s'), decodeEntities(template.title)),
|
|
71
|
-
icon: layout,
|
|
72
|
-
callback: ({
|
|
73
|
-
close
|
|
74
|
-
}) => {
|
|
75
|
-
editTemplate();
|
|
76
|
-
close();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
} else {
|
|
80
|
-
commands.push({
|
|
81
|
-
name: 'core/switch-to-page-focus',
|
|
82
|
-
label: __('Back to page'),
|
|
83
|
-
icon: page,
|
|
84
|
-
callback: ({
|
|
85
|
-
close
|
|
86
|
-
}) => {
|
|
87
|
-
setRenderingMode('template-locked');
|
|
88
|
-
close();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
return {
|
|
93
|
-
isLoading: false,
|
|
94
|
-
commands
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function useManipulateDocumentCommands() {
|
|
98
|
-
const {
|
|
99
|
-
isLoaded,
|
|
100
|
-
record: template
|
|
101
|
-
} = useEditedEntityRecord();
|
|
102
|
-
const {
|
|
103
|
-
removeTemplate,
|
|
104
|
-
revertTemplate
|
|
105
|
-
} = useDispatch(editSiteStore);
|
|
106
|
-
const history = useHistory();
|
|
107
|
-
const isEditingPage = useSelect(select => select(editSiteStore).isPage() && select(editorStore).getCurrentPostType() !== 'wp_template', []);
|
|
108
|
-
if (!isLoaded) {
|
|
109
|
-
return {
|
|
110
|
-
isLoading: true,
|
|
111
|
-
commands: []
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
const commands = [];
|
|
115
|
-
if (isTemplateRevertable(template) && !isEditingPage) {
|
|
116
|
-
const label = template.type === TEMPLATE_POST_TYPE ? sprintf(/* translators: %s: template title */
|
|
117
|
-
__('Reset template: %s'), decodeEntities(template.title)) : sprintf(/* translators: %s: template part title */
|
|
118
|
-
__('Reset template part: %s'), decodeEntities(template.title));
|
|
119
|
-
commands.push({
|
|
120
|
-
name: 'core/reset-template',
|
|
121
|
-
label,
|
|
122
|
-
icon: isRTL() ? rotateRight : rotateLeft,
|
|
123
|
-
callback: ({
|
|
124
|
-
close
|
|
125
|
-
}) => {
|
|
126
|
-
revertTemplate(template);
|
|
127
|
-
close();
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
if (isTemplateRemovable(template) && !isEditingPage) {
|
|
132
|
-
const label = template.type === TEMPLATE_POST_TYPE ? sprintf(/* translators: %s: template title */
|
|
133
|
-
__('Delete template: %s'), decodeEntities(template.title)) : sprintf(/* translators: %s: template part title */
|
|
134
|
-
__('Delete template part: %s'), decodeEntities(template.title));
|
|
135
|
-
commands.push({
|
|
136
|
-
name: 'core/remove-template',
|
|
137
|
-
label,
|
|
138
|
-
icon: trash,
|
|
139
|
-
callback: ({
|
|
140
|
-
close
|
|
141
|
-
}) => {
|
|
142
|
-
removeTemplate(template);
|
|
143
|
-
// Navigate to the template list
|
|
144
|
-
history.push({
|
|
145
|
-
postType: template.type
|
|
146
|
-
});
|
|
147
|
-
close();
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
return {
|
|
152
|
-
isLoading: !isLoaded,
|
|
153
|
-
commands
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
export function useEditModeCommands() {
|
|
157
|
-
useCommandLoader({
|
|
158
|
-
name: 'core/edit-site/page-content-focus',
|
|
159
|
-
hook: usePageContentFocusCommands,
|
|
160
|
-
context: 'entity-edit'
|
|
161
|
-
});
|
|
162
|
-
useCommandLoader({
|
|
163
|
-
name: 'core/edit-site/manipulate-document',
|
|
164
|
-
hook: useManipulateDocumentCommands
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
//# sourceMappingURL=use-edit-mode-commands.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["useSelect","useDispatch","__","sprintf","isRTL","trash","rotateLeft","rotateRight","layout","page","useCommandLoader","decodeEntities","privateApis","routerPrivateApis","store","editorStore","editSiteStore","useEditedEntityRecord","isTemplateRemovable","isTemplateRevertable","unlock","TEMPLATE_POST_TYPE","useLink","useHistory","usePageContentFocusCommands","record","template","isPage","canvasMode","templateId","currentPostType","select","_isPage","getCanvasMode","getCurrentPostType","getCurrentTemplateId","onClick","editTemplate","postType","postId","setRenderingMode","isLoading","commands","push","name","label","title","icon","callback","close","useManipulateDocumentCommands","isLoaded","removeTemplate","revertTemplate","history","isEditingPage","type","useEditModeCommands","hook","context"],"sources":["@wordpress/edit-site/src/hooks/commands/use-edit-mode-commands.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { __, sprintf, isRTL } from '@wordpress/i18n';\nimport { trash, rotateLeft, rotateRight, layout, page } from '@wordpress/icons';\nimport { useCommandLoader } from '@wordpress/commands';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport useEditedEntityRecord from '../../components/use-edited-entity-record';\nimport isTemplateRemovable from '../../utils/is-template-removable';\nimport isTemplateRevertable from '../../utils/is-template-revertable';\nimport { unlock } from '../../lock-unlock';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { useLink } from '../../components/routes/link';\n\nconst { useHistory } = unlock( routerPrivateApis );\n\nfunction usePageContentFocusCommands() {\n\tconst { record: template } = useEditedEntityRecord();\n\tconst { isPage, canvasMode, templateId, currentPostType } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isPage: _isPage, getCanvasMode } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\t\t\tconst { getCurrentPostType, getCurrentTemplateId } =\n\t\t\t\tselect( editorStore );\n\t\t\treturn {\n\t\t\t\tisPage: _isPage(),\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\ttemplateId: getCurrentTemplateId(),\n\t\t\t\tcurrentPostType: getCurrentPostType(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst { onClick: editTemplate } = useLink( {\n\t\tpostType: 'wp_template',\n\t\tpostId: templateId,\n\t} );\n\n\tconst { setRenderingMode } = useDispatch( editorStore );\n\n\tif ( ! isPage || canvasMode !== 'edit' ) {\n\t\treturn { isLoading: false, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( currentPostType !== 'wp_template' ) {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-template-focus',\n\t\t\tlabel: sprintf(\n\t\t\t\t/* translators: %s: template title */\n\t\t\t\t__( 'Edit template: %s' ),\n\t\t\t\tdecodeEntities( template.title )\n\t\t\t),\n\t\t\ticon: layout,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\teditTemplate();\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t} else {\n\t\tcommands.push( {\n\t\t\tname: 'core/switch-to-page-focus',\n\t\t\tlabel: __( 'Back to page' ),\n\t\t\ticon: page,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tsetRenderingMode( 'template-locked' );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn { isLoading: false, commands };\n}\n\nfunction useManipulateDocumentCommands() {\n\tconst { isLoaded, record: template } = useEditedEntityRecord();\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst history = useHistory();\n\tconst isEditingPage = useSelect(\n\t\t( select ) =>\n\t\t\tselect( editSiteStore ).isPage() &&\n\t\t\tselect( editorStore ).getCurrentPostType() !== 'wp_template',\n\t\t[]\n\t);\n\n\tif ( ! isLoaded ) {\n\t\treturn { isLoading: true, commands: [] };\n\t}\n\n\tconst commands = [];\n\n\tif ( isTemplateRevertable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Reset template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Reset template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/reset-template',\n\t\t\tlabel,\n\t\t\ticon: isRTL() ? rotateRight : rotateLeft,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\trevertTemplate( template );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\tif ( isTemplateRemovable( template ) && ! isEditingPage ) {\n\t\tconst label =\n\t\t\ttemplate.type === TEMPLATE_POST_TYPE\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t/* translators: %s: template title */\n\t\t\t\t\t\t__( 'Delete template: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t/* translators: %s: template part title */\n\t\t\t\t\t\t__( 'Delete template part: %s' ),\n\t\t\t\t\t\tdecodeEntities( template.title )\n\t\t\t\t );\n\t\tcommands.push( {\n\t\t\tname: 'core/remove-template',\n\t\t\tlabel,\n\t\t\ticon: trash,\n\t\t\tcallback: ( { close } ) => {\n\t\t\t\tremoveTemplate( template );\n\t\t\t\t// Navigate to the template list\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: template.type,\n\t\t\t\t} );\n\t\t\t\tclose();\n\t\t\t},\n\t\t} );\n\t}\n\n\treturn {\n\t\tisLoading: ! isLoaded,\n\t\tcommands,\n\t};\n}\n\nexport function useEditModeCommands() {\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/page-content-focus',\n\t\thook: usePageContentFocusCommands,\n\t\tcontext: 'entity-edit',\n\t} );\n\n\tuseCommandLoader( {\n\t\tname: 'core/edit-site/manipulate-document',\n\t\thook: useManipulateDocumentCommands,\n\t} );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,EAAE,EAAEC,OAAO,EAAEC,KAAK,QAAQ,iBAAiB;AACpD,SAASC,KAAK,EAAEC,UAAU,EAAEC,WAAW,EAAEC,MAAM,EAAEC,IAAI,QAAQ,kBAAkB;AAC/E,SAASC,gBAAgB,QAAQ,qBAAqB;AACtD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,KAAK,IAAIC,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA,SAASD,KAAK,IAAIE,aAAa,QAAQ,aAAa;AACpD,OAAOC,qBAAqB,MAAM,2CAA2C;AAC7E,OAAOC,mBAAmB,MAAM,mCAAmC;AACnE,OAAOC,oBAAoB,MAAM,oCAAoC;AACrE,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,kBAAkB,QAAQ,uBAAuB;AAC1D,SAASC,OAAO,QAAQ,8BAA8B;AAEtD,MAAM;EAAEC;AAAW,CAAC,GAAGH,MAAM,CAAEP,iBAAkB,CAAC;AAElD,SAASW,2BAA2BA,CAAA,EAAG;EACtC,MAAM;IAAEC,MAAM,EAAEC;EAAS,CAAC,GAAGT,qBAAqB,CAAC,CAAC;EACpD,MAAM;IAAEU,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAgB,CAAC,GAAG9B,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,IAAI,EAAER;EACP,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect, useState, flushSync } from '@wordpress/element';
|
|
5
|
-
import { createQueue } from '@wordpress/priority-queue';
|
|
6
|
-
|
|
7
|
-
const blockPreviewQueue = createQueue();
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Renders a component at the next idle time.
|
|
11
|
-
* @param {*} props
|
|
12
|
-
*/
|
|
13
|
-
export function Async( { children, placeholder } ) {
|
|
14
|
-
const [ shouldRender, setShouldRender ] = useState( false );
|
|
15
|
-
|
|
16
|
-
// In the future, we could try to use startTransition here, but currently
|
|
17
|
-
// react will batch all transitions, which means all previews will be
|
|
18
|
-
// rendered at the same time.
|
|
19
|
-
// https://react.dev/reference/react/startTransition#caveats
|
|
20
|
-
// > If there are multiple ongoing Transitions, React currently batches them
|
|
21
|
-
// > together. This is a limitation that will likely be removed in a future
|
|
22
|
-
// > release.
|
|
23
|
-
|
|
24
|
-
useEffect( () => {
|
|
25
|
-
const context = {};
|
|
26
|
-
blockPreviewQueue.add( context, () => {
|
|
27
|
-
// Synchronously run all renders so it consumes timeRemaining.
|
|
28
|
-
// See https://github.com/WordPress/gutenberg/pull/48238
|
|
29
|
-
flushSync( () => {
|
|
30
|
-
setShouldRender( true );
|
|
31
|
-
} );
|
|
32
|
-
} );
|
|
33
|
-
return () => {
|
|
34
|
-
blockPreviewQueue.cancel( context );
|
|
35
|
-
};
|
|
36
|
-
}, [] );
|
|
37
|
-
|
|
38
|
-
if ( ! shouldRender ) {
|
|
39
|
-
return placeholder;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return children;
|
|
43
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useShortcut } from '@wordpress/keyboard-shortcuts';
|
|
5
|
-
import { useDispatch, useSelect } from '@wordpress/data';
|
|
6
|
-
import { store as coreStore } from '@wordpress/core-data';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import { store as editSiteStore } from '../../store';
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
function KeyboardShortcutsGlobal() {
|
|
16
|
-
const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =
|
|
17
|
-
useSelect( coreStore );
|
|
18
|
-
const { hasNonPostEntityChanges } = useSelect( editorStore );
|
|
19
|
-
const { getCanvasMode } = unlock( useSelect( editSiteStore ) );
|
|
20
|
-
const { setIsSaveViewOpened } = useDispatch( editSiteStore );
|
|
21
|
-
|
|
22
|
-
useShortcut( 'core/edit-site/save', ( event ) => {
|
|
23
|
-
event.preventDefault();
|
|
24
|
-
|
|
25
|
-
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
26
|
-
const hasDirtyEntities = !! dirtyEntityRecords.length;
|
|
27
|
-
const isSaving = dirtyEntityRecords.some( ( record ) =>
|
|
28
|
-
isSavingEntityRecord( record.kind, record.name, record.key )
|
|
29
|
-
);
|
|
30
|
-
const _hasNonPostEntityChanges = hasNonPostEntityChanges();
|
|
31
|
-
const isViewMode = getCanvasMode() === 'view';
|
|
32
|
-
if (
|
|
33
|
-
( ! hasDirtyEntities || ! _hasNonPostEntityChanges || isSaving ) &&
|
|
34
|
-
! isViewMode
|
|
35
|
-
) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
// At this point, we know that there are dirty entities, other than
|
|
39
|
-
// the edited post, and we're not in the process of saving, so open
|
|
40
|
-
// save view.
|
|
41
|
-
setIsSaveViewOpened( true );
|
|
42
|
-
} );
|
|
43
|
-
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export default KeyboardShortcutsGlobal;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useEffect } from '@wordpress/element';
|
|
5
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
6
|
-
import { useDispatch } from '@wordpress/data';
|
|
7
|
-
import { __ } from '@wordpress/i18n';
|
|
8
|
-
|
|
9
|
-
function KeyboardShortcutsRegister() {
|
|
10
|
-
// Registering the shortcuts.
|
|
11
|
-
const { registerShortcut } = useDispatch( keyboardShortcutsStore );
|
|
12
|
-
useEffect( () => {
|
|
13
|
-
registerShortcut( {
|
|
14
|
-
name: 'core/edit-site/save',
|
|
15
|
-
category: 'global',
|
|
16
|
-
description: __( 'Save your changes.' ),
|
|
17
|
-
keyCombination: {
|
|
18
|
-
modifier: 'primary',
|
|
19
|
-
character: 's',
|
|
20
|
-
},
|
|
21
|
-
} );
|
|
22
|
-
}, [ registerShortcut ] );
|
|
23
|
-
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default KeyboardShortcutsRegister;
|