@wordpress/edit-site 5.12.8 → 5.12.9
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/index.js +0 -4
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/block-editor/use-site-editor-settings.js +12 -6
- package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build/components/page-patterns/grid.js +72 -12
- package/build/components/page-patterns/grid.js.map +1 -1
- package/build/components/page-patterns/patterns-list.js +2 -3
- package/build/components/page-patterns/patterns-list.js.map +1 -1
- package/build/components/page-template-parts/add-new-template-part.js +74 -0
- package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build/components/page-template-parts/index.js +2 -23
- package/build/components/page-template-parts/index.js.map +1 -1
- package/build/components/resizable-frame/index.js +75 -32
- package/build/components/resizable-frame/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen/index.js +13 -7
- package/build/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
- package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build/components/sidebar-navigation-screen-patterns/index.js +3 -4
- package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build/components/site-hub/index.js +3 -1
- package/build/components/site-hub/index.js.map +1 -1
- package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
- package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-module/components/block-editor/index.js +0 -4
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/block-editor/use-site-editor-settings.js +13 -7
- package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
- package/build-module/components/page-patterns/grid.js +75 -15
- package/build-module/components/page-patterns/grid.js.map +1 -1
- package/build-module/components/page-patterns/patterns-list.js +3 -4
- package/build-module/components/page-patterns/patterns-list.js.map +1 -1
- package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
- package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
- package/build-module/components/page-template-parts/index.js +3 -22
- package/build-module/components/page-template-parts/index.js.map +1 -1
- package/build-module/components/resizable-frame/index.js +76 -35
- package/build-module/components/resizable-frame/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen/index.js +14 -8
- package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
- package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
- package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +33 -25
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
- package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-patterns/index.js +3 -4
- package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
- package/build-module/components/site-hub/index.js +3 -1
- package/build-module/components/site-hub/index.js.map +1 -1
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
- package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
- package/build-style/style-rtl.css +48 -10
- package/build-style/style.css +48 -10
- package/package.json +14 -14
- package/src/components/block-editor/index.js +0 -4
- package/src/components/block-editor/use-site-editor-settings.js +16 -11
- package/src/components/layout/style.scss +1 -0
- package/src/components/page-patterns/grid.js +101 -16
- package/src/components/page-patterns/patterns-list.js +3 -4
- package/src/components/page-patterns/style.scss +21 -1
- package/src/components/page-template-parts/add-new-template-part.js +57 -0
- package/src/components/page-template-parts/index.js +3 -22
- package/src/components/resizable-frame/index.js +100 -31
- package/src/components/resizable-frame/style.scss +26 -9
- package/src/components/sidebar-navigation-item/style.scss +10 -1
- package/src/components/sidebar-navigation-screen/index.js +13 -6
- package/src/components/sidebar-navigation-screen-main/template-part-hint.js +1 -3
- package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
- package/src/components/sidebar-navigation-screen-pages/index.js +39 -29
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
- package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
- package/src/components/sidebar-navigation-screen-patterns/index.js +20 -18
- package/src/components/site-hub/index.js +5 -1
- package/src/components/site-hub/style.scss +5 -0
- package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
|
@@ -7,8 +7,7 @@ import {
|
|
|
7
7
|
__experimentalVStack as VStack,
|
|
8
8
|
} from '@wordpress/components';
|
|
9
9
|
import { __ } from '@wordpress/i18n';
|
|
10
|
-
import {
|
|
11
|
-
import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
|
|
10
|
+
import { useEntityRecords } from '@wordpress/core-data';
|
|
12
11
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
13
12
|
|
|
14
13
|
/**
|
|
@@ -19,8 +18,7 @@ import Table from '../table';
|
|
|
19
18
|
import Link from '../routes/link';
|
|
20
19
|
import AddedBy from '../list/added-by';
|
|
21
20
|
import TemplateActions from '../template-actions';
|
|
22
|
-
import
|
|
23
|
-
import { store as editSiteStore } from '../../store';
|
|
21
|
+
import AddNewTemplatePart from './add-new-template-part';
|
|
24
22
|
|
|
25
23
|
export default function PageTemplateParts() {
|
|
26
24
|
const { records: templateParts } = useEntityRecords(
|
|
@@ -31,15 +29,6 @@ export default function PageTemplateParts() {
|
|
|
31
29
|
}
|
|
32
30
|
);
|
|
33
31
|
|
|
34
|
-
const { canCreate } = useSelect( ( select ) => {
|
|
35
|
-
const { supportsTemplatePartsMode } =
|
|
36
|
-
select( editSiteStore ).getSettings();
|
|
37
|
-
return {
|
|
38
|
-
postType: select( coreStore ).getPostType( 'wp_template_part' ),
|
|
39
|
-
canCreate: ! supportsTemplatePartsMode,
|
|
40
|
-
};
|
|
41
|
-
} );
|
|
42
|
-
|
|
43
32
|
const columns = [
|
|
44
33
|
{
|
|
45
34
|
header: __( 'Template Part' ),
|
|
@@ -87,15 +76,7 @@ export default function PageTemplateParts() {
|
|
|
87
76
|
return (
|
|
88
77
|
<Page
|
|
89
78
|
title={ __( 'Template Parts' ) }
|
|
90
|
-
actions={
|
|
91
|
-
canCreate && (
|
|
92
|
-
<AddNewTemplate
|
|
93
|
-
templateType={ 'wp_template_part' }
|
|
94
|
-
showIcon={ false }
|
|
95
|
-
toggleProps={ { variant: 'primary' } }
|
|
96
|
-
/>
|
|
97
|
-
)
|
|
98
|
-
}
|
|
79
|
+
actions={ <AddNewTemplatePart /> }
|
|
99
80
|
>
|
|
100
81
|
{ templateParts && (
|
|
101
82
|
<Table data={ templateParts } columns={ columns } />
|
|
@@ -9,9 +9,12 @@ import classnames from 'classnames';
|
|
|
9
9
|
import { useState, useRef, useEffect } from '@wordpress/element';
|
|
10
10
|
import {
|
|
11
11
|
ResizableBox,
|
|
12
|
+
Tooltip,
|
|
12
13
|
__unstableMotion as motion,
|
|
13
14
|
} from '@wordpress/components';
|
|
14
|
-
import {
|
|
15
|
+
import { useInstanceId } from '@wordpress/compose';
|
|
16
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
17
|
+
import { __ } from '@wordpress/i18n';
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* Internal dependencies
|
|
@@ -33,7 +36,7 @@ const HANDLE_STYLES_OVERRIDE = {
|
|
|
33
36
|
};
|
|
34
37
|
|
|
35
38
|
// The minimum width of the frame (in px) while resizing.
|
|
36
|
-
const FRAME_MIN_WIDTH =
|
|
39
|
+
const FRAME_MIN_WIDTH = 320;
|
|
37
40
|
// The reference width of the frame (in px) used to calculate the aspect ratio.
|
|
38
41
|
const FRAME_REFERENCE_WIDTH = 1300;
|
|
39
42
|
// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.
|
|
@@ -42,6 +45,8 @@ const FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;
|
|
|
42
45
|
// viewport's edge. If the frame is resized to be closer to the viewport's edge
|
|
43
46
|
// than this distance, then "canvas mode" will be enabled.
|
|
44
47
|
const SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;
|
|
48
|
+
// Default size for the `frameSize` state.
|
|
49
|
+
const INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };
|
|
45
50
|
|
|
46
51
|
function calculateNewHeight( width, initialAspectRatio ) {
|
|
47
52
|
const lerp = ( a, b, amount ) => {
|
|
@@ -78,22 +83,27 @@ function ResizableFrame( {
|
|
|
78
83
|
oversizedClassName,
|
|
79
84
|
innerContentStyle,
|
|
80
85
|
} ) {
|
|
81
|
-
const [ frameSize, setFrameSize ] = useState(
|
|
82
|
-
width: '100%',
|
|
83
|
-
height: '100%',
|
|
84
|
-
} );
|
|
86
|
+
const [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );
|
|
85
87
|
// The width of the resizable frame when a new resize gesture starts.
|
|
86
88
|
const [ startingWidth, setStartingWidth ] = useState();
|
|
87
89
|
const [ isResizing, setIsResizing ] = useState( false );
|
|
88
|
-
const [
|
|
90
|
+
const [ shouldShowHandle, setShouldShowHandle ] = useState( false );
|
|
89
91
|
const [ isOversized, setIsOversized ] = useState( false );
|
|
90
92
|
const [ resizeRatio, setResizeRatio ] = useState( 1 );
|
|
93
|
+
const canvasMode = useSelect(
|
|
94
|
+
( select ) => unlock( select( editSiteStore ) ).getCanvasMode(),
|
|
95
|
+
[]
|
|
96
|
+
);
|
|
91
97
|
const { setCanvasMode } = unlock( useDispatch( editSiteStore ) );
|
|
92
98
|
const initialAspectRatioRef = useRef( null );
|
|
93
99
|
// The width of the resizable frame on initial render.
|
|
94
100
|
const initialComputedWidthRef = useRef( null );
|
|
95
101
|
const FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };
|
|
96
102
|
const frameRef = useRef( null );
|
|
103
|
+
const resizableHandleHelpId = useInstanceId(
|
|
104
|
+
ResizableFrame,
|
|
105
|
+
'edit-site-resizable-frame-handle-help'
|
|
106
|
+
);
|
|
97
107
|
|
|
98
108
|
// Remember frame dimensions on initial render.
|
|
99
109
|
useEffect( () => {
|
|
@@ -154,13 +164,40 @@ function ResizableFrame( {
|
|
|
154
164
|
if ( remainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ) {
|
|
155
165
|
// Reset the initial aspect ratio if the frame is resized slightly
|
|
156
166
|
// above the sidebar but not far enough to trigger full screen.
|
|
157
|
-
setFrameSize(
|
|
167
|
+
setFrameSize( INITIAL_FRAME_SIZE );
|
|
158
168
|
} else {
|
|
159
169
|
// Trigger full screen if the frame is resized far enough to the left.
|
|
160
170
|
setCanvasMode( 'edit' );
|
|
161
171
|
}
|
|
162
172
|
};
|
|
163
173
|
|
|
174
|
+
// Handle resize by arrow keys
|
|
175
|
+
const handleResizableHandleKeyDown = ( event ) => {
|
|
176
|
+
if ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
event.preventDefault();
|
|
181
|
+
|
|
182
|
+
const step = 20 * ( event.shiftKey ? 5 : 1 );
|
|
183
|
+
const delta = step * ( event.key === 'ArrowLeft' ? 1 : -1 );
|
|
184
|
+
const newWidth = Math.min(
|
|
185
|
+
Math.max(
|
|
186
|
+
FRAME_MIN_WIDTH,
|
|
187
|
+
frameRef.current.resizable.offsetWidth + delta
|
|
188
|
+
),
|
|
189
|
+
initialComputedWidthRef.current
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
setFrameSize( {
|
|
193
|
+
width: newWidth,
|
|
194
|
+
height: calculateNewHeight(
|
|
195
|
+
newWidth,
|
|
196
|
+
initialAspectRatioRef.current
|
|
197
|
+
),
|
|
198
|
+
} );
|
|
199
|
+
};
|
|
200
|
+
|
|
164
201
|
const frameAnimationVariants = {
|
|
165
202
|
default: {
|
|
166
203
|
flexGrow: 0,
|
|
@@ -173,16 +210,26 @@ function ResizableFrame( {
|
|
|
173
210
|
};
|
|
174
211
|
|
|
175
212
|
const resizeHandleVariants = {
|
|
176
|
-
|
|
213
|
+
hidden: {
|
|
214
|
+
opacity: 0,
|
|
215
|
+
left: 0,
|
|
216
|
+
},
|
|
217
|
+
visible: {
|
|
177
218
|
opacity: 1,
|
|
178
219
|
left: -16,
|
|
179
220
|
},
|
|
180
|
-
|
|
221
|
+
active: {
|
|
181
222
|
opacity: 1,
|
|
182
223
|
left: -16,
|
|
183
224
|
scaleY: 1.3,
|
|
184
225
|
},
|
|
185
226
|
};
|
|
227
|
+
const currentResizeHandleVariant = ( () => {
|
|
228
|
+
if ( isResizing ) {
|
|
229
|
+
return 'active';
|
|
230
|
+
}
|
|
231
|
+
return shouldShowHandle ? 'visible' : 'hidden';
|
|
232
|
+
} )();
|
|
186
233
|
|
|
187
234
|
return (
|
|
188
235
|
<ResizableBox
|
|
@@ -217,28 +264,50 @@ function ResizableFrame( {
|
|
|
217
264
|
minWidth={ FRAME_MIN_WIDTH }
|
|
218
265
|
maxWidth={ isFullWidth ? '100%' : '150%' }
|
|
219
266
|
maxHeight={ '100%' }
|
|
220
|
-
|
|
221
|
-
|
|
267
|
+
onFocus={ () => setShouldShowHandle( true ) }
|
|
268
|
+
onBlur={ () => setShouldShowHandle( false ) }
|
|
269
|
+
onMouseOver={ () => setShouldShowHandle( true ) }
|
|
270
|
+
onMouseOut={ () => setShouldShowHandle( false ) }
|
|
222
271
|
handleComponent={ {
|
|
223
|
-
left:
|
|
224
|
-
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
272
|
+
left: canvasMode === 'view' && (
|
|
273
|
+
<>
|
|
274
|
+
<Tooltip text={ __( 'Drag to resize' ) }>
|
|
275
|
+
{ /* Disable reason: role="separator" does in fact support aria-valuenow */ }
|
|
276
|
+
{ /* eslint-disable-next-line jsx-a11y/role-supports-aria-props */ }
|
|
277
|
+
<motion.button
|
|
278
|
+
key="handle"
|
|
279
|
+
role="separator"
|
|
280
|
+
aria-orientation="vertical"
|
|
281
|
+
className={ classnames(
|
|
282
|
+
'edit-site-resizable-frame__handle',
|
|
283
|
+
{ 'is-resizing': isResizing }
|
|
284
|
+
) }
|
|
285
|
+
variants={ resizeHandleVariants }
|
|
286
|
+
animate={ currentResizeHandleVariant }
|
|
287
|
+
aria-label={ __( 'Drag to resize' ) }
|
|
288
|
+
aria-describedby={ resizableHandleHelpId }
|
|
289
|
+
aria-valuenow={
|
|
290
|
+
frameRef.current?.resizable?.offsetWidth ||
|
|
291
|
+
undefined
|
|
292
|
+
}
|
|
293
|
+
aria-valuemin={ FRAME_MIN_WIDTH }
|
|
294
|
+
aria-valuemax={
|
|
295
|
+
initialComputedWidthRef.current
|
|
296
|
+
}
|
|
297
|
+
onKeyDown={ handleResizableHandleKeyDown }
|
|
298
|
+
initial="hidden"
|
|
299
|
+
exit="hidden"
|
|
300
|
+
whileFocus="active"
|
|
301
|
+
whileHover="active"
|
|
302
|
+
/>
|
|
303
|
+
</Tooltip>
|
|
304
|
+
<div hidden id={ resizableHandleHelpId }>
|
|
305
|
+
{ __(
|
|
306
|
+
'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'
|
|
307
|
+
) }
|
|
308
|
+
</div>
|
|
309
|
+
</>
|
|
310
|
+
),
|
|
242
311
|
} }
|
|
243
312
|
onResizeStart={ handleResizeStart }
|
|
244
313
|
onResize={ handleResize }
|
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
.edit-site-resizable-frame__inner {
|
|
2
2
|
position: relative;
|
|
3
3
|
|
|
4
|
+
&.edit-site-layout__resizable-frame-oversized {
|
|
5
|
+
@at-root {
|
|
6
|
+
body:has(&) {
|
|
7
|
+
.edit-site-site-hub {
|
|
8
|
+
.edit-site-site-hub__site-title,
|
|
9
|
+
.edit-site-site-hub_toggle-command-center {
|
|
10
|
+
opacity: 0 !important;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.edit-site-site-hub__view-mode-toggle-container {
|
|
14
|
+
background-color: transparent;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
4
21
|
&.is-resizing {
|
|
5
22
|
@at-root {
|
|
6
23
|
body:has(&) {
|
|
@@ -30,11 +47,13 @@
|
|
|
30
47
|
.edit-site-resizable-frame__handle {
|
|
31
48
|
align-items: center;
|
|
32
49
|
background-color: rgba($gray-700, 0.4);
|
|
50
|
+
border: 0;
|
|
33
51
|
border-radius: $grid-unit-05;
|
|
34
52
|
cursor: col-resize;
|
|
35
53
|
display: flex;
|
|
36
54
|
height: $grid-unit-80;
|
|
37
55
|
justify-content: flex-end;
|
|
56
|
+
padding: 0;
|
|
38
57
|
position: absolute;
|
|
39
58
|
top: calc(50% - #{$grid-unit-40});
|
|
40
59
|
width: $grid-unit-05;
|
|
@@ -56,16 +75,14 @@
|
|
|
56
75
|
width: $grid-unit-40;
|
|
57
76
|
}
|
|
58
77
|
|
|
59
|
-
&:
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
&:focus-visible {
|
|
79
|
+
// Works with Windows high contrast mode while also hiding weird outline in Safari.
|
|
80
|
+
outline: 2px solid transparent;
|
|
62
81
|
}
|
|
63
82
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
color:
|
|
68
|
-
margin-right: $grid-unit-10;
|
|
69
|
-
padding: 4px 8px;
|
|
83
|
+
&:hover,
|
|
84
|
+
&:focus,
|
|
85
|
+
&.is-resizing {
|
|
86
|
+
background-color: var(--wp-admin-theme-color);
|
|
70
87
|
}
|
|
71
88
|
}
|
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
&[aria-current] {
|
|
12
12
|
color: $gray-200;
|
|
13
13
|
background: $gray-800;
|
|
14
|
+
|
|
15
|
+
.edit-site-sidebar-navigation-item__drilldown-indicator {
|
|
16
|
+
fill: $gray-200;
|
|
17
|
+
}
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
&[aria-current] {
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
}
|
|
20
24
|
|
|
21
25
|
.edit-site-sidebar-navigation-item__drilldown-indicator {
|
|
22
|
-
fill: $gray-
|
|
26
|
+
fill: $gray-600;
|
|
23
27
|
}
|
|
24
28
|
|
|
25
29
|
&:is(a) {
|
|
@@ -31,6 +35,11 @@
|
|
|
31
35
|
box-shadow: none;
|
|
32
36
|
outline: none;
|
|
33
37
|
}
|
|
38
|
+
|
|
39
|
+
&:focus-visible {
|
|
40
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
41
|
+
outline: 2px solid transparent;
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
&.with-suffix {
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
import {
|
|
5
5
|
__experimentalHStack as HStack,
|
|
6
6
|
__experimentalHeading as Heading,
|
|
7
|
-
__experimentalNavigatorToParentButton as NavigatorToParentButton,
|
|
8
7
|
__experimentalUseNavigator as useNavigator,
|
|
9
8
|
__experimentalVStack as VStack,
|
|
10
9
|
} from '@wordpress/components';
|
|
@@ -41,7 +40,7 @@ export default function SidebarNavigationScreen( {
|
|
|
41
40
|
};
|
|
42
41
|
}, [] );
|
|
43
42
|
const { getTheme } = useSelect( coreStore );
|
|
44
|
-
const
|
|
43
|
+
const navigator = useNavigator();
|
|
45
44
|
const theme = getTheme( currentlyPreviewingTheme() );
|
|
46
45
|
const icon = isRTL() ? chevronRight : chevronLeft;
|
|
47
46
|
|
|
@@ -58,16 +57,24 @@ export default function SidebarNavigationScreen( {
|
|
|
58
57
|
className="edit-site-sidebar-navigation-screen__title-icon"
|
|
59
58
|
>
|
|
60
59
|
{ ! isRoot && ! backPath && (
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
<SidebarButton
|
|
61
|
+
onClick={ () => {
|
|
62
|
+
if ( navigator.location.isInitial ) {
|
|
63
|
+
navigator.goToParent( { replace: true } );
|
|
64
|
+
} else {
|
|
65
|
+
navigator.goBack();
|
|
66
|
+
}
|
|
67
|
+
} }
|
|
68
|
+
icon={ icon }
|
|
64
69
|
label={ __( 'Back' ) }
|
|
65
70
|
showTooltip={ false }
|
|
66
71
|
/>
|
|
67
72
|
) }
|
|
68
73
|
{ ! isRoot && backPath && (
|
|
69
74
|
<SidebarButton
|
|
70
|
-
onClick={ () =>
|
|
75
|
+
onClick={ () =>
|
|
76
|
+
navigator.goTo( backPath, { isBack: true } )
|
|
77
|
+
}
|
|
71
78
|
icon={ icon }
|
|
72
79
|
label={ __( 'Back' ) }
|
|
73
80
|
showTooltip={ false }
|
|
@@ -28,9 +28,7 @@ export default function TemplatePartHint() {
|
|
|
28
28
|
setPreference( 'core', PREFERENCE_NAME, false );
|
|
29
29
|
} }
|
|
30
30
|
>
|
|
31
|
-
{ __(
|
|
32
|
-
'Looking for template parts? You can now find them in the new "Patterns" page.'
|
|
33
|
-
) }
|
|
31
|
+
{ __( 'Looking for template parts? Find them in "Patterns".' ) }
|
|
34
32
|
</Notice>
|
|
35
33
|
);
|
|
36
34
|
}
|
|
@@ -23,13 +23,13 @@ export default function SingleNavigationMenu( {
|
|
|
23
23
|
<SidebarNavigationScreenWrapper
|
|
24
24
|
actions={
|
|
25
25
|
<>
|
|
26
|
-
<EditButton postId={ navigationMenu?.id } />
|
|
27
26
|
<ScreenNavigationMoreMenu
|
|
28
27
|
menuTitle={ decodeEntities( menuTitle ) }
|
|
29
28
|
onDelete={ handleDelete }
|
|
30
29
|
onSave={ handleSave }
|
|
31
30
|
onDuplicate={ handleDuplicate }
|
|
32
31
|
/>
|
|
32
|
+
<EditButton postId={ navigationMenu?.id } />
|
|
33
33
|
</>
|
|
34
34
|
}
|
|
35
35
|
title={ decodeEntities( menuTitle ) }
|
|
@@ -58,13 +58,16 @@ export default function SidebarNavigationScreenPages() {
|
|
|
58
58
|
templates?.find( ( template ) => template.slug === 'home' ) ||
|
|
59
59
|
templates?.find( ( template ) => template.slug === 'index' );
|
|
60
60
|
|
|
61
|
+
const getPostsPageTemplate = () =>
|
|
62
|
+
templates?.find( ( template ) => template.slug === 'home' ) ||
|
|
63
|
+
templates?.find( ( template ) => template.slug === 'index' );
|
|
64
|
+
|
|
61
65
|
const pagesAndTemplates = pages?.concat( dynamicPageTemplates, [
|
|
62
66
|
homeTemplate,
|
|
63
67
|
] );
|
|
64
68
|
|
|
65
69
|
const { frontPage, postsPage } = useSelect( ( select ) => {
|
|
66
70
|
const { getEntityRecord } = select( coreStore );
|
|
67
|
-
|
|
68
71
|
const siteSettings = getEntityRecord( 'root', 'site' );
|
|
69
72
|
return {
|
|
70
73
|
frontPage: siteSettings?.page_on_front,
|
|
@@ -106,6 +109,27 @@ export default function SidebarNavigationScreenPages() {
|
|
|
106
109
|
setShowAddPage( false );
|
|
107
110
|
};
|
|
108
111
|
|
|
112
|
+
const getPageProps = ( id ) => {
|
|
113
|
+
let itemIcon = page;
|
|
114
|
+
const postsPageTemplateId =
|
|
115
|
+
postsPage && postsPage === id ? getPostsPageTemplate()?.id : null;
|
|
116
|
+
|
|
117
|
+
switch ( id ) {
|
|
118
|
+
case frontPage:
|
|
119
|
+
itemIcon = home;
|
|
120
|
+
break;
|
|
121
|
+
case postsPage:
|
|
122
|
+
itemIcon = verse;
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return {
|
|
127
|
+
icon: itemIcon,
|
|
128
|
+
postType: postsPageTemplateId ? 'wp_template' : 'page',
|
|
129
|
+
postId: postsPageTemplateId || id,
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
|
|
109
133
|
return (
|
|
110
134
|
<>
|
|
111
135
|
{ showAddPage && (
|
|
@@ -152,34 +176,20 @@ export default function SidebarNavigationScreenPages() {
|
|
|
152
176
|
</Truncate>
|
|
153
177
|
</PageItem>
|
|
154
178
|
) }
|
|
155
|
-
{ reorderedPages?.map( (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
postId={ item.id }
|
|
170
|
-
key={ item.id }
|
|
171
|
-
icon={ itemIcon }
|
|
172
|
-
withChevron
|
|
173
|
-
>
|
|
174
|
-
<Truncate numberOfLines={ 1 }>
|
|
175
|
-
{ decodeEntities(
|
|
176
|
-
item?.title?.rendered ||
|
|
177
|
-
__( '(no title)' )
|
|
178
|
-
) }
|
|
179
|
-
</Truncate>
|
|
180
|
-
</PageItem>
|
|
181
|
-
);
|
|
182
|
-
} ) }
|
|
179
|
+
{ reorderedPages?.map( ( { id, title } ) => (
|
|
180
|
+
<PageItem
|
|
181
|
+
{ ...getPageProps( id ) }
|
|
182
|
+
key={ id }
|
|
183
|
+
withChevron
|
|
184
|
+
>
|
|
185
|
+
<Truncate numberOfLines={ 1 }>
|
|
186
|
+
{ decodeEntities(
|
|
187
|
+
title?.rendered ||
|
|
188
|
+
__( '(no title)' )
|
|
189
|
+
) }
|
|
190
|
+
</Truncate>
|
|
191
|
+
</PageItem>
|
|
192
|
+
) ) }
|
|
183
193
|
</ItemGroup>
|
|
184
194
|
) }
|
|
185
195
|
</>
|
|
@@ -19,8 +19,9 @@ export default function TemplatePartNavigationMenu( { id } ) {
|
|
|
19
19
|
<>
|
|
20
20
|
<Heading
|
|
21
21
|
className="edit-site-sidebar-navigation-screen-template-part-navigation-menu__title"
|
|
22
|
-
size="
|
|
22
|
+
size="11"
|
|
23
23
|
upperCase={ true }
|
|
24
|
+
weight={ 500 }
|
|
24
25
|
>
|
|
25
26
|
{ title?.rendered || __( 'Navigation' ) }
|
|
26
27
|
</Heading>
|
|
@@ -22,8 +22,9 @@ export default function TemplatePartNavigationMenus( { menus } ) {
|
|
|
22
22
|
<>
|
|
23
23
|
<Heading
|
|
24
24
|
className="edit-site-sidebar-navigation-screen-template-part-navigation-menu__title"
|
|
25
|
-
size="
|
|
25
|
+
size="11"
|
|
26
26
|
upperCase={ true }
|
|
27
|
+
weight={ 500 }
|
|
27
28
|
>
|
|
28
29
|
{ __( 'Navigation' ) }
|
|
29
30
|
</Heading>
|
|
@@ -107,7 +107,7 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
107
107
|
const { templatePartAreas, hasTemplateParts, isLoading } =
|
|
108
108
|
useTemplatePartAreas();
|
|
109
109
|
const { patternCategories, hasPatterns } = usePatternCategories();
|
|
110
|
-
const { myPatterns
|
|
110
|
+
const { myPatterns } = useMyPatterns();
|
|
111
111
|
|
|
112
112
|
const isTemplatePartsMode = useSelect( ( select ) => {
|
|
113
113
|
const settings = select( editSiteStore ).getSettings();
|
|
@@ -153,23 +153,25 @@ export default function SidebarNavigationScreenPatterns() {
|
|
|
153
153
|
</Item>
|
|
154
154
|
</ItemGroup>
|
|
155
155
|
) }
|
|
156
|
-
|
|
157
|
-
<
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
156
|
+
<ItemGroup className="edit-site-sidebar-navigation-screen-patterns__group">
|
|
157
|
+
<CategoryItem
|
|
158
|
+
key={ myPatterns.name }
|
|
159
|
+
count={
|
|
160
|
+
! myPatterns.count
|
|
161
|
+
? '0'
|
|
162
|
+
: myPatterns.count
|
|
163
|
+
}
|
|
164
|
+
label={ myPatterns.label }
|
|
165
|
+
icon={ starFilled }
|
|
166
|
+
id={ myPatterns.name }
|
|
167
|
+
type="wp_block"
|
|
168
|
+
isActive={
|
|
169
|
+
currentCategory ===
|
|
170
|
+
`${ myPatterns.name }` &&
|
|
171
|
+
currentType === 'wp_block'
|
|
172
|
+
}
|
|
173
|
+
/>
|
|
174
|
+
</ItemGroup>
|
|
173
175
|
{ hasTemplateParts && (
|
|
174
176
|
<TemplatePartGroup
|
|
175
177
|
areas={ templatePartAreas }
|
|
@@ -51,7 +51,10 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
51
51
|
const { open: openCommandCenter } = useDispatch( commandsStore );
|
|
52
52
|
|
|
53
53
|
const disableMotion = useReducedMotion();
|
|
54
|
-
const {
|
|
54
|
+
const {
|
|
55
|
+
setCanvasMode,
|
|
56
|
+
__experimentalSetPreviewDeviceType: setPreviewDeviceType,
|
|
57
|
+
} = unlock( useDispatch( editSiteStore ) );
|
|
55
58
|
const { clearSelectedBlock } = useDispatch( blockEditorStore );
|
|
56
59
|
const isBackToDashboardButton = canvasMode === 'view';
|
|
57
60
|
const siteIconButtonProps = isBackToDashboardButton
|
|
@@ -67,6 +70,7 @@ const SiteHub = forwardRef( ( props, ref ) => {
|
|
|
67
70
|
event.preventDefault();
|
|
68
71
|
if ( canvasMode === 'edit' ) {
|
|
69
72
|
clearSelectedBlock();
|
|
73
|
+
setPreviewDeviceType( 'desktop' );
|
|
70
74
|
setCanvasMode( 'view' );
|
|
71
75
|
}
|
|
72
76
|
},
|