@wordpress/edit-site 5.4.0 → 5.6.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-template-modal.js +12 -3
- package/build/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build/components/add-new-template/new-template-part.js +8 -7
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +19 -16
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/app/index.js +4 -2
- package/build/components/app/index.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +2 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/editor/index.js +5 -7
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/border-panel.js +20 -159
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +13 -11
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +41 -487
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/duotone-panel.js +78 -0
- package/build/components/global-styles/duotone-panel.js.map +1 -0
- package/build/components/global-styles/filter-utils.js +17 -0
- package/build/components/global-styles/filter-utils.js.map +1 -0
- package/build/components/global-styles/hooks.js +11 -26
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/preview.js +9 -5
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-block-list.js +6 -11
- package/build/components/global-styles/screen-block-list.js.map +1 -1
- package/build/components/global-styles/screen-border.js +14 -6
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-filters.js +46 -0
- package/build/components/global-styles/screen-filters.js.map +1 -0
- package/build/components/global-styles/screen-layout.js +13 -5
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -1
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -1
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-variations.js +1 -1
- package/build/components/global-styles/screen-variations.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +6 -4
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -5
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -1
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +124 -0
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build/components/keyboard-shortcuts/global.js +48 -0
- package/build/components/keyboard-shortcuts/global.js.map +1 -0
- package/build/components/keyboard-shortcuts/index.js +67 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +153 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -0
- package/build/components/layout/index.js +12 -1
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/added-by.js +127 -136
- package/build/components/list/added-by.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +9 -7
- package/build/components/list/table.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/save-panel/index.js +11 -1
- package/build/components/save-panel/index.js.map +1 -1
- package/build/components/sidebar/index.js +27 -17
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-button/index.js +30 -0
- package/build/components/sidebar-button/index.js.map +1 -0
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +14 -11
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +16 -16
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +22 -26
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +97 -14
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +66 -27
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +30 -17
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +14 -10
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +151 -21
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +36 -34
- 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 +24 -8
- 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 +67 -18
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +5 -10
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-part-converter/convert-to-regular.js +8 -12
- package/build/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build/components/template-part-converter/convert-to-template-part.js +2 -2
- package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build/components/template-part-converter/index.js +19 -14
- package/build/components/template-part-converter/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/index.js +13 -22
- package/build/index.js.map +1 -1
- package/build/store/actions.js +2 -2
- package/build/store/actions.js.map +1 -1
- package/build/utils/get-is-list-page.js +1 -1
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-template-modal.js +13 -4
- package/build-module/components/add-new-template/add-custom-template-modal.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +8 -7
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +21 -17
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/app/index.js +3 -2
- package/build-module/components/app/index.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +2 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/editor/index.js +5 -6
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +21 -157
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +14 -11
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +43 -480
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/duotone-panel.js +67 -0
- package/build-module/components/global-styles/duotone-panel.js.map +1 -0
- package/build-module/components/global-styles/filter-utils.js +9 -0
- package/build-module/components/global-styles/filter-utils.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +11 -26
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/preview.js +10 -6
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-block-list.js +6 -8
- package/build-module/components/global-styles/screen-block-list.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +12 -3
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-filters.js +33 -0
- package/build-module/components/global-styles/screen-filters.js.map +1 -0
- package/build-module/components/global-styles/screen-layout.js +11 -2
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +2 -1
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +2 -1
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-variations.js +1 -1
- package/build-module/components/global-styles/screen-variations.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +6 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +2 -5
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +6 -1
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +108 -0
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/global.js +37 -0
- package/build-module/components/keyboard-shortcuts/global.js.map +1 -0
- package/build-module/components/keyboard-shortcuts/index.js +65 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +141 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -0
- package/build-module/components/layout/index.js +10 -1
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/added-by.js +126 -138
- package/build-module/components/list/added-by.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +9 -7
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/save-panel/index.js +8 -1
- package/build-module/components/save-panel/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +24 -19
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-button/index.js +18 -0
- package/build-module/components/sidebar-button/index.js.map +1 -0
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +8 -2
- package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +12 -12
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +16 -16
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +24 -30
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +91 -14
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +67 -30
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +28 -18
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +13 -10
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +152 -25
- 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 +36 -34
- 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 +24 -8
- 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 +65 -18
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +5 -9
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-regular.js +9 -13
- package/build-module/components/template-part-converter/convert-to-regular.js.map +1 -1
- package/build-module/components/template-part-converter/convert-to-template-part.js +3 -3
- package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
- package/build-module/components/template-part-converter/index.js +20 -15
- package/build-module/components/template-part-converter/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/index.js +16 -23
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +2 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +1 -1
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +203 -143
- package/build-style/style.css +203 -143
- package/package.json +31 -31
- package/src/components/add-new-template/add-custom-template-modal.js +14 -10
- package/src/components/add-new-template/new-template-part.js +7 -9
- package/src/components/add-new-template/new-template.js +60 -38
- package/src/components/add-new-template/style.scss +12 -6
- package/src/components/app/index.js +9 -6
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/block-editor/style.scss +1 -1
- package/src/components/editor/index.js +62 -65
- package/src/components/editor/style.scss +0 -6
- package/src/components/global-styles/border-panel.js +24 -199
- package/src/components/global-styles/context-menu.js +18 -12
- package/src/components/global-styles/dimensions-panel.js +43 -577
- package/src/components/global-styles/duotone-panel.js +82 -0
- package/src/components/global-styles/filter-utils.js +9 -0
- package/src/components/global-styles/hooks.js +12 -36
- package/src/components/global-styles/preview.js +155 -140
- package/src/components/global-styles/screen-block-list.js +6 -11
- package/src/components/global-styles/screen-border.js +10 -3
- package/src/components/global-styles/screen-filters.js +27 -0
- package/src/components/global-styles/screen-layout.js +9 -2
- package/src/components/global-styles/screen-root.js +1 -1
- package/src/components/global-styles/screen-style-variations.js +5 -1
- package/src/components/global-styles/screen-variations.js +0 -1
- package/src/components/global-styles/shadow-panel.js +4 -3
- package/src/components/global-styles/style.scss +10 -0
- package/src/components/global-styles/typography-panel.js +5 -7
- package/src/components/global-styles/ui.js +6 -1
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcuts/edit-mode.js +116 -0
- package/src/components/keyboard-shortcuts/global.js +35 -0
- package/src/components/keyboard-shortcuts/index.js +70 -0
- package/src/components/keyboard-shortcuts/register.js +157 -0
- package/src/components/layout/index.js +19 -0
- package/src/components/layout/style.scss +9 -4
- package/src/components/list/added-by.js +152 -155
- package/src/components/list/index.js +3 -1
- package/src/components/list/style.scss +5 -13
- package/src/components/list/table.js +11 -9
- package/src/components/routes/link.js +9 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/save-panel/index.js +8 -1
- package/src/components/sidebar/index.js +33 -16
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/index.js +21 -0
- package/src/components/sidebar-button/style.scss +24 -0
- package/src/components/sidebar-edit-mode/global-styles-sidebar.js +3 -7
- package/src/components/sidebar-edit-mode/style.scss +16 -0
- package/src/components/sidebar-navigation-item/style.scss +1 -23
- package/src/components/sidebar-navigation-screen/index.js +37 -38
- package/src/components/sidebar-navigation-screen/style.scss +16 -9
- package/src/components/sidebar-navigation-screen-main/index.js +24 -11
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +39 -26
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +99 -12
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +108 -1
- package/src/components/sidebar-navigation-screen-template/index.js +89 -30
- package/src/components/sidebar-navigation-screen-template/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +29 -14
- package/src/components/sidebar-navigation-screen-templates/style.scss +0 -5
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -6
- package/src/components/site-hub/index.js +5 -1
- package/src/components/site-hub/style.scss +5 -1
- package/src/components/style-book/index.js +234 -55
- package/src/components/style-book/style.scss +1 -45
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +28 -23
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +77 -17
- package/src/components/template-details/index.js +4 -8
- package/src/components/template-part-converter/convert-to-regular.js +10 -17
- package/src/components/template-part-converter/convert-to-template-part.js +9 -16
- package/src/components/template-part-converter/index.js +28 -12
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/index.js +11 -22
- package/src/store/actions.js +2 -2
- package/src/store/test/actions.js +0 -2
- package/src/style.scss +3 -1
- package/src/utils/get-is-list-page.js +1 -1
- package/src/utils/history.js +13 -9
- package/build/components/navigation-inspector/index.js +0 -161
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -62
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -146
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/navigation-inspector/index.js +0 -191
- package/src/components/navigation-inspector/navigation-menu.js +0 -66
- package/src/components/navigation-inspector/style.scss +0 -46
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { Button } from '@wordpress/components';
|
|
10
|
+
|
|
11
|
+
export default function SidebarButton( props ) {
|
|
12
|
+
return (
|
|
13
|
+
<Button
|
|
14
|
+
{ ...props }
|
|
15
|
+
className={ classnames(
|
|
16
|
+
'edit-site-sidebar-button',
|
|
17
|
+
props.className
|
|
18
|
+
) }
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.edit-site-sidebar-button {
|
|
2
|
+
color: $gray-200;
|
|
3
|
+
flex-shrink: 0;
|
|
4
|
+
|
|
5
|
+
// Focus (resets default button focus and use focus-visible).
|
|
6
|
+
&:focus:not(:disabled) {
|
|
7
|
+
box-shadow: none;
|
|
8
|
+
outline: none;
|
|
9
|
+
}
|
|
10
|
+
&:focus-visible:not(:disabled) {
|
|
11
|
+
box-shadow:
|
|
12
|
+
0 0 0 var(--wp-admin-border-width-focus)
|
|
13
|
+
var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
|
|
14
|
+
outline: 3px solid transparent;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:hover,
|
|
18
|
+
&:focus-visible,
|
|
19
|
+
&:focus,
|
|
20
|
+
&:not([aria-disabled="true"]):active,
|
|
21
|
+
&[aria-expanded="true"] {
|
|
22
|
+
color: $white;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -37,18 +37,14 @@ export default function GlobalStylesSidebar() {
|
|
|
37
37
|
closeLabel={ __( 'Close Styles sidebar' ) }
|
|
38
38
|
panelClassName="edit-site-global-styles-sidebar__panel"
|
|
39
39
|
header={
|
|
40
|
-
<Flex>
|
|
41
|
-
<FlexBlock>
|
|
40
|
+
<Flex className="edit-site-global-styles-sidebar__header">
|
|
41
|
+
<FlexBlock style={ { minWidth: 'min-content' } }>
|
|
42
42
|
<strong>{ __( 'Styles' ) }</strong>
|
|
43
43
|
</FlexBlock>
|
|
44
44
|
<FlexItem>
|
|
45
45
|
<Button
|
|
46
46
|
icon={ seen }
|
|
47
|
-
label={
|
|
48
|
-
isStyleBookOpened
|
|
49
|
-
? __( 'Close Style Book' )
|
|
50
|
-
: __( 'Open Style Book' )
|
|
51
|
-
}
|
|
47
|
+
label={ __( 'Style Book' ) }
|
|
52
48
|
isPressed={ isStyleBookOpened }
|
|
53
49
|
disabled={ editorMode !== 'visual' }
|
|
54
50
|
onClick={ () => {
|
|
@@ -83,3 +83,19 @@
|
|
|
83
83
|
.edit-site-global-styles-sidebar hr {
|
|
84
84
|
margin: 0;
|
|
85
85
|
}
|
|
86
|
+
|
|
87
|
+
.show-icon-labels {
|
|
88
|
+
.edit-site-global-styles-sidebar__header {
|
|
89
|
+
.components-button.has-icon {
|
|
90
|
+
// Hide the button icons when labels are set to display...
|
|
91
|
+
svg {
|
|
92
|
+
display: none;
|
|
93
|
+
}
|
|
94
|
+
// ... and display labels.
|
|
95
|
+
&::after {
|
|
96
|
+
content: attr(aria-label);
|
|
97
|
+
font-size: $helptext-font-size;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
.edit-site-sidebar-navigation-item.components-item {
|
|
2
2
|
color: $gray-600;
|
|
3
|
-
|
|
3
|
+
margin: 0 $grid-unit-05;
|
|
4
4
|
|
|
5
5
|
&:hover,
|
|
6
6
|
&:focus,
|
|
7
7
|
&[aria-current] {
|
|
8
8
|
color: $white;
|
|
9
9
|
background: $gray-800;
|
|
10
|
-
border-width: $border-width-tab;
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
&[aria-current] {
|
|
@@ -15,28 +14,7 @@
|
|
|
15
14
|
}
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
.edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .components-button {
|
|
19
|
-
color: $gray-600;
|
|
20
|
-
&:hover,
|
|
21
|
-
&:focus,
|
|
22
|
-
&[aria-current] {
|
|
23
|
-
color: $white;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .offcanvas-editor-list-view-leaf {
|
|
28
|
-
&:hover,
|
|
29
|
-
&:focus,
|
|
30
|
-
&[aria-current] {
|
|
31
|
-
background: $gray-800;
|
|
32
|
-
}
|
|
33
|
-
.block-editor-list-view-block__menu {
|
|
34
|
-
margin-left: -$grid-unit-10;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
17
|
.edit-site-sidebar-navigation-screen__content .block-editor-list-view-block-select-button {
|
|
39
18
|
cursor: grab;
|
|
40
|
-
width: calc(100% - #{ $border-width-focus });
|
|
41
19
|
padding: $grid-unit-10;
|
|
42
20
|
}
|
|
@@ -5,8 +5,6 @@ import {
|
|
|
5
5
|
__experimentalHStack as HStack,
|
|
6
6
|
__experimentalVStack as VStack,
|
|
7
7
|
__experimentalNavigatorToParentButton as NavigatorToParentButton,
|
|
8
|
-
Button,
|
|
9
|
-
__experimentalNavigatorScreen as NavigatorScreen,
|
|
10
8
|
} from '@wordpress/components';
|
|
11
9
|
import { isRTL, __ } from '@wordpress/i18n';
|
|
12
10
|
import { chevronRight, chevronLeft } from '@wordpress/icons';
|
|
@@ -17,12 +15,14 @@ import { useSelect } from '@wordpress/data';
|
|
|
17
15
|
*/
|
|
18
16
|
import { store as editSiteStore } from '../../store';
|
|
19
17
|
import { unlock } from '../../private-apis';
|
|
18
|
+
import SidebarButton from '../sidebar-button';
|
|
20
19
|
|
|
21
20
|
export default function SidebarNavigationScreen( {
|
|
22
|
-
|
|
21
|
+
isRoot,
|
|
23
22
|
title,
|
|
24
23
|
actions,
|
|
25
24
|
content,
|
|
25
|
+
description,
|
|
26
26
|
} ) {
|
|
27
27
|
const { dashboardLink } = useSelect( ( select ) => {
|
|
28
28
|
const { getSettings } = unlock( select( editSiteStore ) );
|
|
@@ -32,41 +32,40 @@ export default function SidebarNavigationScreen( {
|
|
|
32
32
|
}, [] );
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
<h2 className="edit-site-sidebar-navigation-screen__title">
|
|
61
|
-
{ title }
|
|
62
|
-
</h2>
|
|
63
|
-
{ actions }
|
|
64
|
-
</HStack>
|
|
35
|
+
<VStack spacing={ 2 }>
|
|
36
|
+
<HStack
|
|
37
|
+
spacing={ 4 }
|
|
38
|
+
justify="flex-start"
|
|
39
|
+
className="edit-site-sidebar-navigation-screen__title-icon"
|
|
40
|
+
>
|
|
41
|
+
{ ! isRoot ? (
|
|
42
|
+
<NavigatorToParentButton
|
|
43
|
+
as={ SidebarButton }
|
|
44
|
+
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
45
|
+
aria-label={ __( 'Back' ) }
|
|
46
|
+
/>
|
|
47
|
+
) : (
|
|
48
|
+
<SidebarButton
|
|
49
|
+
icon={ isRTL() ? chevronRight : chevronLeft }
|
|
50
|
+
aria-label={ __( 'Navigate to the Dashboard' ) }
|
|
51
|
+
href={ dashboardLink || 'index.php' }
|
|
52
|
+
label={ __( 'Dashboard' ) }
|
|
53
|
+
/>
|
|
54
|
+
) }
|
|
55
|
+
<h2 className="edit-site-sidebar-navigation-screen__title">
|
|
56
|
+
{ title }
|
|
57
|
+
</h2>
|
|
58
|
+
{ actions }
|
|
59
|
+
</HStack>
|
|
65
60
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
<nav className="edit-site-sidebar-navigation-screen__content">
|
|
62
|
+
{ description && (
|
|
63
|
+
<p className="edit-site-sidebar-navigation-screen__description">
|
|
64
|
+
{ description }
|
|
65
|
+
</p>
|
|
66
|
+
) }
|
|
67
|
+
{ content }
|
|
68
|
+
</nav>
|
|
69
|
+
</VStack>
|
|
71
70
|
);
|
|
72
71
|
}
|
|
@@ -10,6 +10,21 @@
|
|
|
10
10
|
color: $gray-600;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
.edit-site-sidebar-navigation-screen__page-link {
|
|
14
|
+
color: $gray-600;
|
|
15
|
+
|
|
16
|
+
&:hover,
|
|
17
|
+
&:focus {
|
|
18
|
+
color: $white;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.components-external-link__icon {
|
|
22
|
+
margin-left: $grid-unit-05;
|
|
23
|
+
}
|
|
24
|
+
margin-left: $grid-unit-20;
|
|
25
|
+
display: inline-block;
|
|
26
|
+
}
|
|
27
|
+
|
|
13
28
|
.edit-site-sidebar-navigation-screen__title-icon {
|
|
14
29
|
position: sticky;
|
|
15
30
|
top: 0;
|
|
@@ -23,17 +38,9 @@
|
|
|
23
38
|
|
|
24
39
|
.edit-site-sidebar-navigation-screen__title {
|
|
25
40
|
font-size: calc(1.56 * 13px);
|
|
41
|
+
line-height: normal;
|
|
26
42
|
font-weight: 500;
|
|
27
43
|
flex-grow: 1;
|
|
28
44
|
color: $white;
|
|
29
45
|
margin: 0;
|
|
30
46
|
}
|
|
31
|
-
|
|
32
|
-
.edit-site-sidebar-navigation-screen__back {
|
|
33
|
-
color: $gray-200;
|
|
34
|
-
|
|
35
|
-
&:hover,
|
|
36
|
-
&:not([aria-disabled="true"]):active {
|
|
37
|
-
color: $white;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -17,23 +17,36 @@ import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
|
17
17
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
18
18
|
|
|
19
19
|
export default function SidebarNavigationScreenMain() {
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const hasNavigationMenus = useSelect( ( select ) => {
|
|
21
|
+
// The query needs to be the same as in the "SidebarNavigationScreenNavigationMenus" component,
|
|
22
|
+
// to avoid double network calls.
|
|
23
|
+
const navigationMenus = select( coreStore ).getEntityRecords(
|
|
24
|
+
'postType',
|
|
25
|
+
'wp_navigation',
|
|
26
|
+
{
|
|
27
|
+
per_page: 1,
|
|
25
28
|
status: 'publish',
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
order: 'desc',
|
|
30
|
+
orderby: 'date',
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
return navigationMenus?.length > 0;
|
|
28
35
|
} );
|
|
29
36
|
|
|
37
|
+
const showNavigationScreen = process.env.IS_GUTENBERG_PLUGIN
|
|
38
|
+
? hasNavigationMenus
|
|
39
|
+
: false;
|
|
30
40
|
return (
|
|
31
41
|
<SidebarNavigationScreen
|
|
32
|
-
|
|
42
|
+
isRoot
|
|
33
43
|
title={ __( 'Design' ) }
|
|
44
|
+
description={ __(
|
|
45
|
+
'Customize the appearance of your website using the block editor.'
|
|
46
|
+
) }
|
|
34
47
|
content={
|
|
35
48
|
<ItemGroup>
|
|
36
|
-
{
|
|
49
|
+
{ showNavigationScreen && (
|
|
37
50
|
<NavigatorButton
|
|
38
51
|
as={ SidebarNavigationItem }
|
|
39
52
|
path="/navigation"
|
|
@@ -45,7 +58,7 @@ export default function SidebarNavigationScreenMain() {
|
|
|
45
58
|
) }
|
|
46
59
|
<NavigatorButton
|
|
47
60
|
as={ SidebarNavigationItem }
|
|
48
|
-
path="/
|
|
61
|
+
path="/wp_template"
|
|
49
62
|
withChevron
|
|
50
63
|
icon={ layout }
|
|
51
64
|
>
|
|
@@ -53,7 +66,7 @@ export default function SidebarNavigationScreenMain() {
|
|
|
53
66
|
</NavigatorButton>
|
|
54
67
|
<NavigatorButton
|
|
55
68
|
as={ SidebarNavigationItem }
|
|
56
|
-
path="/
|
|
69
|
+
path="/wp_template_part"
|
|
57
70
|
withChevron
|
|
58
71
|
icon={ symbolFilled }
|
|
59
72
|
>
|
|
@@ -2,10 +2,14 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useDispatch
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import {
|
|
7
|
+
__experimentalUseNavigator as useNavigator,
|
|
8
|
+
ExternalLink,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
import { useEntityRecord } from '@wordpress/core-data';
|
|
8
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
|
+
import { pencil } from '@wordpress/icons';
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Internal dependencies
|
|
@@ -13,39 +17,48 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
13
17
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
14
18
|
import { unlock } from '../../private-apis';
|
|
15
19
|
import { store as editSiteStore } from '../../store';
|
|
20
|
+
import SidebarButton from '../sidebar-button';
|
|
16
21
|
|
|
17
22
|
export default function SidebarNavigationScreenNavigationItem() {
|
|
18
23
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const { postType, postId } = getEditedPostContext() ?? {};
|
|
24
|
-
|
|
25
|
-
// The currently selected entity to display.
|
|
26
|
-
// Typically template or template part in the site editor.
|
|
27
|
-
return {
|
|
28
|
-
post:
|
|
29
|
-
postId && postType
|
|
30
|
-
? getEntityRecord( 'postType', postType, postId )
|
|
31
|
-
: null,
|
|
32
|
-
};
|
|
33
|
-
}, [] );
|
|
24
|
+
const {
|
|
25
|
+
params: { postType, postId },
|
|
26
|
+
} = useNavigator();
|
|
27
|
+
const { record } = useEntityRecord( 'postType', postType, postId );
|
|
34
28
|
|
|
35
29
|
return (
|
|
36
30
|
<SidebarNavigationScreen
|
|
37
|
-
|
|
38
|
-
title={ post ? decodeEntities( post?.title?.rendered ) : null }
|
|
31
|
+
title={ record ? decodeEntities( record?.title?.rendered ) : null }
|
|
39
32
|
actions={
|
|
40
|
-
<
|
|
41
|
-
variant="primary"
|
|
33
|
+
<SidebarButton
|
|
42
34
|
onClick={ () => setCanvasMode( 'edit' ) }
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
|
|
35
|
+
label={ __( 'Edit' ) }
|
|
36
|
+
icon={ pencil }
|
|
37
|
+
/>
|
|
38
|
+
}
|
|
39
|
+
description={
|
|
40
|
+
postType === 'page'
|
|
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
|
+
)
|
|
46
47
|
}
|
|
47
48
|
content={
|
|
48
|
-
|
|
49
|
+
<>
|
|
50
|
+
{ record?.link ? (
|
|
51
|
+
<ExternalLink
|
|
52
|
+
className="edit-site-sidebar-navigation-screen__page-link"
|
|
53
|
+
href={ record.link }
|
|
54
|
+
>
|
|
55
|
+
{ record.link }
|
|
56
|
+
</ExternalLink>
|
|
57
|
+
) : null }
|
|
58
|
+
{ record
|
|
59
|
+
? decodeEntities( record?.description?.rendered )
|
|
60
|
+
: null }
|
|
61
|
+
</>
|
|
49
62
|
}
|
|
50
63
|
/>
|
|
51
64
|
);
|
|
@@ -2,20 +2,79 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useCallback } from '@wordpress/element';
|
|
5
|
+
import { useCallback, useMemo } from '@wordpress/element';
|
|
6
|
+
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { BlockEditorProvider } from '@wordpress/block-editor';
|
|
9
|
+
import { createBlock } from '@wordpress/blocks';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Internal dependencies
|
|
9
13
|
*/
|
|
10
14
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
11
|
-
import NavigationInspector from '../navigation-inspector';
|
|
12
15
|
import { useHistory } from '../routes';
|
|
16
|
+
import NavigationMenuContent from './navigation-menu-content';
|
|
17
|
+
import { NavigationMenuLoader } from './loader';
|
|
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
|
+
}
|
|
13
41
|
|
|
14
42
|
export default function SidebarNavigationScreenNavigationMenus() {
|
|
15
43
|
const history = useHistory();
|
|
44
|
+
const { navigationMenus, hasResolvedNavigationMenus, storedSettings } =
|
|
45
|
+
useSelect( ( select ) => {
|
|
46
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
47
|
+
const { getEntityRecords, hasFinishedResolution } =
|
|
48
|
+
select( coreStore );
|
|
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 ] );
|
|
71
|
+
|
|
72
|
+
const isLoading = ! hasResolvedNavigationMenus;
|
|
73
|
+
const hasNavigationMenus = !! navigationMenus?.length;
|
|
74
|
+
|
|
16
75
|
const onSelect = useCallback(
|
|
17
76
|
( selectedBlock ) => {
|
|
18
|
-
const { attributes } = selectedBlock;
|
|
77
|
+
const { attributes, name } = selectedBlock;
|
|
19
78
|
if (
|
|
20
79
|
attributes.kind === 'post-type' &&
|
|
21
80
|
attributes.id &&
|
|
@@ -25,21 +84,49 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
25
84
|
history.push( {
|
|
26
85
|
postType: attributes.type,
|
|
27
86
|
postId: attributes.id,
|
|
28
|
-
|
|
87
|
+
} );
|
|
88
|
+
}
|
|
89
|
+
if ( name === 'core/page-list-item' && attributes.id && history ) {
|
|
90
|
+
history.push( {
|
|
91
|
+
postType: 'page',
|
|
92
|
+
postId: attributes.id,
|
|
29
93
|
} );
|
|
30
94
|
}
|
|
31
95
|
},
|
|
32
96
|
[ history ]
|
|
33
97
|
);
|
|
98
|
+
|
|
99
|
+
if ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {
|
|
100
|
+
return (
|
|
101
|
+
<SidebarNavigationScreenWrapper>
|
|
102
|
+
{ __( 'There are no Navigation Menus.' ) }
|
|
103
|
+
</SidebarNavigationScreenWrapper>
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if ( ! hasResolvedNavigationMenus || isLoading ) {
|
|
108
|
+
return (
|
|
109
|
+
<SidebarNavigationScreenWrapper>
|
|
110
|
+
<NavigationMenuLoader />
|
|
111
|
+
</SidebarNavigationScreenWrapper>
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
34
115
|
return (
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
116
|
+
<BlockEditorProvider
|
|
117
|
+
settings={ storedSettings }
|
|
118
|
+
value={ blocks }
|
|
119
|
+
onChange={ noop }
|
|
120
|
+
onInput={ noop }
|
|
121
|
+
>
|
|
122
|
+
<SidebarNavigationScreenWrapper>
|
|
123
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__content">
|
|
124
|
+
<NavigationMenuContent
|
|
125
|
+
rootClientId={ blocks[ 0 ].clientId }
|
|
126
|
+
onSelect={ onSelect }
|
|
127
|
+
/>
|
|
41
128
|
</div>
|
|
42
|
-
|
|
43
|
-
|
|
129
|
+
</SidebarNavigationScreenWrapper>
|
|
130
|
+
</BlockEditorProvider>
|
|
44
131
|
);
|
|
45
132
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function NavigationMenuLoader() {
|
|
2
|
+
return (
|
|
3
|
+
<>
|
|
4
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
|
|
5
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
|
|
6
|
+
<div className="edit-site-sidebar-navigation-screen-navigation-menus__placeholder" />
|
|
7
|
+
</>
|
|
8
|
+
);
|
|
9
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
privateApis as blockEditorPrivateApis,
|
|
6
|
+
store as blockEditorStore,
|
|
7
|
+
BlockList,
|
|
8
|
+
BlockTools,
|
|
9
|
+
} from '@wordpress/block-editor';
|
|
10
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
11
|
+
import { createBlock } from '@wordpress/blocks';
|
|
12
|
+
import { useCallback } from '@wordpress/element';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Internal dependencies
|
|
16
|
+
*/
|
|
17
|
+
import { unlock } from '../../private-apis';
|
|
18
|
+
import { NavigationMenuLoader } from './loader';
|
|
19
|
+
|
|
20
|
+
export default function NavigationMenuContent( { rootClientId, onSelect } ) {
|
|
21
|
+
const { clientIdsTree, isLoading } = useSelect(
|
|
22
|
+
( select ) => {
|
|
23
|
+
const { __unstableGetClientIdsTree, areInnerBlocksControlled } =
|
|
24
|
+
select( blockEditorStore );
|
|
25
|
+
return {
|
|
26
|
+
clientIdsTree: __unstableGetClientIdsTree( rootClientId ),
|
|
27
|
+
|
|
28
|
+
// This is a small hack to wait for the navigation block
|
|
29
|
+
// to actually load its inner blocks.
|
|
30
|
+
isLoading: ! areInnerBlocksControlled( rootClientId ),
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
[ rootClientId ]
|
|
34
|
+
);
|
|
35
|
+
const { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =
|
|
36
|
+
useDispatch( blockEditorStore );
|
|
37
|
+
|
|
38
|
+
const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );
|
|
39
|
+
|
|
40
|
+
const offCanvasOnselect = useCallback(
|
|
41
|
+
( block ) => {
|
|
42
|
+
if (
|
|
43
|
+
block.name === 'core/navigation-link' &&
|
|
44
|
+
! block.attributes.url
|
|
45
|
+
) {
|
|
46
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
47
|
+
replaceBlock(
|
|
48
|
+
block.clientId,
|
|
49
|
+
createBlock( 'core/navigation-link', block.attributes )
|
|
50
|
+
);
|
|
51
|
+
} else {
|
|
52
|
+
onSelect( block );
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
[ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// The hidden block is needed because it makes block edit side effects trigger.
|
|
59
|
+
// For example a navigation page list load its items has an effect on edit to load its items.
|
|
60
|
+
return (
|
|
61
|
+
<>
|
|
62
|
+
{ isLoading && <NavigationMenuLoader /> }
|
|
63
|
+
{ ! isLoading && (
|
|
64
|
+
<OffCanvasEditor
|
|
65
|
+
blocks={ clientIdsTree }
|
|
66
|
+
onSelect={ offCanvasOnselect }
|
|
67
|
+
LeafMoreMenu={ LeafMoreMenu }
|
|
68
|
+
showAppender={ false }
|
|
69
|
+
/>
|
|
70
|
+
) }
|
|
71
|
+
<div style={ { visibility: 'hidden' } }>
|
|
72
|
+
<BlockTools>
|
|
73
|
+
<BlockList />
|
|
74
|
+
</BlockTools>
|
|
75
|
+
</div>
|
|
76
|
+
</>
|
|
77
|
+
);
|
|
78
|
+
}
|