@wordpress/edit-site 6.0.0 → 6.0.1
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/build/components/block-editor/inserter-media-categories.js +1 -1
- package/build/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build/components/editor/index.js +52 -59
- package/build/components/editor/index.js.map +1 -1
- package/build/components/editor/use-editor-title.js +39 -0
- package/build/components/editor/use-editor-title.js.map +1 -0
- package/build/components/global-styles/screen-css.js +1 -1
- package/build/components/global-styles/screen-css.js.map +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build/components/global-styles/variations/variations-color.js +1 -1
- package/build/components/global-styles/variations/variations-color.js.map +1 -1
- package/build/components/global-styles-sidebar/index.js +2 -0
- package/build/components/global-styles-sidebar/index.js.map +1 -1
- package/build/components/layout/index.js +16 -59
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-patterns/index.js +5 -5
- package/build/components/page-patterns/index.js.map +1 -1
- package/build/components/pagination/index.js +17 -8
- package/build/components/pagination/index.js.map +1 -1
- package/build/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +1 -1
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/site-hub/index.js +38 -128
- package/build/components/site-hub/index.js.map +1 -1
- package/build/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build/store/private-actions.js +33 -18
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js +1 -1
- package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
- package/build-module/components/editor/index.js +52 -59
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/editor/use-editor-title.js +31 -0
- package/build-module/components/editor/use-editor-title.js.map +1 -0
- package/build-module/components/global-styles/screen-css.js +1 -1
- package/build-module/components/global-styles/screen-css.js.map +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
- package/build-module/components/global-styles/variations/variations-color.js +2 -2
- package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
- package/build-module/components/global-styles-sidebar/index.js +2 -0
- package/build-module/components/global-styles-sidebar/index.js.map +1 -1
- package/build-module/components/layout/index.js +18 -61
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-patterns/index.js +5 -5
- package/build-module/components/page-patterns/index.js.map +1 -1
- package/build-module/components/pagination/index.js +17 -8
- package/build-module/components/pagination/index.js.map +1 -1
- package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
- package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +40 -130
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
- package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
- package/build-module/store/private-actions.js +33 -18
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +43 -85
- package/build-style/style.css +43 -85
- package/package.json +41 -41
- package/src/components/block-editor/inserter-media-categories.js +1 -3
- package/src/components/block-editor/style.scss +11 -0
- package/src/components/editor/index.js +67 -95
- package/src/components/editor/style.scss +1 -5
- package/src/components/editor/use-editor-title.js +35 -0
- package/src/components/global-styles/screen-css.js +1 -1
- package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
- package/src/components/global-styles/screen-revisions/style.scss +4 -8
- package/src/components/global-styles/variations/variations-color.js +6 -3
- package/src/components/global-styles-sidebar/index.js +2 -0
- package/src/components/layout/index.js +17 -67
- package/src/components/layout/style.scss +18 -58
- package/src/components/page-patterns/index.js +15 -12
- package/src/components/pagination/index.js +21 -16
- package/src/components/sidebar-dataviews/dataview-item.js +6 -2
- package/src/components/sidebar-navigation-screen/index.js +1 -1
- package/src/components/sidebar-navigation-screen/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
- package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
- package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
- package/src/components/site-hub/index.js +55 -146
- package/src/components/site-hub/style.scss +1 -4
- package/src/components/site-icon/style.scss +0 -4
- package/src/hooks/push-changes-to-global-styles/index.js +1 -0
- package/src/store/private-actions.js +58 -30
|
@@ -7,19 +7,11 @@ import clsx from 'clsx';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
10
|
-
import {
|
|
11
|
-
Button,
|
|
12
|
-
__unstableMotion as motion,
|
|
13
|
-
__unstableAnimatePresence as AnimatePresence,
|
|
14
|
-
__experimentalHStack as HStack,
|
|
15
|
-
} from '@wordpress/components';
|
|
16
|
-
import { useReducedMotion } from '@wordpress/compose';
|
|
10
|
+
import { Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
17
11
|
import { __ } from '@wordpress/i18n';
|
|
18
|
-
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
19
12
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
21
13
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
22
|
-
import { memo } from '@wordpress/element';
|
|
14
|
+
import { memo, forwardRef } from '@wordpress/element';
|
|
23
15
|
import { search } from '@wordpress/icons';
|
|
24
16
|
import { store as commandsStore } from '@wordpress/commands';
|
|
25
17
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
@@ -32,14 +24,10 @@ import { store as editSiteStore } from '../../store';
|
|
|
32
24
|
import SiteIcon from '../site-icon';
|
|
33
25
|
import { unlock } from '../../lock-unlock';
|
|
34
26
|
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
( select ) => {
|
|
40
|
-
const { getCanvasMode, getSettings } = unlock(
|
|
41
|
-
select( editSiteStore )
|
|
42
|
-
);
|
|
27
|
+
const SiteHub = memo(
|
|
28
|
+
forwardRef( ( { isTransparent }, ref ) => {
|
|
29
|
+
const { dashboardLink, homeUrl, siteTitle } = useSelect( ( select ) => {
|
|
30
|
+
const { getSettings } = unlock( select( editSiteStore ) );
|
|
43
31
|
|
|
44
32
|
const {
|
|
45
33
|
getSite,
|
|
@@ -47,7 +35,6 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
|
|
|
47
35
|
} = select( coreStore );
|
|
48
36
|
const _site = getSite();
|
|
49
37
|
return {
|
|
50
|
-
canvasMode: getCanvasMode(),
|
|
51
38
|
dashboardLink:
|
|
52
39
|
getSettings().__experimentalDashboardLink || 'index.php',
|
|
53
40
|
homeUrl: getUnstableBase()?.home,
|
|
@@ -56,141 +43,63 @@ const SiteHub = memo( ( { isTransparent, className } ) => {
|
|
|
56
43
|
? filterURLForDisplay( _site?.url )
|
|
57
44
|
: _site?.title,
|
|
58
45
|
};
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
);
|
|
62
|
-
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
63
|
-
|
|
64
|
-
const disableMotion = useReducedMotion();
|
|
65
|
-
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
66
|
-
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
67
|
-
const { setDeviceType } = useDispatch( editorStore );
|
|
68
|
-
const isBackToDashboardButton = canvasMode === 'view';
|
|
69
|
-
const siteIconButtonProps = isBackToDashboardButton
|
|
70
|
-
? {
|
|
71
|
-
href: dashboardLink,
|
|
72
|
-
label: __( 'Go to the Dashboard' ),
|
|
73
|
-
}
|
|
74
|
-
: {
|
|
75
|
-
href: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
|
|
76
|
-
role: 'button',
|
|
77
|
-
label: __( 'Open Navigation' ),
|
|
78
|
-
onClick: ( event ) => {
|
|
79
|
-
event.preventDefault();
|
|
80
|
-
if ( canvasMode === 'edit' ) {
|
|
81
|
-
clearSelectedBlock();
|
|
82
|
-
setDeviceType( 'Desktop' );
|
|
83
|
-
setCanvasMode( 'view' );
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
};
|
|
46
|
+
}, [] );
|
|
47
|
+
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
87
48
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
transition={ {
|
|
99
|
-
type: 'tween',
|
|
100
|
-
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
101
|
-
ease: 'easeOut',
|
|
102
|
-
} }
|
|
103
|
-
>
|
|
104
|
-
<HStack justify="flex-start" spacing="0">
|
|
105
|
-
<motion.div
|
|
106
|
-
className={ clsx(
|
|
107
|
-
'edit-site-site-hub__view-mode-toggle-container',
|
|
108
|
-
{
|
|
109
|
-
'has-transparent-background': isTransparent,
|
|
110
|
-
}
|
|
111
|
-
) }
|
|
112
|
-
layout
|
|
113
|
-
transition={ {
|
|
114
|
-
type: 'tween',
|
|
115
|
-
duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
|
|
116
|
-
ease: 'easeOut',
|
|
117
|
-
} }
|
|
118
|
-
>
|
|
119
|
-
<Button
|
|
120
|
-
{ ...siteIconButtonProps }
|
|
121
|
-
className="edit-site-layout__view-mode-toggle"
|
|
49
|
+
return (
|
|
50
|
+
<div className="edit-site-site-hub">
|
|
51
|
+
<HStack justify="flex-start" spacing="0">
|
|
52
|
+
<div
|
|
53
|
+
className={ clsx(
|
|
54
|
+
'edit-site-site-hub__view-mode-toggle-container',
|
|
55
|
+
{
|
|
56
|
+
'has-transparent-background': isTransparent,
|
|
57
|
+
}
|
|
58
|
+
) }
|
|
122
59
|
>
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
transition={ {
|
|
132
|
-
type: 'tween',
|
|
133
|
-
duration: disableMotion
|
|
134
|
-
? 0
|
|
135
|
-
: HUB_ANIMATION_DURATION,
|
|
136
|
-
ease: 'easeOut',
|
|
60
|
+
<Button
|
|
61
|
+
ref={ ref }
|
|
62
|
+
href={ dashboardLink }
|
|
63
|
+
label={ __( 'Go to the Dashboard' ) }
|
|
64
|
+
className="edit-site-layout__view-mode-toggle"
|
|
65
|
+
style={ {
|
|
66
|
+
transform: 'scale(0.5)',
|
|
67
|
+
borderRadius: 4,
|
|
137
68
|
} }
|
|
138
69
|
>
|
|
139
70
|
<SiteIcon className="edit-site-layout__view-mode-toggle-icon" />
|
|
140
|
-
</
|
|
141
|
-
</
|
|
142
|
-
</motion.div>
|
|
71
|
+
</Button>
|
|
72
|
+
</div>
|
|
143
73
|
|
|
144
|
-
|
|
145
|
-
|
|
74
|
+
<HStack>
|
|
75
|
+
<div className="edit-site-site-hub__title">
|
|
76
|
+
<Button
|
|
77
|
+
variant="link"
|
|
78
|
+
href={ homeUrl }
|
|
79
|
+
target="_blank"
|
|
80
|
+
label={ __( 'View site (opens in a new tab)' ) }
|
|
81
|
+
>
|
|
82
|
+
{ decodeEntities( siteTitle ) }
|
|
83
|
+
</Button>
|
|
84
|
+
</div>
|
|
146
85
|
<HStack
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
opacity: isTransparent ? 0 : 1,
|
|
151
|
-
} }
|
|
152
|
-
exit={ { opacity: 0 } }
|
|
153
|
-
transition={ {
|
|
154
|
-
type: 'tween',
|
|
155
|
-
duration: disableMotion ? 0 : 0.2,
|
|
156
|
-
ease: 'easeOut',
|
|
157
|
-
delay: canvasMode === 'view' ? 0.1 : 0,
|
|
158
|
-
} }
|
|
86
|
+
spacing={ 0 }
|
|
87
|
+
expanded={ false }
|
|
88
|
+
className="edit-site-site-hub__actions"
|
|
159
89
|
>
|
|
160
|
-
<
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
) }
|
|
168
|
-
aria-label={ __(
|
|
169
|
-
'View site (opens in a new tab)'
|
|
170
|
-
) }
|
|
171
|
-
>
|
|
172
|
-
{ decodeEntities( siteTitle ) }
|
|
173
|
-
</Button>
|
|
174
|
-
</div>
|
|
175
|
-
<HStack
|
|
176
|
-
spacing={ 0 }
|
|
177
|
-
expanded={ false }
|
|
178
|
-
className="edit-site-site-hub__actions"
|
|
179
|
-
>
|
|
180
|
-
<Button
|
|
181
|
-
className="edit-site-site-hub_toggle-command-center"
|
|
182
|
-
icon={ search }
|
|
183
|
-
onClick={ () => openCommandCenter() }
|
|
184
|
-
label={ __( 'Open command palette' ) }
|
|
185
|
-
shortcut={ displayShortcut.primary( 'k' ) }
|
|
186
|
-
/>
|
|
187
|
-
</HStack>
|
|
90
|
+
<Button
|
|
91
|
+
className="edit-site-site-hub_toggle-command-center"
|
|
92
|
+
icon={ search }
|
|
93
|
+
onClick={ () => openCommandCenter() }
|
|
94
|
+
label={ __( 'Open command palette' ) }
|
|
95
|
+
shortcut={ displayShortcut.primary( 'k' ) }
|
|
96
|
+
/>
|
|
188
97
|
</HStack>
|
|
189
|
-
|
|
190
|
-
</
|
|
191
|
-
</
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
|
|
98
|
+
</HStack>
|
|
99
|
+
</HStack>
|
|
100
|
+
</div>
|
|
101
|
+
);
|
|
102
|
+
} )
|
|
103
|
+
);
|
|
195
104
|
|
|
196
105
|
export default SiteHub;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: space-between;
|
|
5
5
|
gap: $grid-unit-10;
|
|
6
|
+
margin-right: $grid-unit-15;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.edit-site-site-hub__actions {
|
|
@@ -14,10 +15,6 @@
|
|
|
14
15
|
width: $header-height;
|
|
15
16
|
flex-shrink: 0;
|
|
16
17
|
|
|
17
|
-
.edit-site-layout__view-mode-toggle-icon {
|
|
18
|
-
background: $gray-900;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
18
|
&.has-transparent-background .edit-site-layout__view-mode-toggle-icon {
|
|
22
19
|
background: transparent;
|
|
23
20
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
.edit-site-site-icon__icon {
|
|
2
2
|
fill: currentColor;
|
|
3
|
-
// Matches SiteIcon motion, smoothing out the transition.
|
|
4
|
-
transition: padding 0.3s ease-out;
|
|
5
|
-
@include reduce-motion("transition");
|
|
6
3
|
|
|
7
4
|
.edit-site-layout.is-full-canvas & {
|
|
8
5
|
// Make the WordPress icon not so big in full canvas.
|
|
@@ -13,7 +10,6 @@
|
|
|
13
10
|
.edit-site-site-icon__image {
|
|
14
11
|
width: 100%;
|
|
15
12
|
height: 100%;
|
|
16
|
-
border-radius: $radius-block-ui * 2;
|
|
17
13
|
object-fit: cover;
|
|
18
14
|
background: #333;
|
|
19
15
|
|
|
@@ -13,39 +13,67 @@ import { store as editorStore } from '@wordpress/editor';
|
|
|
13
13
|
export const setCanvasMode =
|
|
14
14
|
( mode ) =>
|
|
15
15
|
( { registry, dispatch } ) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
16
|
+
const switchCanvasMode = () => {
|
|
17
|
+
registry.batch( () => {
|
|
18
|
+
const isMediumOrBigger =
|
|
19
|
+
window.matchMedia( '(min-width: 782px)' ).matches;
|
|
20
|
+
registry.dispatch( blockEditorStore ).clearSelectedBlock();
|
|
21
|
+
registry.dispatch( editorStore ).setDeviceType( 'Desktop' );
|
|
22
|
+
registry
|
|
23
|
+
.dispatch( blockEditorStore )
|
|
24
|
+
.__unstableSetEditorMode( 'edit' );
|
|
25
|
+
const isPublishSidebarOpened = registry
|
|
26
|
+
.select( editorStore )
|
|
27
|
+
.isPublishSidebarOpened();
|
|
28
|
+
dispatch( {
|
|
29
|
+
type: 'SET_CANVAS_MODE',
|
|
30
|
+
mode,
|
|
31
|
+
} );
|
|
32
|
+
const isEditMode = mode === 'edit';
|
|
33
|
+
if ( isPublishSidebarOpened && ! isEditMode ) {
|
|
34
|
+
registry.dispatch( editorStore ).closePublishSidebar();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Check if the block list view should be open by default.
|
|
38
|
+
// If `distractionFree` mode is enabled, the block list view should not be open.
|
|
39
|
+
// This behavior is disabled for small viewports.
|
|
40
|
+
if (
|
|
41
|
+
isMediumOrBigger &&
|
|
42
|
+
isEditMode &&
|
|
43
|
+
registry
|
|
44
|
+
.select( preferencesStore )
|
|
45
|
+
.get( 'core', 'showListViewByDefault' ) &&
|
|
46
|
+
! registry
|
|
47
|
+
.select( preferencesStore )
|
|
48
|
+
.get( 'core', 'distractionFree' )
|
|
49
|
+
) {
|
|
50
|
+
registry
|
|
51
|
+
.dispatch( editorStore )
|
|
52
|
+
.setIsListViewOpened( true );
|
|
53
|
+
} else {
|
|
54
|
+
registry
|
|
55
|
+
.dispatch( editorStore )
|
|
56
|
+
.setIsListViewOpened( false );
|
|
57
|
+
}
|
|
58
|
+
registry.dispatch( editorStore ).setIsInserterOpened( false );
|
|
59
|
+
} );
|
|
60
|
+
};
|
|
30
61
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
// This behavior is disabled for small viewports.
|
|
34
|
-
if (
|
|
35
|
-
isMediumOrBigger &&
|
|
36
|
-
isEditMode &&
|
|
37
|
-
registry
|
|
38
|
-
.select( preferencesStore )
|
|
39
|
-
.get( 'core', 'showListViewByDefault' ) &&
|
|
40
|
-
! registry
|
|
41
|
-
.select( preferencesStore )
|
|
42
|
-
.get( 'core', 'distractionFree' )
|
|
43
|
-
) {
|
|
44
|
-
registry.dispatch( editorStore ).setIsListViewOpened( true );
|
|
62
|
+
if ( ! document.startViewTransition ) {
|
|
63
|
+
switchCanvasMode();
|
|
45
64
|
} else {
|
|
46
|
-
|
|
65
|
+
document.documentElement.classList.add(
|
|
66
|
+
`canvas-mode-${ mode }-transition`
|
|
67
|
+
);
|
|
68
|
+
const transition = document.startViewTransition( () =>
|
|
69
|
+
switchCanvasMode()
|
|
70
|
+
);
|
|
71
|
+
transition.finished.finally( () => {
|
|
72
|
+
document.documentElement.classList.remove(
|
|
73
|
+
`canvas-mode-${ mode }-transition`
|
|
74
|
+
);
|
|
75
|
+
} );
|
|
47
76
|
}
|
|
48
|
-
registry.dispatch( editorStore ).setIsInserterOpened( false );
|
|
49
77
|
};
|
|
50
78
|
|
|
51
79
|
/**
|