@wordpress/edit-site 5.12.1 → 5.12.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/build/components/add-new-pattern/index.js +9 -9
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/add-new-template/new-template.js +69 -14
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/create-pattern-modal/index.js +1 -1
- package/build/components/create-pattern-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +1 -1
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/editor/index.js +1 -0
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/ui.js +7 -2
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/header-edit-mode/index.js +36 -9
- package/build/components/header-edit-mode/index.js.map +1 -1
- package/build/components/header-edit-mode/more-menu/index.js +36 -2
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/edit-mode.js +32 -1
- package/build/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build/components/keyboard-shortcuts/register.js +9 -0
- package/build/components/keyboard-shortcuts/register.js.map +1 -1
- package/build/components/layout/index.js +86 -12
- package/build/components/layout/index.js.map +1 -1
- package/build/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build/components/page-library/grid-item.js +11 -7
- package/build/components/page-library/grid-item.js.map +1 -1
- package/build/components/preferences-modal/enable-feature.js +5 -1
- package/build/components/preferences-modal/enable-feature.js.map +1 -1
- package/build/components/preferences-modal/index.js +30 -0
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/sidebar-edit-mode/index.js +4 -2
- package/build/components/sidebar-edit-mode/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +7 -3
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-global-styles/index.js +15 -3
- package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js +1 -1
- package/build/components/sidebar-navigation-screen-library/category-item.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +10 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +14 -3
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +22 -0
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +170 -42
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +2 -1
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +8 -8
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +72 -17
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/create-pattern-modal/index.js +1 -1
- package/build-module/components/create-pattern-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +1 -1
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -0
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/ui.js +8 -3
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/header-edit-mode/index.js +38 -11
- package/build-module/components/header-edit-mode/index.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +35 -3
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js +29 -1
- package/build-module/components/keyboard-shortcuts/edit-mode.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/register.js +9 -0
- package/build-module/components/keyboard-shortcuts/register.js.map +1 -1
- package/build-module/components/layout/index.js +86 -12
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js +9 -3
- package/build-module/components/page-content-focus-manager/back-to-page-notification.js.map +1 -1
- package/build-module/components/page-library/grid-item.js +11 -7
- package/build-module/components/page-library/grid-item.js.map +1 -1
- package/build-module/components/preferences-modal/enable-feature.js +5 -1
- package/build-module/components/preferences-modal/enable-feature.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +27 -0
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/sidebar-edit-mode/index.js +4 -2
- package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +7 -3
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js +14 -3
- package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js +1 -1
- package/build-module/components/sidebar-navigation-screen-library/category-item.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +11 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +14 -4
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +23 -1
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +170 -44
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +2 -1
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +110 -18
- package/build-style/style.css +110 -18
- package/package.json +15 -15
- package/src/components/add-new-pattern/index.js +8 -10
- package/src/components/add-new-template/new-template.js +120 -24
- package/src/components/add-new-template/style.scss +30 -2
- package/src/components/create-pattern-modal/index.js +1 -1
- package/src/components/create-template-part-modal/index.js +1 -1
- package/src/components/editor/index.js +1 -0
- package/src/components/editor/style.scss +4 -0
- package/src/components/global-styles/ui.js +34 -24
- package/src/components/header-edit-mode/index.js +96 -54
- package/src/components/header-edit-mode/more-menu/index.js +52 -7
- package/src/components/keyboard-shortcuts/edit-mode.js +35 -2
- package/src/components/keyboard-shortcuts/register.js +10 -0
- package/src/components/layout/index.js +115 -46
- package/src/components/layout/style.scss +58 -1
- package/src/components/page-content-focus-manager/back-to-page-notification.js +7 -2
- package/src/components/page-library/grid-item.js +9 -9
- package/src/components/page-library/style.scss +2 -2
- package/src/components/preferences-modal/enable-feature.js +5 -2
- package/src/components/preferences-modal/index.js +25 -0
- package/src/components/sidebar-button/style.scss +1 -1
- package/src/components/sidebar-edit-mode/index.js +4 -2
- package/src/components/sidebar-navigation-item/style.scss +1 -1
- package/src/components/sidebar-navigation-screen/index.js +4 -2
- package/src/components/sidebar-navigation-screen/style.scss +2 -1
- package/src/components/sidebar-navigation-screen-details-panel/style.scss +1 -1
- package/src/components/sidebar-navigation-screen-global-styles/index.js +15 -3
- package/src/components/sidebar-navigation-screen-library/category-item.js +1 -1
- package/src/components/sidebar-navigation-screen-library/style.scss +0 -4
- package/src/components/sidebar-navigation-screen-navigation-menu/index.js +1 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +12 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menu/use-navigation-menu-handlers.js +5 -1
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +31 -8
- package/src/components/sidebar-navigation-screen-pattern/style.scss +25 -0
- package/src/components/sidebar-navigation-screen-template/style.scss +15 -15
- package/src/components/site-hub/style.scss +4 -3
- package/src/hooks/commands/use-common-commands.js +20 -1
- package/src/hooks/commands/use-edit-mode-commands.js +155 -36
- package/src/index.js +1 -0
- package/src/store/selectors.js +5 -0
- package/src/store/test/selectors.js +2 -0
- package/src/style.scss +1 -0
|
@@ -12,12 +12,32 @@ import {
|
|
|
12
12
|
__experimentalGrid as Grid,
|
|
13
13
|
__experimentalText as Text,
|
|
14
14
|
__experimentalVStack as VStack,
|
|
15
|
+
Flex,
|
|
16
|
+
Icon,
|
|
15
17
|
} from '@wordpress/components';
|
|
16
18
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
17
19
|
import { useState } from '@wordpress/element';
|
|
18
|
-
import { useDispatch } from '@wordpress/data';
|
|
20
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
19
21
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
archive,
|
|
24
|
+
blockMeta,
|
|
25
|
+
calendar,
|
|
26
|
+
category,
|
|
27
|
+
commentAuthorAvatar,
|
|
28
|
+
edit,
|
|
29
|
+
home,
|
|
30
|
+
layout,
|
|
31
|
+
list,
|
|
32
|
+
media,
|
|
33
|
+
notFound,
|
|
34
|
+
page,
|
|
35
|
+
plus,
|
|
36
|
+
pin,
|
|
37
|
+
postList,
|
|
38
|
+
search,
|
|
39
|
+
tag,
|
|
40
|
+
} from '@wordpress/icons';
|
|
21
41
|
import { __, sprintf } from '@wordpress/i18n';
|
|
22
42
|
import { store as noticesStore } from '@wordpress/notices';
|
|
23
43
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
@@ -56,27 +76,64 @@ const DEFAULT_TEMPLATE_SLUGS = [
|
|
|
56
76
|
'404',
|
|
57
77
|
];
|
|
58
78
|
|
|
59
|
-
|
|
79
|
+
const TEMPLATE_ICONS = {
|
|
80
|
+
'front-page': home,
|
|
81
|
+
home: postList,
|
|
82
|
+
single: pin,
|
|
83
|
+
page,
|
|
84
|
+
archive,
|
|
85
|
+
search,
|
|
86
|
+
404: notFound,
|
|
87
|
+
index: list,
|
|
88
|
+
category,
|
|
89
|
+
author: commentAuthorAvatar,
|
|
90
|
+
taxonomy: blockMeta,
|
|
91
|
+
date: calendar,
|
|
92
|
+
tag,
|
|
93
|
+
attachment: media,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
function TemplateListItem( {
|
|
97
|
+
title,
|
|
98
|
+
direction,
|
|
99
|
+
className,
|
|
100
|
+
description,
|
|
101
|
+
icon,
|
|
102
|
+
onClick,
|
|
103
|
+
children,
|
|
104
|
+
} ) {
|
|
60
105
|
return (
|
|
61
|
-
<Button
|
|
62
|
-
|
|
106
|
+
<Button
|
|
107
|
+
className={ className }
|
|
108
|
+
onClick={ onClick }
|
|
109
|
+
label={ description }
|
|
110
|
+
showTooltip={ !! description }
|
|
111
|
+
>
|
|
112
|
+
<Flex
|
|
63
113
|
as="span"
|
|
64
114
|
spacing={ 2 }
|
|
65
|
-
|
|
115
|
+
align="center"
|
|
116
|
+
justify="center"
|
|
66
117
|
style={ { width: '100%' } }
|
|
118
|
+
direction={ direction }
|
|
67
119
|
>
|
|
68
|
-
<
|
|
69
|
-
|
|
70
|
-
|
|
120
|
+
<div className="edit-site-add-new-template__template-icon">
|
|
121
|
+
<Icon icon={ icon } />
|
|
122
|
+
</div>
|
|
123
|
+
<VStack
|
|
124
|
+
className="edit-site-add-new-template__template-name"
|
|
125
|
+
alignment="center"
|
|
126
|
+
spacing={ 0 }
|
|
71
127
|
>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
128
|
+
<Text
|
|
129
|
+
weight={ 500 }
|
|
130
|
+
lineHeight={ 1.53846153846 } // 20px
|
|
131
|
+
>
|
|
132
|
+
{ title }
|
|
133
|
+
</Text>
|
|
134
|
+
{ children }
|
|
135
|
+
</VStack>
|
|
136
|
+
</Flex>
|
|
80
137
|
</Button>
|
|
81
138
|
);
|
|
82
139
|
}
|
|
@@ -104,6 +161,26 @@ export default function NewTemplate( {
|
|
|
104
161
|
const { createErrorNotice, createSuccessNotice } =
|
|
105
162
|
useDispatch( noticesStore );
|
|
106
163
|
const { setTemplate } = unlock( useDispatch( editSiteStore ) );
|
|
164
|
+
|
|
165
|
+
const { homeUrl } = useSelect( ( select ) => {
|
|
166
|
+
const {
|
|
167
|
+
getUnstableBase, // Site index.
|
|
168
|
+
} = select( coreStore );
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
homeUrl: getUnstableBase()?.home,
|
|
172
|
+
};
|
|
173
|
+
}, [] );
|
|
174
|
+
|
|
175
|
+
const TEMPLATE_SHORT_DESCRIPTIONS = {
|
|
176
|
+
'front-page': homeUrl,
|
|
177
|
+
date: sprintf(
|
|
178
|
+
// translators: %s: The homepage url.
|
|
179
|
+
__( 'E.g. %s' ),
|
|
180
|
+
homeUrl + '/' + new Date().getFullYear()
|
|
181
|
+
),
|
|
182
|
+
};
|
|
183
|
+
|
|
107
184
|
async function createTemplate( template, isWPSuggestion = true ) {
|
|
108
185
|
if ( isCreatingTemplate ) {
|
|
109
186
|
return;
|
|
@@ -220,14 +297,25 @@ export default function NewTemplate( {
|
|
|
220
297
|
justify="center"
|
|
221
298
|
className="edit-site-add-new-template__template-list__contents"
|
|
222
299
|
>
|
|
300
|
+
<Flex className="edit-site-add-new-template__template-list__prompt">
|
|
301
|
+
{ __(
|
|
302
|
+
'Select what the new template should apply to:'
|
|
303
|
+
) }
|
|
304
|
+
</Flex>
|
|
223
305
|
{ missingTemplates.map( ( template ) => {
|
|
224
|
-
const { title,
|
|
225
|
-
template;
|
|
306
|
+
const { title, slug, onClick } = template;
|
|
226
307
|
return (
|
|
227
308
|
<TemplateListItem
|
|
228
309
|
key={ slug }
|
|
229
310
|
title={ title }
|
|
230
|
-
|
|
311
|
+
direction="column"
|
|
312
|
+
className="edit-site-add-new-template__template-button"
|
|
313
|
+
description={
|
|
314
|
+
TEMPLATE_SHORT_DESCRIPTIONS[ slug ]
|
|
315
|
+
}
|
|
316
|
+
icon={
|
|
317
|
+
TEMPLATE_ICONS[ slug ] || layout
|
|
318
|
+
}
|
|
231
319
|
onClick={ () =>
|
|
232
320
|
onClick
|
|
233
321
|
? onClick( template )
|
|
@@ -238,15 +326,23 @@ export default function NewTemplate( {
|
|
|
238
326
|
} ) }
|
|
239
327
|
<TemplateListItem
|
|
240
328
|
title={ __( 'Custom template' ) }
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
329
|
+
direction="row"
|
|
330
|
+
className="edit-site-add-new-template__custom-template-button"
|
|
331
|
+
icon={ edit }
|
|
244
332
|
onClick={ () =>
|
|
245
333
|
setModalContent(
|
|
246
334
|
modalContentMap.customGenericTemplate
|
|
247
335
|
)
|
|
248
336
|
}
|
|
249
|
-
|
|
337
|
+
>
|
|
338
|
+
<Text
|
|
339
|
+
lineHeight={ 1.53846153846 } // 20px
|
|
340
|
+
>
|
|
341
|
+
{ __(
|
|
342
|
+
'A custom template can be manually applied to any post or page.'
|
|
343
|
+
) }
|
|
344
|
+
</Text>
|
|
345
|
+
</TemplateListItem>
|
|
250
346
|
</Grid>
|
|
251
347
|
) }
|
|
252
348
|
{ modalContent === modalContentMap.customTemplate && (
|
|
@@ -138,17 +138,39 @@
|
|
|
138
138
|
@include break-large() {
|
|
139
139
|
width: calc(100% - #{$grid-unit-80 * 2});
|
|
140
140
|
}
|
|
141
|
+
|
|
142
|
+
.edit-site-add-new-template__template-button,
|
|
143
|
+
.edit-site-add-new-template__custom-template-button {
|
|
144
|
+
svg {
|
|
145
|
+
fill: var(--wp-admin-theme-color);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.edit-site-add-new-template__custom-template-button {
|
|
150
|
+
.edit-site-add-new-template__template-name {
|
|
151
|
+
flex-grow: 1;
|
|
152
|
+
align-items: flex-start;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.edit-site-add-new-template__template-icon {
|
|
157
|
+
padding: $grid-unit-10;
|
|
158
|
+
background: rgba(var(--wp-admin-theme-color--rgb), 0.04);
|
|
159
|
+
border-radius: 100%;
|
|
160
|
+
max-height: $grid-unit-50;
|
|
161
|
+
max-width: $grid-unit-50;
|
|
162
|
+
}
|
|
141
163
|
}
|
|
142
164
|
|
|
143
165
|
.edit-site-custom-template-modal__contents,
|
|
144
166
|
.edit-site-add-new-template__template-list__contents {
|
|
145
167
|
> .components-button {
|
|
146
|
-
padding: $grid-unit-
|
|
168
|
+
padding: $grid-unit-40;
|
|
147
169
|
border-radius: $radius-block-ui;
|
|
148
170
|
display: flex;
|
|
149
171
|
flex-direction: column;
|
|
150
172
|
border: $border-width solid $gray-300;
|
|
151
|
-
|
|
173
|
+
justify-content: center;
|
|
152
174
|
|
|
153
175
|
// Show the boundary of the button, in High Contrast Mode.
|
|
154
176
|
outline: 1px solid transparent;
|
|
@@ -183,6 +205,12 @@
|
|
|
183
205
|
}
|
|
184
206
|
}
|
|
185
207
|
}
|
|
208
|
+
|
|
209
|
+
.edit-site-add-new-template__custom-template-button,
|
|
210
|
+
.edit-site-add-new-template__template-list__prompt {
|
|
211
|
+
grid-column-start: 1;
|
|
212
|
+
grid-column-end: 4;
|
|
213
|
+
}
|
|
186
214
|
}
|
|
187
215
|
|
|
188
216
|
.edit-site-add-new-template__template-list__contents {
|
|
@@ -101,7 +101,7 @@ export default function CreateTemplatePartModal( {
|
|
|
101
101
|
|
|
102
102
|
return (
|
|
103
103
|
<Modal
|
|
104
|
-
title={ __( 'Create
|
|
104
|
+
title={ __( 'Create template part' ) }
|
|
105
105
|
onRequestClose={ closeModal }
|
|
106
106
|
overlayClassName="edit-site-create-template-part-modal"
|
|
107
107
|
>
|
|
@@ -180,6 +180,7 @@ export default function Editor( { isLoading } ) {
|
|
|
180
180
|
<SidebarComplementaryAreaFills />
|
|
181
181
|
{ isEditMode && <StartTemplateOptions /> }
|
|
182
182
|
<InterfaceSkeleton
|
|
183
|
+
isDistractionFree={ true }
|
|
183
184
|
enableRegionNavigation={ false }
|
|
184
185
|
className={ classnames(
|
|
185
186
|
'edit-site-editor__interface-skeleton',
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
__experimentalNavigatorScreen as NavigatorScreen,
|
|
12
12
|
__experimentalUseNavigator as useNavigator,
|
|
13
13
|
createSlotFill,
|
|
14
|
+
Button,
|
|
14
15
|
DropdownMenu,
|
|
15
16
|
MenuGroup,
|
|
16
17
|
MenuItem,
|
|
@@ -142,33 +143,42 @@ function GlobalStylesRevisionsMenu() {
|
|
|
142
143
|
|
|
143
144
|
return (
|
|
144
145
|
<GlobalStylesMenuFill>
|
|
145
|
-
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
146
|
+
{ canReset || hasRevisions ? (
|
|
147
|
+
<DropdownMenu icon={ backup } label={ __( 'Revisions' ) }>
|
|
148
|
+
{ ( { onClose } ) => (
|
|
149
|
+
<MenuGroup>
|
|
150
|
+
{ hasRevisions && (
|
|
151
|
+
<MenuItem
|
|
152
|
+
onClick={ loadRevisions }
|
|
153
|
+
icon={
|
|
154
|
+
<RevisionsCountBadge>
|
|
155
|
+
{ revisionsCount }
|
|
156
|
+
</RevisionsCountBadge>
|
|
157
|
+
}
|
|
158
|
+
>
|
|
159
|
+
{ __( 'Revision history' ) }
|
|
160
|
+
</MenuItem>
|
|
161
|
+
) }
|
|
149
162
|
<MenuItem
|
|
150
|
-
onClick={
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
}
|
|
163
|
+
onClick={ () => {
|
|
164
|
+
onReset();
|
|
165
|
+
onClose();
|
|
166
|
+
} }
|
|
167
|
+
disabled={ ! canReset }
|
|
156
168
|
>
|
|
157
|
-
{ __( '
|
|
169
|
+
{ __( 'Reset to defaults' ) }
|
|
158
170
|
</MenuItem>
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
) }
|
|
171
|
-
</DropdownMenu>
|
|
171
|
+
</MenuGroup>
|
|
172
|
+
) }
|
|
173
|
+
</DropdownMenu>
|
|
174
|
+
) : (
|
|
175
|
+
<Button
|
|
176
|
+
label={ __( 'Revisions' ) }
|
|
177
|
+
icon={ backup }
|
|
178
|
+
disabled
|
|
179
|
+
__experimentalIsFocusable
|
|
180
|
+
/>
|
|
181
|
+
) }
|
|
172
182
|
</GlobalStylesMenuFill>
|
|
173
183
|
);
|
|
174
184
|
}
|
|
@@ -7,7 +7,7 @@ import classnames from 'classnames';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useCallback, useRef } from '@wordpress/element';
|
|
10
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
10
|
+
import { useViewportMatch, useReducedMotion } from '@wordpress/compose';
|
|
11
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
12
12
|
import {
|
|
13
13
|
ToolSelector,
|
|
@@ -21,6 +21,7 @@ import { PinnedItems } from '@wordpress/interface';
|
|
|
21
21
|
import { _x, __ } from '@wordpress/i18n';
|
|
22
22
|
import { listView, plus, external, chevronUpDown } from '@wordpress/icons';
|
|
23
23
|
import {
|
|
24
|
+
__unstableMotion as motion,
|
|
24
25
|
Button,
|
|
25
26
|
ToolbarItem,
|
|
26
27
|
MenuGroup,
|
|
@@ -60,6 +61,7 @@ export default function HeaderEditMode() {
|
|
|
60
61
|
isListViewOpen,
|
|
61
62
|
listViewShortcut,
|
|
62
63
|
isVisualMode,
|
|
64
|
+
isDistractionFree,
|
|
63
65
|
blockEditorMode,
|
|
64
66
|
homeUrl,
|
|
65
67
|
showIconLabels,
|
|
@@ -99,6 +101,10 @@ export default function HeaderEditMode() {
|
|
|
99
101
|
editorCanvasView: unlock(
|
|
100
102
|
select( editSiteStore )
|
|
101
103
|
).getEditorCanvasContainerView(),
|
|
104
|
+
isDistractionFree: select( preferencesStore ).get(
|
|
105
|
+
'core/edit-site',
|
|
106
|
+
'distractionFree'
|
|
107
|
+
),
|
|
102
108
|
};
|
|
103
109
|
}, [] );
|
|
104
110
|
|
|
@@ -108,6 +114,7 @@ export default function HeaderEditMode() {
|
|
|
108
114
|
setIsListViewOpened,
|
|
109
115
|
} = useDispatch( editSiteStore );
|
|
110
116
|
const { __unstableSetEditorMode } = useDispatch( blockEditorStore );
|
|
117
|
+
const disableMotion = useReducedMotion();
|
|
111
118
|
|
|
112
119
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
113
120
|
|
|
@@ -156,6 +163,19 @@ export default function HeaderEditMode() {
|
|
|
156
163
|
window?.__experimentalEnableZoomedOutView && isVisualMode;
|
|
157
164
|
const isZoomedOutView = blockEditorMode === 'zoom-out';
|
|
158
165
|
|
|
166
|
+
const toolbarVariants = {
|
|
167
|
+
isDistractionFree: { y: '-50px' },
|
|
168
|
+
isDistractionFreeHovering: { y: 0 },
|
|
169
|
+
view: { y: 0 },
|
|
170
|
+
edit: { y: 0 },
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const toolbarTransition = {
|
|
174
|
+
type: 'tween',
|
|
175
|
+
duration: disableMotion ? 0 : 0.2,
|
|
176
|
+
ease: 'easeOut',
|
|
177
|
+
};
|
|
178
|
+
|
|
159
179
|
return (
|
|
160
180
|
<div
|
|
161
181
|
className={ classnames( 'edit-site-header-edit-mode', {
|
|
@@ -164,26 +184,33 @@ export default function HeaderEditMode() {
|
|
|
164
184
|
>
|
|
165
185
|
{ hasDefaultEditorCanvasView && (
|
|
166
186
|
<NavigableToolbar
|
|
187
|
+
as={ motion.div }
|
|
167
188
|
className="edit-site-header-edit-mode__start"
|
|
168
189
|
aria-label={ __( 'Document tools' ) }
|
|
169
190
|
shouldUseKeyboardFocusShortcut={
|
|
170
191
|
! blockToolbarCanBeFocused
|
|
171
192
|
}
|
|
193
|
+
variants={ toolbarVariants }
|
|
194
|
+
transition={ toolbarTransition }
|
|
172
195
|
>
|
|
173
196
|
<div className="edit-site-header-edit-mode__toolbar">
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
197
|
+
{ ! isDistractionFree && (
|
|
198
|
+
<ToolbarItem
|
|
199
|
+
ref={ inserterButton }
|
|
200
|
+
as={ Button }
|
|
201
|
+
className="edit-site-header-edit-mode__inserter-toggle"
|
|
202
|
+
variant="primary"
|
|
203
|
+
isPressed={ isInserterOpen }
|
|
204
|
+
onMouseDown={ preventDefault }
|
|
205
|
+
onClick={ toggleInserter }
|
|
206
|
+
disabled={ ! isVisualMode }
|
|
207
|
+
icon={ plus }
|
|
208
|
+
label={
|
|
209
|
+
showIconLabels ? shortLabel : longLabel
|
|
210
|
+
}
|
|
211
|
+
showTooltip={ ! showIconLabels }
|
|
212
|
+
/>
|
|
213
|
+
) }
|
|
187
214
|
{ isLargeViewport && (
|
|
188
215
|
<>
|
|
189
216
|
<ToolbarItem
|
|
@@ -208,57 +235,70 @@ export default function HeaderEditMode() {
|
|
|
208
235
|
showIconLabels ? 'tertiary' : undefined
|
|
209
236
|
}
|
|
210
237
|
/>
|
|
211
|
-
|
|
212
|
-
as={ Button }
|
|
213
|
-
className="edit-site-header-edit-mode__list-view-toggle"
|
|
214
|
-
disabled={
|
|
215
|
-
! isVisualMode || isZoomedOutView
|
|
216
|
-
}
|
|
217
|
-
icon={ listView }
|
|
218
|
-
isPressed={ isListViewOpen }
|
|
219
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
220
|
-
label={ __( 'List View' ) }
|
|
221
|
-
onClick={ toggleListView }
|
|
222
|
-
shortcut={ listViewShortcut }
|
|
223
|
-
showTooltip={ ! showIconLabels }
|
|
224
|
-
variant={
|
|
225
|
-
showIconLabels ? 'tertiary' : undefined
|
|
226
|
-
}
|
|
227
|
-
/>
|
|
228
|
-
{ isZoomedOutViewExperimentEnabled && (
|
|
238
|
+
{ ! isDistractionFree && (
|
|
229
239
|
<ToolbarItem
|
|
230
240
|
as={ Button }
|
|
231
|
-
className="edit-site-header-edit-
|
|
232
|
-
|
|
233
|
-
|
|
241
|
+
className="edit-site-header-edit-mode__list-view-toggle"
|
|
242
|
+
disabled={
|
|
243
|
+
! isVisualMode || isZoomedOutView
|
|
244
|
+
}
|
|
245
|
+
icon={ listView }
|
|
246
|
+
isPressed={ isListViewOpen }
|
|
234
247
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
235
|
-
label={ __( '
|
|
236
|
-
onClick={
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
248
|
+
label={ __( 'List View' ) }
|
|
249
|
+
onClick={ toggleListView }
|
|
250
|
+
shortcut={ listViewShortcut }
|
|
251
|
+
showTooltip={ ! showIconLabels }
|
|
252
|
+
variant={
|
|
253
|
+
showIconLabels
|
|
254
|
+
? 'tertiary'
|
|
255
|
+
: undefined
|
|
256
|
+
}
|
|
244
257
|
/>
|
|
245
258
|
) }
|
|
259
|
+
{ isZoomedOutViewExperimentEnabled &&
|
|
260
|
+
! isDistractionFree && (
|
|
261
|
+
<ToolbarItem
|
|
262
|
+
as={ Button }
|
|
263
|
+
className="edit-site-header-edit-mode__zoom-out-view-toggle"
|
|
264
|
+
icon={ chevronUpDown }
|
|
265
|
+
isPressed={ isZoomedOutView }
|
|
266
|
+
/* translators: button label text should, if possible, be under 16 characters. */
|
|
267
|
+
label={ __( 'Zoom-out View' ) }
|
|
268
|
+
onClick={ () => {
|
|
269
|
+
setPreviewDeviceType(
|
|
270
|
+
'desktop'
|
|
271
|
+
);
|
|
272
|
+
__unstableSetEditorMode(
|
|
273
|
+
isZoomedOutView
|
|
274
|
+
? 'edit'
|
|
275
|
+
: 'zoom-out'
|
|
276
|
+
);
|
|
277
|
+
} }
|
|
278
|
+
/>
|
|
279
|
+
) }
|
|
246
280
|
</>
|
|
247
281
|
) }
|
|
248
282
|
</div>
|
|
249
283
|
</NavigableToolbar>
|
|
250
284
|
) }
|
|
251
285
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
286
|
+
{ ! isDistractionFree && (
|
|
287
|
+
<div className="edit-site-header-edit-mode__center">
|
|
288
|
+
{ ! hasDefaultEditorCanvasView ? (
|
|
289
|
+
getEditorCanvasContainerTitle( editorCanvasView )
|
|
290
|
+
) : (
|
|
291
|
+
<DocumentActions />
|
|
292
|
+
) }
|
|
293
|
+
</div>
|
|
294
|
+
) }
|
|
259
295
|
|
|
260
296
|
<div className="edit-site-header-edit-mode__end">
|
|
261
|
-
<div
|
|
297
|
+
<motion.div
|
|
298
|
+
className="edit-site-header-edit-mode__actions"
|
|
299
|
+
variants={ toolbarVariants }
|
|
300
|
+
transition={ toolbarTransition }
|
|
301
|
+
>
|
|
262
302
|
{ ! isFocusMode && hasDefaultEditorCanvasView && (
|
|
263
303
|
<div
|
|
264
304
|
className={ classnames(
|
|
@@ -290,9 +330,11 @@ export default function HeaderEditMode() {
|
|
|
290
330
|
</div>
|
|
291
331
|
) }
|
|
292
332
|
<SaveButton />
|
|
293
|
-
|
|
333
|
+
{ ! isDistractionFree && (
|
|
334
|
+
<PinnedItems.Slot scope="core/edit-site" />
|
|
335
|
+
) }
|
|
294
336
|
<MoreMenu showIconLabels={ showIconLabels } />
|
|
295
|
-
</div>
|
|
337
|
+
</motion.div>
|
|
296
338
|
</div>
|
|
297
339
|
</div>
|
|
298
340
|
);
|