@wordpress/edit-site 5.9.0 → 5.11.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-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +7 -22
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +32 -27
- package/build/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build/components/add-new-template/new-template-part.js +8 -2
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +104 -68
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +8 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/back-button.js +10 -3
- package/build/components/block-editor/back-button.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +39 -6
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +1 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +6 -7
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +20 -11
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor-canvas-container/index.js +27 -6
- package/build/components/editor-canvas-container/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +1 -1
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +14 -3
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +17 -18
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +14 -3
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/root-menu.js +61 -0
- package/build/components/global-styles/root-menu.js.map +1 -0
- package/build/components/global-styles/screen-block-list.js +3 -1
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-block.js +235 -7
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +9 -26
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +20 -15
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -17
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-revisions/index.js +141 -0
- package/build/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +130 -0
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js +121 -0
- package/build/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build/components/global-styles/screen-root.js +6 -6
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +0 -3
- package/build/components/global-styles/screen-typography-element.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +11 -39
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/style-variations-container.js +9 -18
- package/build/components/global-styles/style-variations-container.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +7 -11
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +70 -117
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/variations-panel.js +4 -28
- package/build/components/global-styles/variations-panel.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +28 -103
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +15 -2
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +1 -1
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/hooks.js +54 -0
- package/build/components/layout/hooks.js.map +1 -0
- package/build/components/layout/index.js +57 -104
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/index.js +5 -2
- package/build/components/list/actions/index.js.map +1 -1
- package/build/components/list/index.js +9 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +1 -1
- package/build/components/list/table.js.map +1 -1
- package/build/components/plugin-template-setting-panel/index.js +44 -0
- package/build/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build/components/resizable-frame/index.js +242 -0
- package/build/components/resizable-frame/index.js.map +1 -0
- package/build/components/revisions/index.js +96 -0
- package/build/components/revisions/index.js.map +1 -0
- package/build/components/routes/link.js +17 -2
- package/build/components/routes/link.js.map +1 -1
- package/build/components/routes/use-title.js +8 -2
- package/build/components/routes/use-title.js.map +1 -1
- package/build/components/save-button/index.js +31 -6
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +14 -31
- package/build/components/save-hub/index.js.map +1 -1
- package/build/components/save-panel/index.js +20 -7
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +6 -10
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/index.js +19 -5
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +9 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js +40 -0
- package/build/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build/components/sidebar-edit-mode/template-card/index.js +1 -8
- package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
- package/build/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build/components/sidebar-navigation-item/index.js +5 -7
- package/build/components/sidebar-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -4
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +75 -11
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +31 -23
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +162 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js +17 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +55 -93
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +87 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +14 -71
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +53 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build/components/sidebar-navigation-screen-page/index.js +67 -0
- package/build/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-pages/index.js +74 -0
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +39 -12
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-subtitle/index.js +18 -0
- package/build/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build/components/site-hub/index.js +34 -6
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/start-template-options/index.js +12 -16
- package/build/components/start-template-options/index.js.map +1 -1
- package/build/components/style-book/index.js +93 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +8 -2
- 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-canvas-mode-with-url.js +9 -4
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +17 -3
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +8 -4
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +105 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build/hooks/template-part-edit.js +8 -2
- package/build/hooks/template-part-edit.js.map +1 -1
- package/build/index.js +8 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -3
- package/build/store/actions.js.map +1 -1
- package/build/utils/is-previewing-theme.js +27 -0
- package/build/utils/is-previewing-theme.js.map +1 -0
- package/build/utils/use-activate-theme.js +46 -0
- package/build/utils/use-activate-theme.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-generic-template-modal.js → add-custom-generic-template-modal-content.js} +8 -20
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +34 -28
- package/build-module/components/add-new-template/add-custom-template-modal-content.js.map +1 -0
- package/build-module/components/add-new-template/new-template-part.js +5 -1
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +102 -68
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +6 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/back-button.js +6 -1
- package/build-module/components/block-editor/back-button.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +37 -6
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/index.js +1 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +7 -8
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +18 -11
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor-canvas-container/index.js +27 -8
- package/build-module/components/editor-canvas-container/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +1 -1
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +13 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +17 -18
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +13 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/root-menu.js +47 -0
- package/build-module/components/global-styles/root-menu.js.map +1 -0
- package/build-module/components/global-styles/screen-block-list.js +4 -2
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +229 -7
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +9 -25
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +20 -15
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +4 -16
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/index.js +121 -0
- package/build-module/components/global-styles/screen-revisions/index.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +118 -0
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js +107 -0
- package/build-module/components/global-styles/screen-revisions/use-global-styles-revisions.js.map +1 -0
- package/build-module/components/global-styles/screen-root.js +6 -6
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +0 -3
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +11 -37
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/style-variations-container.js +10 -18
- package/build-module/components/global-styles/style-variations-container.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +7 -11
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +71 -115
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/variations-panel.js +3 -22
- package/build-module/components/global-styles/variations-panel.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +31 -107
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +16 -4
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +1 -1
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/hooks.js +41 -0
- package/build-module/components/layout/hooks.js.map +1 -0
- package/build-module/components/layout/index.js +53 -102
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/index.js +6 -3
- package/build-module/components/list/actions/index.js.map +1 -1
- package/build-module/components/list/index.js +5 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +1 -1
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/plugin-template-setting-panel/index.js +35 -0
- package/build-module/components/plugin-template-setting-panel/index.js.map +1 -0
- package/build-module/components/resizable-frame/index.js +228 -0
- package/build-module/components/resizable-frame/index.js.map +1 -0
- package/build-module/components/revisions/index.js +78 -0
- package/build-module/components/revisions/index.js.map +1 -0
- package/build-module/components/routes/link.js +13 -1
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/routes/use-title.js +5 -1
- package/build-module/components/routes/use-title.js.map +1 -1
- package/build-module/components/save-button/index.js +28 -6
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +13 -32
- package/build-module/components/save-hub/index.js.map +1 -1
- package/build-module/components/save-panel/index.js +19 -7
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +6 -11
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/index.js +14 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +9 -3
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +10 -5
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js +29 -0
- package/build-module/components/sidebar-edit-mode/sidebar-fixed-bottom.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/template-card/index.js +2 -7
- package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +2 -2
- package/build-module/components/sidebar-edit-mode/template-revisions/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-item/index.js +6 -8
- package/build-module/components/sidebar-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +13 -5
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +70 -14
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +30 -24
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +141 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js +10 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/constants.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +52 -93
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +71 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +13 -72
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +40 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigator-button.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-page/index.js +48 -0
- package/build-module/components/sidebar-navigation-screen-page/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js +57 -0
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +38 -12
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-subtitle/index.js +10 -0
- package/build-module/components/sidebar-navigation-subtitle/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +32 -6
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/start-template-options/index.js +13 -17
- package/build-module/components/start-template-options/index.js.map +1 -1
- package/build-module/components/style-book/index.js +93 -20
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -1
- 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-canvas-mode-with-url.js +5 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +13 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +8 -4
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +86 -0
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -0
- package/build-module/hooks/template-part-edit.js +5 -1
- package/build-module/hooks/template-part-edit.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -3
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/is-previewing-theme.js +17 -0
- package/build-module/utils/is-previewing-theme.js.map +1 -0
- package/build-module/utils/use-activate-theme.js +36 -0
- package/build-module/utils/use-activate-theme.js.map +1 -0
- package/build-style/style-rtl.css +409 -265
- package/build-style/style.css +410 -265
- package/package.json +37 -35
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +82 -0
- package/src/components/add-new-template/{add-custom-template-modal.js → add-custom-template-modal-content.js} +44 -34
- package/src/components/add-new-template/new-template-part.js +4 -1
- package/src/components/add-new-template/new-template.js +142 -154
- package/src/components/add-new-template/style.scss +120 -103
- package/src/components/app/index.js +6 -3
- package/src/components/block-editor/back-button.js +4 -1
- package/src/components/block-editor/editor-canvas.js +36 -8
- package/src/components/block-editor/index.js +2 -3
- package/src/components/block-editor/style.scss +15 -8
- package/src/components/create-template-part-modal/index.js +19 -25
- package/src/components/editor/index.js +20 -8
- package/src/components/editor/style.scss +21 -6
- package/src/components/editor-canvas-container/index.js +43 -21
- package/src/components/global-styles/block-preview-panel.js +1 -1
- package/src/components/global-styles/color-palette-panel.js +9 -0
- package/src/components/global-styles/dimensions-panel.js +15 -15
- package/src/components/global-styles/gradients-palette-panel.js +8 -0
- package/src/components/global-styles/root-menu.js +66 -0
- package/src/components/global-styles/screen-block-list.js +2 -2
- package/src/components/global-styles/screen-block.js +255 -7
- package/src/components/global-styles/screen-colors.js +9 -16
- package/src/components/global-styles/screen-css.js +21 -21
- package/src/components/global-styles/screen-layout.js +5 -9
- package/src/components/global-styles/screen-revisions/index.js +169 -0
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +139 -0
- package/src/components/global-styles/screen-revisions/style.scss +100 -0
- package/src/components/global-styles/screen-revisions/test/use-global-styles-revisions.js +138 -0
- package/src/components/global-styles/screen-revisions/use-global-styles-revisions.js +99 -0
- package/src/components/global-styles/screen-root.js +7 -5
- package/src/components/global-styles/screen-typography-element.js +1 -3
- package/src/components/global-styles/screen-typography.js +44 -79
- package/src/components/global-styles/style-variations-container.js +17 -28
- package/src/components/global-styles/style.scss +4 -23
- package/src/components/global-styles/typography-panel.js +12 -13
- package/src/components/global-styles/ui.js +83 -110
- package/src/components/global-styles/variations-panel.js +3 -26
- package/src/components/header-edit-mode/document-actions/index.js +26 -129
- package/src/components/header-edit-mode/document-actions/style.scss +28 -59
- package/src/components/header-edit-mode/index.js +23 -2
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/keyboard-shortcuts/register.js +1 -1
- package/src/components/layout/hooks.js +46 -0
- package/src/components/layout/index.js +60 -125
- package/src/components/layout/style.scss +9 -5
- package/src/components/list/actions/index.js +12 -5
- package/src/components/list/index.js +4 -1
- package/src/components/list/style.scss +5 -0
- package/src/components/list/table.js +3 -1
- package/src/components/plugin-template-setting-panel/index.js +33 -0
- package/src/components/resizable-frame/index.js +253 -0
- package/src/components/resizable-frame/style.scss +69 -0
- package/src/components/revisions/index.js +105 -0
- package/src/components/routes/link.js +16 -1
- package/src/components/routes/use-title.js +4 -1
- package/src/components/save-button/index.js +27 -6
- package/src/components/save-hub/index.js +17 -35
- package/src/components/save-panel/index.js +15 -3
- package/src/components/secondary-sidebar/list-view-sidebar.js +4 -7
- package/src/components/sidebar/index.js +15 -4
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +9 -7
- package/src/components/sidebar-edit-mode/index.js +17 -6
- package/src/components/sidebar-edit-mode/sidebar-fixed-bottom.js +26 -0
- package/src/components/sidebar-edit-mode/style.scss +10 -0
- package/src/components/sidebar-edit-mode/template-card/index.js +1 -9
- package/src/components/sidebar-edit-mode/{template-card/last-revision.js → template-revisions/index.js} +1 -2
- package/src/components/sidebar-navigation-item/index.js +13 -14
- package/src/components/sidebar-navigation-item/style.scss +17 -1
- package/src/components/sidebar-navigation-screen/index.js +26 -5
- package/src/components/sidebar-navigation-screen/style.scss +1 -2
- package/src/components/sidebar-navigation-screen-global-styles/index.js +106 -21
- package/src/components/sidebar-navigation-screen-main/index.js +39 -35
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +3 -9
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +157 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/constants.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +63 -105
- package/src/components/sidebar-navigation-screen-navigation-menus/leaf-more-menu.js +83 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +8 -74
- package/src/components/sidebar-navigation-screen-navigation-menus/navigator-button.js +47 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +6 -20
- package/src/components/sidebar-navigation-screen-page/index.js +59 -0
- package/src/components/sidebar-navigation-screen-pages/index.js +82 -0
- package/src/components/sidebar-navigation-screen-pages/style.scss +4 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +57 -14
- package/src/components/sidebar-navigation-subtitle/index.js +5 -0
- package/src/components/sidebar-navigation-subtitle/style.scss +7 -0
- package/src/components/site-hub/index.js +88 -58
- package/src/components/site-hub/style.scss +8 -0
- package/src/components/start-template-options/index.js +19 -27
- package/src/components/start-template-options/style.scss +28 -21
- package/src/components/style-book/index.js +132 -43
- package/src/components/style-book/style.scss +19 -0
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -1
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -1
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +14 -1
- package/src/components/use-edited-entity-record/index.js +12 -3
- package/src/hooks/commands/use-edit-mode-commands.js +79 -0
- package/src/hooks/template-part-edit.js +4 -1
- package/src/index.js +1 -0
- package/src/store/actions.js +4 -5
- package/src/store/test/actions.js +6 -14
- package/src/store/test/utils.js +15 -5
- package/src/style.scss +5 -2
- package/src/utils/is-previewing-theme.js +18 -0
- package/src/utils/use-activate-theme.js +38 -0
- package/build/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build/components/global-styles/border-panel.js +0 -133
- package/build/components/global-styles/border-panel.js.map +0 -1
- package/build/components/global-styles/context-menu.js +0 -126
- package/build/components/global-styles/context-menu.js.map +0 -1
- package/build/components/global-styles/custom-css.js +0 -113
- package/build/components/global-styles/custom-css.js.map +0 -1
- package/build/components/global-styles/effects-panel.js +0 -53
- package/build/components/global-styles/effects-panel.js.map +0 -1
- package/build/components/global-styles/filters-panel.js +0 -50
- package/build/components/global-styles/filters-panel.js.map +0 -1
- package/build/components/global-styles/screen-border.js +0 -61
- package/build/components/global-styles/screen-border.js.map +0 -1
- package/build/components/global-styles/screen-effects.js +0 -61
- package/build/components/global-styles/screen-effects.js.map +0 -1
- package/build/components/global-styles/screen-filters.js +0 -46
- package/build/components/global-styles/screen-filters.js.map +0 -1
- package/build/components/global-styles/screen-variations.js +0 -71
- package/build/components/global-styles/screen-variations.js.map +0 -1
- package/build/components/navigate-to-link/index.js +0 -51
- package/build/components/navigate-to-link/index.js.map +0 -1
- package/build/components/routes/index.js +0 -60
- package/build/components/routes/index.js.map +0 -1
- package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -19
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build/components/template-details/edit-template-title.js +0 -42
- package/build/components/template-details/edit-template-title.js.map +0 -1
- package/build/components/template-details/index.js +0 -103
- package/build/components/template-details/index.js.map +0 -1
- package/build/components/template-details/template-areas.js +0 -160
- package/build/components/template-details/template-areas.js.map +0 -1
- package/build/components/template-details/template-part-area-selector.js +0 -48
- package/build/components/template-details/template-part-area-selector.js.map +0 -1
- package/build/hooks/commands/index.js +0 -19
- package/build/hooks/commands/index.js.map +0 -1
- package/build/hooks/commands/use-navigation-commands.js +0 -126
- package/build/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build/hooks/commands/use-wp-admin-commands.js +0 -97
- package/build/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build/utils/history.js +0 -41
- package/build/utils/history.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal.js.map +0 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +0 -1
- package/build-module/components/global-styles/border-panel.js +0 -123
- package/build-module/components/global-styles/border-panel.js.map +0 -1
- package/build-module/components/global-styles/context-menu.js +0 -107
- package/build-module/components/global-styles/context-menu.js.map +0 -1
- package/build-module/components/global-styles/custom-css.js +0 -98
- package/build-module/components/global-styles/custom-css.js.map +0 -1
- package/build-module/components/global-styles/effects-panel.js +0 -43
- package/build-module/components/global-styles/effects-panel.js.map +0 -1
- package/build-module/components/global-styles/filters-panel.js +0 -40
- package/build-module/components/global-styles/filters-panel.js.map +0 -1
- package/build-module/components/global-styles/screen-border.js +0 -44
- package/build-module/components/global-styles/screen-border.js.map +0 -1
- package/build-module/components/global-styles/screen-effects.js +0 -44
- package/build-module/components/global-styles/screen-effects.js.map +0 -1
- package/build-module/components/global-styles/screen-filters.js +0 -33
- package/build-module/components/global-styles/screen-filters.js.map +0 -1
- package/build-module/components/global-styles/screen-variations.js +0 -54
- package/build-module/components/global-styles/screen-variations.js.map +0 -1
- package/build-module/components/navigate-to-link/index.js +0 -39
- package/build-module/components/navigate-to-link/index.js.map +0 -1
- package/build-module/components/routes/index.js +0 -47
- package/build-module/components/routes/index.js.map +0 -1
- package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +0 -1
- package/build-module/components/template-details/edit-template-title.js +0 -33
- package/build-module/components/template-details/edit-template-title.js.map +0 -1
- package/build-module/components/template-details/index.js +0 -83
- package/build-module/components/template-details/index.js.map +0 -1
- package/build-module/components/template-details/template-areas.js +0 -141
- package/build-module/components/template-details/template-areas.js.map +0 -1
- package/build-module/components/template-details/template-part-area-selector.js +0 -36
- package/build-module/components/template-details/template-part-area-selector.js.map +0 -1
- package/build-module/hooks/commands/index.js +0 -10
- package/build-module/hooks/commands/index.js.map +0 -1
- package/build-module/hooks/commands/use-navigation-commands.js +0 -109
- package/build-module/hooks/commands/use-navigation-commands.js.map +0 -1
- package/build-module/hooks/commands/use-wp-admin-commands.js +0 -81
- package/build-module/hooks/commands/use-wp-admin-commands.js.map +0 -1
- package/build-module/utils/history.js +0 -31
- package/build-module/utils/history.js.map +0 -1
- package/src/components/add-new-template/add-custom-generic-template-modal.js +0 -101
- package/src/components/global-styles/border-panel.js +0 -112
- package/src/components/global-styles/context-menu.js +0 -175
- package/src/components/global-styles/custom-css.js +0 -131
- package/src/components/global-styles/effects-panel.js +0 -40
- package/src/components/global-styles/filters-panel.js +0 -39
- package/src/components/global-styles/screen-border.js +0 -35
- package/src/components/global-styles/screen-effects.js +0 -35
- package/src/components/global-styles/screen-filters.js +0 -27
- package/src/components/global-styles/screen-variations.js +0 -46
- package/src/components/navigate-to-link/index.js +0 -46
- package/src/components/routes/index.js +0 -53
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +0 -9
- package/src/components/template-details/edit-template-title.js +0 -41
- package/src/components/template-details/index.js +0 -113
- package/src/components/template-details/style.scss +0 -72
- package/src/components/template-details/template-areas.js +0 -164
- package/src/components/template-details/template-part-area-selector.js +0 -39
- package/src/hooks/commands/index.js +0 -10
- package/src/hooks/commands/use-navigation-commands.js +0 -112
- package/src/hooks/commands/use-wp-admin-commands.js +0 -79
- package/src/utils/history.js +0 -39
|
@@ -6,37 +6,37 @@ import {
|
|
|
6
6
|
__experimentalNavigatorButton as NavigatorButton,
|
|
7
7
|
} from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { layout,
|
|
10
|
-
import { useSelect } from '@wordpress/data';
|
|
11
|
-
|
|
9
|
+
import { layout, symbol, navigation, styles, page } from '@wordpress/icons';
|
|
10
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
+
|
|
12
|
+
import { useEffect } from '@wordpress/element';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Internal dependencies
|
|
15
16
|
*/
|
|
16
17
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
17
18
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
+
import { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';
|
|
20
|
+
import { unlock } from '../../private-apis';
|
|
21
|
+
import { store as editSiteStore } from '../../store';
|
|
22
|
+
import SidebarNavigationScreenNavigationMenuButton from '../sidebar-navigation-screen-navigation-menus/navigator-button';
|
|
18
23
|
|
|
19
24
|
export default function SidebarNavigationScreenMain() {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
per_page: 1,
|
|
28
|
-
status: 'publish',
|
|
29
|
-
order: 'desc',
|
|
30
|
-
orderby: 'date',
|
|
31
|
-
}
|
|
32
|
-
);
|
|
25
|
+
const editorCanvasContainerView = useSelect( ( select ) => {
|
|
26
|
+
return unlock( select( editSiteStore ) ).getEditorCanvasContainerView();
|
|
27
|
+
}, [] );
|
|
28
|
+
|
|
29
|
+
const { setEditorCanvasContainerView } = unlock(
|
|
30
|
+
useDispatch( editSiteStore )
|
|
31
|
+
);
|
|
33
32
|
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
// Clear the editor canvas container view when accessing the main navigation screen.
|
|
34
|
+
useEffect( () => {
|
|
35
|
+
if ( editorCanvasContainerView ) {
|
|
36
|
+
setEditorCanvasContainerView( undefined );
|
|
37
|
+
}
|
|
38
|
+
}, [ editorCanvasContainerView, setEditorCanvasContainerView ] );
|
|
36
39
|
|
|
37
|
-
const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN
|
|
38
|
-
? hasNavigationMenus
|
|
39
|
-
: false;
|
|
40
40
|
return (
|
|
41
41
|
<SidebarNavigationScreen
|
|
42
42
|
isRoot
|
|
@@ -46,23 +46,27 @@ export default function SidebarNavigationScreenMain() {
|
|
|
46
46
|
) }
|
|
47
47
|
content={
|
|
48
48
|
<ItemGroup>
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
path="/navigation"
|
|
53
|
-
withChevron
|
|
54
|
-
icon={ navigation }
|
|
55
|
-
>
|
|
56
|
-
{ __( 'Navigation' ) }
|
|
57
|
-
</NavigatorButton>
|
|
58
|
-
) }
|
|
59
|
-
<NavigatorButton
|
|
49
|
+
<SidebarNavigationScreenNavigationMenuButton
|
|
50
|
+
withChevron
|
|
51
|
+
icon={ navigation }
|
|
60
52
|
as={ SidebarNavigationItem }
|
|
61
|
-
|
|
53
|
+
>
|
|
54
|
+
{ __( 'Navigation' ) }
|
|
55
|
+
</SidebarNavigationScreenNavigationMenuButton>
|
|
56
|
+
|
|
57
|
+
<SidebarNavigationItemGlobalStyles
|
|
62
58
|
withChevron
|
|
63
59
|
icon={ styles }
|
|
64
60
|
>
|
|
65
61
|
{ __( 'Styles' ) }
|
|
62
|
+
</SidebarNavigationItemGlobalStyles>
|
|
63
|
+
<NavigatorButton
|
|
64
|
+
as={ SidebarNavigationItem }
|
|
65
|
+
path="/page"
|
|
66
|
+
withChevron
|
|
67
|
+
icon={ page }
|
|
68
|
+
>
|
|
69
|
+
{ __( 'Pages' ) }
|
|
66
70
|
</NavigatorButton>
|
|
67
71
|
<NavigatorButton
|
|
68
72
|
as={ SidebarNavigationItem }
|
|
@@ -76,9 +80,9 @@ export default function SidebarNavigationScreenMain() {
|
|
|
76
80
|
as={ SidebarNavigationItem }
|
|
77
81
|
path="/wp_template_part"
|
|
78
82
|
withChevron
|
|
79
|
-
icon={
|
|
83
|
+
icon={ symbol }
|
|
80
84
|
>
|
|
81
|
-
{ __( '
|
|
85
|
+
{ __( 'Library' ) }
|
|
82
86
|
</NavigatorButton>
|
|
83
87
|
</ItemGroup>
|
|
84
88
|
}
|
|
@@ -36,15 +36,9 @@ export default function SidebarNavigationScreenNavigationItem() {
|
|
|
36
36
|
icon={ pencil }
|
|
37
37
|
/>
|
|
38
38
|
}
|
|
39
|
-
description={
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
'Pages are static and are not listed by date. Pages do not use tags or categories.'
|
|
43
|
-
)
|
|
44
|
-
: __(
|
|
45
|
-
'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'
|
|
46
|
-
)
|
|
47
|
-
}
|
|
39
|
+
description={ __(
|
|
40
|
+
'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'
|
|
41
|
+
) }
|
|
48
42
|
content={
|
|
49
43
|
<>
|
|
50
44
|
{ record?.link ? (
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useEntityRecord } from '@wordpress/core-data';
|
|
5
|
+
import {
|
|
6
|
+
__experimentalUseNavigator as useNavigator,
|
|
7
|
+
Spinner,
|
|
8
|
+
} from '@wordpress/components';
|
|
9
|
+
import { __ } from '@wordpress/i18n';
|
|
10
|
+
import { useCallback, useMemo } from '@wordpress/element';
|
|
11
|
+
import { useSelect } from '@wordpress/data';
|
|
12
|
+
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
13
|
+
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
14
|
+
import { createBlock } from '@wordpress/blocks';
|
|
15
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
import { unlock } from '../../private-apis';
|
|
21
|
+
import { store as editSiteStore } from '../../store';
|
|
22
|
+
import {
|
|
23
|
+
isPreviewingTheme,
|
|
24
|
+
currentlyPreviewingTheme,
|
|
25
|
+
} from '../../utils/is-previewing-theme';
|
|
26
|
+
import { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';
|
|
27
|
+
import NavigationMenuContent from '../sidebar-navigation-screen-navigation-menus/navigation-menu-content';
|
|
28
|
+
|
|
29
|
+
const { useHistory } = unlock( routerPrivateApis );
|
|
30
|
+
const noop = () => {};
|
|
31
|
+
|
|
32
|
+
export default function SidebarNavigationScreenNavigationMenu() {
|
|
33
|
+
const postType = `wp_navigation`;
|
|
34
|
+
const {
|
|
35
|
+
params: { postId },
|
|
36
|
+
} = useNavigator();
|
|
37
|
+
|
|
38
|
+
const { record: navigationMenu, isResolving: isLoading } = useEntityRecord(
|
|
39
|
+
'postType',
|
|
40
|
+
postType,
|
|
41
|
+
postId
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;
|
|
45
|
+
|
|
46
|
+
if ( isLoading ) {
|
|
47
|
+
return (
|
|
48
|
+
<SidebarNavigationScreenWrapper
|
|
49
|
+
description={ __(
|
|
50
|
+
'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'
|
|
51
|
+
) }
|
|
52
|
+
>
|
|
53
|
+
<Spinner className="edit-site-sidebar-navigation-screen-navigation-menus__loading" />
|
|
54
|
+
</SidebarNavigationScreenWrapper>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if ( ! isLoading && ! navigationMenu ) {
|
|
59
|
+
return (
|
|
60
|
+
<SidebarNavigationScreenWrapper
|
|
61
|
+
description={ __( 'Navigation Menu missing.' ) }
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if ( ! navigationMenu?.content?.raw ) {
|
|
67
|
+
return (
|
|
68
|
+
<SidebarNavigationScreenWrapper
|
|
69
|
+
title={ decodeEntities( menuTitle ) }
|
|
70
|
+
description={ __( 'This Navigation Menu is empty.' ) }
|
|
71
|
+
/>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<SidebarNavigationScreenWrapper
|
|
77
|
+
title={ decodeEntities( menuTitle ) }
|
|
78
|
+
description={ __(
|
|
79
|
+
'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'
|
|
80
|
+
) }
|
|
81
|
+
>
|
|
82
|
+
<NavigationMenuEditor navigationMenu={ navigationMenu } />
|
|
83
|
+
</SidebarNavigationScreenWrapper>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function NavigationMenuEditor( { navigationMenu } ) {
|
|
88
|
+
const history = useHistory();
|
|
89
|
+
|
|
90
|
+
const onSelect = useCallback(
|
|
91
|
+
( selectedBlock ) => {
|
|
92
|
+
const { attributes, name } = selectedBlock;
|
|
93
|
+
if (
|
|
94
|
+
attributes.kind === 'post-type' &&
|
|
95
|
+
attributes.id &&
|
|
96
|
+
attributes.type &&
|
|
97
|
+
history
|
|
98
|
+
) {
|
|
99
|
+
history.push( {
|
|
100
|
+
postType: attributes.type,
|
|
101
|
+
postId: attributes.id,
|
|
102
|
+
...( isPreviewingTheme() && {
|
|
103
|
+
theme_preview: currentlyPreviewingTheme(),
|
|
104
|
+
} ),
|
|
105
|
+
} );
|
|
106
|
+
}
|
|
107
|
+
if ( name === 'core/page-list-item' && attributes.id && history ) {
|
|
108
|
+
history.push( {
|
|
109
|
+
postType: 'page',
|
|
110
|
+
postId: attributes.id,
|
|
111
|
+
...( isPreviewingTheme() && {
|
|
112
|
+
theme_preview: currentlyPreviewingTheme(),
|
|
113
|
+
} ),
|
|
114
|
+
} );
|
|
115
|
+
}
|
|
116
|
+
},
|
|
117
|
+
[ history ]
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
const { storedSettings } = useSelect( ( select ) => {
|
|
121
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
storedSettings: getSettings( false ),
|
|
125
|
+
};
|
|
126
|
+
}, [] );
|
|
127
|
+
|
|
128
|
+
const blocks = useMemo( () => {
|
|
129
|
+
if ( ! NavigationMenuEditor ) {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return [
|
|
134
|
+
createBlock( 'core/navigation', { ref: navigationMenu?.id } ),
|
|
135
|
+
];
|
|
136
|
+
}, [ navigationMenu ] );
|
|
137
|
+
|
|
138
|
+
if ( ! navigationMenu || ! blocks?.length ) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return (
|
|
143
|
+
<BlockEditorProvider
|
|
144
|
+
settings={ storedSettings }
|
|
145
|
+
value={ blocks }
|
|
146
|
+
onChange={ noop }
|
|
147
|
+
onInput={ noop }
|
|
148
|
+
>
|
|
149
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__content">
|
|
150
|
+
<NavigationMenuContent
|
|
151
|
+
rootClientId={ blocks[ 0 ].clientId }
|
|
152
|
+
onSelect={ onSelect }
|
|
153
|
+
/>
|
|
154
|
+
</div>
|
|
155
|
+
</BlockEditorProvider>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// This requested is preloaded in `gutenberg_preload_navigation_posts`.
|
|
2
|
+
// As unbounded queries are limited to 100 by `fetchAllMiddleware`
|
|
3
|
+
// on apiFetch this query is limited to 100.
|
|
4
|
+
export const PRELOADED_NAVIGATION_MENUS_QUERY = {
|
|
5
|
+
per_page: 100,
|
|
6
|
+
status: 'publish',
|
|
7
|
+
order: 'desc',
|
|
8
|
+
orderby: 'date',
|
|
9
|
+
};
|
|
@@ -2,131 +2,89 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
5
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
6
|
+
|
|
7
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
|
+
import {
|
|
9
|
+
__experimentalItemGroup as ItemGroup,
|
|
10
|
+
Spinner,
|
|
11
|
+
} from '@wordpress/components';
|
|
12
|
+
import { navigation } from '@wordpress/icons';
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* Internal dependencies
|
|
13
16
|
*/
|
|
14
17
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import { unlock } from '../../private-apis';
|
|
19
|
-
import { store as editSiteStore } from '../../store';
|
|
20
|
-
|
|
21
|
-
const noop = () => {};
|
|
22
|
-
const NAVIGATION_MENUS_QUERY = {
|
|
23
|
-
per_page: 1,
|
|
24
|
-
status: 'publish',
|
|
25
|
-
order: 'desc',
|
|
26
|
-
orderby: 'date',
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function SidebarNavigationScreenWrapper( { children, actions } ) {
|
|
30
|
-
return (
|
|
31
|
-
<SidebarNavigationScreen
|
|
32
|
-
title={ __( 'Navigation' ) }
|
|
33
|
-
actions={ actions }
|
|
34
|
-
description={ __(
|
|
35
|
-
'Browse your site, edit pages, and manage your primary navigation menu.'
|
|
36
|
-
) }
|
|
37
|
-
content={ children }
|
|
38
|
-
/>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
18
|
+
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
19
|
+
import { PRELOADED_NAVIGATION_MENUS_QUERY } from './constants';
|
|
20
|
+
import { useLink } from '../routes/link';
|
|
41
21
|
|
|
42
22
|
export default function SidebarNavigationScreenNavigationMenus() {
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const navigationMenusQuery = [
|
|
51
|
-
'postType',
|
|
52
|
-
'wp_navigation',
|
|
53
|
-
NAVIGATION_MENUS_QUERY,
|
|
54
|
-
];
|
|
55
|
-
return {
|
|
56
|
-
storedSettings: getSettings( false ),
|
|
57
|
-
navigationMenus: getEntityRecords( ...navigationMenusQuery ),
|
|
58
|
-
hasResolvedNavigationMenus: hasFinishedResolution(
|
|
59
|
-
'getEntityRecords',
|
|
60
|
-
navigationMenusQuery
|
|
61
|
-
),
|
|
62
|
-
};
|
|
63
|
-
}, [] );
|
|
64
|
-
|
|
65
|
-
const firstNavigationMenu = navigationMenus?.[ 0 ]?.id;
|
|
66
|
-
const blocks = useMemo( () => {
|
|
67
|
-
return [
|
|
68
|
-
createBlock( 'core/navigation', { ref: firstNavigationMenu } ),
|
|
69
|
-
];
|
|
70
|
-
}, [ firstNavigationMenu ] );
|
|
23
|
+
const { records: navigationMenus, isResolving: isLoading } =
|
|
24
|
+
useEntityRecords(
|
|
25
|
+
'postType',
|
|
26
|
+
`wp_navigation`,
|
|
27
|
+
PRELOADED_NAVIGATION_MENUS_QUERY
|
|
28
|
+
);
|
|
71
29
|
|
|
72
|
-
const isLoading = ! hasResolvedNavigationMenus;
|
|
73
30
|
const hasNavigationMenus = !! navigationMenus?.length;
|
|
74
31
|
|
|
75
|
-
|
|
76
|
-
( selectedBlock ) => {
|
|
77
|
-
const { attributes, name } = selectedBlock;
|
|
78
|
-
if (
|
|
79
|
-
attributes.kind === 'post-type' &&
|
|
80
|
-
attributes.id &&
|
|
81
|
-
attributes.type &&
|
|
82
|
-
history
|
|
83
|
-
) {
|
|
84
|
-
history.push( {
|
|
85
|
-
postType: attributes.type,
|
|
86
|
-
postId: attributes.id,
|
|
87
|
-
} );
|
|
88
|
-
}
|
|
89
|
-
if ( name === 'core/page-list-item' && attributes.id && history ) {
|
|
90
|
-
history.push( {
|
|
91
|
-
postType: 'page',
|
|
92
|
-
postId: attributes.id,
|
|
93
|
-
} );
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
[ history ]
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
if ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {
|
|
32
|
+
if ( isLoading ) {
|
|
100
33
|
return (
|
|
101
34
|
<SidebarNavigationScreenWrapper>
|
|
102
|
-
|
|
35
|
+
<Spinner className="edit-site-sidebar-navigation-screen-navigation-menus__loading" />
|
|
103
36
|
</SidebarNavigationScreenWrapper>
|
|
104
37
|
);
|
|
105
38
|
}
|
|
106
39
|
|
|
107
|
-
if ( !
|
|
40
|
+
if ( ! isLoading && ! hasNavigationMenus ) {
|
|
108
41
|
return (
|
|
109
|
-
<SidebarNavigationScreenWrapper
|
|
110
|
-
|
|
111
|
-
|
|
42
|
+
<SidebarNavigationScreenWrapper
|
|
43
|
+
description={ __( 'No Navigation Menus found.' ) }
|
|
44
|
+
/>
|
|
112
45
|
);
|
|
113
46
|
}
|
|
114
47
|
|
|
115
48
|
return (
|
|
116
|
-
<
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
49
|
+
<SidebarNavigationScreenWrapper>
|
|
50
|
+
<ItemGroup>
|
|
51
|
+
{ navigationMenus?.map( ( navMenu ) => (
|
|
52
|
+
<NavMenuItem
|
|
53
|
+
postId={ navMenu.id }
|
|
54
|
+
key={ navMenu.id }
|
|
55
|
+
withChevron
|
|
56
|
+
icon={ navigation }
|
|
57
|
+
>
|
|
58
|
+
{ decodeEntities(
|
|
59
|
+
navMenu.title?.rendered || navMenu.slug
|
|
60
|
+
) }
|
|
61
|
+
</NavMenuItem>
|
|
62
|
+
) ) }
|
|
63
|
+
</ItemGroup>
|
|
64
|
+
</SidebarNavigationScreenWrapper>
|
|
131
65
|
);
|
|
132
66
|
}
|
|
67
|
+
|
|
68
|
+
export function SidebarNavigationScreenWrapper( {
|
|
69
|
+
children,
|
|
70
|
+
actions,
|
|
71
|
+
title,
|
|
72
|
+
description,
|
|
73
|
+
} ) {
|
|
74
|
+
return (
|
|
75
|
+
<SidebarNavigationScreen
|
|
76
|
+
title={ title || __( 'Navigation' ) }
|
|
77
|
+
actions={ actions }
|
|
78
|
+
description={ description || __( 'Manage your Navigation menus.' ) }
|
|
79
|
+
content={ children }
|
|
80
|
+
/>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const NavMenuItem = ( { postId, ...props } ) => {
|
|
85
|
+
const linkInfo = useLink( {
|
|
86
|
+
postId,
|
|
87
|
+
postType: 'wp_navigation',
|
|
88
|
+
} );
|
|
89
|
+
return <SidebarNavigationItem { ...linkInfo } { ...props } />;
|
|
90
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { chevronUp, chevronDown, moreVertical } from '@wordpress/icons';
|
|
6
|
+
import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
9
|
+
import { BlockTitle, store as blockEditorStore } from '@wordpress/block-editor';
|
|
10
|
+
|
|
11
|
+
const POPOVER_PROPS = {
|
|
12
|
+
className: 'block-editor-block-settings-menu__popover',
|
|
13
|
+
position: 'bottom right',
|
|
14
|
+
variant: 'toolbar',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default function LeafMoreMenu( props ) {
|
|
18
|
+
const { block } = props;
|
|
19
|
+
const { clientId } = block;
|
|
20
|
+
const { moveBlocksDown, moveBlocksUp, removeBlocks } =
|
|
21
|
+
useDispatch( blockEditorStore );
|
|
22
|
+
|
|
23
|
+
const removeLabel = sprintf(
|
|
24
|
+
/* translators: %s: block name */
|
|
25
|
+
__( 'Remove %s' ),
|
|
26
|
+
BlockTitle( { clientId, maximumLength: 25 } )
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
const rootClientId = useSelect(
|
|
30
|
+
( select ) => {
|
|
31
|
+
const { getBlockRootClientId } = select( blockEditorStore );
|
|
32
|
+
|
|
33
|
+
return getBlockRootClientId( clientId );
|
|
34
|
+
},
|
|
35
|
+
[ clientId ]
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<DropdownMenu
|
|
40
|
+
icon={ moreVertical }
|
|
41
|
+
label={ __( 'Options' ) }
|
|
42
|
+
className="block-editor-block-settings-menu"
|
|
43
|
+
popoverProps={ POPOVER_PROPS }
|
|
44
|
+
noIcons
|
|
45
|
+
{ ...props }
|
|
46
|
+
>
|
|
47
|
+
{ ( { onClose } ) => (
|
|
48
|
+
<>
|
|
49
|
+
<MenuGroup>
|
|
50
|
+
<MenuItem
|
|
51
|
+
icon={ chevronUp }
|
|
52
|
+
onClick={ () => {
|
|
53
|
+
moveBlocksUp( [ clientId ], rootClientId );
|
|
54
|
+
onClose();
|
|
55
|
+
} }
|
|
56
|
+
>
|
|
57
|
+
{ __( 'Move up' ) }
|
|
58
|
+
</MenuItem>
|
|
59
|
+
<MenuItem
|
|
60
|
+
icon={ chevronDown }
|
|
61
|
+
onClick={ () => {
|
|
62
|
+
moveBlocksDown( [ clientId ], rootClientId );
|
|
63
|
+
onClose();
|
|
64
|
+
} }
|
|
65
|
+
>
|
|
66
|
+
{ __( 'Move down' ) }
|
|
67
|
+
</MenuItem>
|
|
68
|
+
</MenuGroup>
|
|
69
|
+
<MenuGroup>
|
|
70
|
+
<MenuItem
|
|
71
|
+
onClick={ () => {
|
|
72
|
+
removeBlocks( [ clientId ], false );
|
|
73
|
+
onClose();
|
|
74
|
+
} }
|
|
75
|
+
>
|
|
76
|
+
{ removeLabel }
|
|
77
|
+
</MenuItem>
|
|
78
|
+
</MenuGroup>
|
|
79
|
+
</>
|
|
80
|
+
) }
|
|
81
|
+
</DropdownMenu>
|
|
82
|
+
);
|
|
83
|
+
}
|