@wordpress/edit-site 5.3.1 → 5.3.3
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 +1 -0
- package/build/components/add-new-template/new-template-part.js +8 -5
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +8 -5
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +3 -3
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/block-editor/index.js +3 -3
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +26 -38
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +10 -12
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +2 -2
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +2 -2
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/context-menu.js +9 -2
- package/build/components/global-styles/context-menu.js.map +1 -1
- package/build/components/global-styles/custom-css.js +2 -2
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/dimensions-panel.js +2 -2
- package/build/components/global-styles/dimensions-panel.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +2 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +2 -2
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build/components/global-styles/header.js +1 -1
- package/build/components/global-styles/header.js.map +1 -1
- package/build/components/global-styles/hooks.js +2 -2
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/navigation-button.js +1 -1
- package/build/components/global-styles/navigation-button.js.map +1 -1
- package/build/components/global-styles/palette.js +2 -2
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/preview.js +2 -2
- package/build/components/global-styles/preview.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +2 -2
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-border.js +0 -6
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +2 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +2 -2
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-css.js +5 -5
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-effects.js +53 -0
- package/build/components/global-styles/screen-effects.js.map +1 -0
- package/build/components/global-styles/screen-heading-color.js +2 -2
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +2 -2
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +2 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-style-variations.js +2 -2
- package/build/components/global-styles/screen-style-variations.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +2 -2
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +2 -2
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/shadow-panel.js +3 -3
- package/build/components/global-styles/shadow-panel.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +2 -2
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/typography-preview.js +2 -2
- package/build/components/global-styles/typography-preview.js.map +1 -1
- package/build/components/global-styles/ui.js +10 -10
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles-renderer/index.js +2 -2
- package/build/components/global-styles-renderer/index.js.map +1 -1
- package/build/components/header-edit-mode/index.js +6 -3
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/layout/index.js +13 -24
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/actions/rename-menu-item.js +1 -1
- package/build/components/list/actions/rename-menu-item.js.map +1 -1
- package/build/components/list/table.js +1 -0
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-inspector/navigation-menu.js +2 -2
- package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build/components/save-panel/index.js +78 -0
- package/build/components/save-panel/index.js.map +1 -0
- package/build/components/sidebar/index.js +42 -5
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +28 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +72 -0
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-template/index.js +70 -0
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build/components/sidebar-navigation-screen-templates/index.js +32 -82
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +43 -0
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build/components/site-hub/index.js +14 -49
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/style-book/index.js +10 -3
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -20
- package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +3 -3
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +12 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +6 -2
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +2 -2
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/{experiments.js → private-apis.js} +3 -3
- package/build/private-apis.js.map +1 -0
- package/build/store/index.js +3 -3
- package/build/store/index.js.map +1 -1
- package/build/utils/get-is-list-page.js +5 -6
- package/build/utils/get-is-list-page.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +7 -4
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +7 -4
- 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/index.js +3 -3
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +28 -41
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +10 -11
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +3 -3
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +3 -3
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/context-menu.js +9 -3
- package/build-module/components/global-styles/context-menu.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +3 -3
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/dimensions-panel.js +3 -3
- package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -3
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +3 -3
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/header.js +2 -2
- package/build-module/components/global-styles/header.js.map +1 -1
- package/build-module/components/global-styles/hooks.js +3 -3
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/navigation-button.js +2 -2
- package/build-module/components/global-styles/navigation-button.js.map +1 -1
- package/build-module/components/global-styles/palette.js +3 -3
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/preview.js +3 -3
- package/build-module/components/global-styles/preview.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +3 -3
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +0 -5
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +3 -3
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +3 -3
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-css.js +5 -5
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-effects.js +35 -0
- package/build-module/components/global-styles/screen-effects.js.map +1 -0
- package/build-module/components/global-styles/screen-heading-color.js +3 -3
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +3 -3
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +3 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-style-variations.js +3 -3
- package/build-module/components/global-styles/screen-style-variations.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +3 -3
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -3
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/shadow-panel.js +4 -4
- package/build-module/components/global-styles/shadow-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +3 -3
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/typography-preview.js +3 -3
- package/build-module/components/global-styles/typography-preview.js.map +1 -1
- package/build-module/components/global-styles/ui.js +10 -11
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles-renderer/index.js +3 -3
- package/build-module/components/global-styles-renderer/index.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +6 -3
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/layout/index.js +12 -24
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/actions/rename-menu-item.js +1 -1
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
- package/build-module/components/list/table.js +1 -0
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +3 -3
- package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
- package/build-module/components/save-panel/index.js +64 -0
- package/build-module/components/save-panel/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +36 -5
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +27 -9
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +55 -0
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-template/index.js +53 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-templates/index.js +34 -81
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -0
- package/build-module/components/site-hub/index.js +14 -46
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/style-book/index.js +11 -4
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +55 -21
- package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
- package/build-module/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +11 -11
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +6 -2
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +3 -3
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/{experiments.js → private-apis.js} +2 -2
- package/build-module/private-apis.js.map +1 -0
- package/build-module/store/index.js +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/utils/get-is-list-page.js +5 -6
- package/build-module/utils/get-is-list-page.js.map +1 -1
- package/build-style/style-rtl.css +100 -62
- package/build-style/style.css +100 -62
- package/package.json +20 -20
- package/src/components/add-new-template/new-template-part.js +7 -4
- package/src/components/add-new-template/new-template.js +8 -6
- package/src/components/block-editor/editor-canvas.js +1 -1
- package/src/components/block-editor/index.js +3 -3
- package/src/components/editor/index.js +32 -71
- package/src/components/editor/style.scss +2 -2
- package/src/components/global-styles/block-preview-panel.js +8 -12
- package/src/components/global-styles/border-panel.js +3 -3
- package/src/components/global-styles/color-palette-panel.js +3 -3
- package/src/components/global-styles/context-menu.js +14 -2
- package/src/components/global-styles/custom-css.js +3 -3
- package/src/components/global-styles/dimensions-panel.js +3 -3
- package/src/components/global-styles/global-styles-provider.js +3 -3
- package/src/components/global-styles/gradients-palette-panel.js +3 -3
- package/src/components/global-styles/header.js +2 -2
- package/src/components/global-styles/hooks.js +3 -3
- package/src/components/global-styles/navigation-button.js +4 -2
- package/src/components/global-styles/palette.js +3 -3
- package/src/components/global-styles/preview.js +3 -3
- package/src/components/global-styles/screen-background-color.js +3 -3
- package/src/components/global-styles/screen-border.js +0 -5
- package/src/components/global-styles/screen-button-color.js +3 -3
- package/src/components/global-styles/screen-colors.js +3 -3
- package/src/components/global-styles/screen-css.js +14 -7
- package/src/components/global-styles/screen-effects.js +28 -0
- package/src/components/global-styles/screen-heading-color.js +3 -3
- package/src/components/global-styles/screen-link-color.js +3 -3
- package/src/components/global-styles/screen-root.js +3 -3
- package/src/components/global-styles/screen-style-variations.js +3 -3
- package/src/components/global-styles/screen-text-color.js +3 -3
- package/src/components/global-styles/screen-typography.js +3 -3
- package/src/components/global-styles/shadow-panel.js +4 -4
- package/src/components/global-styles/style.scss +2 -5
- package/src/components/global-styles/typography-panel.js +3 -3
- package/src/components/global-styles/typography-preview.js +3 -3
- package/src/components/global-styles/ui.js +8 -8
- package/src/components/global-styles-renderer/index.js +3 -3
- package/src/components/header-edit-mode/index.js +6 -3
- package/src/components/keyboard-shortcut-help-modal/config.js +1 -1
- package/src/components/layout/index.js +38 -48
- package/src/components/layout/style.scss +36 -26
- package/src/components/list/actions/rename-menu-item.js +1 -1
- package/src/components/list/table.js +4 -0
- package/src/components/navigation-inspector/navigation-menu.js +3 -3
- package/src/components/save-panel/index.js +68 -0
- package/src/components/save-panel/style.scss +5 -0
- package/src/components/sidebar/index.js +36 -8
- package/src/components/sidebar/style.scss +15 -0
- package/src/components/sidebar-navigation-screen/index.js +27 -11
- package/src/components/sidebar-navigation-screen/style.scss +4 -6
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +52 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +1 -1
- package/src/components/sidebar-navigation-screen-template/index.js +52 -0
- package/src/components/sidebar-navigation-screen-templates/index.js +49 -83
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +31 -0
- package/src/components/site-hub/index.js +67 -122
- package/src/components/site-hub/style.scss +1 -10
- package/src/components/style-book/index.js +11 -7
- package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +48 -14
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
- package/src/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js → use-sync-path-with-url.js} +10 -10
- package/src/components/use-edited-entity-record/index.js +6 -2
- package/src/hooks/push-changes-to-global-styles/index.js +3 -3
- package/src/{experiments.js → private-apis.js} +1 -1
- package/src/store/index.js +1 -1
- package/src/style.scss +1 -0
- package/src/utils/get-is-list-page.js +5 -5
- package/build/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build/experiments.js.map +0 -1
- package/build-module/components/sync-state-with-url/use-sync-sidebar-path-with-url.js.map +0 -1
- package/build-module/experiments.js.map +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
8
|
+
import { Button } from '@wordpress/components';
|
|
9
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
10
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
16
|
+
import { unlock } from '../../private-apis';
|
|
17
|
+
import { store as editSiteStore } from '../../store';
|
|
18
|
+
export default function SidebarNavigationScreenNavigationItem() {
|
|
19
|
+
var _post$title, _post$description;
|
|
20
|
+
|
|
21
|
+
const {
|
|
22
|
+
setCanvasMode
|
|
23
|
+
} = unlock(useDispatch(editSiteStore));
|
|
24
|
+
const {
|
|
25
|
+
post
|
|
26
|
+
} = useSelect(select => {
|
|
27
|
+
var _getEditedPostContext;
|
|
28
|
+
|
|
29
|
+
const {
|
|
30
|
+
getEditedPostContext
|
|
31
|
+
} = select(editSiteStore);
|
|
32
|
+
const {
|
|
33
|
+
getEntityRecord
|
|
34
|
+
} = select(coreStore);
|
|
35
|
+
const {
|
|
36
|
+
postType,
|
|
37
|
+
postId
|
|
38
|
+
} = (_getEditedPostContext = getEditedPostContext()) !== null && _getEditedPostContext !== void 0 ? _getEditedPostContext : {}; // The currently selected entity to display.
|
|
39
|
+
// Typically template or template part in the site editor.
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
post: postId && postType ? getEntityRecord('postType', postType, postId) : null
|
|
43
|
+
};
|
|
44
|
+
}, []);
|
|
45
|
+
return createElement(SidebarNavigationScreen, {
|
|
46
|
+
path: "/navigation/single",
|
|
47
|
+
title: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$title = post.title) === null || _post$title === void 0 ? void 0 : _post$title.rendered) : null,
|
|
48
|
+
actions: createElement(Button, {
|
|
49
|
+
variant: "primary",
|
|
50
|
+
onClick: () => setCanvasMode('edit')
|
|
51
|
+
}, __('Edit')),
|
|
52
|
+
content: post ? decodeEntities(post === null || post === void 0 ? void 0 : (_post$description = post.description) === null || _post$description === void 0 ? void 0 : _post$description.rendered) : null
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js"],"names":["__","useDispatch","useSelect","Button","store","coreStore","decodeEntities","SidebarNavigationScreen","unlock","editSiteStore","SidebarNavigationScreenNavigationItem","setCanvasMode","post","select","getEditedPostContext","getEntityRecord","postType","postId","title","rendered","description"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,cAAT,QAA+B,0BAA/B;AA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D,IADD;AAiBA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nexport default function SidebarNavigationScreenNavigationItem() {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\n\tconst { post } = useSelect( ( select ) => {\n\t\tconst { getEditedPostContext } = select( editSiteStore );\n\t\tconst { getEntityRecord } = select( coreStore );\n\t\tconst { postType, postId } = getEditedPostContext() ?? {};\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tpost:\n\t\t\t\tpostId && postType\n\t\t\t\t\t? getEntityRecord( 'postType', postType, postId )\n\t\t\t\t\t: null,\n\t\t};\n\t}, [] );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation/single\"\n\t\t\ttitle={ post ? decodeEntities( post?.title?.rendered ) : null }\n\t\t\tactions={\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\tpost ? decodeEntities( post?.description?.rendered ) : null\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -22,13 +22,13 @@ export default function SidebarNavigationScreenNavigationMenus() {
|
|
|
22
22
|
if (attributes.kind === 'post-type' && attributes.id && attributes.type && history) {
|
|
23
23
|
history.push({
|
|
24
24
|
postType: attributes.type,
|
|
25
|
-
postId: attributes.id
|
|
25
|
+
postId: attributes.id,
|
|
26
|
+
path: '/navigation/single'
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
29
|
}, [history]);
|
|
29
30
|
return createElement(SidebarNavigationScreen, {
|
|
30
31
|
path: "/navigation",
|
|
31
|
-
parentTitle: __('Design'),
|
|
32
32
|
title: __('Navigation'),
|
|
33
33
|
content: createElement("div", {
|
|
34
34
|
className: "edit-site-sidebar-navigation-screen-navigation-menus"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,WAA3B;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAMG,QAAQ,GAAGN,WAAW,CACzBO,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE;
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js"],"names":["__","useCallback","SidebarNavigationScreen","NavigationInspector","useHistory","SidebarNavigationScreenNavigationMenus","history","onSelect","selectedBlock","attributes","kind","id","type","push","postType","postId","path"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,oBAA5B;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,mBAAP,MAAgC,yBAAhC;AACA,SAASC,UAAT,QAA2B,WAA3B;AAEA,eAAe,SAASC,sCAAT,GAAkD;AAChE,QAAMC,OAAO,GAAGF,UAAU,EAA1B;AACA,QAAMG,QAAQ,GAAGN,WAAW,CACzBO,aAAF,IAAqB;AACpB,UAAM;AAAEC,MAAAA;AAAF,QAAiBD,aAAvB;;AACA,QACCC,UAAU,CAACC,IAAX,KAAoB,WAApB,IACAD,UAAU,CAACE,EADX,IAEAF,UAAU,CAACG,IAFX,IAGAN,OAJD,EAKE;AACDA,MAAAA,OAAO,CAACO,IAAR,CAAc;AACbC,QAAAA,QAAQ,EAAEL,UAAU,CAACG,IADR;AAEbG,QAAAA,MAAM,EAAEN,UAAU,CAACE,EAFN;AAGbK,QAAAA,IAAI,EAAE;AAHO,OAAd;AAKA;AACD,GAf0B,EAgB3B,CAAEV,OAAF,CAhB2B,CAA5B;AAkBA,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAC,aADN;AAEC,IAAA,KAAK,EAAGN,EAAE,CAAE,YAAF,CAFX;AAGC,IAAA,OAAO,EACN;AAAK,MAAA,SAAS,EAAC;AAAf,OACC,cAAC,mBAAD;AAAqB,MAAA,QAAQ,EAAGO;AAAhC,MADD;AAJF,IADD;AAWA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useCallback } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport NavigationInspector from '../navigation-inspector';\nimport { useHistory } from '../routes';\n\nexport default function SidebarNavigationScreenNavigationMenus() {\n\tconst history = useHistory();\n\tconst onSelect = useCallback(\n\t\t( selectedBlock ) => {\n\t\t\tconst { attributes } = selectedBlock;\n\t\t\tif (\n\t\t\t\tattributes.kind === 'post-type' &&\n\t\t\t\tattributes.id &&\n\t\t\t\tattributes.type &&\n\t\t\t\thistory\n\t\t\t) {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostType: attributes.type,\n\t\t\t\t\tpostId: attributes.id,\n\t\t\t\t\tpath: '/navigation/single',\n\t\t\t\t} );\n\t\t\t}\n\t\t},\n\t\t[ history ]\n\t);\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath=\"/navigation\"\n\t\t\ttitle={ __( 'Navigation' ) }\n\t\t\tcontent={\n\t\t\t\t<div className=\"edit-site-sidebar-navigation-screen-navigation-menus\">\n\t\t\t\t\t<NavigationInspector onSelect={ onSelect } />\n\t\t\t\t</div>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useDispatch } from '@wordpress/data';
|
|
8
|
+
import { Button } from '@wordpress/components';
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
14
|
+
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
15
|
+
import { unlock } from '../../private-apis';
|
|
16
|
+
import { store as editSiteStore } from '../../store';
|
|
17
|
+
const config = {
|
|
18
|
+
wp_template: {
|
|
19
|
+
path: '/templates/single'
|
|
20
|
+
},
|
|
21
|
+
wp_template_part: {
|
|
22
|
+
path: '/template-parts/single'
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export default function SidebarNavigationScreenTemplate(_ref) {
|
|
26
|
+
let {
|
|
27
|
+
postType = 'wp_template'
|
|
28
|
+
} = _ref;
|
|
29
|
+
const {
|
|
30
|
+
setCanvasMode
|
|
31
|
+
} = unlock(useDispatch(editSiteStore));
|
|
32
|
+
const {
|
|
33
|
+
getDescription,
|
|
34
|
+
getTitle,
|
|
35
|
+
record
|
|
36
|
+
} = useEditedEntityRecord();
|
|
37
|
+
let description = getDescription();
|
|
38
|
+
|
|
39
|
+
if (!description && record.is_custom) {
|
|
40
|
+
description = __('This is a custom template that can be applied manually to any Post or Page.');
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return createElement(SidebarNavigationScreen, {
|
|
44
|
+
path: config[postType].path,
|
|
45
|
+
title: getTitle(),
|
|
46
|
+
actions: createElement(Button, {
|
|
47
|
+
variant: "primary",
|
|
48
|
+
onClick: () => setCanvasMode('edit')
|
|
49
|
+
}, __('Edit')),
|
|
50
|
+
content: description ? createElement("p", null, description) : undefined
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-template/index.js"],"names":["__","useDispatch","Button","SidebarNavigationScreen","useEditedEntityRecord","unlock","store","editSiteStore","config","wp_template","path","wp_template_part","SidebarNavigationScreenTemplate","postType","setCanvasMode","getDescription","getTitle","record","description","is_custom","undefined"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,MAAT,QAAuB,uBAAvB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AACA,OAAOC,qBAAP,MAAkC,6BAAlC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,IAAI,EAAE;AADM,GADC;AAIdC,EAAAA,gBAAgB,EAAE;AACjBD,IAAAA,IAAI,EAAE;AADW;AAJJ,CAAf;AASA,eAAe,SAASE,+BAAT,OAEX;AAAA,MAFqD;AACxDC,IAAAA,QAAQ,GAAG;AAD6C,GAErD;AACH,QAAM;AAAEC,IAAAA;AAAF,MAAoBT,MAAM,CAAEJ,WAAW,CAAEM,aAAF,CAAb,CAAhC;AACA,QAAM;AAAEQ,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA;AAA5B,MAAuCb,qBAAqB,EAAlE;AACA,MAAIc,WAAW,GAAGH,cAAc,EAAhC;;AACA,MAAK,CAAEG,WAAF,IAAiBD,MAAM,CAACE,SAA7B,EAAyC;AACxCD,IAAAA,WAAW,GAAGlB,EAAE,CACf,6EADe,CAAhB;AAGA;;AAED,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAGQ,MAAM,CAAEK,QAAF,CAAN,CAAmBH,IAD3B;AAEC,IAAA,KAAK,EAAGM,QAAQ,EAFjB;AAGC,IAAA,OAAO,EACN,cAAC,MAAD;AACC,MAAA,OAAO,EAAC,SADT;AAEC,MAAA,OAAO,EAAG,MAAMF,aAAa,CAAE,MAAF;AAF9B,OAIGd,EAAE,CAAE,MAAF,CAJL,CAJF;AAWC,IAAA,OAAO,EAAGkB,WAAW,GAAG,yBAAKA,WAAL,CAAH,GAA4BE;AAXlD,IADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport useEditedEntityRecord from '../use-edited-entity-record';\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates/single',\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts/single',\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplate( {\n\tpostType = 'wp_template',\n} ) {\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { getDescription, getTitle, record } = useEditedEntityRecord();\n\tlet description = getDescription();\n\tif ( ! description && record.is_custom ) {\n\t\tdescription = __(\n\t\t\t'This is a custom template that can be applied manually to any Post or Page.'\n\t\t);\n\t}\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ getTitle() }\n\t\t\tactions={\n\t\t\t\t<Button\n\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\tonClick={ () => setCanvasMode( 'edit' ) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Edit' ) }\n\t\t\t\t</Button>\n\t\t\t}\n\t\t\tcontent={ description ? <p>{ description }</p> : undefined }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -4,9 +4,8 @@ import { createElement, Fragment } from "@wordpress/element";
|
|
|
4
4
|
/**
|
|
5
5
|
* WordPress dependencies
|
|
6
6
|
*/
|
|
7
|
-
import { __experimentalItemGroup as ItemGroup } from '@wordpress/components';
|
|
7
|
+
import { __experimentalItemGroup as ItemGroup, __experimentalItem as Item } from '@wordpress/components';
|
|
8
8
|
import { __ } from '@wordpress/i18n';
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
9
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
11
10
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
12
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -17,28 +16,7 @@ import { useViewportMatch } from '@wordpress/compose';
|
|
|
17
16
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
18
17
|
import { useLink } from '../routes/link';
|
|
19
18
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
20
|
-
import { useLocation } from '../routes';
|
|
21
|
-
import { store as editSiteStore } from '../../store';
|
|
22
19
|
import AddNewTemplate from '../add-new-template';
|
|
23
|
-
|
|
24
|
-
function omit(object, keys) {
|
|
25
|
-
return Object.fromEntries(Object.entries(object).filter(_ref => {
|
|
26
|
-
let [key] = _ref;
|
|
27
|
-
return !keys.includes(key);
|
|
28
|
-
}));
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const Item = _ref2 => {
|
|
32
|
-
let {
|
|
33
|
-
item
|
|
34
|
-
} = _ref2;
|
|
35
|
-
const linkInfo = useLink(item.params);
|
|
36
|
-
const props = item.params ? { ...omit(item, 'params'),
|
|
37
|
-
...linkInfo
|
|
38
|
-
} : item;
|
|
39
|
-
return createElement(SidebarNavigationItem, props);
|
|
40
|
-
};
|
|
41
|
-
|
|
42
20
|
const config = {
|
|
43
21
|
wp_template: {
|
|
44
22
|
path: '/templates',
|
|
@@ -59,65 +37,39 @@ const config = {
|
|
|
59
37
|
}
|
|
60
38
|
}
|
|
61
39
|
};
|
|
62
|
-
|
|
40
|
+
|
|
41
|
+
const TemplateItem = _ref => {
|
|
63
42
|
let {
|
|
64
|
-
postType
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
43
|
+
postType,
|
|
44
|
+
postId,
|
|
45
|
+
...props
|
|
46
|
+
} = _ref;
|
|
47
|
+
const linkInfo = useLink({
|
|
48
|
+
postType,
|
|
49
|
+
postId,
|
|
50
|
+
path: config[postType].path + '/single'
|
|
51
|
+
});
|
|
52
|
+
return createElement(SidebarNavigationItem, _extends({}, linkInfo, props));
|
|
53
|
+
};
|
|
72
54
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
} =
|
|
77
|
-
|
|
78
|
-
getEditedPostType,
|
|
79
|
-
getEditedPostId
|
|
80
|
-
} = select(editSiteStore);
|
|
81
|
-
return {
|
|
82
|
-
editedPostId: getEditedPostId(),
|
|
83
|
-
editedPostType: getEditedPostType()
|
|
84
|
-
};
|
|
85
|
-
}, []);
|
|
55
|
+
export default function SidebarNavigationScreenTemplates(_ref2) {
|
|
56
|
+
let {
|
|
57
|
+
postType = 'wp_template'
|
|
58
|
+
} = _ref2;
|
|
59
|
+
const isMobileViewport = useViewportMatch('medium', '<');
|
|
86
60
|
const {
|
|
87
61
|
records: templates,
|
|
88
62
|
isResolving: isLoading
|
|
89
63
|
} = useEntityRecords('postType', postType, {
|
|
90
64
|
per_page: -1
|
|
91
65
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}];
|
|
98
|
-
} else if (!templates && !isLoading) {
|
|
99
|
-
items = [{
|
|
100
|
-
children: config[postType].labels.notFound
|
|
101
|
-
}];
|
|
102
|
-
} else {
|
|
103
|
-
items = templates === null || templates === void 0 ? void 0 : templates.map(template => {
|
|
104
|
-
var _template$title;
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
params: {
|
|
108
|
-
postType,
|
|
109
|
-
postId: template.id
|
|
110
|
-
},
|
|
111
|
-
children: decodeEntities(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug),
|
|
112
|
-
'aria-current': params.postType === postType && params.postId === template.id || // This is a special case for the home page.
|
|
113
|
-
editedPostId === template.id && editedPostType === postType && !!params.postId ? 'page' : undefined
|
|
114
|
-
};
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
|
|
66
|
+
const browseAllLink = useLink({
|
|
67
|
+
postType,
|
|
68
|
+
postId: undefined,
|
|
69
|
+
path: config[postType].path + '/all'
|
|
70
|
+
});
|
|
118
71
|
return createElement(SidebarNavigationScreen, {
|
|
119
72
|
path: config[postType].path,
|
|
120
|
-
parentTitle: __('Design'),
|
|
121
73
|
title: config[postType].labels.title,
|
|
122
74
|
actions: !isMobileViewport && createElement(AddNewTemplate, {
|
|
123
75
|
templateType: postType,
|
|
@@ -125,16 +77,17 @@ export default function SidebarNavigationScreenTemplates(_ref3) {
|
|
|
125
77
|
className: 'edit-site-sidebar-navigation-screen-templates__add-button'
|
|
126
78
|
}
|
|
127
79
|
}),
|
|
128
|
-
content: createElement(Fragment, null, createElement(ItemGroup, null,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
80
|
+
content: createElement(Fragment, null, isLoading && config[postType].labels.loading, !isLoading && createElement(ItemGroup, null, !(templates !== null && templates !== void 0 && templates.length) && createElement(Item, null, config[postType].labels.notFound), (templates !== null && templates !== void 0 ? templates : []).map(template => {
|
|
81
|
+
var _template$title;
|
|
82
|
+
|
|
83
|
+
return createElement(TemplateItem, {
|
|
84
|
+
postType: postType,
|
|
85
|
+
postId: template.id,
|
|
86
|
+
key: template.id
|
|
87
|
+
}, decodeEntities(((_template$title = template.title) === null || _template$title === void 0 ? void 0 : _template$title.rendered) || template.slug));
|
|
88
|
+
}), !isMobileViewport && createElement(SidebarNavigationItem, _extends({
|
|
132
89
|
className: "edit-site-sidebar-navigation-screen-templates__see-all"
|
|
133
|
-
},
|
|
134
|
-
postType,
|
|
135
|
-
postId: undefined
|
|
136
|
-
}), {
|
|
137
|
-
"aria-current": params.postType === postType && !params.postId ? 'page' : undefined,
|
|
90
|
+
}, browseAllLink, {
|
|
138
91
|
children: config[postType].labels.manage
|
|
139
92
|
}))))
|
|
140
93
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates/index.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalItem","Item","__","useEntityRecords","decodeEntities","useViewportMatch","SidebarNavigationScreen","useLink","SidebarNavigationItem","AddNewTemplate","config","wp_template","path","labels","title","loading","notFound","manage","wp_template_part","TemplateItem","postType","postId","props","linkInfo","SidebarNavigationScreenTemplates","isMobileViewport","records","templates","isResolving","isLoading","per_page","browseAllLink","undefined","className","length","map","template","id","rendered","slug"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,kBAAkB,IAAIC,IAFvB,QAGO,uBA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G,CAAEW,SAAF,aAAEA,SAAF,cAAEA,SAAF,GAAe,EAAf,EAAoBQ,GAApB,CAA2BC,QAAF;AAAA;;AAAA,aAC1B,cAAC,YAAD;AACC,QAAA,QAAQ,EAAGhB,QADZ;AAEC,QAAA,MAAM,EAAGgB,QAAQ,CAACC,EAFnB;AAGC,QAAA,GAAG,EAAGD,QAAQ,CAACC;AAHhB,SAKGjC,cAAc,CACf,oBAAAgC,QAAQ,CAACtB,KAAT,oEAAgBwB,QAAhB,KACCF,QAAQ,CAACG,IAFK,CALjB,CAD0B;AAAA,KAAzB,CANH,EAkBG,CAAEd,gBAAF,IACD,cAAC,qBAAD;AACC,MAAA,SAAS,EAAC;AADX,OAEMM,aAFN;AAGC,MAAA,QAAQ,EACPrB,MAAM,CAAEU,QAAF,CAAN,CAAmBP,MAAnB,CAA0BI;AAJ5B,OAnBF,CAHF;AAfF,IADD;AAoDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalItem as Item,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useEntityRecords } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { useLink } from '../routes/link';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport AddNewTemplate from '../add-new-template';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates',\n\t\tlabels: {\n\t\t\ttitle: __( 'Templates' ),\n\t\t\tloading: __( 'Loading templates' ),\n\t\t\tnotFound: __( 'No templates found' ),\n\t\t\tmanage: __( 'Manage all templates' ),\n\t\t},\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts',\n\t\tlabels: {\n\t\t\ttitle: __( 'Template parts' ),\n\t\t\tloading: __( 'Loading template parts' ),\n\t\t\tnotFound: __( 'No template parts found' ),\n\t\t\tmanage: __( 'Manage all template parts' ),\n\t\t},\n\t},\n};\n\nconst TemplateItem = ( { postType, postId, ...props } ) => {\n\tconst linkInfo = useLink( {\n\t\tpostType,\n\t\tpostId,\n\t\tpath: config[ postType ].path + '/single',\n\t} );\n\treturn <SidebarNavigationItem { ...linkInfo } { ...props } />;\n};\n\nexport default function SidebarNavigationScreenTemplates( {\n\tpostType = 'wp_template',\n} ) {\n\tconst isMobileViewport = useViewportMatch( 'medium', '<' );\n\n\tconst { records: templates, isResolving: isLoading } = useEntityRecords(\n\t\t'postType',\n\t\tpostType,\n\t\t{\n\t\t\tper_page: -1,\n\t\t}\n\t);\n\n\tconst browseAllLink = useLink( {\n\t\tpostType,\n\t\tpostId: undefined,\n\t\tpath: config[ postType ].path + '/all',\n\t} );\n\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ config[ postType ].labels.title }\n\t\t\tactions={\n\t\t\t\t! isMobileViewport && (\n\t\t\t\t\t<AddNewTemplate\n\t\t\t\t\t\ttemplateType={ postType }\n\t\t\t\t\t\ttoggleProps={ {\n\t\t\t\t\t\t\tclassName:\n\t\t\t\t\t\t\t\t'edit-site-sidebar-navigation-screen-templates__add-button',\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontent={\n\t\t\t\t<>\n\t\t\t\t\t{ isLoading && config[ postType ].labels.loading }\n\t\t\t\t\t{ ! isLoading && (\n\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t{ ! templates?.length && (\n\t\t\t\t\t\t\t\t<Item>\n\t\t\t\t\t\t\t\t\t{ config[ postType ].labels.notFound }\n\t\t\t\t\t\t\t\t</Item>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t{ ( templates ?? [] ).map( ( template ) => (\n\t\t\t\t\t\t\t\t<TemplateItem\n\t\t\t\t\t\t\t\t\tpostType={ postType }\n\t\t\t\t\t\t\t\t\tpostId={ template.id }\n\t\t\t\t\t\t\t\t\tkey={ template.id }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ decodeEntities(\n\t\t\t\t\t\t\t\t\t\ttemplate.title?.rendered ||\n\t\t\t\t\t\t\t\t\t\t\ttemplate.slug\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t</TemplateItem>\n\t\t\t\t\t\t\t) ) }\n\t\t\t\t\t\t\t{ ! isMobileViewport && (\n\t\t\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-sidebar-navigation-screen-templates__see-all\"\n\t\t\t\t\t\t\t\t\t{ ...browseAllLink }\n\t\t\t\t\t\t\t\t\tchildren={\n\t\t\t\t\t\t\t\t\t\tconfig[ postType ].labels.manage\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
/**
|
|
8
|
+
* Internal dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
12
|
+
const config = {
|
|
13
|
+
wp_template: {
|
|
14
|
+
path: '/templates/all',
|
|
15
|
+
title: __('All templates')
|
|
16
|
+
},
|
|
17
|
+
wp_template_part: {
|
|
18
|
+
path: '/template-parts/all',
|
|
19
|
+
title: __('All template parts')
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export default function SidebarNavigationScreenTemplatesBrowse(_ref) {
|
|
23
|
+
let {
|
|
24
|
+
postType = 'wp_template'
|
|
25
|
+
} = _ref;
|
|
26
|
+
return createElement(SidebarNavigationScreen, {
|
|
27
|
+
path: config[postType].path,
|
|
28
|
+
title: config[postType].title
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js"],"names":["__","SidebarNavigationScreen","config","wp_template","path","title","wp_template_part","SidebarNavigationScreenTemplatesBrowse","postType"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,uBAAP,MAAoC,8BAApC;AAEA,MAAMC,MAAM,GAAG;AACdC,EAAAA,WAAW,EAAE;AACZC,IAAAA,IAAI,EAAE,gBADM;AAEZC,IAAAA,KAAK,EAAEL,EAAE,CAAE,eAAF;AAFG,GADC;AAKdM,EAAAA,gBAAgB,EAAE;AACjBF,IAAAA,IAAI,EAAE,qBADW;AAEjBC,IAAAA,KAAK,EAAEL,EAAE,CAAE,oBAAF;AAFQ;AALJ,CAAf;AAWA,eAAe,SAASO,sCAAT,OAEX;AAAA,MAF4D;AAC/DC,IAAAA,QAAQ,GAAG;AADoD,GAE5D;AACH,SACC,cAAC,uBAAD;AACC,IAAA,IAAI,EAAGN,MAAM,CAAEM,QAAF,CAAN,CAAmBJ,IAD3B;AAEC,IAAA,KAAK,EAAGF,MAAM,CAAEM,QAAF,CAAN,CAAmBH;AAF5B,IADD;AAMA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\n\nconst config = {\n\twp_template: {\n\t\tpath: '/templates/all',\n\t\ttitle: __( 'All templates' ),\n\t},\n\twp_template_part: {\n\t\tpath: '/template-parts/all',\n\t\ttitle: __( 'All template parts' ),\n\t},\n};\n\nexport default function SidebarNavigationScreenTemplatesBrowse( {\n\tpostType = 'wp_template',\n} ) {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tpath={ config[ postType ].path }\n\t\t\ttitle={ config[ postType ].title }\n\t\t/>\n\t);\n}\n"]}
|
|
@@ -10,8 +10,8 @@ import classnames from 'classnames';
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
13
|
-
import { Button, __unstableMotion as motion, __experimentalHStack as HStack
|
|
14
|
-
import { useReducedMotion
|
|
13
|
+
import { Button, __unstableMotion as motion, __experimentalHStack as HStack } from '@wordpress/components';
|
|
14
|
+
import { useReducedMotion } from '@wordpress/compose';
|
|
15
15
|
import { __ } from '@wordpress/i18n';
|
|
16
16
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
17
17
|
import { store as coreStore } from '@wordpress/core-data';
|
|
@@ -21,50 +21,32 @@ import { forwardRef } from '@wordpress/element';
|
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
23
|
import { store as editSiteStore } from '../../store';
|
|
24
|
-
import { useLocation } from '../routes';
|
|
25
|
-
import getIsListPage from '../../utils/get-is-list-page';
|
|
26
24
|
import SiteIcon from '../site-icon';
|
|
27
|
-
import
|
|
28
|
-
import { unlock } from '../../experiments';
|
|
25
|
+
import { unlock } from '../../private-apis';
|
|
29
26
|
const HUB_ANIMATION_DURATION = 0.3;
|
|
30
|
-
const SiteHub = forwardRef((
|
|
31
|
-
let {
|
|
32
|
-
isMobileCanvasVisible,
|
|
33
|
-
setIsMobileCanvasVisible,
|
|
34
|
-
...props
|
|
35
|
-
} = _ref;
|
|
36
|
-
const {
|
|
37
|
-
params
|
|
38
|
-
} = useLocation();
|
|
39
|
-
const isListPage = getIsListPage(params);
|
|
40
|
-
const isEditorPage = !isListPage;
|
|
27
|
+
const SiteHub = forwardRef((props, ref) => {
|
|
41
28
|
const {
|
|
42
29
|
canvasMode,
|
|
43
|
-
dashboardLink
|
|
44
|
-
entityConfig
|
|
30
|
+
dashboardLink
|
|
45
31
|
} = useSelect(select => {
|
|
46
32
|
select(editSiteStore).getEditedPostType();
|
|
47
33
|
const {
|
|
48
34
|
getCanvasMode,
|
|
49
|
-
getSettings
|
|
50
|
-
getEditedPostType
|
|
35
|
+
getSettings
|
|
51
36
|
} = unlock(select(editSiteStore));
|
|
52
37
|
return {
|
|
53
38
|
canvasMode: getCanvasMode(),
|
|
54
|
-
dashboardLink: getSettings().__experimentalDashboardLink
|
|
55
|
-
entityConfig: select(coreStore).getEntityConfig('postType', getEditedPostType())
|
|
39
|
+
dashboardLink: getSettings().__experimentalDashboardLink
|
|
56
40
|
};
|
|
57
41
|
}, []);
|
|
58
42
|
const disableMotion = useReducedMotion();
|
|
59
|
-
const isMobileViewport = useViewportMatch('medium', '<');
|
|
60
43
|
const {
|
|
61
44
|
setCanvasMode
|
|
62
45
|
} = unlock(useDispatch(editSiteStore));
|
|
63
46
|
const {
|
|
64
47
|
clearSelectedBlock
|
|
65
48
|
} = useDispatch(blockEditorStore);
|
|
66
|
-
const
|
|
67
|
-
const isBackToDashboardButton = !isMobileViewport && canvasMode === 'view' || isMobileViewport && !isMobileCanvasVisible;
|
|
49
|
+
const isBackToDashboardButton = canvasMode === 'view';
|
|
68
50
|
const showLabels = canvasMode !== 'edit';
|
|
69
51
|
const siteIconButtonProps = isBackToDashboardButton ? {
|
|
70
52
|
href: dashboardLink || 'index.php',
|
|
@@ -73,13 +55,14 @@ const SiteHub = forwardRef((_ref, ref) => {
|
|
|
73
55
|
label: __('Open Navigation Sidebar'),
|
|
74
56
|
onClick: () => {
|
|
75
57
|
clearSelectedBlock();
|
|
76
|
-
setIsMobileCanvasVisible(false);
|
|
77
58
|
setCanvasMode('view');
|
|
78
59
|
}
|
|
79
60
|
};
|
|
80
|
-
const {
|
|
81
|
-
|
|
82
|
-
|
|
61
|
+
const siteTitle = useSelect(select => {
|
|
62
|
+
var _select$getEntityReco;
|
|
63
|
+
|
|
64
|
+
return (_select$getEntityReco = select(coreStore).getEntityRecord('root', 'site')) === null || _select$getEntityReco === void 0 ? void 0 : _select$getEntityReco.title;
|
|
65
|
+
}, []);
|
|
83
66
|
return createElement(motion.div, _extends({
|
|
84
67
|
ref: ref
|
|
85
68
|
}, props, {
|
|
@@ -106,22 +89,7 @@ const SiteHub = forwardRef((_ref, ref) => {
|
|
|
106
89
|
className: "edit-site-layout__view-mode-toggle"
|
|
107
90
|
}), createElement(SiteIcon, {
|
|
108
91
|
className: "edit-site-layout__view-mode-toggle-icon"
|
|
109
|
-
}))), showLabels && createElement(
|
|
110
|
-
spacing: 0
|
|
111
|
-
}, createElement("div", {
|
|
112
|
-
className: "edit-site-site-hub__title"
|
|
113
|
-
}, getTitle()), createElement("div", {
|
|
114
|
-
className: "edit-site-site-hub__post-type"
|
|
115
|
-
}, entityConfig === null || entityConfig === void 0 ? void 0 : entityConfig.label))), showEditButton && createElement(Button, {
|
|
116
|
-
className: "edit-site-site-hub__edit-button",
|
|
117
|
-
onClick: () => {
|
|
118
|
-
setCanvasMode('edit');
|
|
119
|
-
},
|
|
120
|
-
variant: "primary"
|
|
121
|
-
}, __('Edit')), isMobileViewport && !isMobileCanvasVisible && createElement(Button, {
|
|
122
|
-
onClick: () => setIsMobileCanvasVisible(true),
|
|
123
|
-
variant: "primary"
|
|
124
|
-
}, __('View Editor')));
|
|
92
|
+
}))), showLabels && createElement("div", null, siteTitle)));
|
|
125
93
|
});
|
|
126
94
|
export default SiteHub;
|
|
127
95
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["classnames","useSelect","useDispatch","Button","__unstableMotion","motion","__experimentalHStack","HStack","
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"names":["classnames","useSelect","useDispatch","Button","__unstableMotion","motion","__experimentalHStack","HStack","useReducedMotion","__","store","blockEditorStore","coreStore","forwardRef","editSiteStore","SiteIcon","unlock","HUB_ANIMATION_DURATION","SiteHub","props","ref","canvasMode","dashboardLink","select","getEditedPostType","getCanvasMode","getSettings","__experimentalDashboardLink","disableMotion","setCanvasMode","clearSelectedBlock","isBackToDashboardButton","showLabels","siteIconButtonProps","href","label","onClick","siteTitle","getEntityRecord","title","className","type","duration","ease"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SACCC,MADD,EAECC,gBAAgB,IAAIC,MAFrB,EAGCC,oBAAoB,IAAIC,MAHzB,QAIO,uBAJP;AAKA,SAASC,gBAAT,QAAiC,oBAAjC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,yBAA1C;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,SAASH,KAAK,IAAII,aAAlB,QAAuC,aAAvC;AACA,OAAOC,QAAP,MAAqB,cAArB;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAMC,sBAAsB,GAAG,GAA/B;AAEA,MAAMC,OAAO,GAAGL,UAAU,CAAE,CAAEM,KAAF,EAASC,GAAT,KAAkB;AAC7C,QAAM;AAAEC,IAAAA,UAAF;AAAcC,IAAAA;AAAd,MAAgCrB,SAAS,CAAIsB,MAAF,IAAc;AAC9DA,IAAAA,MAAM,CAAET,aAAF,CAAN,CAAwBU,iBAAxB;AACA,UAAM;AAAEC,MAAAA,aAAF;AAAiBC,MAAAA;AAAjB,QAAiCV,MAAM,CAC5CO,MAAM,CAAET,aAAF,CADsC,CAA7C;AAGA,WAAO;AACNO,MAAAA,UAAU,EAAEI,aAAa,EADnB;AAENH,MAAAA,aAAa,EAAEI,WAAW,GAAGC;AAFvB,KAAP;AAIA,GAT8C,EAS5C,EAT4C,CAA/C;AA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AC;AAHT,KAKC,cAAC,MAAD,CAAQ,GAAR;AACC,IAAA,SAAS,EAAC,gDADX;AAEC,IAAA,MAAM,MAFP;AAGC,IAAA,UAAU,EAAG;AACZF,MAAAA,IAAI,EAAE,OADM;AAEZC,MAAAA,QAAQ,EAAEd,aAAa,GAAG,CAAH,GAAOX,sBAFlB;AAGZ0B,MAAAA,IAAI,EAAE;AAHM;AAHd,KASC,cAAC,MAAD,eACMV,mBADN;AAEC,IAAA,SAAS,EAAC;AAFX,MAIC,cAAC,QAAD;AAAU,IAAA,SAAS,EAAC;AAApB,IAJD,CATD,CALD,EAsBGD,UAAU,IAAI,2BAAOK,SAAP,CAtBjB,CAXD,CADD;AAsCA,CAxEyB,CAA1B;AA0EA,eAAenB,OAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { forwardRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../private-apis';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = forwardRef( ( props, ref ) => {\n\tconst { canvasMode, dashboardLink } = useSelect( ( select ) => {\n\t\tselect( editSiteStore ).getEditedPostType();\n\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\tselect( editSiteStore )\n\t\t);\n\t\treturn {\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tdashboardLink: getSettings().__experimentalDashboardLink,\n\t\t};\n\t}, [] );\n\tconst disableMotion = useReducedMotion();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst showLabels = canvasMode !== 'edit';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink || 'index.php',\n\t\t\t\t'aria-label': __( 'Go back to the dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\tlabel: __( 'Open Navigation Sidebar' ),\n\t\t\t\tonClick: () => {\n\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t},\n\t\t };\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\n\treturn (\n\t\t<motion.div\n\t\t\tref={ ref }\n\t\t\t{ ...props }\n\t\t\tclassName={ classnames( 'edit-site-site-hub', props.className ) }\n\t\t\tlayout\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack\n\t\t\t\tjustify=\"flex-start\"\n\t\t\t\tclassName=\"edit-site-site-hub__text-content\"\n\t\t\t\tspacing=\"0\"\n\t\t\t>\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName=\"edit-site-site-hub__view-mode-toggle-container\"\n\t\t\t\t\tlayout\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t</Button>\n\t\t\t\t</motion.div>\n\n\t\t\t\t{ showLabels && <div>{ siteTitle }</div> }\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"]}
|
|
@@ -11,7 +11,7 @@ import classnames from 'classnames';
|
|
|
11
11
|
import { Button, TabPanel, createSlotFill, __experimentalUseSlotFills as useSlotFills } from '@wordpress/components';
|
|
12
12
|
import { __, sprintf } from '@wordpress/i18n';
|
|
13
13
|
import { getCategories, getBlockTypes, getBlockFromExample, createBlock } from '@wordpress/blocks';
|
|
14
|
-
import { BlockPreview,
|
|
14
|
+
import { BlockPreview, privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
|
|
15
15
|
import { closeSmall } from '@wordpress/icons';
|
|
16
16
|
import { useResizeObserver } from '@wordpress/compose';
|
|
17
17
|
import { useMemo, memo } from '@wordpress/element';
|
|
@@ -19,10 +19,10 @@ import { useMemo, memo } from '@wordpress/element';
|
|
|
19
19
|
* Internal dependencies
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import { unlock } from '../../
|
|
22
|
+
import { unlock } from '../../private-apis';
|
|
23
23
|
const {
|
|
24
24
|
useGlobalStyle
|
|
25
|
-
} = unlock(
|
|
25
|
+
} = unlock(blockEditorPrivateApis);
|
|
26
26
|
const SLOT_FILL_NAME = 'EditSiteStyleBook';
|
|
27
27
|
const {
|
|
28
28
|
Slot: StyleBookSlot,
|
|
@@ -53,7 +53,14 @@ function getExamples() {
|
|
|
53
53
|
level: 5
|
|
54
54
|
})]
|
|
55
55
|
};
|
|
56
|
-
const otherExamples = getBlockTypes().filter(blockType =>
|
|
56
|
+
const otherExamples = getBlockTypes().filter(blockType => {
|
|
57
|
+
const {
|
|
58
|
+
name,
|
|
59
|
+
example,
|
|
60
|
+
supports
|
|
61
|
+
} = blockType;
|
|
62
|
+
return name !== 'core/heading' && !!example && supports.inserter !== false;
|
|
63
|
+
}).map(blockType => ({
|
|
57
64
|
name: blockType.name,
|
|
58
65
|
title: blockType.title,
|
|
59
66
|
category: blockType.category,
|