@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
|
@@ -11,12 +11,26 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _i18n = require("@wordpress/i18n");
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _data = require("@wordpress/data");
|
|
15
|
+
|
|
16
|
+
var _coreData = require("@wordpress/core-data");
|
|
17
|
+
|
|
18
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
19
|
+
|
|
20
|
+
var _blocks = require("@wordpress/blocks");
|
|
15
21
|
|
|
16
|
-
var
|
|
22
|
+
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
17
23
|
|
|
18
24
|
var _routes = require("../routes");
|
|
19
25
|
|
|
26
|
+
var _navigationMenuContent = _interopRequireDefault(require("./navigation-menu-content"));
|
|
27
|
+
|
|
28
|
+
var _loader = require("./loader");
|
|
29
|
+
|
|
30
|
+
var _privateApis = require("../../private-apis");
|
|
31
|
+
|
|
32
|
+
var _store = require("../../store");
|
|
33
|
+
|
|
20
34
|
/**
|
|
21
35
|
* WordPress dependencies
|
|
22
36
|
*/
|
|
@@ -24,29 +38,98 @@ var _routes = require("../routes");
|
|
|
24
38
|
/**
|
|
25
39
|
* Internal dependencies
|
|
26
40
|
*/
|
|
41
|
+
const noop = () => {};
|
|
42
|
+
|
|
43
|
+
const NAVIGATION_MENUS_QUERY = {
|
|
44
|
+
per_page: 1,
|
|
45
|
+
status: 'publish',
|
|
46
|
+
order: 'desc',
|
|
47
|
+
orderby: 'date'
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
function SidebarNavigationScreenWrapper(_ref) {
|
|
51
|
+
let {
|
|
52
|
+
children,
|
|
53
|
+
actions
|
|
54
|
+
} = _ref;
|
|
55
|
+
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
56
|
+
title: (0, _i18n.__)('Navigation'),
|
|
57
|
+
actions: actions,
|
|
58
|
+
description: (0, _i18n.__)('Browse your site, edit pages, and manage your primary navigation menu.'),
|
|
59
|
+
content: children
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
27
63
|
function SidebarNavigationScreenNavigationMenus() {
|
|
64
|
+
var _navigationMenus$;
|
|
65
|
+
|
|
28
66
|
const history = (0, _routes.useHistory)();
|
|
67
|
+
const {
|
|
68
|
+
navigationMenus,
|
|
69
|
+
hasResolvedNavigationMenus,
|
|
70
|
+
storedSettings
|
|
71
|
+
} = (0, _data.useSelect)(select => {
|
|
72
|
+
const {
|
|
73
|
+
getSettings
|
|
74
|
+
} = (0, _privateApis.unlock)(select(_store.store));
|
|
75
|
+
const {
|
|
76
|
+
getEntityRecords,
|
|
77
|
+
hasFinishedResolution
|
|
78
|
+
} = select(_coreData.store);
|
|
79
|
+
const navigationMenusQuery = ['postType', 'wp_navigation', NAVIGATION_MENUS_QUERY];
|
|
80
|
+
return {
|
|
81
|
+
storedSettings: getSettings(false),
|
|
82
|
+
navigationMenus: getEntityRecords(...navigationMenusQuery),
|
|
83
|
+
hasResolvedNavigationMenus: hasFinishedResolution('getEntityRecords', navigationMenusQuery)
|
|
84
|
+
};
|
|
85
|
+
}, []);
|
|
86
|
+
const firstNavigationMenu = navigationMenus === null || navigationMenus === void 0 ? void 0 : (_navigationMenus$ = navigationMenus[0]) === null || _navigationMenus$ === void 0 ? void 0 : _navigationMenus$.id;
|
|
87
|
+
const blocks = (0, _element.useMemo)(() => {
|
|
88
|
+
return [(0, _blocks.createBlock)('core/navigation', {
|
|
89
|
+
ref: firstNavigationMenu
|
|
90
|
+
})];
|
|
91
|
+
}, [firstNavigationMenu]);
|
|
92
|
+
const isLoading = !hasResolvedNavigationMenus;
|
|
93
|
+
const hasNavigationMenus = !!(navigationMenus !== null && navigationMenus !== void 0 && navigationMenus.length);
|
|
29
94
|
const onSelect = (0, _element.useCallback)(selectedBlock => {
|
|
30
95
|
const {
|
|
31
|
-
attributes
|
|
96
|
+
attributes,
|
|
97
|
+
name
|
|
32
98
|
} = selectedBlock;
|
|
33
99
|
|
|
34
100
|
if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
|
|
35
101
|
history.push({
|
|
36
102
|
postType: attributes.type,
|
|
37
|
-
postId: attributes.id
|
|
38
|
-
|
|
103
|
+
postId: attributes.id
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (name === 'core/page-list-item' && attributes.id && history) {
|
|
108
|
+
history.push({
|
|
109
|
+
postType: 'page',
|
|
110
|
+
postId: attributes.id
|
|
39
111
|
});
|
|
40
112
|
}
|
|
41
113
|
}, [history]);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
114
|
+
|
|
115
|
+
if (hasResolvedNavigationMenus && !hasNavigationMenus) {
|
|
116
|
+
return (0, _element.createElement)(SidebarNavigationScreenWrapper, null, (0, _i18n.__)('There are no Navigation Menus.'));
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!hasResolvedNavigationMenus || isLoading) {
|
|
120
|
+
return (0, _element.createElement)(SidebarNavigationScreenWrapper, null, (0, _element.createElement)(_loader.NavigationMenuLoader, null));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return (0, _element.createElement)(_blockEditor.BlockEditorProvider, {
|
|
124
|
+
settings: storedSettings,
|
|
125
|
+
value: blocks,
|
|
126
|
+
onChange: noop,
|
|
127
|
+
onInput: noop
|
|
128
|
+
}, (0, _element.createElement)(SidebarNavigationScreenWrapper, null, (0, _element.createElement)("div", {
|
|
129
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__content"
|
|
130
|
+
}, (0, _element.createElement)(_navigationMenuContent.default, {
|
|
131
|
+
rootClientId: blocks[0].clientId,
|
|
132
|
+
onSelect: onSelect
|
|
133
|
+
}))));
|
|
51
134
|
}
|
|
52
135
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["noop","NAVIGATION_MENUS_QUERY","per_page","status","order","orderby","SidebarNavigationScreenWrapper","children","actions","SidebarNavigationScreenNavigationMenus","history","navigationMenus","hasResolvedNavigationMenus","storedSettings","select","getSettings","editSiteStore","getEntityRecords","hasFinishedResolution","coreStore","navigationMenusQuery","firstNavigationMenu","id","blocks","ref","isLoading","hasNavigationMenus","length","onSelect","selectedBlock","attributes","name","kind","type","push","postType","postId","clientId"],"mappings":";;;;;;;;;AAIA;;AADA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAlBA;AACA;AACA;;AAQA;AACA;AACA;AAQA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AACA,MAAMC,sBAAsB,GAAG;AAC9BC,EAAAA,QAAQ,EAAE,CADoB;AAE9BC,EAAAA,MAAM,EAAE,SAFsB;AAG9BC,EAAAA,KAAK,EAAE,MAHuB;AAI9BC,EAAAA,OAAO,EAAE;AAJqB,CAA/B;;AAOA,SAASC,8BAAT,OAAiE;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAChE,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAG,cAAI,YAAJ,CADT;AAEC,IAAA,OAAO,EAAGA,OAFX;AAGC,IAAA,WAAW,EAAG,cACb,wEADa,CAHf;AAMC,IAAA,OAAO,EAAGD;AANX,IADD;AAUA;;AAEc,SAASE,sCAAT,GAAkD;AAAA;;AAChE,QAAMC,OAAO,GAAG,yBAAhB;AACA,QAAM;AAAEC,IAAAA,eAAF;AAAmBC,IAAAA,0BAAnB;AAA+CC,I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AAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACR;AAFN,OAAd;AAIA;;AACD,QAAKS,IAAI,KAAK,qBAAT,IAAkCD,UAAU,CAACR,EAA7C,IAAmDZ,OAAxD,EAAkE;AACjEA,MAAAA,OAAO,CAACwB,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAE,MADG;AAEbC,QAAAA,MAAM,EAAEN,UAAU,CAACR;AAFN,OAAd;AAIA;AACD,GApBe,EAqBhB,CAAEZ,OAAF,CArBgB,CAAjB;;AAwBA,MAAKE,0BAA0B,IAAI,CAAEc,kBAArC,EAA0D;AACzD,WACC,4BAAC,8BAAD,QACG,cAAI,gCAAJ,CADH,CADD;AAKA;;AAED,MAAK,CAAEd,0BAAF,IAAgCa,SAArC,EAAiD;AAChD,WACC,4BAAC,8BAAD,QACC,4BAAC,4BAAD,OADD,CADD;AAKA;;AAED,SACC,4BAAC,gCAAD;AACC,IAAA,QAAQ,EAAGZ,cADZ;AAEC,IAAA,KAAK,EAAGU,MAFT;AAGC,IAAA,QAAQ,EAAGvB,IAHZ;AAIC,IAAA,OAAO,EAAGA;AAJX,KAMC,4BAAC,8BAAD,QACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,4BAAC,8BAAD;AACC,IAAA,YAAY,EAAGuB,MAAM,CAAE,CAAF,CAAN,CAAYc,QAD5B;AAEC,IAAA,QAAQ,EAAGT;AAFZ,IADD,CADD,CAND,CADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback, useMemo } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { createBlock } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useHistory } from '../routes';\nimport NavigationMenuContent from './navigation-menu-content';\nimport { NavigationMenuLoader } from './loader';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst noop = () => {};\nconst NAVIGATION_MENUS_QUERY = {\n\tper_page: 1,\n\tstatus: 'publish',\n\torder: 'desc',\n\torderby: 'date',\n};\n\nfunction SidebarNavigationScreenWrapper( { children, actions } ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tactions={ actions }\n\t\t\tdescription={ __(\n\t\t\t\t'Browse your site, edit pages, and manage your primary navigation menu.'\n\t\t\t) }\n\t\t\tcontent={ children }\n\t\t/>\n\t);\n}\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst { navigationMenus, hasResolvedNavigationMenus, storedSettings } =\n\t\tuseSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\t\t\tconst { getEntityRecords, hasFinishedResolution } =\n\t\t\t\tselect( coreStore );\n\n\t\t\tconst navigationMenusQuery = [\n\t\t\t\t'postType',\n\t\t\t\t'wp_navigation',\n\t\t\t\tNAVIGATION_MENUS_QUERY,\n\t\t\t];\n\t\t\treturn {\n\t\t\t\tstoredSettings: getSettings( false ),\n\t\t\t\tnavigationMenus: getEntityRecords( ...navigationMenusQuery ),\n\t\t\t\thasResolvedNavigationMenus: hasFinishedResolution(\n\t\t\t\t\t'getEntityRecords',\n\t\t\t\t\tnavigationMenusQuery\n\t\t\t\t),\n\t\t\t};\n\t\t}, [] );\n\n\tconst firstNavigationMenu = navigationMenus?.[ 0 ]?.id;\n\tconst blocks = useMemo( () => {\n\t\treturn [\n\t\t\tcreateBlock( 'core/navigation', { ref: firstNavigationMenu } ),\n\t\t];\n\t}, [ firstNavigationMenu ] );\n\n\tconst isLoading = ! hasResolvedNavigationMenus;\n\tconst hasNavigationMenus = !! navigationMenus?.length;\n\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes, name } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t\tif ( name === 'core/page-list-item' && attributes.id && history ) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: 'page',\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\n\tif ( hasResolvedNavigationMenus && ! hasNavigationMenus ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t{ __( 'There are no Navigation Menus.' ) }\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! hasResolvedNavigationMenus || isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<NavigationMenuLoader />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tvalue={ blocks }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<SidebarNavigationScreenWrapper>\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__content\">\n\t\t\t\t\t<NavigationMenuContent\n\t\t\t\t\t\trootClientId={ blocks[ 0 ].clientId }\n\t\t\t\t\t\tonSelect={ onSelect }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t</BlockEditorProvider>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NavigationMenuLoader = NavigationMenuLoader;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
function NavigationMenuLoader() {
|
|
11
|
+
return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)("div", {
|
|
12
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
|
|
13
|
+
}), (0, _element.createElement)("div", {
|
|
14
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
|
|
15
|
+
}), (0, _element.createElement)("div", {
|
|
16
|
+
className: "edit-site-sidebar-navigation-screen-navigation-menus__placeholder"
|
|
17
|
+
}));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/loader.js"],"names":["NavigationMenuLoader"],"mappings":";;;;;;;;;AAAO,SAASA,oBAAT,GAAgC;AACtC,SACC,qDACC;AAAK,IAAA,SAAS,EAAC;AAAf,IADD,EAEC;AAAK,IAAA,SAAS,EAAC;AAAf,IAFD,EAGC;AAAK,IAAA,SAAS,EAAC;AAAf,IAHD,CADD;AAOA","sourcesContent":["export function NavigationMenuLoader() {\n\treturn (\n\t\t<>\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus__placeholder\" />\n\t\t</>\n\t);\n}\n"]}
|
package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = NavigationMenuContent;
|
|
7
|
+
|
|
8
|
+
var _element = require("@wordpress/element");
|
|
9
|
+
|
|
10
|
+
var _blockEditor = require("@wordpress/block-editor");
|
|
11
|
+
|
|
12
|
+
var _data = require("@wordpress/data");
|
|
13
|
+
|
|
14
|
+
var _blocks = require("@wordpress/blocks");
|
|
15
|
+
|
|
16
|
+
var _privateApis = require("../../private-apis");
|
|
17
|
+
|
|
18
|
+
var _loader = require("./loader");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* WordPress dependencies
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Internal dependencies
|
|
26
|
+
*/
|
|
27
|
+
function NavigationMenuContent(_ref) {
|
|
28
|
+
let {
|
|
29
|
+
rootClientId,
|
|
30
|
+
onSelect
|
|
31
|
+
} = _ref;
|
|
32
|
+
const {
|
|
33
|
+
clientIdsTree,
|
|
34
|
+
isLoading
|
|
35
|
+
} = (0, _data.useSelect)(select => {
|
|
36
|
+
const {
|
|
37
|
+
__unstableGetClientIdsTree,
|
|
38
|
+
areInnerBlocksControlled
|
|
39
|
+
} = select(_blockEditor.store);
|
|
40
|
+
return {
|
|
41
|
+
clientIdsTree: __unstableGetClientIdsTree(rootClientId),
|
|
42
|
+
// This is a small hack to wait for the navigation block
|
|
43
|
+
// to actually load its inner blocks.
|
|
44
|
+
isLoading: !areInnerBlocksControlled(rootClientId)
|
|
45
|
+
};
|
|
46
|
+
}, [rootClientId]);
|
|
47
|
+
const {
|
|
48
|
+
replaceBlock,
|
|
49
|
+
__unstableMarkNextChangeAsNotPersistent
|
|
50
|
+
} = (0, _data.useDispatch)(_blockEditor.store);
|
|
51
|
+
const {
|
|
52
|
+
OffCanvasEditor,
|
|
53
|
+
LeafMoreMenu
|
|
54
|
+
} = (0, _privateApis.unlock)(_blockEditor.privateApis);
|
|
55
|
+
const offCanvasOnselect = (0, _element.useCallback)(block => {
|
|
56
|
+
if (block.name === 'core/navigation-link' && !block.attributes.url) {
|
|
57
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
58
|
+
|
|
59
|
+
replaceBlock(block.clientId, (0, _blocks.createBlock)('core/navigation-link', block.attributes));
|
|
60
|
+
} else {
|
|
61
|
+
onSelect(block);
|
|
62
|
+
}
|
|
63
|
+
}, [onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock]); // The hidden block is needed because it makes block edit side effects trigger.
|
|
64
|
+
// For example a navigation page list load its items has an effect on edit to load its items.
|
|
65
|
+
|
|
66
|
+
return (0, _element.createElement)(_element.Fragment, null, isLoading && (0, _element.createElement)(_loader.NavigationMenuLoader, null), !isLoading && (0, _element.createElement)(OffCanvasEditor, {
|
|
67
|
+
blocks: clientIdsTree,
|
|
68
|
+
onSelect: offCanvasOnselect,
|
|
69
|
+
LeafMoreMenu: LeafMoreMenu,
|
|
70
|
+
showAppender: false
|
|
71
|
+
}), (0, _element.createElement)("div", {
|
|
72
|
+
style: {
|
|
73
|
+
visibility: 'hidden'
|
|
74
|
+
}
|
|
75
|
+
}, (0, _element.createElement)(_blockEditor.BlockTools, null, (0, _element.createElement)(_blockEditor.BlockList, null))));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=navigation-menu-content.js.map
|
package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js"],"names":["NavigationMenuContent","rootClientId","onSelect","clientIdsTree","isLoading","select","__unstableGetClientIdsTree","areInnerBlocksControlled","blockEditorStore","replaceBlock","__unstableMarkNextChangeAsNotPersistent","OffCanvasEditor","LeafMoreMenu","blockEditorPrivateApis","offCanvasOnselect","block","name","attributes","url","clientId","visibility"],"mappings":";;;;;;;AAWA;;AARA;;AAMA;;AACA;;AAMA;;AACA;;AAjBA;AACA;AACA;;AAWA;AACA;AACA;AAIe,SAASA,qBAAT,OAA6D;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;AA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E;AAAd;AAAb,KACC,4BAAC,uBAAD,QACC,4BAAC,sBAAD,OADD,CADD,CAVD,CADD;AAkBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\tBlockList,\n\tBlockTools,\n} from '@wordpress/block-editor';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { createBlock } from '@wordpress/blocks';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { NavigationMenuLoader } from './loader';\n\nexport default function NavigationMenuContent( { rootClientId, onSelect } ) {\n\tconst { clientIdsTree, isLoading } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { __unstableGetClientIdsTree, areInnerBlocksControlled } =\n\t\t\t\tselect( blockEditorStore );\n\t\t\treturn {\n\t\t\t\tclientIdsTree: __unstableGetClientIdsTree( rootClientId ),\n\n\t\t\t\t// This is a small hack to wait for the navigation block\n\t\t\t\t// to actually load its inner blocks.\n\t\t\t\tisLoading: ! areInnerBlocksControlled( rootClientId ),\n\t\t\t};\n\t\t},\n\t\t[ rootClientId ]\n\t);\n\tconst { replaceBlock, __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\n\tconst { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );\n\n\tconst offCanvasOnselect = useCallback(\n\t\t( block ) => {\n\t\t\tif (\n\t\t\t\tblock.name === 'core/navigation-link' &&\n\t\t\t\t! block.attributes.url\n\t\t\t) {\n\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\treplaceBlock(\n\t\t\t\t\tblock.clientId,\n\t\t\t\t\tcreateBlock( 'core/navigation-link', block.attributes )\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\tonSelect( block );\n\t\t\t}\n\t\t},\n\t\t[ onSelect, __unstableMarkNextChangeAsNotPersistent, replaceBlock ]\n\t);\n\n\t// The hidden block is needed because it makes block edit side effects trigger.\n\t// For example a navigation page list load its items has an effect on edit to load its items.\n\treturn (\n\t\t<>\n\t\t\t{ isLoading && <NavigationMenuLoader /> }\n\t\t\t{ ! isLoading && (\n\t\t\t\t<OffCanvasEditor\n\t\t\t\t\tblocks={ clientIdsTree }\n\t\t\t\t\tonSelect={ offCanvasOnselect }\n\t\t\t\t\tLeafMoreMenu={ LeafMoreMenu }\n\t\t\t\t\tshowAppender={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t<div style={ { visibility: 'hidden' } }>\n\t\t\t\t<BlockTools>\n\t\t\t\t\t<BlockList />\n\t\t\t\t</BlockTools>\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -13,8 +13,12 @@ var _i18n = require("@wordpress/i18n");
|
|
|
13
13
|
|
|
14
14
|
var _data = require("@wordpress/data");
|
|
15
15
|
|
|
16
|
+
var _icons = require("@wordpress/icons");
|
|
17
|
+
|
|
16
18
|
var _components = require("@wordpress/components");
|
|
17
19
|
|
|
20
|
+
var _coreData = require("@wordpress/core-data");
|
|
21
|
+
|
|
18
22
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
19
23
|
|
|
20
24
|
var _useEditedEntityRecord = _interopRequireDefault(require("../use-edited-entity-record"));
|
|
@@ -23,6 +27,10 @@ var _privateApis = require("../../private-apis");
|
|
|
23
27
|
|
|
24
28
|
var _store = require("../../store");
|
|
25
29
|
|
|
30
|
+
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
31
|
+
|
|
32
|
+
var _addedBy = require("../list/added-by");
|
|
33
|
+
|
|
26
34
|
/**
|
|
27
35
|
* WordPress dependencies
|
|
28
36
|
*/
|
|
@@ -30,41 +38,72 @@ var _store = require("../../store");
|
|
|
30
38
|
/**
|
|
31
39
|
* Internal dependencies
|
|
32
40
|
*/
|
|
33
|
-
|
|
34
|
-
wp_template: {
|
|
35
|
-
path: '/templates/single'
|
|
36
|
-
},
|
|
37
|
-
wp_template_part: {
|
|
38
|
-
path: '/template-parts/single'
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
function SidebarNavigationScreenTemplate(_ref) {
|
|
43
|
-
let {
|
|
44
|
-
postType = 'wp_template'
|
|
45
|
-
} = _ref;
|
|
46
|
-
const {
|
|
47
|
-
setCanvasMode
|
|
48
|
-
} = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
|
|
41
|
+
function useTemplateTitleAndDescription(postType, postId) {
|
|
49
42
|
const {
|
|
50
43
|
getDescription,
|
|
51
44
|
getTitle,
|
|
52
45
|
record
|
|
53
|
-
} = (0, _useEditedEntityRecord.default)();
|
|
54
|
-
|
|
46
|
+
} = (0, _useEditedEntityRecord.default)(postType, postId);
|
|
47
|
+
const currentTheme = (0, _data.useSelect)(select => select(_coreData.store).getCurrentTheme(), []);
|
|
48
|
+
const addedBy = (0, _addedBy.useAddedBy)(postType, postId);
|
|
49
|
+
const isAddedByActiveTheme = addedBy.type === 'theme' && record.theme === (currentTheme === null || currentTheme === void 0 ? void 0 : currentTheme.stylesheet);
|
|
50
|
+
const title = getTitle();
|
|
51
|
+
let descriptionText = getDescription();
|
|
55
52
|
|
|
56
|
-
if (!
|
|
57
|
-
|
|
53
|
+
if (!descriptionText && addedBy.text) {
|
|
54
|
+
if (record.type === 'wp_template' && record.is_custom) {
|
|
55
|
+
descriptionText = (0, _i18n.__)('This is a custom template that can be applied manually to any Post or Page.');
|
|
56
|
+
} else if (record.type === 'wp_template_part') {
|
|
57
|
+
descriptionText = (0, _i18n.sprintf)( // translators: %s: template part title e.g: "Header".
|
|
58
|
+
(0, _i18n.__)('This is your %s template part.'), getTitle());
|
|
59
|
+
}
|
|
58
60
|
}
|
|
59
61
|
|
|
62
|
+
const description = (0, _element.createElement)(_element.Fragment, null, descriptionText, addedBy.text && !isAddedByActiveTheme && (0, _element.createElement)("span", {
|
|
63
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description"
|
|
64
|
+
}, (0, _element.createElement)("span", {
|
|
65
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description-author"
|
|
66
|
+
}, (0, _element.createElement)("span", {
|
|
67
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description-author-icon"
|
|
68
|
+
}, addedBy.imageUrl ? (0, _element.createElement)("img", {
|
|
69
|
+
src: addedBy.imageUrl,
|
|
70
|
+
alt: "",
|
|
71
|
+
width: "24",
|
|
72
|
+
height: "24"
|
|
73
|
+
}) : (0, _element.createElement)(_components.Icon, {
|
|
74
|
+
icon: addedBy.icon
|
|
75
|
+
})), addedBy.text), addedBy.isCustomized && (0, _element.createElement)("span", {
|
|
76
|
+
className: "edit-site-sidebar-navigation-screen-template__added-by-description-customized"
|
|
77
|
+
}, postType === 'wp_template' ? (0, _i18n._x)('(Customized)', 'template') : (0, _i18n._x)('(Customized)', 'template part'))));
|
|
78
|
+
return {
|
|
79
|
+
title,
|
|
80
|
+
description
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function SidebarNavigationScreenTemplate() {
|
|
85
|
+
const {
|
|
86
|
+
params
|
|
87
|
+
} = (0, _components.__experimentalUseNavigator)();
|
|
88
|
+
const {
|
|
89
|
+
postType,
|
|
90
|
+
postId
|
|
91
|
+
} = params;
|
|
92
|
+
const {
|
|
93
|
+
setCanvasMode
|
|
94
|
+
} = (0, _privateApis.unlock)((0, _data.useDispatch)(_store.store));
|
|
95
|
+
const {
|
|
96
|
+
title,
|
|
97
|
+
description
|
|
98
|
+
} = useTemplateTitleAndDescription(postType, postId);
|
|
60
99
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
|
|
100
|
+
title: title,
|
|
101
|
+
actions: (0, _element.createElement)(_sidebarButton.default, {
|
|
102
|
+
onClick: () => setCanvasMode('edit'),
|
|
103
|
+
label: (0, _i18n.__)('Edit'),
|
|
104
|
+
icon: _icons.pencil
|
|
105
|
+
}),
|
|
106
|
+
description: description
|
|
68
107
|
});
|
|
69
108
|
}
|
|
70
109
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["useTemplateTitleAndDescription","postType","postId","getDescription","getTitle","record","currentTheme","select","coreStore","getCurrentTheme","addedBy","isAddedByActiveTheme","type","theme","stylesheet","title","descriptionText","text","is_custom","description","imageUrl","icon","isCustomized","SidebarNavigationScreenTemplate","params","setCanvasMode","editSiteStore","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AACA;;AACA;;AAIA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AApBA;AACA;AACA;;AAUA;AACA;AACA;AAQA,SAASA,8BAAT,CAAyCC,QAAzC,EAAmDC,MAAnD,EAA4D;AAC3D,QAAM;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuC,oCAC5CJ,QAD4C,EAE5CC,MAF4C,CAA7C;AAIA,QAAMI,YAAY,GAAG,qBAClBC,MAAF,IAAcA,MAAM,CAAEC,eAAF,CAAN,CAAoBC,eAApB,EADM,EAEpB,EAFoB,CAArB;AAIA,QAAMC,OAAO,GAAG,yBAAYT,QAAZ,EAAsBC,MAAtB,CAAhB;AACA,QAAMS,oBAAoB,GACzBD,OAAO,CAACE,IAAR,KAAiB,OAAjB,IAA4BP,MAAM,CAACQ,KAAP,MAAiBP,YAAjB,aAAiBA,YAAjB,uBAAiBA,YAAY,CAAEQ,UAA/B,CAD7B;AAEA,QAAMC,KAAK,GAAGX,QAAQ,EAAtB;AACA,MAAIY,eAAe,GAAGb,cAAc,EAApC;;AAEA,MAAK,CAAEa,eAAF,IAAqBN,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YAAb,CAAR,CAA1B;AACA,QAAM;AAAEX,IAAAA,KAAF;AAASI,IAAAA;AAAT,MAAyBnB,8BAA8B,CAC5DC,QAD4D,EAE5DC,MAF4D,CAA7D;AAKA,SACC,4BAAC,gCAAD;AACC,IAAA,KAAK,EAAGa,KADT;AAEC,IAAA,OAAO,EACN,4BAAC,sBAAD;AACC,MAAA,OAAO,EAAG,MAAMU,aAAa,CAAE,MAAF,CAD9B;AAEC,MAAA,KAAK,EAAG,cAAI,MAAJ,CAFT;AAGC,MAAA,IAAI,EAAGE;AAHR,MAHF;AASC,IAAA,WAAW,EAAGR;AATf,IADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf, _x } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { pencil } from '@wordpress/icons';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tIcon,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport { useAddedBy } from '../list/added-by';\n\nfunction useTemplateTitleAndDescription( postType, postId ) {\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord(\n\t\tpostType,\n\t\tpostId\n\t);\n\tconst currentTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme(),\n\t\t[]\n\t);\n\tconst addedBy = useAddedBy( postType, postId );\n\tconst isAddedByActiveTheme =\n\t\taddedBy.type === 'theme' && record.theme === currentTheme?.stylesheet;\n\tconst title = getTitle();\n\tlet descriptionText = getDescription();\n\n\tif ( ! descriptionText && addedBy.text ) {\n\t\tif ( record.type === 'wp_template' && record.is_custom ) {\n\t\t\tdescriptionText = __(\n\t\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t\t);\n\t\t} else if ( record.type === 'wp_template_part' ) {\n\t\t\tdescriptionText = sprintf(\n\t\t\t\t// translators: %s: template part title e.g: \"Header\".\n\t\t\t\t__( 'This is your %s template part.' ),\n\t\t\t\tgetTitle()\n\t\t\t);\n\t\t}\n\t}\n\n\tconst description = (\n\t\t<>\n\t\t\t{ descriptionText }\n\n\t\t\t{ addedBy.text && ! isAddedByActiveTheme && (\n\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description\">\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author\">\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-author-icon\">\n\t\t\t\t\t\t\t{ addedBy.imageUrl ? (\n\t\t\t\t\t\t\t\t<img\n\t\t\t\t\t\t\t\t\tsrc={ addedBy.imageUrl }\n\t\t\t\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t\t\t\t\twidth=\"24\"\n\t\t\t\t\t\t\t\t\theight=\"24\"\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<Icon icon={ addedBy.icon } />\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{ addedBy.text }\n\t\t\t\t\t</span>\n\n\t\t\t\t\t{ addedBy.isCustomized && (\n\t\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-template__added-by-description-customized\">\n\t\t\t\t\t\t\t{ postType === 'wp_template'\n\t\t\t\t\t\t\t\t? _x( '(Customized)', 'template' )\n\t\t\t\t\t\t\t\t: _x( '(Customized)', 'template part' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t) }\n\t\t\t\t</span>\n\t\t\t) }\n\t\t</>\n\t);\n\n\treturn { title, description };\n}\n\nexport default function SidebarNavigationScreenTemplate() {\n\tconst { params } = useNavigator();\n\tconst { postType, postId } = params;\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { title, description } = useTemplateTitleAndDescription(\n\t\tpostType,\n\t\tpostId\n\t);\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\ttitle={ title }\n\t\t\tactions={\n\t\t\t\t<SidebarButton\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t\tlabel={ __( 'Edit' ) }\n\t\t\t\t\ticon={ pencil }\n\t\t\t\t/>\n\t\t\t}\n\t\t\tdescription={ description }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -17,6 +17,8 @@ var _i18n = require("@wordpress/i18n");
|
|
|
17
17
|
|
|
18
18
|
var _coreData = require("@wordpress/core-data");
|
|
19
19
|
|
|
20
|
+
var _data = require("@wordpress/data");
|
|
21
|
+
|
|
20
22
|
var _htmlEntities = require("@wordpress/html-entities");
|
|
21
23
|
|
|
22
24
|
var _compose = require("@wordpress/compose");
|
|
@@ -29,6 +31,10 @@ var _sidebarNavigationItem = _interopRequireDefault(require("../sidebar-navigati
|
|
|
29
31
|
|
|
30
32
|
var _addNewTemplate = _interopRequireDefault(require("../add-new-template"));
|
|
31
33
|
|
|
34
|
+
var _store = require("../../store");
|
|
35
|
+
|
|
36
|
+
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* WordPress dependencies
|
|
34
40
|
*/
|
|
@@ -38,21 +44,21 @@ var _addNewTemplate = _interopRequireDefault(require("../add-new-template"));
|
|
|
38
44
|
*/
|
|
39
45
|
const config = {
|
|
40
46
|
wp_template: {
|
|
41
|
-
path: '/templates',
|
|
42
47
|
labels: {
|
|
43
48
|
title: (0, _i18n.__)('Templates'),
|
|
44
49
|
loading: (0, _i18n.__)('Loading templates'),
|
|
45
50
|
notFound: (0, _i18n.__)('No templates found'),
|
|
46
|
-
manage: (0, _i18n.__)('Manage all templates')
|
|
51
|
+
manage: (0, _i18n.__)('Manage all templates'),
|
|
52
|
+
description: (0, _i18n.__)('Express the layout of your site with templates.')
|
|
47
53
|
}
|
|
48
54
|
},
|
|
49
55
|
wp_template_part: {
|
|
50
|
-
path: '/template-parts',
|
|
51
56
|
labels: {
|
|
52
57
|
title: (0, _i18n.__)('Template parts'),
|
|
53
58
|
loading: (0, _i18n.__)('Loading template parts'),
|
|
54
59
|
notFound: (0, _i18n.__)('No template parts found'),
|
|
55
|
-
manage: (0, _i18n.__)('Manage all template parts')
|
|
60
|
+
manage: (0, _i18n.__)('Manage all template parts'),
|
|
61
|
+
description: (0, _i18n.__)('Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.')
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
};
|
|
@@ -65,38 +71,45 @@ const TemplateItem = _ref => {
|
|
|
65
71
|
} = _ref;
|
|
66
72
|
const linkInfo = (0, _link.useLink)({
|
|
67
73
|
postType,
|
|
68
|
-
postId
|
|
69
|
-
path: config[postType].path + '/single'
|
|
74
|
+
postId
|
|
70
75
|
});
|
|
71
76
|
return (0, _element.createElement)(_sidebarNavigationItem.default, (0, _extends2.default)({}, linkInfo, props));
|
|
72
77
|
};
|
|
73
78
|
|
|
74
|
-
function SidebarNavigationScreenTemplates(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
function SidebarNavigationScreenTemplates() {
|
|
80
|
+
const {
|
|
81
|
+
params: {
|
|
82
|
+
postType
|
|
83
|
+
}
|
|
84
|
+
} = (0, _components.__experimentalUseNavigator)();
|
|
78
85
|
const isMobileViewport = (0, _compose.useViewportMatch)('medium', '<');
|
|
86
|
+
const isTemplatePartsMode = (0, _data.useSelect)(select => {
|
|
87
|
+
const settings = select(_store.store).getSettings();
|
|
88
|
+
return !!settings.supportsTemplatePartsMode;
|
|
89
|
+
}, []);
|
|
79
90
|
const {
|
|
80
91
|
records: templates,
|
|
81
92
|
isResolving: isLoading
|
|
82
93
|
} = (0, _coreData.useEntityRecords)('postType', postType, {
|
|
83
94
|
per_page: -1
|
|
84
95
|
});
|
|
96
|
+
const sortedTemplates = templates ? [...templates] : [];
|
|
97
|
+
sortedTemplates.sort((a, b) => a.slug.localeCompare(b.slug));
|
|
85
98
|
const browseAllLink = (0, _link.useLink)({
|
|
86
|
-
postType
|
|
87
|
-
postId: undefined,
|
|
88
|
-
path: config[postType].path + '/all'
|
|
99
|
+
path: '/' + postType + '/all'
|
|
89
100
|
});
|
|
101
|
+
const canCreate = !isMobileViewport && !isTemplatePartsMode;
|
|
90
102
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
91
|
-
|
|
103
|
+
isRoot: isTemplatePartsMode,
|
|
92
104
|
title: config[postType].labels.title,
|
|
93
|
-
|
|
105
|
+
description: config[postType].labels.description,
|
|
106
|
+
actions: canCreate && (0, _element.createElement)(_addNewTemplate.default, {
|
|
94
107
|
templateType: postType,
|
|
95
108
|
toggleProps: {
|
|
96
|
-
|
|
109
|
+
as: _sidebarButton.default
|
|
97
110
|
}
|
|
98
111
|
}),
|
|
99
|
-
content: (0, _element.createElement)(_element.Fragment, null, isLoading && config[postType].labels.loading, !isLoading && (0, _element.createElement)(_components.__experimentalItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && (0, _element.createElement)(_components.__experimentalItem, null, config[postType].labels.notFound),
|
|
112
|
+
content: (0, _element.createElement)(_element.Fragment, null, isLoading && config[postType].labels.loading, !isLoading && (0, _element.createElement)(_components.__experimentalItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && (0, _element.createElement)(_components.__experimentalItem, null, config[postType].labels.notFound), sortedTemplates.map(template => {
|
|
100
113
|
var _template$title;
|
|
101
114
|
|
|
102
115
|
return (0, _element.createElement)(TemplateItem, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["config","wp_template","labels","title","loading","notFound","manage","description","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","params","isMobileViewport","isTemplatePartsMode","select","settings","editSiteStore","getSettings","supportsTemplatePartsMode","records","templates","isResolving","isLoading","per_page","sortedTemplates","sort","a","b","slug","localeCompare","browseAllLink","path","canCreate","as","SidebarButton","length","map","template","id","rendered"],"mappings":";;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAtBA;AACA;AACA;;AAYA;AACA;AACA;AAQA,MAAMA,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,cAAI,WAAJ,CADA;AAEPC,MAAAA,OAAO,EAAE,cAAI,mBAAJ,CAFF;AAGPC,MAAAA,QAAQ,EAAE,cAAI,oBAAJ,CAHH;AAIPC,MAAAA,MAAM,EAAE,cAAI,sBAAJ,CAJD;AAKPC,MAAAA,WAAW,EAAE,cACZ,iDADY;AALN;AADI,GADC;AAYdC,EAAAA,gBAAgB,EAAE;AACjBN,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,cAAI,gBAAJ,CADA;AAEPC,MAAAA,OAAO,EAAE,cAAI,wBAAJ,CAFF;AAGPC,MAAAA,QAAQ,EAAE,cAAI,yBAAJ,CAHH;AAIPC,MAAAA,MAAM,EAAE,cAAI,2BAAJ,CAJD;AAKPC,MAAAA,WAAW,EAAE,cACZ,6LADY;AALN;AADS;AAZJ,CAAf;;AAyBA,MAAME,YAAY,GAAG,QAAsC;AAAA,MAApC;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,MAAZ;AAAoB,OAAGC;AAAvB,GAAoC;AAC1D,QAAMC,QAAQ,GAAG,mBAAS;AACzBH,IAAAA,QADyB;AAEzBC,IAAAA;AAFyB,GAAT,CAAjB;AAIA,SAAO,4BAAC,8BAAD,6BAA4BE,QAA5B,EAA4CD,KAA5C,EAAP;AACA,CA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G1B,QADhB;AAEC,MAAA,WAAW,EAAG;AACb2B,QAAAA,EAAE,EAAEC;AADS;AAFf,MANH;AAcC,IAAA,OAAO,EACN,qDACGZ,SAAS,IAAI1B,MAAM,CAAEU,QAAF,CAAN,CAAmBR,MAAnB,CAA0BE,OAD1C,EAEG,CAAEsB,SAAF,IACD,4BAAC,mCAAD,QACG,EAAEF,SAAF,aAAEA,SAAF,eAAEA,SAAS,CAAEe,MAAb,KACD,4BAAC,8BAAD,QACGvC,MAAM,CAAEU,QAAF,CAAN,CAAmBR,MAAnB,CAA0BG,QAD7B,CAFF,EAMGuB,eAAe,CAACY,GAAhB,CAAuBC,QAAF;AAAA;;AAAA,aACtB,4BAAC,YAAD;AACC,QAAA,QAAQ,EAAG/B,QADZ;AAEC,QAAA,MAAM,EAAG+B,QAAQ,CAACC,EAFnB;AAGC,QAAA,GAAG,EAAGD,QAAQ,CAACC;AAHhB,SAKG,kCACD,oBAAAD,QAAQ,CAACtC,KAAT,oEAAgBwC,QAAhB,KACCF,QAAQ,CAACT,IAFT,CALH,CADsB;AAAA,KAArB,CANH,EAkBG,CAAEhB,gBAAF,IACD,4BAAC,8BAAD;AACC,MAAA,SAAS,EAAC;AADX,OAEMkB,aAFN;AAGC,MAAA,QAAQ,EACPlC,MAAM,CAAEU,QAAF,CAAN,CAAmBR,MAAnB,CAA0BI;AAJ5B,OAnBF,CAHF;AAfF,IADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\n\nconst config = {\n\twp_template: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t\tdescription: __(\n\t\t\t\t'Express the layout of your site with templates.'\n\t\t\t),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t\tdescription: __(\n\t\t\t\t'Template Parts are small pieces of a layout that can be reused across multiple templates and always appear the same way. Common template parts include the site header, footer, or sidebar.'\n\t\t\t),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates() {\n\tconst {\n\t\tparams: { postType },\n\t} = useNavigator();\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst isTemplatePartsMode = useSelect( ( select ) => {\n\t\tconst settings = select( editSiteStore ).getSettings();\n\n\t\treturn !! settings.supportsTemplatePartsMode;\n\t}, [] );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\tconst sortedTemplates = templates ? [ ...templates ] : [];\n\tsortedTemplates.sort( ( a, b ) => a.slug.localeCompare( b.slug ) );\n\n\tconst browseAllLink = useLink( {\n\t\tpath: '/' + postType + '/all',\n\t} );\n\n\tconst canCreate = ! isMobileViewport && ! isTemplatePartsMode;\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot={ isTemplatePartsMode }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tdescription={ config[ postType ].labels.description }\n\t\t\tactions={\n\t\t\t\tcanCreate && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tas: SidebarButton,\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ sortedTemplates.map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -11,6 +11,8 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _i18n = require("@wordpress/i18n");
|
|
13
13
|
|
|
14
|
+
var _components = require("@wordpress/components");
|
|
15
|
+
|
|
14
16
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
15
17
|
|
|
16
18
|
/**
|
|
@@ -22,22 +24,24 @@ var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-naviga
|
|
|
22
24
|
*/
|
|
23
25
|
const config = {
|
|
24
26
|
wp_template: {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
title: (0, _i18n.__)('All templates'),
|
|
28
|
+
description: (0, _i18n.__)('Create new templates, or reset any customizations made to the templates supplied by your theme.')
|
|
27
29
|
},
|
|
28
30
|
wp_template_part: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
title: (0, _i18n.__)('All template parts'),
|
|
32
|
+
description: (0, _i18n.__)('Create new template parts, or reset any customizations made to the template parts supplied by your theme.')
|
|
31
33
|
}
|
|
32
34
|
};
|
|
33
35
|
|
|
34
|
-
function SidebarNavigationScreenTemplatesBrowse(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
function SidebarNavigationScreenTemplatesBrowse() {
|
|
37
|
+
const {
|
|
38
|
+
params: {
|
|
39
|
+
postType
|
|
40
|
+
}
|
|
41
|
+
} = (0, _components.__experimentalUseNavigator)();
|
|
38
42
|
return (0, _element.createElement)(_sidebarNavigationScreen.default, {
|
|
39
|
-
|
|
40
|
-
|
|
43
|
+
title: config[postType].title,
|
|
44
|
+
description: config[postType].description
|
|
41
45
|
});
|
|
42
46
|
}
|
|
43
47
|
//# sourceMappingURL=index.js.map
|