@wordpress/edit-site 5.0.0 → 5.1.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 +12 -1
- package/build/components/block-editor/index.js +3 -2
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/editor/index.js +4 -16
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +20 -5
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/border-panel.js +0 -1
- package/build/components/global-styles/border-panel.js.map +1 -1
- package/build/components/global-styles/custom-css.js +1 -0
- package/build/components/global-styles/custom-css.js.map +1 -1
- package/build/components/global-styles/global-styles-provider.js +3 -2
- package/build/components/global-styles/global-styles-provider.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +0 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-block.js +2 -6
- package/build/components/global-styles/screen-block.js.map +1 -1
- package/build/components/global-styles/screen-border.js +4 -0
- package/build/components/global-styles/screen-border.js.map +1 -1
- package/build/components/global-styles/screen-button-color.js +0 -2
- package/build/components/global-styles/screen-button-color.js.map +1 -1
- package/build/components/global-styles/screen-colors.js +4 -0
- package/build/components/global-styles/screen-colors.js.map +1 -1
- package/build/components/global-styles/screen-heading-color.js +1 -3
- package/build/components/global-styles/screen-heading-color.js.map +1 -1
- package/build/components/global-styles/screen-layout.js +4 -0
- package/build/components/global-styles/screen-layout.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +0 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-root.js +7 -2
- package/build/components/global-styles/screen-root.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +0 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography.js +4 -0
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-utils.js +17 -5
- package/build/components/global-styles/typography-utils.js.map +1 -1
- package/build/components/global-styles/utils.js +11 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/header-edit-mode/document-actions/index.js +10 -41
- package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build/components/layout/index.js +52 -83
- package/build/components/layout/index.js.map +1 -1
- package/build/components/sidebar/index.js +5 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +3 -1
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/build/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -31
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +3 -22
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/site-hub/index.js +149 -0
- package/build/components/site-hub/index.js.map +1 -0
- package/build/components/use-edited-entity-record/index.js +60 -0
- package/build/components/use-edited-entity-record/index.js.map +1 -0
- package/build/hooks/index.js +2 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +144 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build/index.js +5 -0
- package/build/index.js.map +1 -1
- package/build-module/components/block-editor/index.js +3 -2
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -12
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +19 -5
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/border-panel.js +0 -1
- package/build-module/components/global-styles/border-panel.js.map +1 -1
- package/build-module/components/global-styles/custom-css.js +1 -0
- package/build-module/components/global-styles/custom-css.js.map +1 -1
- package/build-module/components/global-styles/global-styles-provider.js +3 -2
- package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +0 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-block.js +2 -5
- package/build-module/components/global-styles/screen-block.js.map +1 -1
- package/build-module/components/global-styles/screen-border.js +3 -0
- package/build-module/components/global-styles/screen-border.js.map +1 -1
- package/build-module/components/global-styles/screen-button-color.js +0 -2
- package/build-module/components/global-styles/screen-button-color.js.map +1 -1
- package/build-module/components/global-styles/screen-colors.js +3 -0
- package/build-module/components/global-styles/screen-colors.js.map +1 -1
- package/build-module/components/global-styles/screen-heading-color.js +1 -3
- package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
- package/build-module/components/global-styles/screen-layout.js +3 -0
- package/build-module/components/global-styles/screen-layout.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +0 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-root.js +8 -3
- package/build-module/components/global-styles/screen-root.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +0 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography.js +3 -0
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-utils.js +17 -5
- package/build-module/components/global-styles/typography-utils.js.map +1 -1
- package/build-module/components/global-styles/utils.js +9 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/header-edit-mode/document-actions/index.js +10 -38
- package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
- package/build-module/components/layout/index.js +51 -81
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +4 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +3 -1
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +11 -1
- package/build-module/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +2 -27
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -23
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +126 -0
- package/build-module/components/site-hub/index.js.map +1 -0
- package/build-module/components/use-edited-entity-record/index.js +48 -0
- package/build-module/components/use-edited-entity-record/index.js.map +1 -0
- package/build-module/hooks/index.js +1 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +132 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -0
- package/build-module/index.js +4 -0
- package/build-module/index.js.map +1 -1
- package/build-style/style-rtl.css +106 -113
- package/build-style/style.css +106 -113
- package/package.json +30 -29
- package/src/components/block-editor/index.js +3 -5
- package/src/components/editor/index.js +1 -16
- package/src/components/global-styles/block-preview-panel.js +24 -9
- package/src/components/global-styles/border-panel.js +0 -1
- package/src/components/global-styles/custom-css.js +1 -0
- package/src/components/global-styles/global-styles-provider.js +11 -5
- package/src/components/global-styles/screen-background-color.js +0 -1
- package/src/components/global-styles/screen-block.js +1 -4
- package/src/components/global-styles/screen-border.js +2 -0
- package/src/components/global-styles/screen-button-color.js +0 -2
- package/src/components/global-styles/screen-colors.js +3 -0
- package/src/components/global-styles/screen-heading-color.js +1 -3
- package/src/components/global-styles/screen-layout.js +2 -0
- package/src/components/global-styles/screen-link-color.js +0 -1
- package/src/components/global-styles/screen-root.js +34 -27
- package/src/components/global-styles/screen-text-color.js +0 -1
- package/src/components/global-styles/screen-typography.js +3 -0
- package/src/components/global-styles/test/typography-utils.js +72 -23
- package/src/components/global-styles/typography-utils.js +24 -4
- package/src/components/global-styles/utils.js +10 -1
- package/src/components/header-edit-mode/document-actions/index.js +18 -37
- package/src/components/header-edit-mode/style.scss +1 -0
- package/src/components/layout/index.js +122 -165
- package/src/components/layout/style.scss +70 -63
- package/src/components/list/style.scss +1 -8
- package/src/components/sidebar/index.js +4 -1
- package/src/components/sidebar-edit-mode/index.js +1 -1
- package/src/components/sidebar-edit-mode/navigation-menu-sidebar/navigation-menu.js +10 -0
- package/src/components/sidebar-navigation-screen/style.scss +2 -4
- package/src/components/sidebar-navigation-screen-main/index.js +1 -29
- package/src/components/sidebar-navigation-screen-templates/index.js +9 -27
- package/src/components/site-hub/index.js +150 -0
- package/src/components/site-hub/style.scss +31 -0
- package/src/components/use-edited-entity-record/index.js +37 -0
- package/src/hooks/index.js +1 -0
- package/src/hooks/push-changes-to-global-styles/index.js +162 -0
- package/src/hooks/push-changes-to-global-styles/style.scss +4 -0
- package/src/index.js +2 -0
- package/src/style.scss +2 -0
- package/build/components/site-title/index.js +0 -55
- package/build/components/site-title/index.js.map +0 -1
- package/build-module/components/site-title/index.js +0 -43
- package/build-module/components/site-title/index.js.map +0 -1
- package/src/components/site-title/index.js +0 -39
|
@@ -3,50 +3,22 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import {
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
|
-
__experimentalHStack as HStack,
|
|
7
6
|
__experimentalNavigatorButton as NavigatorButton,
|
|
8
|
-
Button,
|
|
9
7
|
} from '@wordpress/components';
|
|
10
8
|
import { __ } from '@wordpress/i18n';
|
|
11
9
|
import { layout, symbolFilled } from '@wordpress/icons';
|
|
12
|
-
import { useDispatch } from '@wordpress/data';
|
|
13
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
14
10
|
|
|
15
11
|
/**
|
|
16
12
|
* Internal dependencies
|
|
17
13
|
*/
|
|
18
14
|
import SidebarNavigationScreen from '../sidebar-navigation-screen';
|
|
19
15
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
20
|
-
import { useLocation } from '../routes';
|
|
21
|
-
import { store as editSiteStore } from '../../store';
|
|
22
|
-
import getIsListPage from '../../utils/get-is-list-page';
|
|
23
16
|
|
|
24
17
|
export default function SidebarNavigationScreenMain() {
|
|
25
|
-
const { params } = useLocation();
|
|
26
|
-
const isListPage = getIsListPage( params );
|
|
27
|
-
const isEditorPage = ! isListPage;
|
|
28
|
-
const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
|
|
29
|
-
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
30
|
-
|
|
31
18
|
return (
|
|
32
19
|
<SidebarNavigationScreen
|
|
33
20
|
path="/"
|
|
34
|
-
title={
|
|
35
|
-
<HStack justify="space-between" style={ { minHeight: 36 } }>
|
|
36
|
-
<div>{ __( 'Design' ) }</div>
|
|
37
|
-
{ ! isMobileViewport && isEditorPage && (
|
|
38
|
-
<Button
|
|
39
|
-
className="edit-site-layout__edit-button"
|
|
40
|
-
label={ __( 'Open the editor' ) }
|
|
41
|
-
onClick={ () => {
|
|
42
|
-
__unstableSetCanvasMode( 'edit' );
|
|
43
|
-
} }
|
|
44
|
-
>
|
|
45
|
-
{ __( 'Edit' ) }
|
|
46
|
-
</Button>
|
|
47
|
-
) }
|
|
48
|
-
</HStack>
|
|
49
|
-
}
|
|
21
|
+
title={ __( 'Design' ) }
|
|
50
22
|
content={
|
|
51
23
|
<ItemGroup>
|
|
52
24
|
<NavigatorButton
|
|
@@ -4,10 +4,9 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__experimentalItemGroup as ItemGroup,
|
|
6
6
|
__experimentalHStack as HStack,
|
|
7
|
-
Button,
|
|
8
7
|
} from '@wordpress/components';
|
|
9
8
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
9
|
+
import { useSelect } from '@wordpress/data';
|
|
11
10
|
import { useEntityRecords } from '@wordpress/core-data';
|
|
12
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
12
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -20,7 +19,6 @@ import { useLink } from '../routes/link';
|
|
|
20
19
|
import SidebarNavigationItem from '../sidebar-navigation-item';
|
|
21
20
|
import { useLocation } from '../routes';
|
|
22
21
|
import { store as editSiteStore } from '../../store';
|
|
23
|
-
import getIsListPage from '../../utils/get-is-list-page';
|
|
24
22
|
import AddNewTemplate from '../add-new-template';
|
|
25
23
|
|
|
26
24
|
function omit( object, keys ) {
|
|
@@ -62,10 +60,7 @@ export default function SidebarNavigationScreenTemplates( {
|
|
|
62
60
|
postType = 'wp_template',
|
|
63
61
|
} ) {
|
|
64
62
|
const { params } = useLocation();
|
|
65
|
-
const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
|
|
66
63
|
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
67
|
-
const isListPage = getIsListPage( params );
|
|
68
|
-
const isEditorPage = ! isListPage;
|
|
69
64
|
|
|
70
65
|
// Ideally the URL params would be enough.
|
|
71
66
|
// Loading the editor should ideally redirect to the home page
|
|
@@ -125,31 +120,18 @@ export default function SidebarNavigationScreenTemplates( {
|
|
|
125
120
|
path={ config[ postType ].path }
|
|
126
121
|
parentTitle={ __( 'Design' ) }
|
|
127
122
|
title={
|
|
128
|
-
<HStack
|
|
123
|
+
<HStack justify="space-between">
|
|
129
124
|
<div style={ { flexShrink: 0 } }>
|
|
130
125
|
{ config[ postType ].labels.title }
|
|
131
126
|
</div>
|
|
132
127
|
{ ! isMobileViewport && (
|
|
133
|
-
<
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
/>
|
|
141
|
-
{ isEditorPage && (
|
|
142
|
-
<Button
|
|
143
|
-
className="edit-site-layout__edit-button"
|
|
144
|
-
label={ __( 'Open the editor' ) }
|
|
145
|
-
onClick={ () => {
|
|
146
|
-
__unstableSetCanvasMode( 'edit' );
|
|
147
|
-
} }
|
|
148
|
-
>
|
|
149
|
-
{ __( 'Edit' ) }
|
|
150
|
-
</Button>
|
|
151
|
-
) }
|
|
152
|
-
</HStack>
|
|
128
|
+
<AddNewTemplate
|
|
129
|
+
templateType={ postType }
|
|
130
|
+
toggleProps={ {
|
|
131
|
+
className:
|
|
132
|
+
'edit-site-sidebar-navigation-screen-templates__add-button',
|
|
133
|
+
} }
|
|
134
|
+
/>
|
|
153
135
|
) }
|
|
154
136
|
</HStack>
|
|
155
137
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import classnames from 'classnames';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
+
import {
|
|
11
|
+
Button,
|
|
12
|
+
__unstableMotion as motion,
|
|
13
|
+
__experimentalHStack as HStack,
|
|
14
|
+
__experimentalVStack as VStack,
|
|
15
|
+
} from '@wordpress/components';
|
|
16
|
+
import { useReducedMotion, useViewportMatch } from '@wordpress/compose';
|
|
17
|
+
import { __ } from '@wordpress/i18n';
|
|
18
|
+
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
19
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
import { store as editSiteStore } from '../../store';
|
|
25
|
+
import { useLocation } from '../routes';
|
|
26
|
+
import getIsListPage from '../../utils/get-is-list-page';
|
|
27
|
+
import SiteIcon from '../site-icon';
|
|
28
|
+
import useEditedEntityRecord from '../use-edited-entity-record';
|
|
29
|
+
|
|
30
|
+
const HUB_ANIMATION_DURATION = 0.3;
|
|
31
|
+
|
|
32
|
+
function SiteHub( {
|
|
33
|
+
className,
|
|
34
|
+
isMobileCanvasVisible,
|
|
35
|
+
setIsMobileCanvasVisible,
|
|
36
|
+
} ) {
|
|
37
|
+
const { params } = useLocation();
|
|
38
|
+
const isListPage = getIsListPage( params );
|
|
39
|
+
const isEditorPage = ! isListPage;
|
|
40
|
+
const { canvasMode, dashboardLink, entityConfig } = useSelect(
|
|
41
|
+
( select ) => {
|
|
42
|
+
select( editSiteStore ).getEditedPostType();
|
|
43
|
+
const { __unstableGetCanvasMode, getSettings, getEditedPostType } =
|
|
44
|
+
select( editSiteStore );
|
|
45
|
+
return {
|
|
46
|
+
canvasMode: __unstableGetCanvasMode(),
|
|
47
|
+
dashboardLink: getSettings().__experimentalDashboardLink,
|
|
48
|
+
entityConfig: select( coreStore ).getEntityConfig(
|
|
49
|
+
'postType',
|
|
50
|
+
getEditedPostType()
|
|
51
|
+
),
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
[]
|
|
55
|
+
);
|
|
56
|
+
const disableMotion = useReducedMotion();
|
|
57
|
+
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
58
|
+
const { __unstableSetCanvasMode } = useDispatch( editSiteStore );
|
|
59
|
+
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
60
|
+
const showEditButton =
|
|
61
|
+
( isEditorPage && canvasMode === 'view' && ! isMobileViewport ) ||
|
|
62
|
+
( isMobileViewport && canvasMode === 'view' && isMobileCanvasVisible );
|
|
63
|
+
const isBackToDashboardButton =
|
|
64
|
+
( ! isMobileViewport && canvasMode === 'view' ) ||
|
|
65
|
+
( isMobileViewport && ! isMobileCanvasVisible );
|
|
66
|
+
const showLabels = canvasMode !== 'edit';
|
|
67
|
+
const siteIconButtonProps = isBackToDashboardButton
|
|
68
|
+
? {
|
|
69
|
+
href: dashboardLink || 'index.php',
|
|
70
|
+
'aria-label': __( 'Go back to the dashboard' ),
|
|
71
|
+
}
|
|
72
|
+
: {
|
|
73
|
+
label: __( 'Open Navigation Sidebar' ),
|
|
74
|
+
onClick: () => {
|
|
75
|
+
clearSelectedBlock();
|
|
76
|
+
setIsMobileCanvasVisible( false );
|
|
77
|
+
__unstableSetCanvasMode( 'view' );
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
const { getTitle } = useEditedEntityRecord();
|
|
81
|
+
|
|
82
|
+
return (
|
|
83
|
+
<motion.div
|
|
84
|
+
className={ classnames( 'edit-site-site-hub', className ) }
|
|
85
|
+
layout
|
|
86
|
+
transition={ {
|
|
87
|
+
type: 'tween',
|
|
88
|
+
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
89
|
+
ease: 'easeOut',
|
|
90
|
+
} }
|
|
91
|
+
>
|
|
92
|
+
<HStack
|
|
93
|
+
justify="flex-start"
|
|
94
|
+
className="edit-site-site-hub__text-content"
|
|
95
|
+
>
|
|
96
|
+
<motion.div
|
|
97
|
+
className="edit-site-site-hub__view-mode-toggle-container"
|
|
98
|
+
layout
|
|
99
|
+
transition={ {
|
|
100
|
+
type: 'tween',
|
|
101
|
+
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
102
|
+
ease: 'easeOut',
|
|
103
|
+
} }
|
|
104
|
+
>
|
|
105
|
+
<Button
|
|
106
|
+
{ ...siteIconButtonProps }
|
|
107
|
+
className="edit-site-layout__view-mode-toggle"
|
|
108
|
+
>
|
|
109
|
+
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
110
|
+
</Button>
|
|
111
|
+
</motion.div>
|
|
112
|
+
|
|
113
|
+
{ showLabels && (
|
|
114
|
+
<VStack spacing={ 0 }>
|
|
115
|
+
<div className="edit-site-site-hub__title">
|
|
116
|
+
{ getTitle() }
|
|
117
|
+
</div>
|
|
118
|
+
<div className="edit-site-site-hub__post-type">
|
|
119
|
+
{ entityConfig?.label }
|
|
120
|
+
</div>
|
|
121
|
+
</VStack>
|
|
122
|
+
) }
|
|
123
|
+
</HStack>
|
|
124
|
+
|
|
125
|
+
{ showEditButton && (
|
|
126
|
+
<Button
|
|
127
|
+
className="edit-site-site-hub__edit-button"
|
|
128
|
+
label={ __( 'Open the editor' ) }
|
|
129
|
+
onClick={ () => {
|
|
130
|
+
__unstableSetCanvasMode( 'edit' );
|
|
131
|
+
} }
|
|
132
|
+
variant="primary"
|
|
133
|
+
>
|
|
134
|
+
{ __( 'Edit' ) }
|
|
135
|
+
</Button>
|
|
136
|
+
) }
|
|
137
|
+
|
|
138
|
+
{ isMobileViewport && ! isMobileCanvasVisible && (
|
|
139
|
+
<Button
|
|
140
|
+
onClick={ () => setIsMobileCanvasVisible( true ) }
|
|
141
|
+
variant="primary"
|
|
142
|
+
>
|
|
143
|
+
{ __( 'View Editor' ) }
|
|
144
|
+
</Button>
|
|
145
|
+
) }
|
|
146
|
+
</motion.div>
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export default SiteHub;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.edit-site-site-hub {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: $grid-unit-10;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.edit-site-site-hub__edit-button {
|
|
9
|
+
height: $grid-unit-40;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.edit-site-site-hub__post-type {
|
|
13
|
+
opacity: 0.6;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.edit-site-site-hub__view-mode-toggle-container {
|
|
17
|
+
height: $header-height;
|
|
18
|
+
width: $header-height;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.edit-site-site-hub__text-content {
|
|
23
|
+
// Necessary for the ellipsis to work.
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.edit-site-site-hub__title {
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
white-space: nowrap;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect } from '@wordpress/data';
|
|
5
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
6
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
7
|
+
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Internal dependencies
|
|
11
|
+
*/
|
|
12
|
+
import { store as editSiteStore } from '../../store';
|
|
13
|
+
|
|
14
|
+
export default function useEditedEntityRecord() {
|
|
15
|
+
const { record, title, isLoaded } = useSelect( ( select ) => {
|
|
16
|
+
const { getEditedPostType, getEditedPostId } = select( editSiteStore );
|
|
17
|
+
const { getEditedEntityRecord } = select( coreStore );
|
|
18
|
+
const { __experimentalGetTemplateInfo: getTemplateInfo } =
|
|
19
|
+
select( editorStore );
|
|
20
|
+
const postType = getEditedPostType();
|
|
21
|
+
const postId = getEditedPostId();
|
|
22
|
+
const _record = getEditedEntityRecord( 'postType', postType, postId );
|
|
23
|
+
const _isLoaded = !! postId;
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
record: _record,
|
|
27
|
+
title: getTemplateInfo( _record ).title,
|
|
28
|
+
isLoaded: _isLoaded,
|
|
29
|
+
};
|
|
30
|
+
}, [] );
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
isLoaded,
|
|
34
|
+
record,
|
|
35
|
+
getTitle: () => ( title ? decodeEntities( title ) : null ),
|
|
36
|
+
};
|
|
37
|
+
}
|
package/src/hooks/index.js
CHANGED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { get, set } from 'lodash';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* WordPress dependencies
|
|
8
|
+
*/
|
|
9
|
+
import { addFilter } from '@wordpress/hooks';
|
|
10
|
+
import { createHigherOrderComponent } from '@wordpress/compose';
|
|
11
|
+
import {
|
|
12
|
+
InspectorAdvancedControls,
|
|
13
|
+
store as blockEditorStore,
|
|
14
|
+
} from '@wordpress/block-editor';
|
|
15
|
+
import { BaseControl, Button } from '@wordpress/components';
|
|
16
|
+
import { __, sprintf } from '@wordpress/i18n';
|
|
17
|
+
import {
|
|
18
|
+
__EXPERIMENTAL_STYLE_PROPERTY as STYLE_PROPERTY,
|
|
19
|
+
getBlockType,
|
|
20
|
+
} from '@wordpress/blocks';
|
|
21
|
+
import { useContext, useMemo, useCallback } from '@wordpress/element';
|
|
22
|
+
import { useDispatch } from '@wordpress/data';
|
|
23
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Internal dependencies
|
|
27
|
+
*/
|
|
28
|
+
import { getSupportedGlobalStylesPanels } from '../../components/global-styles/hooks';
|
|
29
|
+
import { GlobalStylesContext } from '../../components/global-styles/context';
|
|
30
|
+
import {
|
|
31
|
+
STYLE_PATH_TO_CSS_VAR_INFIX,
|
|
32
|
+
STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE,
|
|
33
|
+
} from '../../components/global-styles/utils';
|
|
34
|
+
|
|
35
|
+
function getChangesToPush( name, attributes ) {
|
|
36
|
+
return getSupportedGlobalStylesPanels( name ).flatMap( ( key ) => {
|
|
37
|
+
if ( ! STYLE_PROPERTY[ key ] ) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const { value: path } = STYLE_PROPERTY[ key ];
|
|
41
|
+
const presetAttributeKey = path.join( '.' );
|
|
42
|
+
const presetAttributeValue =
|
|
43
|
+
attributes[
|
|
44
|
+
STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]
|
|
45
|
+
];
|
|
46
|
+
const value = presetAttributeValue
|
|
47
|
+
? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`
|
|
48
|
+
: get( attributes.style, path );
|
|
49
|
+
return value ? [ { path, value } ] : [];
|
|
50
|
+
} );
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function cloneDeep( object ) {
|
|
54
|
+
return ! object ? {} : JSON.parse( JSON.stringify( object ) );
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function PushChangesToGlobalStylesControl( {
|
|
58
|
+
name,
|
|
59
|
+
attributes,
|
|
60
|
+
setAttributes,
|
|
61
|
+
} ) {
|
|
62
|
+
const changes = useMemo(
|
|
63
|
+
() => getChangesToPush( name, attributes ),
|
|
64
|
+
[ name, attributes ]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const { user: userConfig, setUserConfig } =
|
|
68
|
+
useContext( GlobalStylesContext );
|
|
69
|
+
|
|
70
|
+
const { __unstableMarkNextChangeAsNotPersistent } =
|
|
71
|
+
useDispatch( blockEditorStore );
|
|
72
|
+
const { createSuccessNotice } = useDispatch( noticesStore );
|
|
73
|
+
|
|
74
|
+
const pushChanges = useCallback( () => {
|
|
75
|
+
if ( changes.length === 0 ) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const { style: blockStyles } = attributes;
|
|
80
|
+
|
|
81
|
+
const newBlockStyles = cloneDeep( blockStyles );
|
|
82
|
+
const newUserConfig = cloneDeep( userConfig );
|
|
83
|
+
|
|
84
|
+
for ( const { path, value } of changes ) {
|
|
85
|
+
set( newBlockStyles, path, undefined );
|
|
86
|
+
set( newUserConfig, [ 'styles', 'blocks', name, ...path ], value );
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// @wordpress/core-data doesn't support editing multiple entity types in
|
|
90
|
+
// a single undo level. So for now, we disable @wordpress/core-data undo
|
|
91
|
+
// tracking and implement our own Undo button in the snackbar
|
|
92
|
+
// notification.
|
|
93
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
94
|
+
setAttributes( { style: newBlockStyles } );
|
|
95
|
+
setUserConfig( () => newUserConfig, { undoIgnore: true } );
|
|
96
|
+
|
|
97
|
+
createSuccessNotice(
|
|
98
|
+
sprintf(
|
|
99
|
+
// translators: %s: Title of the block e.g. 'Heading'.
|
|
100
|
+
__( 'Pushed styles to all %s blocks.' ),
|
|
101
|
+
getBlockType( name ).title
|
|
102
|
+
),
|
|
103
|
+
{
|
|
104
|
+
type: 'snackbar',
|
|
105
|
+
actions: [
|
|
106
|
+
{
|
|
107
|
+
label: __( 'Undo' ),
|
|
108
|
+
onClick() {
|
|
109
|
+
__unstableMarkNextChangeAsNotPersistent();
|
|
110
|
+
setAttributes( { style: blockStyles } );
|
|
111
|
+
setUserConfig( () => userConfig, {
|
|
112
|
+
undoIgnore: true,
|
|
113
|
+
} );
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
],
|
|
117
|
+
}
|
|
118
|
+
);
|
|
119
|
+
}, [ changes, attributes, userConfig, name ] );
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<BaseControl
|
|
123
|
+
className="edit-site-push-changes-to-global-styles-control"
|
|
124
|
+
help={ sprintf(
|
|
125
|
+
// translators: %s: Title of the block e.g. 'Heading'.
|
|
126
|
+
__(
|
|
127
|
+
'Move this block’s typography, spacing, dimensions, and color styles to all %s blocks.'
|
|
128
|
+
),
|
|
129
|
+
getBlockType( name ).title
|
|
130
|
+
) }
|
|
131
|
+
>
|
|
132
|
+
<BaseControl.VisualLabel>
|
|
133
|
+
{ __( 'Styles' ) }
|
|
134
|
+
</BaseControl.VisualLabel>
|
|
135
|
+
<Button
|
|
136
|
+
variant="primary"
|
|
137
|
+
disabled={ changes.length === 0 }
|
|
138
|
+
onClick={ pushChanges }
|
|
139
|
+
>
|
|
140
|
+
{ __( 'Push changes to Global Styles' ) }
|
|
141
|
+
</Button>
|
|
142
|
+
</BaseControl>
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const withPushChangesToGlobalStyles = createHigherOrderComponent(
|
|
147
|
+
( BlockEdit ) => ( props ) =>
|
|
148
|
+
(
|
|
149
|
+
<>
|
|
150
|
+
<BlockEdit { ...props } />
|
|
151
|
+
<InspectorAdvancedControls>
|
|
152
|
+
<PushChangesToGlobalStylesControl { ...props } />
|
|
153
|
+
</InspectorAdvancedControls>
|
|
154
|
+
</>
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
addFilter(
|
|
159
|
+
'editor.BlockEdit',
|
|
160
|
+
'core/edit-site/push-changes-to-global-styles',
|
|
161
|
+
withPushChangesToGlobalStyles
|
|
162
|
+
);
|
package/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
16
16
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
17
17
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
18
18
|
import { addFilter } from '@wordpress/hooks';
|
|
19
|
+
import { registerLegacyWidgetBlock } from '@wordpress/widgets';
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* Internal dependencies
|
|
@@ -109,6 +110,7 @@ export function initializeEditor( id, settings ) {
|
|
|
109
110
|
|
|
110
111
|
dispatch( blocksStore ).__experimentalReapplyBlockTypeFilters();
|
|
111
112
|
registerCoreBlocks();
|
|
113
|
+
registerLegacyWidgetBlock( { inserter: false } );
|
|
112
114
|
if ( process.env.IS_GUTENBERG_PLUGIN ) {
|
|
113
115
|
__experimentalRegisterExperimentalCoreBlocks( {
|
|
114
116
|
enableFSEBlocks: true,
|
package/src/style.scss
CHANGED
|
@@ -22,8 +22,10 @@
|
|
|
22
22
|
@import "./components/sidebar-navigation-item/style.scss";
|
|
23
23
|
@import "./components/sidebar-navigation-screen/style.scss";
|
|
24
24
|
@import "./components/sidebar-navigation-screen-templates/style.scss";
|
|
25
|
+
@import "./components/site-hub/style.scss";
|
|
25
26
|
@import "./components/site-icon/style.scss";
|
|
26
27
|
@import "./components/style-book/style.scss";
|
|
28
|
+
@import "./hooks/push-changes-to-global-styles/style.scss";
|
|
27
29
|
|
|
28
30
|
html #wpadminbar {
|
|
29
31
|
display: none;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
|
|
10
|
-
var _element = require("@wordpress/element");
|
|
11
|
-
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
|
|
14
|
-
var _data = require("@wordpress/data");
|
|
15
|
-
|
|
16
|
-
var _coreData = require("@wordpress/core-data");
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* External dependencies
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* WordPress dependencies
|
|
24
|
-
*/
|
|
25
|
-
function SiteTitle(_ref) {
|
|
26
|
-
let {
|
|
27
|
-
className
|
|
28
|
-
} = _ref;
|
|
29
|
-
const {
|
|
30
|
-
isRequestingSite,
|
|
31
|
-
siteTitle
|
|
32
|
-
} = (0, _data.useSelect)(select => {
|
|
33
|
-
const {
|
|
34
|
-
getEntityRecord,
|
|
35
|
-
isResolving
|
|
36
|
-
} = select(_coreData.store);
|
|
37
|
-
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
|
|
38
|
-
return {
|
|
39
|
-
isRequestingSite: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
|
|
40
|
-
siteTitle: siteData.name
|
|
41
|
-
};
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
44
|
-
if (isRequestingSite && !siteTitle) {
|
|
45
|
-
return null;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return (0, _element.createElement)("div", {
|
|
49
|
-
className: (0, _classnames.default)(className, 'edit-site-site-title')
|
|
50
|
-
}, siteTitle);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var _default = SiteTitle;
|
|
54
|
-
exports.default = _default;
|
|
55
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-title/index.js"],"names":["SiteTitle","className","isRequestingSite","siteTitle","select","getEntityRecord","isResolving","coreDataStore","siteData","undefined","name"],"mappings":";;;;;;;;;;;AAGA;;AAKA;;AACA;;AATA;AACA;AACA;;AAGA;AACA;AACA;AAIA,SAASA,SAAT,OAAoC;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AACnC,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAkC,qBAAaC,MAAF,IAAc;AAChE,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAEG,eAAF,CAA/C;AACA,UAAMC,QAAQ,GACbH,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BI,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNP,MAAAA,gBAAgB,EAAEI,WAAW,CAAE,MAAF,EAAU,iBAAV,EAA6B,CACzD,MADyD,EAEzD,gBAFyD,EAGzDG,SAHyD,CAA7B,CADvB;AAMNN,MAAAA,SAAS,EAAEK,QAAQ,CAACE;AANd,KAAP;AAQA,GAbuC,EAarC,EAbqC,CAAxC;;AAeA,MAAKR,gBAAgB,IAAI,CAAEC,SAA3B,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAG,yBAAYF,SAAZ,EAAuB,sBAAvB;AAAjB,KACGE,SADH,CADD;AAKA;;eAEcH,S","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\nfunction SiteTitle( { className } ) {\n\tconst { isRequestingSite, siteTitle } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tisRequestingSite: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteTitle: siteData.name,\n\t\t};\n\t}, [] );\n\n\tif ( isRequestingSite && ! siteTitle ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className={ classnames( className, 'edit-site-site-title' ) }>\n\t\t\t{ siteTitle }\n\t\t</div>\n\t);\n}\n\nexport default SiteTitle;\n"]}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { createElement } from "@wordpress/element";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* External dependencies
|
|
5
|
-
*/
|
|
6
|
-
import classnames from 'classnames';
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { useSelect } from '@wordpress/data';
|
|
12
|
-
import { store as coreDataStore } from '@wordpress/core-data';
|
|
13
|
-
|
|
14
|
-
function SiteTitle(_ref) {
|
|
15
|
-
let {
|
|
16
|
-
className
|
|
17
|
-
} = _ref;
|
|
18
|
-
const {
|
|
19
|
-
isRequestingSite,
|
|
20
|
-
siteTitle
|
|
21
|
-
} = useSelect(select => {
|
|
22
|
-
const {
|
|
23
|
-
getEntityRecord,
|
|
24
|
-
isResolving
|
|
25
|
-
} = select(coreDataStore);
|
|
26
|
-
const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
|
|
27
|
-
return {
|
|
28
|
-
isRequestingSite: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
|
|
29
|
-
siteTitle: siteData.name
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
|
-
if (isRequestingSite && !siteTitle) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return createElement("div", {
|
|
38
|
-
className: classnames(className, 'edit-site-site-title')
|
|
39
|
-
}, siteTitle);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export default SiteTitle;
|
|
43
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/site-title/index.js"],"names":["classnames","useSelect","store","coreDataStore","SiteTitle","className","isRequestingSite","siteTitle","select","getEntityRecord","isResolving","siteData","undefined","name"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;;AAEA,SAASC,SAAT,OAAoC;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AACnC,QAAM;AAAEC,IAAAA,gBAAF;AAAoBC,IAAAA;AAApB,MAAkCN,SAAS,CAAIO,MAAF,IAAc;AAChE,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAEL,aAAF,CAA/C;AACA,UAAMQ,QAAQ,GACbF,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BG,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNN,MAAAA,gBAAgB,EAAEI,WAAW,CAAE,MAAF,EAAU,iBAAV,EAA6B,CACzD,MADyD,EAEzD,gBAFyD,EAGzDE,SAHyD,CAA7B,CADvB;AAMNL,MAAAA,SAAS,EAAEI,QAAQ,CAACE;AANd,KAAP;AAQA,GAbgD,EAa9C,EAb8C,CAAjD;;AAeA,MAAKP,gBAAgB,IAAI,CAAEC,SAA3B,EAAuC;AACtC,WAAO,IAAP;AACA;;AAED,SACC;AAAK,IAAA,SAAS,EAAGP,UAAU,CAAEK,SAAF,EAAa,sBAAb;AAA3B,KACGE,SADH,CADD;AAKA;;AAED,eAAeH,SAAf","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreDataStore } from '@wordpress/core-data';\n\nfunction SiteTitle( { className } ) {\n\tconst { isRequestingSite, siteTitle } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tisRequestingSite: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteTitle: siteData.name,\n\t\t};\n\t}, [] );\n\n\tif ( isRequestingSite && ! siteTitle ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<div className={ classnames( className, 'edit-site-site-title' ) }>\n\t\t\t{ siteTitle }\n\t\t</div>\n\t);\n}\n\nexport default SiteTitle;\n"]}
|