@wordpress/edit-site 5.3.6 → 5.3.8
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-template/new-template.js +16 -10
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/editor-canvas.js +2 -1
- package/build/components/block-editor/editor-canvas.js.map +1 -1
- package/build/components/layout/index.js +6 -0
- package/build/components/layout/index.js.map +1 -1
- package/build/components/list/index.js +2 -1
- package/build/components/list/index.js.map +1 -1
- package/build/components/routes/link.js +4 -1
- package/build/components/routes/link.js.map +1 -1
- package/build/components/save-button/index.js +2 -5
- package/build/components/save-button/index.js.map +1 -1
- package/build/components/save-hub/index.js +82 -0
- package/build/components/save-hub/index.js.map +1 -0
- package/build/components/sidebar/index.js +2 -4
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +5 -2
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-item/index.js +9 -14
- package/build/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js +100 -11
- package/build/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js +19 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +77 -0
- package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build/components/sidebar-navigation-screen-template/index.js +18 -4
- package/build/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build/components/style-book/index.js +134 -19
- package/build/components/style-book/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- 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-path-with-url.js +9 -7
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build/components/template-details/index.js +0 -3
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/use-edited-entity-record/index.js +6 -6
- package/build/components/use-edited-entity-record/index.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/utils/history.js +8 -2
- package/build/utils/history.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +18 -11
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/editor-canvas.js +2 -1
- package/build-module/components/block-editor/editor-canvas.js.map +1 -1
- package/build-module/components/layout/index.js +6 -0
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/list/index.js +2 -1
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/routes/link.js +5 -2
- package/build-module/components/routes/link.js.map +1 -1
- package/build-module/components/save-button/index.js +2 -5
- package/build-module/components/save-button/index.js.map +1 -1
- package/build-module/components/save-hub/index.js +68 -0
- package/build-module/components/save-hub/index.js.map +1 -0
- package/build-module/components/sidebar/index.js +2 -4
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/index.js +1 -0
- package/build-module/components/sidebar-navigation-screen-main/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js +13 -18
- package/build-module/components/sidebar-navigation-screen-navigation-item/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js +94 -11
- package/build-module/components/sidebar-navigation-screen-navigation-menus/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js +11 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/loader.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +66 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -0
- package/build-module/components/sidebar-navigation-screen-template/index.js +18 -5
- package/build-module/components/sidebar-navigation-screen-template/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates/index.js +5 -2
- package/build-module/components/sidebar-navigation-screen-templates/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js +6 -3
- package/build-module/components/sidebar-navigation-screen-templates-browse/index.js.map +1 -1
- package/build-module/components/style-book/index.js +135 -22
- package/build-module/components/style-book/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +24 -8
- 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-path-with-url.js +9 -7
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/template-details/index.js +0 -3
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/use-edited-entity-record/index.js +6 -6
- package/build-module/components/use-edited-entity-record/index.js.map +1 -1
- package/build-module/index.js +4 -1
- package/build-module/index.js.map +1 -1
- package/build-module/utils/history.js +9 -3
- package/build-module/utils/history.js.map +1 -1
- package/build-style/style-rtl.css +96 -111
- package/build-style/style.css +96 -111
- package/package.json +10 -10
- package/src/components/add-new-template/new-template.js +57 -32
- package/src/components/add-new-template/style.scss +12 -1
- package/src/components/block-editor/editor-canvas.js +2 -1
- package/src/components/layout/index.js +14 -0
- package/src/components/layout/style.scss +1 -3
- package/src/components/list/index.js +3 -1
- package/src/components/routes/link.js +9 -2
- package/src/components/save-button/index.js +2 -2
- package/src/components/save-hub/index.js +78 -0
- package/src/components/save-hub/style.scss +15 -0
- package/src/components/sidebar/index.js +2 -3
- package/src/components/sidebar/style.scss +4 -3
- package/src/components/sidebar-button/style.scss +2 -1
- package/src/components/sidebar-navigation-item/style.scss +0 -20
- package/src/components/sidebar-navigation-screen/index.js +6 -0
- package/src/components/sidebar-navigation-screen/style.scss +15 -0
- package/src/components/sidebar-navigation-screen-main/index.js +3 -0
- package/src/components/sidebar-navigation-screen-navigation-item/index.js +30 -21
- package/src/components/sidebar-navigation-screen-navigation-menus/index.js +104 -10
- package/src/components/sidebar-navigation-screen-navigation-menus/loader.js +9 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +78 -0
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +59 -4
- package/src/components/sidebar-navigation-screen-template/index.js +21 -7
- package/src/components/sidebar-navigation-screen-templates/index.js +7 -0
- package/src/components/sidebar-navigation-screen-templates-browse/index.js +12 -1
- package/src/components/site-hub/style.scss +1 -1
- package/src/components/style-book/index.js +209 -54
- package/src/components/style-book/style.scss +1 -45
- package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +38 -8
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +12 -7
- package/src/components/template-details/index.js +0 -3
- package/src/components/use-edited-entity-record/index.js +26 -18
- package/src/index.js +5 -1
- package/src/style.scss +1 -1
- package/src/utils/history.js +13 -9
- package/build/components/navigation-inspector/index.js +0 -190
- package/build/components/navigation-inspector/index.js.map +0 -1
- package/build/components/navigation-inspector/navigation-menu.js +0 -62
- package/build/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/build-module/components/navigation-inspector/index.js +0 -173
- package/build-module/components/navigation-inspector/index.js.map +0 -1
- package/build-module/components/navigation-inspector/navigation-menu.js +0 -52
- package/build-module/components/navigation-inspector/navigation-menu.js.map +0 -1
- package/src/components/navigation-inspector/index.js +0 -223
- package/src/components/navigation-inspector/navigation-menu.js +0 -66
- package/src/components/navigation-inspector/style.scss +0 -46
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-site",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.8",
|
|
4
4
|
"description": "Edit Site Page module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -29,33 +29,33 @@
|
|
|
29
29
|
"@babel/runtime": "^7.16.0",
|
|
30
30
|
"@wordpress/a11y": "^3.26.1",
|
|
31
31
|
"@wordpress/api-fetch": "^6.23.1",
|
|
32
|
-
"@wordpress/block-editor": "^11.3.
|
|
33
|
-
"@wordpress/block-library": "^8.3.
|
|
32
|
+
"@wordpress/block-editor": "^11.3.8",
|
|
33
|
+
"@wordpress/block-library": "^8.3.8",
|
|
34
34
|
"@wordpress/blocks": "^12.3.3",
|
|
35
|
-
"@wordpress/components": "^23.3.
|
|
35
|
+
"@wordpress/components": "^23.3.6",
|
|
36
36
|
"@wordpress/compose": "^6.3.3",
|
|
37
37
|
"@wordpress/core-data": "^6.3.3",
|
|
38
38
|
"@wordpress/data": "^8.3.3",
|
|
39
39
|
"@wordpress/deprecated": "^3.26.1",
|
|
40
|
-
"@wordpress/editor": "^13.3.
|
|
40
|
+
"@wordpress/editor": "^13.3.8",
|
|
41
41
|
"@wordpress/element": "^5.3.2",
|
|
42
42
|
"@wordpress/hooks": "^3.26.1",
|
|
43
43
|
"@wordpress/html-entities": "^3.26.1",
|
|
44
44
|
"@wordpress/i18n": "^4.26.1",
|
|
45
45
|
"@wordpress/icons": "^9.17.2",
|
|
46
|
-
"@wordpress/interface": "^5.3.
|
|
46
|
+
"@wordpress/interface": "^5.3.7",
|
|
47
47
|
"@wordpress/keyboard-shortcuts": "^4.3.3",
|
|
48
48
|
"@wordpress/keycodes": "^3.26.2",
|
|
49
49
|
"@wordpress/media-utils": "^4.17.2",
|
|
50
50
|
"@wordpress/notices": "^3.26.3",
|
|
51
51
|
"@wordpress/plugins": "^5.3.3",
|
|
52
|
-
"@wordpress/preferences": "^3.3.
|
|
52
|
+
"@wordpress/preferences": "^3.3.6",
|
|
53
53
|
"@wordpress/private-apis": "^0.8.1",
|
|
54
|
-
"@wordpress/reusable-blocks": "^4.3.
|
|
54
|
+
"@wordpress/reusable-blocks": "^4.3.8",
|
|
55
55
|
"@wordpress/style-engine": "^1.9.1",
|
|
56
56
|
"@wordpress/url": "^3.27.1",
|
|
57
57
|
"@wordpress/viewport": "^5.3.3",
|
|
58
|
-
"@wordpress/widgets": "^3.3.
|
|
58
|
+
"@wordpress/widgets": "^3.3.8",
|
|
59
59
|
"classnames": "^2.3.1",
|
|
60
60
|
"colord": "^2.9.2",
|
|
61
61
|
"downloadjs": "^1.4.7",
|
|
@@ -73,5 +73,5 @@
|
|
|
73
73
|
"publishConfig": {
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "446428841b54f47e5373d6e9723ef7ec24cf11b3"
|
|
77
77
|
}
|
|
@@ -7,7 +7,8 @@ import {
|
|
|
7
7
|
DropdownMenu,
|
|
8
8
|
MenuGroup,
|
|
9
9
|
MenuItem,
|
|
10
|
-
|
|
10
|
+
Tooltip,
|
|
11
|
+
VisuallyHidden,
|
|
11
12
|
} from '@wordpress/components';
|
|
12
13
|
import { useState } from '@wordpress/element';
|
|
13
14
|
import { useDispatch } from '@wordpress/data';
|
|
@@ -179,6 +180,11 @@ export default function NewTemplate( {
|
|
|
179
180
|
if ( ! missingTemplates.length ) {
|
|
180
181
|
return null;
|
|
181
182
|
}
|
|
183
|
+
|
|
184
|
+
const customTemplateDescription = __(
|
|
185
|
+
'A custom template can be manually applied to any post or page.'
|
|
186
|
+
);
|
|
187
|
+
|
|
182
188
|
return (
|
|
183
189
|
<>
|
|
184
190
|
<DropdownMenu
|
|
@@ -196,7 +202,7 @@ export default function NewTemplate( {
|
|
|
196
202
|
{ isCreatingTemplate && (
|
|
197
203
|
<TemplateActionsLoadingScreen />
|
|
198
204
|
) }
|
|
199
|
-
<
|
|
205
|
+
<div className="edit-site-new-template-dropdown__menu-groups">
|
|
200
206
|
<MenuGroup label={ postType.labels.add_new_item }>
|
|
201
207
|
{ missingTemplates.map( ( template ) => {
|
|
202
208
|
const {
|
|
@@ -207,44 +213,63 @@ export default function NewTemplate( {
|
|
|
207
213
|
icon,
|
|
208
214
|
} = template;
|
|
209
215
|
return (
|
|
210
|
-
<
|
|
211
|
-
icon={
|
|
212
|
-
icon ||
|
|
213
|
-
TEMPLATE_ICONS[ slug ] ||
|
|
214
|
-
post
|
|
215
|
-
}
|
|
216
|
-
iconPosition="left"
|
|
217
|
-
info={ description }
|
|
216
|
+
<Tooltip
|
|
218
217
|
key={ slug }
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
: createTemplate( template )
|
|
223
|
-
}
|
|
218
|
+
position="top right"
|
|
219
|
+
text={ description }
|
|
220
|
+
className="edit-site-new-template-dropdown__menu-item-tooltip"
|
|
224
221
|
>
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
<MenuItem
|
|
223
|
+
icon={
|
|
224
|
+
icon ||
|
|
225
|
+
TEMPLATE_ICONS[ slug ] ||
|
|
226
|
+
post
|
|
227
|
+
}
|
|
228
|
+
iconPosition="left"
|
|
229
|
+
onClick={ () =>
|
|
230
|
+
onClick
|
|
231
|
+
? onClick( template )
|
|
232
|
+
: createTemplate(
|
|
233
|
+
template
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
>
|
|
237
|
+
{ title }
|
|
238
|
+
{ /* TODO: This probably won't be needed if the <Tooltip> component is accessible.
|
|
239
|
+
* @see https://github.com/WordPress/gutenberg/issues/48222 */ }
|
|
240
|
+
<VisuallyHidden>
|
|
241
|
+
{ description }
|
|
242
|
+
</VisuallyHidden>
|
|
243
|
+
</MenuItem>
|
|
244
|
+
</Tooltip>
|
|
227
245
|
);
|
|
228
246
|
} ) }
|
|
229
247
|
</MenuGroup>
|
|
230
248
|
<MenuGroup>
|
|
231
|
-
<
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
'Custom templates can be applied to any post or page.'
|
|
236
|
-
) }
|
|
237
|
-
key="custom-template"
|
|
238
|
-
onClick={ () =>
|
|
239
|
-
setShowCustomGenericTemplateModal(
|
|
240
|
-
true
|
|
241
|
-
)
|
|
242
|
-
}
|
|
249
|
+
<Tooltip
|
|
250
|
+
position="top right"
|
|
251
|
+
text={ customTemplateDescription }
|
|
252
|
+
className="edit-site-new-template-dropdown__menu-item-tooltip"
|
|
243
253
|
>
|
|
244
|
-
|
|
245
|
-
|
|
254
|
+
<MenuItem
|
|
255
|
+
icon={ customGenericTemplateIcon }
|
|
256
|
+
iconPosition="left"
|
|
257
|
+
onClick={ () =>
|
|
258
|
+
setShowCustomGenericTemplateModal(
|
|
259
|
+
true
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
>
|
|
263
|
+
{ __( 'Custom template' ) }
|
|
264
|
+
{ /* TODO: This probably won't be needed if the <Tooltip> component is accessible.
|
|
265
|
+
* @see https://github.com/WordPress/gutenberg/issues/48222 */ }
|
|
266
|
+
<VisuallyHidden>
|
|
267
|
+
{ customTemplateDescription }
|
|
268
|
+
</VisuallyHidden>
|
|
269
|
+
</MenuItem>
|
|
270
|
+
</Tooltip>
|
|
246
271
|
</MenuGroup>
|
|
247
|
-
</
|
|
272
|
+
</div>
|
|
248
273
|
</>
|
|
249
274
|
) }
|
|
250
275
|
</DropdownMenu>
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
.edit-site-new-template-dropdown {
|
|
2
|
-
.edit-site-new-template-
|
|
2
|
+
.edit-site-new-template-dropdown__menu-groups {
|
|
3
3
|
@include break-small() {
|
|
4
4
|
min-width: 300px;
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
|
+
|
|
8
|
+
// The specificity is needed to override the default tooltip styles.
|
|
9
|
+
&__menu-item-tooltip.components-tooltip .components-popover__content {
|
|
10
|
+
max-width: 320px;
|
|
11
|
+
padding: $grid-unit-10 $grid-unit-15;
|
|
12
|
+
border-radius: 2px;
|
|
13
|
+
white-space: pre-wrap;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
width: auto;
|
|
16
|
+
text-align: left;
|
|
17
|
+
}
|
|
7
18
|
}
|
|
8
19
|
|
|
9
20
|
.edit-site-custom-template-modal {
|
|
@@ -43,7 +43,8 @@ function EditorCanvas( { enableResizing, settings, children, ...props } ) {
|
|
|
43
43
|
// Forming a "block formatting context" to prevent margin collapsing.
|
|
44
44
|
// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
|
|
45
45
|
`.is-root-container { display: flow-root; }
|
|
46
|
-
body { position: relative;
|
|
46
|
+
body { position: relative;
|
|
47
|
+
${ canvasMode === 'view' ? 'cursor: pointer;' : '' }}}`
|
|
47
48
|
}</style>
|
|
48
49
|
{ enableResizing && (
|
|
49
50
|
<style>
|
|
@@ -277,6 +277,20 @@ export default function Layout() {
|
|
|
277
277
|
{ canvasResizer }
|
|
278
278
|
{ !! canvasSize.width && (
|
|
279
279
|
<motion.div
|
|
280
|
+
whileHover={
|
|
281
|
+
isEditorPage && canvasMode === 'view'
|
|
282
|
+
? {
|
|
283
|
+
scale: 1.01,
|
|
284
|
+
transition: {
|
|
285
|
+
duration:
|
|
286
|
+
disableMotion ||
|
|
287
|
+
isResizing
|
|
288
|
+
? 0
|
|
289
|
+
: 0.2,
|
|
290
|
+
},
|
|
291
|
+
}
|
|
292
|
+
: {}
|
|
293
|
+
}
|
|
280
294
|
initial={ false }
|
|
281
295
|
layout="position"
|
|
282
296
|
className="edit-site-layout__canvas"
|
|
@@ -19,8 +19,10 @@ import useTitle from '../routes/use-title';
|
|
|
19
19
|
|
|
20
20
|
export default function List() {
|
|
21
21
|
const {
|
|
22
|
-
params: {
|
|
22
|
+
params: { path },
|
|
23
23
|
} = useLocation();
|
|
24
|
+
const templateType =
|
|
25
|
+
path === '/wp_template/all' ? 'wp_template' : 'wp_template_part';
|
|
24
26
|
|
|
25
27
|
useRegisterShortcuts();
|
|
26
28
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { addQueryArgs } from '@wordpress/url';
|
|
4
|
+
import { addQueryArgs, getQueryArgs, removeQueryArgs } from '@wordpress/url';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Internal dependencies
|
|
@@ -21,8 +21,15 @@ export function useLink( params = {}, state, shouldReplace = false ) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
const currentArgs = getQueryArgs( window.location.href );
|
|
25
|
+
const currentUrlWithoutArgs = removeQueryArgs(
|
|
26
|
+
window.location.href,
|
|
27
|
+
...Object.keys( currentArgs )
|
|
28
|
+
);
|
|
29
|
+
const newUrl = addQueryArgs( currentUrlWithoutArgs, params );
|
|
30
|
+
|
|
24
31
|
return {
|
|
25
|
-
href:
|
|
32
|
+
href: newUrl,
|
|
26
33
|
onClick,
|
|
27
34
|
};
|
|
28
35
|
}
|
|
@@ -12,7 +12,7 @@ import { displayShortcut } from '@wordpress/keycodes';
|
|
|
12
12
|
*/
|
|
13
13
|
import { store as editSiteStore } from '../../store';
|
|
14
14
|
|
|
15
|
-
export default function SaveButton(
|
|
15
|
+
export default function SaveButton() {
|
|
16
16
|
const { isDirty, isSaving, isSaveViewOpen } = useSelect( ( select ) => {
|
|
17
17
|
const { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =
|
|
18
18
|
select( coreStore );
|
|
@@ -52,7 +52,7 @@ export default function SaveButton( { showTooltip = true } ) {
|
|
|
52
52
|
* of the button that we want to avoid. By setting `showTooltip`,
|
|
53
53
|
& the tooltip is always rendered even when there's no keyboard shortcut.
|
|
54
54
|
*/
|
|
55
|
-
showTooltip
|
|
55
|
+
showTooltip
|
|
56
56
|
>
|
|
57
57
|
{ label }
|
|
58
58
|
</Button>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
5
|
+
import { Button, __experimentalHStack as HStack } from '@wordpress/components';
|
|
6
|
+
import { sprintf, __, _n } from '@wordpress/i18n';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { displayShortcut } from '@wordpress/keycodes';
|
|
9
|
+
import { check } from '@wordpress/icons';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Internal dependencies
|
|
13
|
+
*/
|
|
14
|
+
import { store as editSiteStore } from '../../store';
|
|
15
|
+
|
|
16
|
+
export default function SaveButton() {
|
|
17
|
+
const { countUnsavedChanges, isDirty, isSaving, isSaveViewOpen } =
|
|
18
|
+
useSelect( ( select ) => {
|
|
19
|
+
const {
|
|
20
|
+
__experimentalGetDirtyEntityRecords,
|
|
21
|
+
isSavingEntityRecord,
|
|
22
|
+
} = select( coreStore );
|
|
23
|
+
const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
|
|
24
|
+
const { isSaveViewOpened } = select( editSiteStore );
|
|
25
|
+
return {
|
|
26
|
+
isDirty: dirtyEntityRecords.length > 0,
|
|
27
|
+
isSaving: dirtyEntityRecords.some( ( record ) =>
|
|
28
|
+
isSavingEntityRecord( record.kind, record.name, record.key )
|
|
29
|
+
),
|
|
30
|
+
isSaveViewOpen: isSaveViewOpened(),
|
|
31
|
+
countUnsavedChanges: dirtyEntityRecords.length,
|
|
32
|
+
};
|
|
33
|
+
}, [] );
|
|
34
|
+
const { setIsSaveViewOpened } = useDispatch( editSiteStore );
|
|
35
|
+
|
|
36
|
+
const disabled = ! isDirty || isSaving;
|
|
37
|
+
|
|
38
|
+
const label = disabled ? __( 'Saved' ) : __( 'Save' );
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<HStack className="edit-site-save-hub" alignment="right" spacing={ 4 }>
|
|
42
|
+
{ isDirty && (
|
|
43
|
+
<span>
|
|
44
|
+
{ sprintf(
|
|
45
|
+
// translators: %d: number of unsaved changes (number).
|
|
46
|
+
_n(
|
|
47
|
+
'%d unsaved change',
|
|
48
|
+
'%d unsaved changes',
|
|
49
|
+
countUnsavedChanges
|
|
50
|
+
),
|
|
51
|
+
countUnsavedChanges
|
|
52
|
+
) }
|
|
53
|
+
</span>
|
|
54
|
+
) }
|
|
55
|
+
<Button
|
|
56
|
+
className="edit-site-save-hub__button"
|
|
57
|
+
variant={ disabled ? undefined : 'primary' }
|
|
58
|
+
aria-disabled={ disabled }
|
|
59
|
+
aria-expanded={ isSaveViewOpen }
|
|
60
|
+
isBusy={ isSaving }
|
|
61
|
+
onClick={
|
|
62
|
+
disabled ? undefined : () => setIsSaveViewOpened( true )
|
|
63
|
+
}
|
|
64
|
+
label={ label }
|
|
65
|
+
/*
|
|
66
|
+
* We want the tooltip to show the keyboard shortcut only when the
|
|
67
|
+
* button does something, i.e. when it's not disabled.
|
|
68
|
+
*/
|
|
69
|
+
shortcut={
|
|
70
|
+
disabled ? undefined : displayShortcut.primary( 's' )
|
|
71
|
+
}
|
|
72
|
+
icon={ disabled ? check : undefined }
|
|
73
|
+
>
|
|
74
|
+
{ label }
|
|
75
|
+
</Button>
|
|
76
|
+
</HStack>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -18,7 +18,7 @@ import useSyncPathWithURL, {
|
|
|
18
18
|
} from '../sync-state-with-url/use-sync-path-with-url';
|
|
19
19
|
import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus';
|
|
20
20
|
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
|
|
21
|
-
import
|
|
21
|
+
import SaveHub from '../save-hub';
|
|
22
22
|
import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item';
|
|
23
23
|
import { useLocation } from '../routes';
|
|
24
24
|
|
|
@@ -61,9 +61,8 @@ function Sidebar() {
|
|
|
61
61
|
>
|
|
62
62
|
<SidebarScreens />
|
|
63
63
|
</NavigatorProvider>
|
|
64
|
-
|
|
65
64
|
<div className="edit-site-sidebar__footer">
|
|
66
|
-
<
|
|
65
|
+
<SaveHub />
|
|
67
66
|
</div>
|
|
68
67
|
</>
|
|
69
68
|
);
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
.edit-site-sidebar__content {
|
|
2
2
|
flex-grow: 1;
|
|
3
3
|
overflow-y: auto;
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
.components-navigator-screen {
|
|
6
|
+
@include custom-scrollbars-on-hover;
|
|
7
|
+
}
|
|
5
8
|
}
|
|
6
9
|
|
|
7
10
|
.edit-site-sidebar__footer {
|
|
@@ -9,8 +12,6 @@
|
|
|
9
12
|
flex-shrink: 0;
|
|
10
13
|
margin: 0 $canvas-padding;
|
|
11
14
|
padding: $canvas-padding 0;
|
|
12
|
-
display: flex;
|
|
13
|
-
justify-content: flex-end;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
.edit-site-sidebar__content.edit-site-sidebar__content {
|
|
@@ -15,26 +15,6 @@
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
.edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .components-button {
|
|
19
|
-
color: $gray-600;
|
|
20
|
-
&:hover,
|
|
21
|
-
&:focus,
|
|
22
|
-
&[aria-current] {
|
|
23
|
-
color: $white;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.edit-site-sidebar-navigation-screen__content .edit-site-navigation-inspector .offcanvas-editor-list-view-leaf {
|
|
28
|
-
&:hover,
|
|
29
|
-
&:focus,
|
|
30
|
-
&[aria-current] {
|
|
31
|
-
background: $gray-800;
|
|
32
|
-
}
|
|
33
|
-
.block-editor-list-view-block__menu {
|
|
34
|
-
margin-left: -$grid-unit-10;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
18
|
.edit-site-sidebar-navigation-screen__content .block-editor-list-view-block-select-button {
|
|
39
19
|
cursor: grab;
|
|
40
20
|
width: calc(100% - #{ $border-width-focus });
|
|
@@ -22,6 +22,7 @@ export default function SidebarNavigationScreen( {
|
|
|
22
22
|
title,
|
|
23
23
|
actions,
|
|
24
24
|
content,
|
|
25
|
+
description,
|
|
25
26
|
} ) {
|
|
26
27
|
const { dashboardLink } = useSelect( ( select ) => {
|
|
27
28
|
const { getSettings } = unlock( select( editSiteStore ) );
|
|
@@ -58,6 +59,11 @@ export default function SidebarNavigationScreen( {
|
|
|
58
59
|
</HStack>
|
|
59
60
|
|
|
60
61
|
<nav className="edit-site-sidebar-navigation-screen__content">
|
|
62
|
+
{ description && (
|
|
63
|
+
<p className="edit-site-sidebar-navigation-screen__description">
|
|
64
|
+
{ description }
|
|
65
|
+
</p>
|
|
66
|
+
) }
|
|
61
67
|
{ content }
|
|
62
68
|
</nav>
|
|
63
69
|
</VStack>
|
|
@@ -10,6 +10,21 @@
|
|
|
10
10
|
color: $gray-600;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
.edit-site-sidebar-navigation-screen__page-link {
|
|
14
|
+
color: $gray-600;
|
|
15
|
+
|
|
16
|
+
&:hover,
|
|
17
|
+
&:focus {
|
|
18
|
+
color: $white;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.components-external-link__icon {
|
|
22
|
+
margin-left: $grid-unit-05;
|
|
23
|
+
}
|
|
24
|
+
margin-left: $grid-unit-20;
|
|
25
|
+
display: inline-block;
|
|
26
|
+
}
|
|
27
|
+
|
|
13
28
|
.edit-site-sidebar-navigation-screen__title-icon {
|
|
14
29
|
position: sticky;
|
|
15
30
|
top: 0;
|
|
@@ -31,6 +31,9 @@ export default function SidebarNavigationScreenMain() {
|
|
|
31
31
|
<SidebarNavigationScreen
|
|
32
32
|
isRoot
|
|
33
33
|
title={ __( 'Design' ) }
|
|
34
|
+
description={ __(
|
|
35
|
+
'Customize the appearance of your website using the block editor.'
|
|
36
|
+
) }
|
|
34
37
|
content={
|
|
35
38
|
<ItemGroup>
|
|
36
39
|
{ !! navigationMenus && navigationMenus.length > 0 && (
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import { useDispatch
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { useDispatch } from '@wordpress/data';
|
|
6
|
+
import {
|
|
7
|
+
__experimentalUseNavigator as useNavigator,
|
|
8
|
+
ExternalLink,
|
|
9
|
+
} from '@wordpress/components';
|
|
10
|
+
import { useEntityRecord } from '@wordpress/core-data';
|
|
8
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
9
12
|
import { pencil } from '@wordpress/icons';
|
|
10
13
|
|
|
@@ -21,26 +24,11 @@ export default function SidebarNavigationScreenNavigationItem() {
|
|
|
21
24
|
const {
|
|
22
25
|
params: { postType, postId },
|
|
23
26
|
} = useNavigator();
|
|
24
|
-
|
|
25
|
-
const { post } = useSelect(
|
|
26
|
-
( select ) => {
|
|
27
|
-
const { getEntityRecord } = select( coreStore );
|
|
28
|
-
|
|
29
|
-
// The currently selected entity to display.
|
|
30
|
-
// Typically template or template part in the site editor.
|
|
31
|
-
return {
|
|
32
|
-
post:
|
|
33
|
-
postId && postType
|
|
34
|
-
? getEntityRecord( 'postType', postType, postId )
|
|
35
|
-
: null,
|
|
36
|
-
};
|
|
37
|
-
},
|
|
38
|
-
[ postType, postId ]
|
|
39
|
-
);
|
|
27
|
+
const { record } = useEntityRecord( 'postType', postType, postId );
|
|
40
28
|
|
|
41
29
|
return (
|
|
42
30
|
<SidebarNavigationScreen
|
|
43
|
-
title={
|
|
31
|
+
title={ record ? decodeEntities( record?.title?.rendered ) : null }
|
|
44
32
|
actions={
|
|
45
33
|
<SidebarButton
|
|
46
34
|
onClick={ () => setCanvasMode( 'edit' ) }
|
|
@@ -48,8 +36,29 @@ export default function SidebarNavigationScreenNavigationItem() {
|
|
|
48
36
|
icon={ pencil }
|
|
49
37
|
/>
|
|
50
38
|
}
|
|
39
|
+
description={
|
|
40
|
+
postType === 'page'
|
|
41
|
+
? __(
|
|
42
|
+
'Pages are static and are not listed by date. Pages do not use tags or categories.'
|
|
43
|
+
)
|
|
44
|
+
: __(
|
|
45
|
+
'Posts are entries listed in reverse chronological order on the site homepage or on the posts page.'
|
|
46
|
+
)
|
|
47
|
+
}
|
|
51
48
|
content={
|
|
52
|
-
|
|
49
|
+
<>
|
|
50
|
+
{ record?.link ? (
|
|
51
|
+
<ExternalLink
|
|
52
|
+
className="edit-site-sidebar-navigation-screen__page-link"
|
|
53
|
+
href={ record.link }
|
|
54
|
+
>
|
|
55
|
+
{ record.link }
|
|
56
|
+
</ExternalLink>
|
|
57
|
+
) : null }
|
|
58
|
+
{ record
|
|
59
|
+
? decodeEntities( record?.description?.rendered )
|
|
60
|
+
: null }
|
|
61
|
+
</>
|
|
53
62
|
}
|
|
54
63
|
/>
|
|
55
64
|
);
|