@wordpress/edit-site 5.13.0 → 5.14.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 +2 -0
- package/build/components/add-new-page/index.js +1 -7
- package/build/components/add-new-page/index.js.map +1 -1
- package/build/components/add-new-pattern/index.js +11 -11
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js +2 -2
- package/build/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build/components/add-new-template/new-template.js +69 -14
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +1 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/inserter-media-categories.js +1 -22
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/block-editor/site-editor-canvas.js +29 -32
- package/build/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +9 -12
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/canvas-spinner/index.js +1 -18
- package/build/components/canvas-spinner/index.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +9 -9
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +1 -1
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +11 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/palette.js +1 -1
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +9 -1
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +41 -10
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +47 -17
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +32 -1
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +9 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +103 -26
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page/header.js +1 -1
- package/build/components/page/header.js.map +1 -1
- package/build/components/page/index.js +3 -1
- package/build/components/page/index.js.map +1 -1
- package/build/components/page-actions/delete-page-menu-item.js +2 -1
- package/build/components/page-actions/delete-page-menu-item.js.map +1 -1
- package/build/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build/components/page-main/index.js +8 -4
- package/build/components/page-main/index.js.map +1 -1
- package/build/components/{page-library → page-patterns}/grid-item.js +61 -33
- package/build/components/page-patterns/grid-item.js.map +1 -0
- package/build/components/{page-library → page-patterns}/grid.js +1 -1
- package/build/components/page-patterns/grid.js.map +1 -0
- package/build/components/{page-library → page-patterns}/index.js +6 -6
- package/build/components/page-patterns/index.js.map +1 -0
- package/build/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build/components/page-patterns/no-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/patterns-list.js +9 -7
- package/build/components/page-patterns/patterns-list.js.map +1 -0
- package/build/components/page-patterns/search-items.js.map +1 -0
- package/build/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +3 -3
- package/build/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build/components/{page-library → page-patterns}/use-patterns.js +12 -2
- package/build/components/page-patterns/use-patterns.js.map +1 -0
- package/build/components/{page-library → page-patterns}/utils.js +3 -3
- package/build/components/page-patterns/utils.js.map +1 -0
- package/build/components/page-template-parts/index.js +103 -0
- package/build/components/page-template-parts/index.js.map +1 -0
- package/build/components/page-templates/index.js +1 -0
- package/build/components/page-templates/index.js.map +1 -1
- package/build/components/preferences-modal/enable-feature.js +5 -1
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/index.js +43 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar/index.js +6 -6
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +4 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js +7 -1
- package/build/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +7 -3
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +69 -5
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +2 -2
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +7 -16
- package/build/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -11
- package/build/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +6 -6
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +10 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +9 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +29 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +27 -4
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/page-details.js +11 -4
- package/build/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/index.js +13 -8
- package/build/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js +23 -0
- package/build/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +55 -15
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js +30 -0
- package/build/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -20
- package/build/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +11 -63
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/site-hub/index.js +1 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-actions/index.js +22 -6
- package/build/components/template-actions/index.js.map +1 -1
- package/build/components/welcome-guide/editor.js +1 -1
- package/build/components/welcome-guide/editor.js.map +1 -1
- package/build/components/welcome-guide/index.js +5 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/page.js +70 -0
- package/build/components/welcome-guide/page.js.map +1 -0
- package/build/components/welcome-guide/styles.js +1 -1
- package/build/components/welcome-guide/styles.js.map +1 -1
- package/build/components/welcome-guide/template.js +71 -0
- package/build/components/welcome-guide/template.js.map +1 -0
- package/build/hooks/commands/use-common-commands.js +37 -0
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +195 -44
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +9 -0
- package/build/index.js.map +1 -1
- package/build/store/actions.js +5 -2
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +2 -1
- package/build/store/selectors.js.map +1 -1
- package/build/utils/get-is-list-page.js +2 -2
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build/utils/template-part-create.js +2 -2
- package/build/utils/template-part-create.js.map +1 -1
- package/build-module/components/add-new-page/index.js +1 -6
- package/build-module/components/add-new-page/index.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +11 -11
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +72 -17
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +1 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +1 -22
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/block-editor/site-editor-canvas.js +29 -32
- package/build-module/components/block-editor/site-editor-canvas.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +9 -12
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/canvas-spinner/index.js +1 -15
- package/build-module/components/canvas-spinner/index.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +9 -9
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -1
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +11 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/palette.js +1 -1
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/ui.js +8 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -2
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +43 -12
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +44 -20
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +29 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +9 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +103 -26
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page/header.js +1 -1
- package/build-module/components/page/header.js.map +1 -1
- package/build-module/components/page/index.js +2 -1
- package/build-module/components/page/index.js.map +1 -1
- package/build-module/components/page-actions/delete-page-menu-item.js +2 -1
- package/build-module/components/page-actions/delete-page-menu-item.js.map +1 -1
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build-module/components/page-main/index.js +6 -3
- package/build-module/components/page-main/index.js.map +1 -1
- package/build-module/components/{page-library → page-patterns}/grid-item.js +65 -35
- package/build-module/components/page-patterns/grid-item.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/grid.js +1 -1
- package/build-module/components/page-patterns/grid.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/build-module/components/page-patterns/no-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/patterns-list.js +9 -7
- package/build-module/components/page-patterns/patterns-list.js.map +1 -0
- package/build-module/components/page-patterns/search-items.js.map +1 -0
- package/build-module/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +2 -2
- package/build-module/components/page-patterns/use-pattern-settings.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/use-patterns.js +12 -2
- package/build-module/components/page-patterns/use-patterns.js.map +1 -0
- package/build-module/components/{page-library → page-patterns}/utils.js +3 -3
- package/build-module/components/page-patterns/utils.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +82 -0
- package/build-module/components/page-template-parts/index.js.map +1 -0
- package/build-module/components/page-templates/index.js +1 -0
- package/build-module/components/page-templates/index.js.map +1 -1
- package/build-module/components/preferences-modal/enable-feature.js +5 -1
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +38 -5
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +5 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -2
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js +6 -1
- package/build-module/components/sidebar-edit-mode/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +7 -3
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +67 -5
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +8 -17
- package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js +10 -9
- package/build-module/components/sidebar-navigation-screen-navigation-menu/edit-button.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +5 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +11 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +8 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +20 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +26 -6
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/page-details.js +11 -4
- package/build-module/components/sidebar-navigation-screen-page/page-details.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/build-module/components/sidebar-navigation-screen-page/status-label.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/index.js +12 -7
- package/build-module/components/sidebar-navigation-screen-pattern/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js +21 -0
- package/build-module/components/sidebar-navigation-screen-pattern/use-pattern-details.js.map +1 -1
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +54 -16
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-default-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js +20 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-my-patterns.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +2 -17
- package/build-module/components/sidebar-navigation-screen-patterns/use-pattern-categories.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-patterns/use-template-part-areas.js.map +1 -0
- package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/use-theme-patterns.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +12 -62
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +4 -2
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +1 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-actions/index.js +24 -7
- package/build-module/components/template-actions/index.js.map +1 -1
- package/build-module/components/welcome-guide/editor.js +1 -1
- package/build-module/components/welcome-guide/editor.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/page.js +59 -0
- package/build-module/components/welcome-guide/page.js.map +1 -0
- package/build-module/components/welcome-guide/styles.js +1 -1
- package/build-module/components/welcome-guide/styles.js.map +1 -1
- package/build-module/components/welcome-guide/template.js +60 -0
- package/build-module/components/welcome-guide/template.js.map +1 -0
- package/build-module/hooks/commands/use-common-commands.js +37 -1
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +193 -46
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +5 -2
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +2 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +2 -2
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-module/utils/template-part-create.js +1 -1
- package/build-module/utils/template-part-create.js.map +1 -1
- package/build-style/style-rtl.css +167 -51
- package/build-style/style.css +167 -51
- package/package.json +39 -39
- package/src/components/add-new-page/index.js +1 -6
- package/src/components/add-new-pattern/index.js +11 -13
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +1 -1
- package/src/components/add-new-template/new-template.js +120 -24
- package/src/components/add-new-template/style.scss +30 -2
- package/src/components/block-editor/editor-canvas.js +3 -1
- package/src/components/block-editor/inserter-media-categories.js +1 -21
- package/src/components/block-editor/site-editor-canvas.js +7 -1
- package/src/components/block-editor/use-site-editor-settings.js +8 -12
- package/src/components/canvas-spinner/index.js +1 -11
- package/src/components/canvas-spinner/style.scss +4 -0
- package/src/components/create-pattern-modal/index.js +11 -12
- package/src/components/create-template-part-modal/index.js +1 -1
- package/src/components/editor/index.js +16 -1
- package/src/components/editor/style.scss +4 -0
- package/src/components/global-styles/palette.js +10 -9
- package/src/components/global-styles/stories/index.js +1 -0
- package/src/components/global-styles/ui.js +34 -24
- package/src/components/header-edit-mode/document-actions/index.js +9 -1
- package/src/components/header-edit-mode/document-actions/style.scss +8 -0
- package/src/components/header-edit-mode/index.js +112 -62
- package/src/components/header-edit-mode/more-menu/index.js +74 -30
- package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
- package/src/components/keyboard-shortcuts/edit-mode.js +35 -2
- package/src/components/keyboard-shortcuts/register.js +10 -0
- package/src/components/layout/index.js +140 -76
- package/src/components/layout/style.scss +47 -1
- package/src/components/page/header.js +1 -1
- package/src/components/page/index.js +5 -1
- package/src/components/page-actions/delete-page-menu-item.js +1 -0
- package/src/components/page-content-focus-manager/back-to-page-notification.js +7 -2
- package/src/components/page-main/index.js +6 -3
- package/src/components/{page-library → page-patterns}/grid-item.js +83 -34
- package/src/components/{page-library → page-patterns}/grid.js +1 -1
- package/src/components/{page-library → page-patterns}/index.js +5 -5
- package/src/components/{page-library → page-patterns}/no-patterns.js +1 -1
- package/src/components/{page-library → page-patterns}/patterns-list.js +13 -9
- package/src/components/{page-library → page-patterns}/style.scss +19 -15
- package/src/components/{page-library/use-library-settings.js → page-patterns/use-pattern-settings.js} +1 -1
- package/src/components/{page-library → page-patterns}/use-patterns.js +11 -2
- package/src/components/{page-library → page-patterns}/utils.js +3 -3
- package/src/components/page-template-parts/index.js +105 -0
- package/src/components/page-templates/index.js +1 -1
- package/src/components/preferences-modal/enable-feature.js +5 -2
- package/src/components/preferences-modal/index.js +35 -4
- package/src/components/sidebar/index.js +6 -6
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/index.js +4 -2
- package/src/components/sidebar-edit-mode/settings-header/index.js +7 -2
- package/src/components/sidebar-navigation-item/style.scss +2 -1
- package/src/components/sidebar-navigation-screen/index.js +4 -2
- package/src/components/sidebar-navigation-screen/style.scss +7 -2
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +57 -17
- package/src/components/sidebar-navigation-screen-main/index.js +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js +14 -35
- package/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js +8 -11
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +9 -8
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +12 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +16 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -7
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js +24 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +39 -8
- package/src/components/sidebar-navigation-screen-page/page-details.js +8 -3
- package/src/components/sidebar-navigation-screen-page/status-label.js +1 -1
- package/src/components/sidebar-navigation-screen-pages/index.js +2 -2
- package/src/components/sidebar-navigation-screen-pattern/index.js +13 -6
- package/src/components/sidebar-navigation-screen-pattern/style.scss +29 -0
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-pattern/use-pattern-details.js +43 -1
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/category-item.js +4 -4
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/index.js +75 -22
- package/src/components/sidebar-navigation-screen-patterns/style.scss +3 -0
- package/src/components/sidebar-navigation-screen-patterns/use-my-patterns.js +23 -0
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-pattern-categories.js +1 -18
- package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-theme-patterns.js +1 -1
- package/src/components/sidebar-navigation-screen-template/style.scss +15 -15
- package/src/components/sidebar-navigation-screen-templates/index.js +15 -82
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +2 -0
- package/src/components/site-hub/index.js +1 -1
- package/src/components/site-hub/style.scss +4 -3
- package/src/components/start-template-options/style.scss +0 -3
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +1 -1
- package/src/components/template-actions/index.js +38 -8
- package/src/components/welcome-guide/editor.js +1 -1
- package/src/components/welcome-guide/index.js +4 -0
- package/src/components/welcome-guide/page.js +75 -0
- package/src/components/welcome-guide/style.scss +15 -1
- package/src/components/welcome-guide/styles.js +1 -1
- package/src/components/welcome-guide/template.js +82 -0
- package/src/hooks/commands/use-common-commands.js +32 -1
- package/src/hooks/commands/use-edit-mode-commands.js +182 -38
- package/src/index.js +4 -0
- package/src/store/actions.js +8 -1
- package/src/store/selectors.js +5 -0
- package/src/store/test/selectors.js +2 -0
- package/src/style.scss +3 -2
- package/src/utils/get-is-list-page.js +4 -3
- package/src/utils/template-part-create.js +1 -1
- package/build/components/page-library/grid-item.js.map +0 -1
- package/build/components/page-library/grid.js.map +0 -1
- package/build/components/page-library/index.js.map +0 -1
- package/build/components/page-library/no-patterns.js.map +0 -1
- package/build/components/page-library/patterns-list.js.map +0 -1
- package/build/components/page-library/search-items.js.map +0 -1
- package/build/components/page-library/use-library-settings.js.map +0 -1
- package/build/components/page-library/use-patterns.js.map +0 -1
- package/build/components/page-library/utils.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/build-module/components/page-library/grid-item.js.map +0 -1
- package/build-module/components/page-library/grid.js.map +0 -1
- package/build-module/components/page-library/index.js.map +0 -1
- package/build-module/components/page-library/no-patterns.js.map +0 -1
- package/build-module/components/page-library/patterns-list.js.map +0 -1
- package/build-module/components/page-library/search-items.js.map +0 -1
- package/build-module/components/page-library/use-library-settings.js.map +0 -1
- package/build-module/components/page-library/use-patterns.js.map +0 -1
- package/build-module/components/page-library/utils.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/index.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-default-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-pattern-categories.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-template-part-areas.js.map +0 -1
- package/build-module/components/sidebar-navigation-screen-library/use-theme-patterns.js.map +0 -1
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -7
- /package/build/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
- /package/build-module/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/build-module/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
- /package/src/components/{page-library → page-patterns}/search-items.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-default-pattern-categories.js +0 -0
- /package/src/components/{sidebar-navigation-screen-library → sidebar-navigation-screen-patterns}/use-template-part-areas.js +0 -0
|
@@ -26,6 +26,10 @@ var _blockEditor = require("@wordpress/block-editor");
|
|
|
26
26
|
|
|
27
27
|
var _date = require("@wordpress/date");
|
|
28
28
|
|
|
29
|
+
var _notices = require("@wordpress/notices");
|
|
30
|
+
|
|
31
|
+
var _preferences = require("@wordpress/preferences");
|
|
32
|
+
|
|
29
33
|
var _sidebarNavigationScreen = _interopRequireDefault(require("../sidebar-navigation-screen"));
|
|
30
34
|
|
|
31
35
|
var _styleVariationsContainer = _interopRequireDefault(require("../global-styles/style-variations-container"));
|
|
@@ -58,6 +62,28 @@ function SidebarNavigationItemGlobalStyles(props) {
|
|
|
58
62
|
const {
|
|
59
63
|
setCanvasMode
|
|
60
64
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
65
|
+
const {
|
|
66
|
+
createNotice
|
|
67
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
68
|
+
const {
|
|
69
|
+
set: setPreference
|
|
70
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
71
|
+
const {
|
|
72
|
+
get: getPrefference
|
|
73
|
+
} = (0, _data.useSelect)(_preferences.store);
|
|
74
|
+
const turnOffDistractionFreeMode = (0, _element.useCallback)(() => {
|
|
75
|
+
const isDistractionFree = getPrefference(_store.store.name, 'distractionFree');
|
|
76
|
+
|
|
77
|
+
if (!isDistractionFree) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
setPreference(_store.store.name, 'distractionFree', false);
|
|
82
|
+
createNotice('info', (0, _i18n.__)('Distraction free mode turned off'), {
|
|
83
|
+
isDismissible: true,
|
|
84
|
+
type: 'snackbar'
|
|
85
|
+
});
|
|
86
|
+
}, [createNotice, setPreference, getPrefference]);
|
|
61
87
|
const hasGlobalStyleVariations = (0, _data.useSelect)(select => !!select(_coreData.store).__experimentalGetCurrentThemeGlobalStylesVariations()?.length, []);
|
|
62
88
|
|
|
63
89
|
if (hasGlobalStyleVariations) {
|
|
@@ -69,8 +95,9 @@ function SidebarNavigationItemGlobalStyles(props) {
|
|
|
69
95
|
|
|
70
96
|
return (0, _element.createElement)(_sidebarNavigationItem.default, { ...props,
|
|
71
97
|
onClick: () => {
|
|
72
|
-
//
|
|
73
|
-
|
|
98
|
+
turnOffDistractionFreeMode(); // Switch to edit mode.
|
|
99
|
+
|
|
100
|
+
setCanvasMode('edit'); // Open global styles sidebar.
|
|
74
101
|
|
|
75
102
|
openGeneralSidebar('edit-site/global-styles');
|
|
76
103
|
}
|
|
@@ -165,8 +192,45 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
165
192
|
setCanvasMode,
|
|
166
193
|
setEditorCanvasContainerView
|
|
167
194
|
} = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
|
|
168
|
-
const
|
|
169
|
-
|
|
195
|
+
const {
|
|
196
|
+
createNotice
|
|
197
|
+
} = (0, _data.useDispatch)(_notices.store);
|
|
198
|
+
const {
|
|
199
|
+
set: setPreference
|
|
200
|
+
} = (0, _data.useDispatch)(_preferences.store);
|
|
201
|
+
const {
|
|
202
|
+
get: getPrefference
|
|
203
|
+
} = (0, _data.useSelect)(_preferences.store);
|
|
204
|
+
const {
|
|
205
|
+
isViewMode,
|
|
206
|
+
isStyleBookOpened
|
|
207
|
+
} = (0, _data.useSelect)(select => {
|
|
208
|
+
const {
|
|
209
|
+
getCanvasMode,
|
|
210
|
+
getEditorCanvasContainerView
|
|
211
|
+
} = (0, _lockUnlock.unlock)(select(_store.store));
|
|
212
|
+
return {
|
|
213
|
+
isViewMode: 'view' === getCanvasMode(),
|
|
214
|
+
isStyleBookOpened: 'style-book' === getEditorCanvasContainerView()
|
|
215
|
+
};
|
|
216
|
+
}, []);
|
|
217
|
+
const turnOffDistractionFreeMode = (0, _element.useCallback)(() => {
|
|
218
|
+
const isDistractionFree = getPrefference(_store.store.name, 'distractionFree');
|
|
219
|
+
|
|
220
|
+
if (!isDistractionFree) {
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
setPreference(_store.store.name, 'distractionFree', false);
|
|
225
|
+
createNotice('info', (0, _i18n.__)('Distraction free mode turned off'), {
|
|
226
|
+
isDismissible: true,
|
|
227
|
+
type: 'snackbar'
|
|
228
|
+
});
|
|
229
|
+
}, [createNotice, setPreference, getPrefference]);
|
|
230
|
+
const openGlobalStyles = (0, _element.useCallback)(async () => {
|
|
231
|
+
turnOffDistractionFreeMode();
|
|
232
|
+
return Promise.all([setCanvasMode('edit'), openGeneralSidebar('edit-site/global-styles')]);
|
|
233
|
+
}, [setCanvasMode, openGeneralSidebar, turnOffDistractionFreeMode]);
|
|
170
234
|
const openStyleBook = (0, _element.useCallback)(async () => {
|
|
171
235
|
await openGlobalStyles(); // Open the Style Book once the canvas mode is set to edit,
|
|
172
236
|
// and the global styles sidebar is open. This ensures that
|
|
@@ -200,7 +264,7 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
200
264
|
label: (0, _i18n.__)('Edit styles'),
|
|
201
265
|
onClick: async () => await openGlobalStyles()
|
|
202
266
|
}))
|
|
203
|
-
}), isStyleBookOpened && !isMobileViewport && (0, _element.createElement)(_styleBook.default, {
|
|
267
|
+
}), isStyleBookOpened && !isMobileViewport && isViewMode && (0, _element.createElement)(_styleBook.default, {
|
|
204
268
|
enableResizing: false,
|
|
205
269
|
isSelected: () => false,
|
|
206
270
|
onClick: openStyleBook,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","editSiteStore","setCanvasMode","hasGlobalStyleVariations","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","SidebarNavigationItem","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","SidebarNavigationScreenGlobalStylesFooter","onClickRevisions","revisions","isLoading","revisionsCount","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","hasRevisions","modified","backup","fill","SidebarNavigationScreenGlobalStyles","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isStyleBookOpened","getEditorCanvasContainerView","openGlobalStyles","Promise","all","openStyleBook","openRevisions","seen","edit"],"mappings":";;;;;;;;;;AAgBA;;AAbA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AA5BA;AACA;AACA;;AAgBA;AACA;AACA;AAUA,MAAMA,IAAI,GAAG,MAAM,CAAE,CAArB;;AAEO,SAASC,iCAAT,CAA4CC,KAA5C,EAAoD;AAC1D,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,YAAb,CAA/B;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAoB,wBAAQ,uBAAaD,YAAb,CAAR,CAA1B;AACA,QAAME,wBAAwB,GAAG,qBAC9BC,MAAF,IACC,CAAC,CAAEA,MAAM,CACRC,eADQ,CAAN,CAEDC,mDAFC,IAEsDC,MAJ1B,EAKhC,EALgC,CAAjC;;AAOA,MAAKJ,wBAAL,EAAgC;AAC/B,WACC,4BAAC,yCAAD,OACMJ,KADN;AAEC,MAAA,EAAE,EAAGS,8BAFN;AAGC,MAAA,IAAI,EAAC;AAHN,MADD;AAOA;;AACD,SACC,4BAAC,8BAAD,OACMT,KADN;AAEC,IAAA,OAAO,EAAG,MAAM;AACf;AACAG,MAAAA,aAAa,CAAE,MAAF,CAAb,CAFe,CAGf;;AACAF,MAAAA,kBAAkB,CAAE,yBAAF,CAAlB;AACA;AAPF,IADD;AAWA;;AAED,SAASS,0CAAT,GAAsD;AACrD,QAAM;AAAEC,IAAAA;A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,OAAO,EAAGO,aAHX;AAIC,IAAA,QAAQ,EAAGA,aAJZ;AAKC,IAAA,eAAe,EAAG,KALnB;AAMC,IAAA,QAAQ,EAAG;AANZ,IArCF,CADD;AAiDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { backup, edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\t// switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {\n\tconst { revisions, isLoading } = useGlobalStylesRevisions();\n\tconst { revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\n\tconst hasRevisions = revisionsCount >= 2;\n\tconst modified = revisions?.[ 0 ]?.modified;\n\n\tif ( ! hasRevisions || isLoading || ! modified ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack className=\"edit-site-sidebar-navigation-screen-global-styles__footer\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-global-styles__revisions\"\n\t\t\t\tlabel={ __( 'Revisions' ) }\n\t\t\t\tonClick={ onClickRevisions }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tas=\"span\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-global-styles__revisions__label\">\n\t\t\t\t\t\t{ __( 'Last modified' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</span>\n\t\t\t\t\t<Icon icon={ backup } style={ { fill: 'currentcolor' } } />\n\t\t\t\t</HStack>\n\t\t\t</SidebarNavigationItem>\n\t\t</VStack>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\tconst isStyleBookOpened = useSelect(\n\t\t( select ) =>\n\t\t\t'style-book' ===\n\t\t\tunlock( select( editSiteStore ) ).getEditorCanvasContainerView(),\n\t\t[]\n\t);\n\n\tconst openGlobalStyles = useCallback(\n\t\tasync () =>\n\t\t\tPromise.all( [\n\t\t\t\tsetCanvasMode( 'edit' ),\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t\t] ),\n\t\t[ setCanvasMode, openGeneralSidebar ]\n\t);\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\t<SidebarNavigationScreenGlobalStylesFooter\n\t\t\t\t\t\tonClickRevisions={ openRevisions }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\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\t{ isStyleBookOpened && ! isMobileViewport && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js"],"names":["noop","SidebarNavigationItemGlobalStyles","props","openGeneralSidebar","editSiteStore","setCanvasMode","createNotice","noticesStore","set","setPreference","preferencesStore","get","getPrefference","turnOffDistractionFreeMode","isDistractionFree","name","isDismissible","type","hasGlobalStyleVariations","select","coreStore","__experimentalGetCurrentThemeGlobalStylesVariations","length","SidebarNavigationItem","SidebarNavigationScreenGlobalStylesContent","storedSettings","getSettings","SidebarNavigationScreenGlobalStylesFooter","onClickRevisions","revisions","isLoading","revisionsCount","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","count","hasRevisions","modified","backup","fill","SidebarNavigationScreenGlobalStyles","setIsListViewOpened","isMobileViewport","setEditorCanvasContainerView","isViewMode","isStyleBookOpened","getCanvasMode","getEditorCanvasContainerView","openGlobalStyles","Promise","all","openStyleBook","openRevisions","seen","edit"],"mappings":";;;;;;;;;;AAgBA;;AAbA;;AACA;;AACA;;AACA;;AACA;;AAMA;;AACA;;AACA;;AAEA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA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,EAAGO,aAHX;AAIC,IAAA,QAAQ,EAAGA,aAJZ;AAKC,IAAA,eAAe,EAAG,KALnB;AAMC,IAAA,QAAQ,EAAG;AANZ,IArCF,CADD;AAiDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { backup, edit, seen } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tIcon,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalVStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useViewportMatch } from '@wordpress/compose';\nimport { BlockEditorProvider } from '@wordpress/block-editor';\nimport { humanTimeDiff } from '@wordpress/date';\nimport { useCallback } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport StyleVariationsContainer from '../global-styles/style-variations-container';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarButton from '../sidebar-button';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport StyleBook from '../style-book';\nimport useGlobalStylesRevisions from '../global-styles/screen-revisions/use-global-styles-revisions';\n\nconst noop = () => {};\n\nexport function SidebarNavigationItemGlobalStyles( props ) {\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { get: getPrefference } = useSelect( preferencesStore );\n\n\tconst turnOffDistractionFreeMode = useCallback( () => {\n\t\tconst isDistractionFree = getPrefference(\n\t\t\teditSiteStore.name,\n\t\t\t'distractionFree'\n\t\t);\n\t\tif ( ! isDistractionFree ) {\n\t\t\treturn;\n\t\t}\n\t\tsetPreference( editSiteStore.name, 'distractionFree', false );\n\t\tcreateNotice( 'info', __( 'Distraction free mode turned off' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}, [ createNotice, setPreference, getPrefference ] );\n\tconst hasGlobalStyleVariations = useSelect(\n\t\t( select ) =>\n\t\t\t!! select(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations()?.length,\n\t\t[]\n\t);\n\tif ( hasGlobalStyleVariations ) {\n\t\treturn (\n\t\t\t<NavigatorButton\n\t\t\t\t{ ...props }\n\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\tpath=\"/wp_global_styles\"\n\t\t\t/>\n\t\t);\n\t}\n\treturn (\n\t\t<SidebarNavigationItem\n\t\t\t{ ...props }\n\t\t\tonClick={ () => {\n\t\t\t\tturnOffDistractionFreeMode();\n\t\t\t\t// Switch to edit mode.\n\t\t\t\tsetCanvasMode( 'edit' );\n\t\t\t\t// Open global styles sidebar.\n\t\t\t\topenGeneralSidebar( 'edit-site/global-styles' );\n\t\t\t} }\n\t\t/>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesContent() {\n\tconst { storedSettings } = useSelect( ( select ) => {\n\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\treturn {\n\t\t\tstoredSettings: getSettings( false ),\n\t\t};\n\t}, [] );\n\n\t// Wrap in a BlockEditorProvider to ensure that the Iframe's dependencies are\n\t// loaded. This is necessary because the Iframe component waits until\n\t// the block editor store's `__internalIsInitialized` is true before\n\t// rendering the iframe. Without this, the iframe previews will not render\n\t// in mobile viewport sizes, where the editor canvas is hidden.\n\treturn (\n\t\t<BlockEditorProvider\n\t\t\tsettings={ storedSettings }\n\t\t\tonChange={ noop }\n\t\t\tonInput={ noop }\n\t\t>\n\t\t\t<StyleVariationsContainer />\n\t\t</BlockEditorProvider>\n\t);\n}\n\nfunction SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {\n\tconst { revisions, isLoading } = useGlobalStylesRevisions();\n\tconst { revisionsCount } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\trevisionsCount:\n\t\t\t\tglobalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,\n\t\t};\n\t}, [] );\n\n\tconst hasRevisions = revisionsCount >= 2;\n\tconst modified = revisions?.[ 0 ]?.modified;\n\n\tif ( ! hasRevisions || isLoading || ! modified ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<VStack className=\"edit-site-sidebar-navigation-screen-global-styles__footer\">\n\t\t\t<SidebarNavigationItem\n\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-global-styles__revisions\"\n\t\t\t\tlabel={ __( 'Revisions' ) }\n\t\t\t\tonClick={ onClickRevisions }\n\t\t\t>\n\t\t\t\t<HStack\n\t\t\t\t\tas=\"span\"\n\t\t\t\t\talignment=\"center\"\n\t\t\t\t\tspacing={ 5 }\n\t\t\t\t\tdirection=\"row\"\n\t\t\t\t\tjustify=\"space-between\"\n\t\t\t\t>\n\t\t\t\t\t<span className=\"edit-site-sidebar-navigation-screen-global-styles__revisions__label\">\n\t\t\t\t\t\t{ __( 'Last modified' ) }\n\t\t\t\t\t</span>\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<time dateTime={ modified }>\n\t\t\t\t\t\t\t{ humanTimeDiff( modified ) }\n\t\t\t\t\t\t</time>\n\t\t\t\t\t</span>\n\t\t\t\t\t<Icon icon={ backup } style={ { fill: 'currentcolor' } } />\n\t\t\t\t</HStack>\n\t\t\t</SidebarNavigationItem>\n\t\t</VStack>\n\t);\n}\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst { openGeneralSidebar, setIsListViewOpened } =\n\t\tuseDispatch( editSiteStore );\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\tconst { setCanvasMode, setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tconst { createNotice } = useDispatch( noticesStore );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\tconst { get: getPrefference } = useSelect( preferencesStore );\n\tconst { isViewMode, isStyleBookOpened } = useSelect( ( select ) => {\n\t\tconst { getCanvasMode, getEditorCanvasContainerView } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\treturn {\n\t\t\tisViewMode: 'view' === getCanvasMode(),\n\t\t\tisStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),\n\t\t};\n\t}, [] );\n\n\tconst turnOffDistractionFreeMode = useCallback( () => {\n\t\tconst isDistractionFree = getPrefference(\n\t\t\teditSiteStore.name,\n\t\t\t'distractionFree'\n\t\t);\n\t\tif ( ! isDistractionFree ) {\n\t\t\treturn;\n\t\t}\n\t\tsetPreference( editSiteStore.name, 'distractionFree', false );\n\t\tcreateNotice( 'info', __( 'Distraction free mode turned off' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t}, [ createNotice, setPreference, getPrefference ] );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\tturnOffDistractionFreeMode();\n\t\treturn Promise.all( [\n\t\t\tsetCanvasMode( 'edit' ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ setCanvasMode, openGeneralSidebar, turnOffDistractionFreeMode ] );\n\n\tconst openStyleBook = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the Style Book once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. This ensures that\n\t\t// the Style Book is not prematurely closed.\n\t\tsetEditorCanvasContainerView( 'style-book' );\n\t\tsetIsListViewOpened( false );\n\t}, [\n\t\topenGlobalStyles,\n\t\tsetEditorCanvasContainerView,\n\t\tsetIsListViewOpened,\n\t] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. The global styles UI is responsible\n\t\t// for redirecting to the revisions screen once the editor canvas container\n\t\t// has been set to 'global-styles-revisions'.\n\t\tsetEditorCanvasContainerView( 'global-styles-revisions' );\n\t}, [ openGlobalStyles, setEditorCanvasContainerView ] );\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Styles' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Choose a different style combination for the theme styles.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <SidebarNavigationScreenGlobalStylesContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\t<SidebarNavigationScreenGlobalStylesFooter\n\t\t\t\t\t\tonClickRevisions={ openRevisions }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\tactions={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\t\ticon={ seen }\n\t\t\t\t\t\t\t\tlabel={ __( 'Style Book' ) }\n\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\tsetEditorCanvasContainerView(\n\t\t\t\t\t\t\t\t\t\t! isStyleBookOpened\n\t\t\t\t\t\t\t\t\t\t\t? 'style-book'\n\t\t\t\t\t\t\t\t\t\t\t: undefined\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\tisPressed={ isStyleBookOpened }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<SidebarButton\n\t\t\t\t\t\t\ticon={ edit }\n\t\t\t\t\t\t\tlabel={ __( 'Edit styles' ) }\n\t\t\t\t\t\t\tonClick={ async () => await openGlobalStyles() }\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\t{ isStyleBookOpened && ! isMobileViewport && isViewMode && (\n\t\t\t\t<StyleBook\n\t\t\t\t\tenableResizing={ false }\n\t\t\t\t\tisSelected={ () => false }\n\t\t\t\t\tonClick={ openStyleBook }\n\t\t\t\t\tonSelect={ openStyleBook }\n\t\t\t\t\tshowCloseButton={ false }\n\t\t\t\t\tshowTabs={ false }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -71,10 +71,10 @@ function SidebarNavigationScreenMain() {
|
|
|
71
71
|
icon: _icons.layout
|
|
72
72
|
}, (0, _i18n.__)('Templates')), (0, _element.createElement)(_components.__experimentalNavigatorButton, {
|
|
73
73
|
as: _sidebarNavigationItem.default,
|
|
74
|
-
path: "/
|
|
74
|
+
path: "/patterns",
|
|
75
75
|
withChevron: true,
|
|
76
76
|
icon: _icons.symbol
|
|
77
|
-
}, (0, _i18n.__)('
|
|
77
|
+
}, (0, _i18n.__)('Patterns')))
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","location","setEditorCanvasContainerView","editSiteStore","path","undefined","SidebarNavigationItem","navigation","styles","page","layout","symbol"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAYA;AACA;AACA;AAOe,SAASA,2BAAT,GAAuC;AACrD,QAAM;AAAEC,IAAAA;AAAF,MAAe,6CAArB;AACA,QAAM;AAAEC,IAAAA;AAAF,MAAmC,wBACxC,uBAAaC,YAAb,CADwC,CAAzC,CAFqD,CAMrD;;AACA,0BAAW,MAAM;AAChB,QAAKF,QAAQ,EAAEG,IAAV,KAAmB,GAAxB,EAA8B;AAC7BF,MAAAA,4BAA4B,CAAEG,SAAF,CAA5B;AACA;AACD,GAJD,EAIG,CAAEH,4BAAF,EAAgCD,QAAQ,EAAEG,IAA1C,CAJH;AAMA,SACC,4BAAC,gCAAD;AACC,IAAA,MAAM,MADP;AAEC,IAAA,KAAK,EAAG,cAAI,QAAJ,CAFT;AAGC,IAAA,WAAW,EAAG,cACb,kEADa,CAHf;AAMC,IAAA,OAAO,EACN,4BAAC,mCAAD,QACC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGE,8BADN;AAEC,MAAA,IAAI,EAAC,aAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGC;AAJR,OAMG,cAAI,YAAJ,CANH,CADD,EASC,4BAAC,sEAAD;AACC,MAAA,WAAW,MADZ;AAEC,MAAA,IAAI,EAAGC;AAFR,OAIG,cAAI,QAAJ,CAJH,CATD,EAeC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGF,8BADN;AAEC,MAAA,IAAI,EAAC,OAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGG;AAJR,OAMG,cAAI,OAAJ,CANH,CAfD,EAuBC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGH,8BADN;AAEC,MAAA,IAAI,EAAC,cAFN;AAGC,MAAA,WAAW,MAHZ;AAIC,MAAA,IAAI,EAAGI;AAJR,OAMG,cAAI,WAAJ,CANH,CAvBD,EA+BC,4BAAC,yCAAD;AACC,MAAA,EAAE,EAAGJ,8BADN;AAEC,MAAA,IAAI,EAAC,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-main/index.js"],"names":["SidebarNavigationScreenMain","location","setEditorCanvasContainerView","editSiteStore","path","undefined","SidebarNavigationItem","navigation","styles","page","layout","symbol"],"mappings":";;;;;;;;;AAYA;;AATA;;AAKA;;AACA;;AACA;;AAOA;;AACA;;AACA;;AACA;;AACA;;AArBA;AACA;AACA;;AAYA;AACA;AACA;AAOe,S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MAAA,IAAI,EAAGK;AAJR,OAMG,cAAI,UAAJ,CANH,CA/BD;AAPF,IADD;AAmDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalNavigatorButton as NavigatorButton,\n\t__experimentalUseNavigator as useNavigator,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { layout, symbol, navigation, styles, page } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\n\nimport { useEffect } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { SidebarNavigationItemGlobalStyles } from '../sidebar-navigation-screen-global-styles';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\n\nexport default function SidebarNavigationScreenMain() {\n\tconst { location } = useNavigator();\n\tconst { setEditorCanvasContainerView } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\n\t// Clear the editor canvas container view when accessing the main navigation screen.\n\tuseEffect( () => {\n\t\tif ( location?.path === '/' ) {\n\t\t\tsetEditorCanvasContainerView( undefined );\n\t\t}\n\t}, [ setEditorCanvasContainerView, location?.path ] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={\n\t\t\t\t<ItemGroup>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/navigation\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ navigation }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Navigation' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<SidebarNavigationItemGlobalStyles\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ styles }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Styles' ) }\n\t\t\t\t\t</SidebarNavigationItemGlobalStyles>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/page\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ page }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Pages' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/wp_template\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Templates' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t\t<NavigatorButton\n\t\t\t\t\t\tas={ SidebarNavigationItem }\n\t\t\t\t\t\tpath=\"/patterns\"\n\t\t\t\t\t\twithChevron\n\t\t\t\t\t\ticon={ symbol }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Patterns' ) }\n\t\t\t\t\t</NavigatorButton>\n\t\t\t\t</ItemGroup>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -18,25 +18,16 @@ function RenameModal({
|
|
|
18
18
|
onClose,
|
|
19
19
|
onConfirm
|
|
20
20
|
}) {
|
|
21
|
-
return (0, _element.createElement)(_components.
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}, (0, _element.createElement)("form", null, (0, _element.createElement)(_components.__experimentalVStack, {
|
|
25
|
-
spacing: "3"
|
|
26
|
-
}, (0, _element.createElement)("p", null, (0, _i18n.__)('Are you sure you want to delete this Navigation menu?')), (0, _element.createElement)(_components.__experimentalHStack, {
|
|
27
|
-
justify: "right"
|
|
28
|
-
}, (0, _element.createElement)(_components.Button, {
|
|
29
|
-
variant: "tertiary",
|
|
30
|
-
onClick: onClose
|
|
31
|
-
}, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
|
|
32
|
-
variant: "primary",
|
|
33
|
-
type: "submit",
|
|
34
|
-
onClick: e => {
|
|
21
|
+
return (0, _element.createElement)(_components.__experimentalConfirmDialog, {
|
|
22
|
+
isOpen: true,
|
|
23
|
+
onConfirm: e => {
|
|
35
24
|
e.preventDefault();
|
|
36
25
|
onConfirm(); // Immediate close avoids ability to hit delete multiple times.
|
|
37
26
|
|
|
38
27
|
onClose();
|
|
39
|
-
}
|
|
40
|
-
|
|
28
|
+
},
|
|
29
|
+
onCancel: onClose,
|
|
30
|
+
confirmButtonText: (0, _i18n.__)('Delete')
|
|
31
|
+
}, (0, _i18n.__)('Are you sure you want to delete this Navigation menu?'));
|
|
41
32
|
}
|
|
42
33
|
//# sourceMappingURL=delete-modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js"],"names":["RenameModal","onClose","onConfirm","e","preventDefault"],"mappings":";;;;;;;;;AAGA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/delete-modal.js"],"names":["RenameModal","onClose","onConfirm","e","preventDefault"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIe,SAASA,WAAT,CAAsB;AAAEC,EAAAA,OAAF;AAAWC,EAAAA;AAAX,CAAtB,EAA+C;AAC7D,SACC,4BAAC,uCAAD;AACC,IAAA,MAAM,EAAG,IADV;AAEC,IAAA,SAAS,EAAKC,CAAF,IAAS;AACpBA,MAAAA,CAAC,CAACC,cAAF;AACAF,MAAAA,SAAS,GAFW,CAIpB;;AACAD,MAAAA,OAAO;AACP,KARF;AASC,IAAA,QAAQ,EAAGA,OATZ;AAUC,IAAA,iBAAiB,EAAG,cAAI,QAAJ;AAVrB,KAYG,cAAI,uDAAJ,CAZH,CADD;AAgBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalConfirmDialog as ConfirmDialog } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\nexport default function RenameModal( { onClose, onConfirm } ) {\n\treturn (\n\t\t<ConfirmDialog\n\t\t\tisOpen={ true }\n\t\t\tonConfirm={ ( e ) => {\n\t\t\t\te.preventDefault();\n\t\t\t\tonConfirm();\n\n\t\t\t\t// Immediate close avoids ability to hit delete multiple times.\n\t\t\t\tonClose();\n\t\t\t} }\n\t\t\tonCancel={ onClose }\n\t\t\tconfirmButtonText={ __( 'Delete' ) }\n\t\t>\n\t\t\t{ __( 'Are you sure you want to delete this Navigation menu?' ) }\n\t\t</ConfirmDialog>\n\t);\n}\n"]}
|
|
@@ -11,15 +11,11 @@ var _element = require("@wordpress/element");
|
|
|
11
11
|
|
|
12
12
|
var _i18n = require("@wordpress/i18n");
|
|
13
13
|
|
|
14
|
-
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
14
|
var _icons = require("@wordpress/icons");
|
|
17
15
|
|
|
18
|
-
var _store = require("../../store");
|
|
19
|
-
|
|
20
16
|
var _sidebarButton = _interopRequireDefault(require("../sidebar-button"));
|
|
21
17
|
|
|
22
|
-
var
|
|
18
|
+
var _link = require("../routes/link");
|
|
23
19
|
|
|
24
20
|
/**
|
|
25
21
|
* WordPress dependencies
|
|
@@ -28,12 +24,15 @@ var _lockUnlock = require("../../lock-unlock");
|
|
|
28
24
|
/**
|
|
29
25
|
* Internal dependencies
|
|
30
26
|
*/
|
|
31
|
-
function EditButton(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
function EditButton({
|
|
28
|
+
postId
|
|
29
|
+
}) {
|
|
30
|
+
const linkInfo = (0, _link.useLink)({
|
|
31
|
+
postId,
|
|
32
|
+
postType: 'wp_navigation',
|
|
33
|
+
canvas: 'edit'
|
|
34
|
+
});
|
|
35
|
+
return (0, _element.createElement)(_sidebarButton.default, { ...linkInfo,
|
|
37
36
|
label: (0, _i18n.__)('Edit'),
|
|
38
37
|
icon: _icons.pencil
|
|
39
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js"],"names":["EditButton","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/edit-button.js"],"names":["EditButton","postId","linkInfo","postType","canvas","pencil"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIe,SAASA,UAAT,CAAqB;AAAEC,EAAAA;AAAF,CAArB,EAAkC;AAChD,QAAMC,QAAQ,GAAG,mBAAS;AACzBD,IAAAA,MADyB;AAEzBE,IAAAA,QAAQ,EAAE,eAFe;AAGzBC,IAAAA,MAAM,EAAE;AAHiB,GAAT,CAAjB;AAKA,SACC,4BAAC,sBAAD,OAAoBF,QAApB;AAA+B,IAAA,KAAK,EAAG,cAAI,MAAJ,CAAvC;AAAsD,IAAA,IAAI,EAAGG;AAA7D,IADD;AAGA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { pencil } from '@wordpress/icons';\n/**\n * Internal dependencies\n */\nimport SidebarButton from '../sidebar-button';\nimport { useLink } from '../routes/link';\n\nexport default function EditButton( { postId } ) {\n\tconst linkInfo = useLink( {\n\t\tpostId,\n\t\tpostType: 'wp_navigation',\n\t\tcanvas: 'edit',\n\t} );\n\treturn (\n\t\t<SidebarButton { ...linkInfo } label={ __( 'Edit' ) } icon={ pencil } />\n\t);\n}\n"]}
|
|
@@ -28,6 +28,8 @@ var _singleNavigationMenu = _interopRequireDefault(require("./single-navigation-
|
|
|
28
28
|
|
|
29
29
|
var _useNavigationMenuHandlers = _interopRequireDefault(require("./use-navigation-menu-handlers"));
|
|
30
30
|
|
|
31
|
+
var _buildNavigationLabel = _interopRequireDefault(require("../sidebar-navigation-screen-navigation-menus/build-navigation-label"));
|
|
32
|
+
|
|
31
33
|
/**
|
|
32
34
|
* WordPress dependencies
|
|
33
35
|
*/
|
|
@@ -54,13 +56,11 @@ function SidebarNavigationScreenNavigationMenu() {
|
|
|
54
56
|
} = (0, _data.useSelect)(select => {
|
|
55
57
|
const {
|
|
56
58
|
isSavingEntityRecord,
|
|
57
|
-
isDeletingEntityRecord
|
|
58
|
-
getEditedEntityRecord: getEditedEntityRecordSelector
|
|
59
|
+
isDeletingEntityRecord
|
|
59
60
|
} = select(_coreData.store);
|
|
60
61
|
return {
|
|
61
62
|
isSaving: isSavingEntityRecord('postType', postType, postId),
|
|
62
|
-
isDeleting: isDeletingEntityRecord('postType', postType, postId)
|
|
63
|
-
getEditedEntityRecord: getEditedEntityRecordSelector
|
|
63
|
+
isDeleting: isDeletingEntityRecord('postType', postType, postId)
|
|
64
64
|
};
|
|
65
65
|
}, [postId]);
|
|
66
66
|
const isLoading = isResolving || isSaving || isDeleting;
|
|
@@ -73,7 +73,7 @@ function SidebarNavigationScreenNavigationMenu() {
|
|
|
73
73
|
|
|
74
74
|
const _handleDelete = () => handleDelete(navigationMenu);
|
|
75
75
|
|
|
76
|
-
const _handleSave =
|
|
76
|
+
const _handleSave = edits => handleSave(navigationMenu, edits);
|
|
77
77
|
|
|
78
78
|
const _handleDuplicate = () => handleDuplicate(navigationMenu);
|
|
79
79
|
|
|
@@ -99,7 +99,7 @@ function SidebarNavigationScreenNavigationMenu() {
|
|
|
99
99
|
onSave: _handleSave,
|
|
100
100
|
onDuplicate: _handleDuplicate
|
|
101
101
|
}),
|
|
102
|
-
title: (0,
|
|
102
|
+
title: (0, _buildNavigationLabel.default)(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
|
|
103
103
|
description: (0, _i18n.__)('This Navigation Menu is empty.')
|
|
104
104
|
});
|
|
105
105
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"names":["postType","SidebarNavigationScreenNavigationMenu","params","postId","record","navigationMenu","isResolving","isSaving","isDeleting","select","isSavingEntityRecord","isDeletingEntityRecord","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/index.js"],"names":["postType","SidebarNavigationScreenNavigationMenu","params","postId","record","navigationMenu","isResolving","isSaving","isDeleting","select","isSavingEntityRecord","isDeletingEntityRecord","coreStore","isLoading","menuTitle","title","rendered","slug","handleSave","handleDelete","handleDuplicate","_handleDelete","_handleSave","edits","_handleDuplicate","content","raw","id","status"],"mappings":";;;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AAnBA;AACA;AACA;;AAUA;AACA;AACA;AAOO,MAAMA,QAAQ,GAAI,eAAlB;;;AAEQ,SAASC,qCAAT,GAAiD;AAC/D,QAAM;AACLC,IAAAA,MAAM,EAAE;AAAEC,MAAAA;AAAF;AADH,MAEF,6CAFJ;AAIA,QAAM;AAAEC,IAAAA,MAAM,EAAEC,cAAV;AAA0BC,IAAAA;AAA1B,MAA0C,+BAC/C,UAD+C,EAE/CN,QAF+C,EAG/CG,MAH+C,CAAhD;AAMA,QAAM;AAAEI,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,MAA2B,qBAC9BC,MAAF,IAAc;AACb,UAAM;AAAEC,MAAAA,oBAAF;AAAwBC,MAAAA;AAAxB,QACLF,MAAM,CAAEG,eAAF,CADP;AAGA,WAAO;AACNL,MAAAA,QAAQ,EAAEG,oBAAoB,CAAE,UAAF,EAAcV,QAAd,EAAwBG,MAAxB,CADxB;AAENK,MAAAA,UAAU,EAAEG,sBAAsB,CACjC,UADiC,EAEjCX,QAFiC,EAGjCG,MAHiC;AAF5B,KAAP;AAQA,GAb+B,EAchC,CAAEA,MAAF,CAdgC,CAAjC;AAiBA,QAAMU,SAAS,GAAGP,WAAW,IAAIC,QAAf,IAA2BC,UAA7C;AAEA,QAAMM,S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eAAe,EAAGE;AAJnB,IADD;AAQA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEntityRecord, store as coreStore } from '@wordpress/core-data';\nimport {\n\t__experimentalUseNavigator as useNavigator,\n\tSpinner,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport SingleNavigationMenu from './single-navigation-menu';\nimport useNavigationMenuHandlers from './use-navigation-menu-handlers';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\n\nexport const postType = `wp_navigation`;\n\nexport default function SidebarNavigationScreenNavigationMenu() {\n\tconst {\n\t\tparams: { postId },\n\t} = useNavigator();\n\n\tconst { record: navigationMenu, isResolving } = useEntityRecord(\n\t\t'postType',\n\t\tpostType,\n\t\tpostId\n\t);\n\n\tconst { isSaving, isDeleting } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isDeletingEntityRecord } =\n\t\t\t\tselect( coreStore );\n\n\t\t\treturn {\n\t\t\t\tisSaving: isSavingEntityRecord( 'postType', postType, postId ),\n\t\t\t\tisDeleting: isDeletingEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\tpostType,\n\t\t\t\t\tpostId\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ postId ]\n\t);\n\n\tconst isLoading = isResolving || isSaving || isDeleting;\n\n\tconst menuTitle = navigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\tconst { handleSave, handleDelete, handleDuplicate } =\n\t\tuseNavigationMenuHandlers();\n\n\tconst _handleDelete = () => handleDelete( navigationMenu );\n\tconst _handleSave = ( edits ) => handleSave( navigationMenu, edits );\n\tconst _handleDuplicate = () => handleDuplicate( navigationMenu );\n\n\tif ( isLoading ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t\t) }\n\t\t\t>\n\t\t\t\t<Spinner className=\"edit-site-sidebar-navigation-screen-navigation-menus__loading\" />\n\t\t\t</SidebarNavigationScreenWrapper>\n\t\t);\n\t}\n\n\tif ( ! isLoading && ! navigationMenu ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tdescription={ __( 'Navigation Menu missing.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\tif ( ! navigationMenu?.content?.raw ) {\n\t\treturn (\n\t\t\t<SidebarNavigationScreenWrapper\n\t\t\t\tactions={\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ _handleDelete }\n\t\t\t\t\t\tonSave={ _handleSave }\n\t\t\t\t\t\tonDuplicate={ _handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t}\n\t\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\t\tnavigationMenu?.title,\n\t\t\t\t\tnavigationMenu?.id,\n\t\t\t\t\tnavigationMenu?.status\n\t\t\t\t) }\n\t\t\t\tdescription={ __( 'This Navigation Menu is empty.' ) }\n\t\t\t/>\n\t\t);\n\t}\n\n\treturn (\n\t\t<SingleNavigationMenu\n\t\t\tnavigationMenu={ navigationMenu }\n\t\t\thandleDelete={ _handleDelete }\n\t\t\thandleSave={ _handleSave }\n\t\t\thandleDuplicate={ _handleDuplicate }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -14,12 +14,16 @@ var _i18n = require("@wordpress/i18n");
|
|
|
14
14
|
/**
|
|
15
15
|
* WordPress dependencies
|
|
16
16
|
*/
|
|
17
|
+
const notEmptyString = testString => testString?.trim()?.length > 0;
|
|
18
|
+
|
|
17
19
|
function RenameModal({
|
|
18
20
|
menuTitle,
|
|
19
21
|
onClose,
|
|
20
22
|
onSave
|
|
21
23
|
}) {
|
|
22
24
|
const [editedMenuTitle, setEditedMenuTitle] = (0, _element.useState)(menuTitle);
|
|
25
|
+
const titleHasChanged = editedMenuTitle !== menuTitle;
|
|
26
|
+
const isEditedMenuTitleValid = titleHasChanged && notEmptyString(editedMenuTitle);
|
|
23
27
|
return (0, _element.createElement)(_components.Modal, {
|
|
24
28
|
title: (0, _i18n.__)('Rename'),
|
|
25
29
|
onRequestClose: onClose
|
|
@@ -38,11 +42,16 @@ function RenameModal({
|
|
|
38
42
|
variant: "tertiary",
|
|
39
43
|
onClick: onClose
|
|
40
44
|
}, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
|
|
41
|
-
disabled:
|
|
45
|
+
disabled: !isEditedMenuTitleValid,
|
|
42
46
|
variant: "primary",
|
|
43
47
|
type: "submit",
|
|
44
48
|
onClick: e => {
|
|
45
49
|
e.preventDefault();
|
|
50
|
+
|
|
51
|
+
if (!isEditedMenuTitleValid) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
|
|
46
55
|
onSave({
|
|
47
56
|
title: editedMenuTitle
|
|
48
57
|
}); // Immediate close avoids ability to hit save multiple times.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js"],"names":["RenameModal","menuTitle","onClose","onSave","editedMenuTitle","setEditedMenuTitle","e","preventDefault","title"],"mappings":";;;;;;;AAWA;;AARA;;AAOA;;AAVA;AACA;AACA;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js"],"names":["notEmptyString","testString","trim","length","RenameModal","menuTitle","onClose","onSave","editedMenuTitle","setEditedMenuTitle","titleHasChanged","isEditedMenuTitleValid","e","preventDefault","title"],"mappings":";;;;;;;AAWA;;AARA;;AAOA;;AAVA;AACA;AACA;AAWA,MAAMA,cAAc,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AgBG,cAAI,MAAJ,CAhBH,CALD,CAPD,CADD,CADD,CADD;AAsCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tButton,\n\tTextControl,\n\tModal,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n\nconst notEmptyString = ( testString ) => testString?.trim()?.length > 0;\n\nexport default function RenameModal( { menuTitle, onClose, onSave } ) {\n\tconst [ editedMenuTitle, setEditedMenuTitle ] = useState( menuTitle );\n\n\tconst titleHasChanged = editedMenuTitle !== menuTitle;\n\n\tconst isEditedMenuTitleValid =\n\t\ttitleHasChanged && notEmptyString( editedMenuTitle );\n\n\treturn (\n\t\t<Modal title={ __( 'Rename' ) } onRequestClose={ onClose }>\n\t\t\t<form className=\"sidebar-navigation__rename-modal-form\">\n\t\t\t\t<VStack spacing=\"3\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tvalue={ editedMenuTitle }\n\t\t\t\t\t\tplaceholder={ __( 'Navigation title' ) }\n\t\t\t\t\t\tonChange={ setEditedMenuTitle }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button variant=\"tertiary\" onClick={ onClose }>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tdisabled={ ! isEditedMenuTitleValid }\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tonClick={ ( e ) => {\n\t\t\t\t\t\t\t\te.preventDefault();\n\n\t\t\t\t\t\t\t\tif ( ! isEditedMenuTitleValid ) {\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tonSave( { title: editedMenuTitle } );\n\n\t\t\t\t\t\t\t\t// Immediate close avoids ability to hit save multiple times.\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"]}
|
package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js
CHANGED
|
@@ -19,6 +19,10 @@ var _moreMenu = _interopRequireDefault(require("./more-menu"));
|
|
|
19
19
|
|
|
20
20
|
var _navigationMenuEditor = _interopRequireDefault(require("./navigation-menu-editor"));
|
|
21
21
|
|
|
22
|
+
var _buildNavigationLabel = _interopRequireDefault(require("../sidebar-navigation-screen-navigation-menus/build-navigation-label"));
|
|
23
|
+
|
|
24
|
+
var _editButton = _interopRequireDefault(require("./edit-button"));
|
|
25
|
+
|
|
22
26
|
/**
|
|
23
27
|
* WordPress dependencies
|
|
24
28
|
*/
|
|
@@ -34,13 +38,15 @@ function SingleNavigationMenu({
|
|
|
34
38
|
}) {
|
|
35
39
|
const menuTitle = navigationMenu?.title?.rendered;
|
|
36
40
|
return (0, _element.createElement)(_sidebarNavigationScreenNavigationMenus.SidebarNavigationScreenWrapper, {
|
|
37
|
-
actions: (0, _element.createElement)(
|
|
41
|
+
actions: (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_editButton.default, {
|
|
42
|
+
postId: navigationMenu?.id
|
|
43
|
+
}), (0, _element.createElement)(_moreMenu.default, {
|
|
38
44
|
menuTitle: (0, _htmlEntities.decodeEntities)(menuTitle),
|
|
39
45
|
onDelete: handleDelete,
|
|
40
46
|
onSave: handleSave,
|
|
41
47
|
onDuplicate: handleDuplicate
|
|
42
|
-
}),
|
|
43
|
-
title: (0,
|
|
48
|
+
})),
|
|
49
|
+
title: (0, _buildNavigationLabel.default)(navigationMenu?.title, navigationMenu?.id, navigationMenu?.status),
|
|
44
50
|
description: (0, _i18n.__)('Navigation menus are a curated collection of blocks that allow visitors to get around your site.')
|
|
45
51
|
}, (0, _element.createElement)(_navigationMenuEditor.default, {
|
|
46
52
|
navigationMenuId: navigationMenu?.id
|
package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"names":["SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","id"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js"],"names":["SingleNavigationMenu","navigationMenu","handleDelete","handleDuplicate","handleSave","menuTitle","title","rendered","id","status"],"mappings":";;;;;;;;;;;AAGA;;AACA;;AAIA;;AACA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;;AAGA;AACA;AACA;AAOe,SAASA,oBAAT,CAA+B;AAC7CC,EAAAA,cAD6C;AAE7CC,EAAAA,YAF6C;AAG7CC,EAAAA,eAH6C;AAI7CC,EAAAA;AAJ6C,CAA/B,EAKX;AACH,QAAMC,SAAS,GAAGJ,cAAc,EAAEK,KAAhB,EAAuBC,QAAzC;AAEA,SACC,4BAAC,sEAAD;AACC,IAAA,OAAO,EACN,qDACC,4BAAC,mBAAD;AAAY,MAAA,MAAM,EAAGN,cAAc,EAAEO;AAArC,MADD,EAEC,4BAAC,iBAAD;AACC,MAAA,SAAS,EAAG,kCAAgBH,SAAhB,CADb;AAEC,MAAA,QAAQ,EAAGH,YAFZ;AAGC,MAAA,MAAM,EAAGE,UAHV;AAIC,MAAA,WAAW,EAAGD;AAJf,MAFD,CAFF;AAYC,IAAA,KAAK,EAAG,mCACPF,cAAc,EAAEK,KADT,EAEPL,cAAc,EAAEO,EAFT,EAGPP,cAAc,EAAEQ,MAHT,CAZT;AAiBC,IAAA,WAAW,EAAG,cACb,kGADa;AAjBf,KAqBC,4BAAC,6BAAD;AAAsB,IAAA,gBAAgB,EAAGR,cAAc,EAAEO;AAAzD,IArBD,CADD;AAyBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n/**\n * Internal dependencies\n */\nimport { SidebarNavigationScreenWrapper } from '../sidebar-navigation-screen-navigation-menus';\nimport ScreenNavigationMoreMenu from './more-menu';\nimport NavigationMenuEditor from './navigation-menu-editor';\nimport buildNavigationLabel from '../sidebar-navigation-screen-navigation-menus/build-navigation-label';\nimport EditButton from './edit-button';\n\nexport default function SingleNavigationMenu( {\n\tnavigationMenu,\n\thandleDelete,\n\thandleDuplicate,\n\thandleSave,\n} ) {\n\tconst menuTitle = navigationMenu?.title?.rendered;\n\n\treturn (\n\t\t<SidebarNavigationScreenWrapper\n\t\t\tactions={\n\t\t\t\t<>\n\t\t\t\t\t<EditButton postId={ navigationMenu?.id } />\n\t\t\t\t\t<ScreenNavigationMoreMenu\n\t\t\t\t\t\tmenuTitle={ decodeEntities( menuTitle ) }\n\t\t\t\t\t\tonDelete={ handleDelete }\n\t\t\t\t\t\tonSave={ handleSave }\n\t\t\t\t\t\tonDuplicate={ handleDuplicate }\n\t\t\t\t\t/>\n\t\t\t\t</>\n\t\t\t}\n\t\t\ttitle={ buildNavigationLabel(\n\t\t\t\tnavigationMenu?.title,\n\t\t\t\tnavigationMenu?.id,\n\t\t\t\tnavigationMenu?.status\n\t\t\t) }\n\t\t\tdescription={ __(\n\t\t\t\t'Navigation menus are a curated collection of blocks that allow visitors to get around your site.'\n\t\t\t) }\n\t\t>\n\t\t\t<NavigationMenuEditor navigationMenuId={ navigationMenu?.id } />\n\t\t</SidebarNavigationScreenWrapper>\n\t);\n}\n"]}
|
package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js
CHANGED
|
@@ -81,7 +81,11 @@ function useSaveNavigationMenu() {
|
|
|
81
81
|
createErrorNotice
|
|
82
82
|
} = (0, _data.useDispatch)(_notices.store);
|
|
83
83
|
|
|
84
|
-
const handleSave = async (navigationMenu, edits
|
|
84
|
+
const handleSave = async (navigationMenu, edits) => {
|
|
85
|
+
if (!edits) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
|
|
85
89
|
const postId = navigationMenu?.id; // Prepare for revert in case of error.
|
|
86
90
|
|
|
87
91
|
const originalRecord = getEditedEntityRecord('postType', 'wp_navigation', postId); // Apply the edits.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"names":["useDeleteNavigationMenu","goTo","deleteEntityRecord","coreStore","createSuccessNotice","createErrorNotice","noticesStore","handleDelete","navigationMenu","postId","id","postType","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","saveEditedEntityRecord","handleSave","edits","originalRecord","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,uBAAT,GAAmC;AAClC,QAAM;AAAEC,IAAAA;AAAF,MAAW,6CAAjB;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,eAAb,CAA/B;AAEA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACL,uBAAaC,cAAb,CADD;;AAGA,QAAMC,YAAY,GAAG,MAAQC,cAAR,IAA4B;AAChD,UAAMC,MAAM,GAAGD,cAAc,EAAEE,EAA/B;;AACA,QAAI;AACH,YAAMR,kBAAkB,CACvB,UADuB,EAEvBS,UAFuB,EAGvBF,MAHuB,EAIvB;AACCG,QAAAA,KAAK,EAAE;AADR,OAJuB,EAOvB;AACCC,QAAAA,YAAY,EAAE;AADf,OAPuB,CAAxB;AAWAT,MAAAA,mBAAmB,CAAE,cAAI,yBAAJ,CAAF,EAAmC;AACrDU,QAAAA,IAAI,EAAE;AAD+C,OAAnC,CAAnB;AAGAb,MAAAA,IAAI,CAAE,aAAF,CAAJ;AACA,KAhBD,CAgBE,OAAQc,KAAR,EAAgB;AACjBV,MAAAA,iBAAiB,CAChB;AACC;AACA,oBAAK,wCAAL,CAFD,EAGCU,KAAK,EAAEC,OAHR,CADgB,EAOhB;AACCF,QAAAA,IAAI,EAAE;AADP,OAPgB,CAAjB;AAWA;AACD,GA/BD;;AAiCA,SAAOP,YAAP;AACA;;AAED,SAASU,qBAAT,GAAiC;AAChC,QAAM;AAAEC,IAAAA;AAAF,MAA4B,qBAAaC,MAAF,IAAc;AAC1D,UAAM;AAAED,MAAAA,qBAAqB,EAAEE;AAAzB,QACLD,MAAM,CAAEhB,eAAF,CADP;AAGA,WAAO;AACNe,MAAAA,qBAAqB,EAAEE;AADjB,KAAP;AAGA,GAPiC,EAO/B,EAP+B,CAAlC;AASA,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MACL,uBAAanB,eAAb,CADD;AAGA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACL,uBAAaC,cAAb,CADD;;AAGA,QAAMiB,UAAU,GAAG,OAAQf,cAAR,EAAwBgB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js"],"names":["useDeleteNavigationMenu","goTo","deleteEntityRecord","coreStore","createSuccessNotice","createErrorNotice","noticesStore","handleDelete","navigationMenu","postId","id","postType","force","throwOnError","type","error","message","useSaveNavigationMenu","getEditedEntityRecord","select","getEditedEntityRecordSelector","editEntityRecord","saveEditedEntityRecord","handleSave","edits","originalRecord","useDuplicateNavigationMenu","saveEntityRecord","handleDuplicate","menuTitle","title","rendered","slug","savedRecord","content","raw","status","useNavigationMenuHandlers"],"mappings":";;;;;;;AAGA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AAXA;AACA;AACA;;AAMA;AACA;AACA;AAGA,SAASA,uBAAT,GAAmC;AAClC,QAAM;AAAEC,IAAAA;AAAF,MAAW,6CAAjB;AAEA,QAAM;AAAEC,IAAAA;AAAF,MAAyB,uBAAaC,eAAb,CAA/B;AAEA,QAAM;AAAEC,IAAAA,mBAAF;AAAuBC,IAAAA;AAAvB,MACL,uBAAaC,cAAb,CADD;;AAGA,QAAMC,YAAY,GAAG,MAAQC,cAAR,IAA4B;AAChD,UAAMC,MAAM,GAAGD,cAAc,EAAEE,EAA/B;;AACA,QAAI;AACH,YAAMR,kBAAkB,CACvB,UADuB,EAEvBS,UAFuB,EAGvBF,MAHuB,EAIvB;AACCG,QAAAA,KAAK,EAAE;AADR,OAJuB,EAOvB;AACCC,QAAAA,YAAY,EAAE;AADf,OAPuB,CAAxB;AAWAT,MAAAA,mBAAmB,CAAE,cAAI,yBAAJ,CAAF,EAAmC;AACrDU,QAAAA,IAAI,EAAE;AAD+C,OAAnC,CAAnB;AAGAb,MAAAA,IAAI,CAAE,aAAF,CAAJ;AACA,KAhBD,CAgBE,OAAQc,KAAR,EAAgB;AACjBV,MAAAA,iBAAiB,CAChB;AACC;AACA,oBAAK,wCAAL,CAFD,EAGCU,KAAK,EAAEC,OAHR,CADgB,EAOhB;AACCF,QAAAA,IAAI,EAAE;AADP,OAPgB,CAAjB;AAWA;AACD,GA/BD;;AAiCA,SAAOP,YAAP;AACA;;AAED,SAASU,qBAAT,GAAiC;AAChC,QAAM;AAAEC,IAAAA;AAAF,MAA4B,qBAAaC,MAAF,IAAc;AAC1D,UAAM;AAAED,MAAAA,qBAAqB,EAAEE;AAAzB,QACLD,MAAM,CAAEhB,eAAF,CADP;AAGA,WAAO;AACNe,MAAAA,qBAAqB,EAAEE;AADjB,KAAP;AAGA,GAP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@wordpress/core-data';\nimport { __experimentalUseNavigator as useNavigator } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n/**\n * Internal dependencies\n */\nimport { postType } from '.';\n\nfunction useDeleteNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { deleteEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDelete = async ( navigationMenu ) => {\n\t\tconst postId = navigationMenu?.id;\n\t\ttry {\n\t\t\tawait deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\tpostId,\n\t\t\t\t{\n\t\t\t\t\tforce: true,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t\tcreateSuccessNotice( __( 'Deleted Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tgoTo( '/navigation' );\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to delete Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDelete;\n}\n\nfunction useSaveNavigationMenu() {\n\tconst { getEditedEntityRecord } = useSelect( ( select ) => {\n\t\tconst { getEditedEntityRecord: getEditedEntityRecordSelector } =\n\t\t\tselect( coreStore );\n\n\t\treturn {\n\t\t\tgetEditedEntityRecord: getEditedEntityRecordSelector,\n\t\t};\n\t}, [] );\n\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleSave = async ( navigationMenu, edits ) => {\n\t\tif ( ! edits ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst postId = navigationMenu?.id;\n\t\t// Prepare for revert in case of error.\n\t\tconst originalRecord = getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\t'wp_navigation',\n\t\t\tpostId\n\t\t);\n\n\t\t// Apply the edits.\n\t\teditEntityRecord( 'postType', postType, postId, edits );\n\n\t\t// Attempt to persist.\n\t\ttry {\n\t\t\tawait saveEditedEntityRecord( 'postType', postType, postId, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Renamed Navigation menu' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\t// Revert to original in case of error.\n\t\t\teditEntityRecord( 'postType', postType, postId, originalRecord );\n\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be renamed. */\n\t\t\t\t\t__( `Unable to rename Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleSave;\n}\n\nfunction useDuplicateNavigationMenu() {\n\tconst { goTo } = useNavigator();\n\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst handleDuplicate = async ( navigationMenu ) => {\n\t\tconst menuTitle =\n\t\t\tnavigationMenu?.title?.rendered || navigationMenu?.slug;\n\n\t\ttry {\n\t\t\tconst savedRecord = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpostType,\n\t\t\t\t{\n\t\t\t\t\ttitle: sprintf(\n\t\t\t\t\t\t/* translators: %s: Navigation menu title */\n\t\t\t\t\t\t__( '%s (Copy)' ),\n\t\t\t\t\t\tmenuTitle\n\t\t\t\t\t),\n\t\t\t\t\tcontent: navigationMenu?.content?.raw,\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tif ( savedRecord ) {\n\t\t\t\tcreateSuccessNotice( __( 'Duplicated Navigation menu' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tgoTo( `/navigation/${ postType }/${ savedRecord.id }` );\n\t\t\t}\n\t\t} catch ( error ) {\n\t\t\tcreateErrorNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t/* translators: %s: error message describing why the navigation menu could not be deleted. */\n\t\t\t\t\t__( `Unable to duplicate Navigation menu (%s).` ),\n\t\t\t\t\terror?.message\n\t\t\t\t),\n\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\treturn handleDuplicate;\n}\n\nexport default function useNavigationMenuHandlers() {\n\treturn {\n\t\thandleDelete: useDeleteNavigationMenu(),\n\t\thandleSave: useSaveNavigationMenu(),\n\t\thandleDuplicate: useDuplicateNavigationMenu(),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = buildNavigationLabel;
|
|
7
|
+
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
|
|
10
|
+
var _htmlEntities = require("@wordpress/html-entities");
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* WordPress dependencies
|
|
14
|
+
*/
|
|
15
|
+
// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.
|
|
16
|
+
function buildNavigationLabel(title, id, status) {
|
|
17
|
+
if (!title?.rendered) {
|
|
18
|
+
/* translators: %s is the index of the menu in the list of menus. */
|
|
19
|
+
return (0, _i18n.sprintf)((0, _i18n.__)('(no title %s)'), id);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (status === 'publish') {
|
|
23
|
+
return (0, _htmlEntities.decodeEntities)(title?.rendered);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (0, _i18n.sprintf)( // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
|
|
27
|
+
(0, _i18n.__)('%1$s (%2$s)'), (0, _htmlEntities.decodeEntities)(title?.rendered), status);
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=build-navigation-label.js.map
|
package/build/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/build-navigation-label.js"],"names":["buildNavigationLabel","title","id","status","rendered"],"mappings":";;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAIA;AACe,SAASA,oBAAT,CAA+BC,KAA/B,EAAsCC,EAAtC,EAA0CC,MAA1C,EAAmD;AACjE,MAAK,CAAEF,KAAK,EAAEG,QAAd,EAAyB;AACxB;AACA,WAAO,mBAAS,cAAI,eAAJ,CAAT,EAAgCF,EAAhC,CAAP;AACA;;AAED,MAAKC,MAAM,KAAK,SAAhB,EAA4B;AAC3B,WAAO,kCAAgBF,KAAK,EAAEG,QAAvB,CAAP;AACA;;AAED,SAAO,oBACN;AACA,gBAAI,aAAJ,CAFM,EAGN,kCAAgBH,KAAK,EAAEG,QAAvB,CAHM,EAIND,MAJM,CAAP;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, sprintf } from '@wordpress/i18n';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n// Copied from packages/block-library/src/navigation/edit/navigation-menu-selector.js.\nexport default function buildNavigationLabel( title, id, status ) {\n\tif ( ! title?.rendered ) {\n\t\t/* translators: %s is the index of the menu in the list of menus. */\n\t\treturn sprintf( __( '(no title %s)' ), id );\n\t}\n\n\tif ( status === 'publish' ) {\n\t\treturn decodeEntities( title?.rendered );\n\t}\n\n\treturn sprintf(\n\t\t// translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).\n\t\t__( '%1$s (%2$s)' ),\n\t\tdecodeEntities( title?.rendered ),\n\t\tstatus\n\t);\n}\n"]}
|