@wordpress/edit-site 5.28.2 → 5.28.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 +18 -8
- package/build/components/add-new-pattern/index.js.map +1 -1
- package/build/components/editor/index.js +1 -1
- package/build/components/editor/index.js.map +1 -1
- package/build/components/global-styles/block-preview-panel.js +2 -2
- package/build/components/global-styles/block-preview-panel.js.map +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-details.js +1 -1
- package/build/components/global-styles/font-library-modal/collection-font-details.js.map +1 -1
- package/build/components/global-styles/font-library-modal/font-collection.js +84 -7
- package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/build/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build/components/global-styles/font-library-modal/installed-fonts.js +10 -7
- package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build/components/layout/index.js +8 -3
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/router.js +26 -5
- package/build/components/layout/router.js.map +1 -1
- package/build/components/page-patterns/use-patterns.js +10 -5
- package/build/components/page-patterns/use-patterns.js.map +1 -1
- package/build/components/page-templates-template-parts/index.js +1 -0
- package/build/components/page-templates-template-parts/index.js.map +1 -1
- package/build/components/sidebar/index.js +3 -1
- package/build/components/sidebar/index.js.map +1 -1
- package/build/components/sidebar-navigation-screen-pages/index.js +3 -1
- package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build/store/private-actions.js +3 -1
- package/build/store/private-actions.js.map +1 -1
- package/build-module/components/add-new-pattern/index.js +18 -8
- package/build-module/components/add-new-pattern/index.js.map +1 -1
- package/build-module/components/editor/index.js +1 -1
- package/build-module/components/editor/index.js.map +1 -1
- package/build-module/components/global-styles/block-preview-panel.js +2 -2
- package/build-module/components/global-styles/block-preview-panel.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js +1 -1
- package/build-module/components/global-styles/font-library-modal/collection-font-details.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/font-collection.js +87 -10
- package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/build-module/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js.map +1 -1
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js +11 -8
- package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
- package/build-module/components/layout/index.js +8 -3
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/router.js +26 -5
- package/build-module/components/layout/router.js.map +1 -1
- package/build-module/components/page-patterns/use-patterns.js +10 -5
- package/build-module/components/page-patterns/use-patterns.js.map +1 -1
- package/build-module/components/page-templates-template-parts/index.js +1 -0
- package/build-module/components/page-templates-template-parts/index.js.map +1 -1
- package/build-module/components/sidebar/index.js +3 -1
- package/build-module/components/sidebar/index.js.map +1 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js +3 -1
- package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
- package/build-module/store/private-actions.js +3 -1
- package/build-module/store/private-actions.js.map +1 -1
- package/build-style/style-rtl.css +24 -3
- package/build-style/style.css +24 -3
- package/package.json +12 -12
- package/src/components/add-new-pattern/index.js +27 -11
- package/src/components/editor/index.js +1 -0
- package/src/components/global-styles/block-preview-panel.js +2 -2
- package/src/components/global-styles/font-library-modal/collection-font-details.js +1 -1
- package/src/components/global-styles/font-library-modal/font-collection.js +118 -13
- package/src/components/global-styles/font-library-modal/google-fonts-confirm-dialog.js +1 -1
- package/src/components/global-styles/font-library-modal/installed-fonts.js +25 -23
- package/src/components/global-styles/font-library-modal/style.scss +2 -5
- package/src/components/layout/index.js +47 -30
- package/src/components/layout/router.js +31 -2
- package/src/components/layout/style.scss +7 -0
- package/src/components/page-patterns/style.scss +10 -0
- package/src/components/page-patterns/use-patterns.js +13 -5
- package/src/components/page-templates-template-parts/index.js +1 -0
- package/src/components/page-templates-template-parts/style.scss +6 -0
- package/src/components/sidebar/index.js +7 -3
- package/src/components/sidebar-navigation-screen-pages/index.js +10 -6
- package/src/store/private-actions.js +4 -0
- package/build/components/global-styles/font-library-modal/fonts-grid.js +0 -57
- package/build/components/global-styles/font-library-modal/fonts-grid.js.map +0 -1
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js +0 -50
- package/build-module/components/global-styles/font-library-modal/fonts-grid.js.map +0 -1
- package/src/components/global-styles/font-library-modal/fonts-grid.js +0 -59
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
useContext,
|
|
6
|
+
useEffect,
|
|
7
|
+
useState,
|
|
8
|
+
useMemo,
|
|
9
|
+
createInterpolateElement,
|
|
10
|
+
} from '@wordpress/element';
|
|
5
11
|
import {
|
|
6
12
|
__experimentalSpacer as Spacer,
|
|
7
13
|
__experimentalInputControl as InputControl,
|
|
8
14
|
__experimentalText as Text,
|
|
15
|
+
__experimentalHStack as HStack,
|
|
9
16
|
SelectControl,
|
|
10
17
|
Spinner,
|
|
11
18
|
Icon,
|
|
@@ -14,7 +21,7 @@ import {
|
|
|
14
21
|
Button,
|
|
15
22
|
} from '@wordpress/components';
|
|
16
23
|
import { debounce } from '@wordpress/compose';
|
|
17
|
-
import { __, _x } from '@wordpress/i18n';
|
|
24
|
+
import { sprintf, __, _x } from '@wordpress/i18n';
|
|
18
25
|
import { search, closeSmall } from '@wordpress/icons';
|
|
19
26
|
|
|
20
27
|
/**
|
|
@@ -22,7 +29,6 @@ import { search, closeSmall } from '@wordpress/icons';
|
|
|
22
29
|
*/
|
|
23
30
|
import TabPanelLayout from './tab-panel-layout';
|
|
24
31
|
import { FontLibraryContext } from './context';
|
|
25
|
-
import FontsGrid from './fonts-grid';
|
|
26
32
|
import FontCard from './font-card';
|
|
27
33
|
import filterFonts from './utils/filter-fonts';
|
|
28
34
|
import CollectionFontDetails from './collection-font-details';
|
|
@@ -48,6 +54,7 @@ function FontCollection( { slug } ) {
|
|
|
48
54
|
|
|
49
55
|
const [ selectedFont, setSelectedFont ] = useState( null );
|
|
50
56
|
const [ fontsToInstall, setFontsToInstall ] = useState( [] );
|
|
57
|
+
const [ page, setPage ] = useState( 1 );
|
|
51
58
|
const [ filters, setFilters ] = useState( {} );
|
|
52
59
|
const [ renderConfirmDialog, setRenderConfirmDialog ] = useState(
|
|
53
60
|
requiresPermission && ! getGoogleFontsPermissionFromStorage()
|
|
@@ -109,22 +116,34 @@ function FontCollection( { slug } ) {
|
|
|
109
116
|
[ collectionFonts, filters ]
|
|
110
117
|
);
|
|
111
118
|
|
|
119
|
+
// NOTE: The height of the font library modal unavailable to use for rendering font family items is roughly 417px
|
|
120
|
+
// The height of each font family item is 61px.
|
|
121
|
+
const pageSize = Math.floor( ( window.innerHeight - 417 ) / 61 );
|
|
122
|
+
const totalPages = Math.ceil( fonts.length / pageSize );
|
|
123
|
+
const itemsStart = ( page - 1 ) * pageSize;
|
|
124
|
+
const itemsLimit = page * pageSize;
|
|
125
|
+
const items = fonts.slice( itemsStart, itemsLimit );
|
|
126
|
+
|
|
112
127
|
const handleCategoryFilter = ( category ) => {
|
|
113
128
|
setFilters( { ...filters, category } );
|
|
129
|
+
setPage( 1 );
|
|
114
130
|
};
|
|
115
131
|
|
|
116
132
|
const handleUpdateSearchInput = ( value ) => {
|
|
117
133
|
setFilters( { ...filters, search: value } );
|
|
134
|
+
setPage( 1 );
|
|
118
135
|
};
|
|
119
136
|
|
|
120
137
|
const debouncedUpdateSearchInput = debounce( handleUpdateSearchInput, 300 );
|
|
121
138
|
|
|
122
139
|
const resetFilters = () => {
|
|
123
140
|
setFilters( {} );
|
|
141
|
+
setPage( 1 );
|
|
124
142
|
};
|
|
125
143
|
|
|
126
144
|
const resetSearch = () => {
|
|
127
145
|
setFilters( { ...filters, search: '' } );
|
|
146
|
+
setPage( 1 );
|
|
128
147
|
};
|
|
129
148
|
|
|
130
149
|
const handleUnselectFont = () => {
|
|
@@ -186,6 +205,24 @@ function FontCollection( { slug } ) {
|
|
|
186
205
|
resetFontsToInstall();
|
|
187
206
|
};
|
|
188
207
|
|
|
208
|
+
let footerComponent = null;
|
|
209
|
+
if ( selectedFont ) {
|
|
210
|
+
footerComponent = (
|
|
211
|
+
<InstallFooter
|
|
212
|
+
handleInstall={ handleInstall }
|
|
213
|
+
isDisabled={ fontsToInstall.length === 0 }
|
|
214
|
+
/>
|
|
215
|
+
);
|
|
216
|
+
} else if ( ! renderConfirmDialog && totalPages > 1 ) {
|
|
217
|
+
footerComponent = (
|
|
218
|
+
<PaginationFooter
|
|
219
|
+
page={ page }
|
|
220
|
+
totalPages={ totalPages }
|
|
221
|
+
setPage={ setPage }
|
|
222
|
+
/>
|
|
223
|
+
);
|
|
224
|
+
}
|
|
225
|
+
|
|
189
226
|
return (
|
|
190
227
|
<TabPanelLayout
|
|
191
228
|
title={
|
|
@@ -198,12 +235,7 @@ function FontCollection( { slug } ) {
|
|
|
198
235
|
}
|
|
199
236
|
notice={ notice }
|
|
200
237
|
handleBack={ !! selectedFont && handleUnselectFont }
|
|
201
|
-
footer={
|
|
202
|
-
<Footer
|
|
203
|
-
handleInstall={ handleInstall }
|
|
204
|
-
isDisabled={ fontsToInstall.length === 0 }
|
|
205
|
-
/>
|
|
206
|
-
}
|
|
238
|
+
footer={ footerComponent }
|
|
207
239
|
>
|
|
208
240
|
{ renderConfirmDialog && (
|
|
209
241
|
<>
|
|
@@ -275,8 +307,8 @@ function FontCollection( { slug } ) {
|
|
|
275
307
|
) }
|
|
276
308
|
|
|
277
309
|
{ ! renderConfirmDialog && ! selectedFont && (
|
|
278
|
-
<
|
|
279
|
-
{
|
|
310
|
+
<div className="font-library-modal__fonts-grid__main">
|
|
311
|
+
{ items.map( ( font ) => (
|
|
280
312
|
<FontCard
|
|
281
313
|
key={ font.font_family_settings.slug }
|
|
282
314
|
font={ font.font_family_settings }
|
|
@@ -285,13 +317,86 @@ function FontCollection( { slug } ) {
|
|
|
285
317
|
} }
|
|
286
318
|
/>
|
|
287
319
|
) ) }
|
|
288
|
-
</
|
|
320
|
+
</div>
|
|
289
321
|
) }
|
|
290
322
|
</TabPanelLayout>
|
|
291
323
|
);
|
|
292
324
|
}
|
|
293
325
|
|
|
294
|
-
function
|
|
326
|
+
function PaginationFooter( { page, totalPages, setPage } ) {
|
|
327
|
+
return (
|
|
328
|
+
<Flex justify="center">
|
|
329
|
+
<Button
|
|
330
|
+
label={ __( 'First page' ) }
|
|
331
|
+
size="compact"
|
|
332
|
+
onClick={ () => setPage( 1 ) }
|
|
333
|
+
disabled={ page === 1 }
|
|
334
|
+
__experimentalIsFocusable
|
|
335
|
+
>
|
|
336
|
+
<span>«</span>
|
|
337
|
+
</Button>
|
|
338
|
+
<Button
|
|
339
|
+
label={ __( 'Previous page' ) }
|
|
340
|
+
size="compact"
|
|
341
|
+
onClick={ () => setPage( page - 1 ) }
|
|
342
|
+
disabled={ page === 1 }
|
|
343
|
+
__experimentalIsFocusable
|
|
344
|
+
>
|
|
345
|
+
<span>‹</span>
|
|
346
|
+
</Button>
|
|
347
|
+
<HStack justify="flex-start" expanded={ false } spacing={ 2 }>
|
|
348
|
+
{ createInterpolateElement(
|
|
349
|
+
sprintf(
|
|
350
|
+
// translators: %s: Total number of pages.
|
|
351
|
+
_x( 'Page <CurrenPageControl /> of %s', 'paging' ),
|
|
352
|
+
totalPages
|
|
353
|
+
),
|
|
354
|
+
{
|
|
355
|
+
CurrenPageControl: (
|
|
356
|
+
<SelectControl
|
|
357
|
+
aria-label={ __( 'Current page' ) }
|
|
358
|
+
value={ page }
|
|
359
|
+
options={ [ ...Array( totalPages ) ].map(
|
|
360
|
+
( e, i ) => {
|
|
361
|
+
return {
|
|
362
|
+
label: i + 1,
|
|
363
|
+
value: i + 1,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
) }
|
|
367
|
+
onChange={ ( newPage ) =>
|
|
368
|
+
setPage( parseInt( newPage ) )
|
|
369
|
+
}
|
|
370
|
+
size={ 'compact' }
|
|
371
|
+
__nextHasNoMarginBottom
|
|
372
|
+
/>
|
|
373
|
+
),
|
|
374
|
+
}
|
|
375
|
+
) }
|
|
376
|
+
</HStack>
|
|
377
|
+
<Button
|
|
378
|
+
label={ __( 'Next page' ) }
|
|
379
|
+
size="compact"
|
|
380
|
+
onClick={ () => setPage( page + 1 ) }
|
|
381
|
+
disabled={ page === totalPages }
|
|
382
|
+
__experimentalIsFocusable
|
|
383
|
+
>
|
|
384
|
+
<span>›</span>
|
|
385
|
+
</Button>
|
|
386
|
+
<Button
|
|
387
|
+
label={ __( 'Last page' ) }
|
|
388
|
+
size="compact"
|
|
389
|
+
onClick={ () => setPage( totalPages ) }
|
|
390
|
+
disabled={ page === totalPages }
|
|
391
|
+
__experimentalIsFocusable
|
|
392
|
+
>
|
|
393
|
+
<span>»</span>
|
|
394
|
+
</Button>
|
|
395
|
+
</Flex>
|
|
396
|
+
);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function InstallFooter( { handleInstall, isDisabled } ) {
|
|
295
400
|
const { isInstalling } = useContext( FontLibraryContext );
|
|
296
401
|
|
|
297
402
|
return (
|
|
@@ -24,7 +24,7 @@ function GoogleFontsConfirmDialog() {
|
|
|
24
24
|
<div className="font-library__google-fonts-confirm">
|
|
25
25
|
<Card>
|
|
26
26
|
<CardBody>
|
|
27
|
-
<Text as="h3">Connect to Google Fonts</Text>
|
|
27
|
+
<Text as="h3">{ __( 'Connect to Google Fonts' ) }</Text>
|
|
28
28
|
<Spacer margin={ 6 } />
|
|
29
29
|
<Text as="p">
|
|
30
30
|
{ __(
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
privateApis as componentsPrivateApis,
|
|
8
8
|
__experimentalHStack as HStack,
|
|
9
9
|
__experimentalSpacer as Spacer,
|
|
10
|
+
__experimentalText as Text,
|
|
10
11
|
Button,
|
|
11
12
|
Spinner,
|
|
12
13
|
FlexItem,
|
|
@@ -17,7 +18,6 @@ import {
|
|
|
17
18
|
*/
|
|
18
19
|
import TabPanelLayout from './tab-panel-layout';
|
|
19
20
|
import { FontLibraryContext } from './context';
|
|
20
|
-
import FontsGrid from './fonts-grid';
|
|
21
21
|
import LibraryFontDetails from './library-font-details';
|
|
22
22
|
import LibraryFontCard from './library-font-card';
|
|
23
23
|
import ConfirmDeleteDialog from './confirm-delete-dialog';
|
|
@@ -123,36 +123,38 @@ function InstalledFonts() {
|
|
|
123
123
|
) }
|
|
124
124
|
{ baseCustomFonts.length > 0 && (
|
|
125
125
|
<>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
) ) }
|
|
136
|
-
</FontsGrid>
|
|
126
|
+
{ baseCustomFonts.map( ( font ) => (
|
|
127
|
+
<LibraryFontCard
|
|
128
|
+
font={ font }
|
|
129
|
+
key={ font.slug }
|
|
130
|
+
onClick={ () => {
|
|
131
|
+
handleSelectFont( font );
|
|
132
|
+
} }
|
|
133
|
+
/>
|
|
134
|
+
) ) }
|
|
137
135
|
<Spacer margin={ 8 } />
|
|
138
136
|
</>
|
|
139
137
|
) }
|
|
140
138
|
|
|
141
139
|
{ baseThemeFonts.length > 0 && (
|
|
142
140
|
<>
|
|
143
|
-
<
|
|
144
|
-
{
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
141
|
+
<Text className="font-library-modal__subtitle">
|
|
142
|
+
{ __( 'Theme Fonts' ) }
|
|
143
|
+
</Text>
|
|
144
|
+
|
|
145
|
+
<Spacer margin={ 2 } />
|
|
146
|
+
{ baseThemeFonts.map( ( font ) => (
|
|
147
|
+
<LibraryFontCard
|
|
148
|
+
font={ font }
|
|
149
|
+
key={ font.slug }
|
|
150
|
+
onClick={ () => {
|
|
151
|
+
handleSelectFont( font );
|
|
152
|
+
} }
|
|
153
|
+
/>
|
|
154
|
+
) ) }
|
|
154
155
|
</>
|
|
155
156
|
) }
|
|
157
|
+
<Spacer margin={ 16 } />
|
|
156
158
|
</>
|
|
157
159
|
) }
|
|
158
160
|
|
|
@@ -36,11 +36,8 @@
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
.font-library-
|
|
40
|
-
|
|
41
|
-
display: flex;
|
|
42
|
-
flex-direction: column;
|
|
43
|
-
}
|
|
39
|
+
.font-library-modal__tabpanel-layout .components-base-control__field {
|
|
40
|
+
margin-bottom: 0;
|
|
44
41
|
}
|
|
45
42
|
|
|
46
43
|
.font-library-modal__font-card {
|
|
@@ -251,47 +251,64 @@ export default function Layout() {
|
|
|
251
251
|
The NavigableRegion must always be rendered and not use
|
|
252
252
|
`inert` otherwise `useNavigateRegions` will fail.
|
|
253
253
|
*/ }
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
254
|
+
{ ( ! isMobileViewport ||
|
|
255
|
+
( isMobileViewport && ! areas.mobile ) ) && (
|
|
256
|
+
<NavigableRegion
|
|
257
|
+
ariaLabel={ __( 'Navigation' ) }
|
|
258
|
+
className="edit-site-layout__sidebar-region"
|
|
259
|
+
>
|
|
260
|
+
<AnimatePresence>
|
|
261
|
+
{ canvasMode === 'view' && (
|
|
262
|
+
<motion.div
|
|
263
|
+
initial={ { opacity: 0 } }
|
|
264
|
+
animate={ { opacity: 1 } }
|
|
265
|
+
exit={ { opacity: 0 } }
|
|
266
|
+
transition={ {
|
|
267
|
+
type: 'tween',
|
|
268
|
+
duration:
|
|
269
|
+
// Disable transition in mobile to emulate a full page transition.
|
|
270
|
+
disableMotion ||
|
|
271
|
+
isMobileViewport
|
|
272
|
+
? 0
|
|
273
|
+
: ANIMATION_DURATION,
|
|
274
|
+
ease: 'easeOut',
|
|
275
|
+
} }
|
|
276
|
+
className="edit-site-layout__sidebar"
|
|
277
|
+
>
|
|
278
|
+
<Sidebar />
|
|
279
|
+
</motion.div>
|
|
280
|
+
) }
|
|
281
|
+
</AnimatePresence>
|
|
282
|
+
</NavigableRegion>
|
|
283
|
+
) }
|
|
280
284
|
|
|
281
285
|
<SavePanel />
|
|
282
286
|
|
|
283
|
-
{
|
|
287
|
+
{ isMobileViewport && areas.mobile && (
|
|
284
288
|
<div
|
|
285
|
-
className="edit-site-
|
|
289
|
+
className="edit-site-layout__mobile"
|
|
286
290
|
style={ {
|
|
287
291
|
maxWidth: widths?.content,
|
|
288
292
|
} }
|
|
289
293
|
>
|
|
290
|
-
{ areas.
|
|
294
|
+
{ areas.mobile }
|
|
291
295
|
</div>
|
|
292
296
|
) }
|
|
293
297
|
|
|
294
|
-
{
|
|
298
|
+
{ ! isMobileViewport &&
|
|
299
|
+
areas.content &&
|
|
300
|
+
canvasMode !== 'edit' && (
|
|
301
|
+
<div
|
|
302
|
+
className="edit-site-layout__area"
|
|
303
|
+
style={ {
|
|
304
|
+
maxWidth: widths?.content,
|
|
305
|
+
} }
|
|
306
|
+
>
|
|
307
|
+
{ areas.content }
|
|
308
|
+
</div>
|
|
309
|
+
) }
|
|
310
|
+
|
|
311
|
+
{ ! isMobileViewport && areas.preview && (
|
|
295
312
|
<div className="edit-site-layout__canvas-container">
|
|
296
313
|
{ canvasResizer }
|
|
297
314
|
{ !! canvasSize.width && (
|
|
@@ -23,13 +23,21 @@ const { useLocation } = unlock( routerPrivateApis );
|
|
|
23
23
|
export default function useLayoutAreas() {
|
|
24
24
|
const isSiteEditorLoading = useIsSiteEditorLoading();
|
|
25
25
|
const { params } = useLocation();
|
|
26
|
-
const { postType, postId, path, layout, isCustom } = params ?? {};
|
|
26
|
+
const { postType, postId, path, layout, isCustom, canvas } = params ?? {};
|
|
27
|
+
|
|
28
|
+
// Note: Since "sidebar" is not yet supported here,
|
|
29
|
+
// returning undefined from "mobile" means show the sidebar.
|
|
30
|
+
|
|
27
31
|
// Regular page
|
|
28
32
|
if ( path === '/page' ) {
|
|
29
33
|
return {
|
|
30
34
|
areas: {
|
|
31
35
|
content: undefined,
|
|
32
36
|
preview: <Editor isLoading={ isSiteEditorLoading } />,
|
|
37
|
+
mobile:
|
|
38
|
+
canvas === 'edit' ? (
|
|
39
|
+
<Editor isLoading={ isSiteEditorLoading } />
|
|
40
|
+
) : undefined,
|
|
33
41
|
},
|
|
34
42
|
widths: {
|
|
35
43
|
content: undefined,
|
|
@@ -63,6 +71,10 @@ export default function useLayoutAreas() {
|
|
|
63
71
|
return {
|
|
64
72
|
areas: {
|
|
65
73
|
preview: <Editor isLoading={ isSiteEditorLoading } />,
|
|
74
|
+
mobile:
|
|
75
|
+
canvas === 'edit' ? (
|
|
76
|
+
<Editor isLoading={ isSiteEditorLoading } />
|
|
77
|
+
) : undefined,
|
|
66
78
|
},
|
|
67
79
|
};
|
|
68
80
|
}
|
|
@@ -79,6 +91,11 @@ export default function useLayoutAreas() {
|
|
|
79
91
|
preview: isListLayout && (
|
|
80
92
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
81
93
|
),
|
|
94
|
+
mobile: (
|
|
95
|
+
<PageTemplatesTemplateParts
|
|
96
|
+
postType={ TEMPLATE_POST_TYPE }
|
|
97
|
+
/>
|
|
98
|
+
),
|
|
82
99
|
},
|
|
83
100
|
widths: {
|
|
84
101
|
content: isListLayout ? 380 : undefined,
|
|
@@ -98,6 +115,11 @@ export default function useLayoutAreas() {
|
|
|
98
115
|
preview: isListLayout && (
|
|
99
116
|
<Editor isLoading={ isSiteEditorLoading } />
|
|
100
117
|
),
|
|
118
|
+
mobile: (
|
|
119
|
+
<PageTemplatesTemplateParts
|
|
120
|
+
postType={ TEMPLATE_PART_POST_TYPE }
|
|
121
|
+
/>
|
|
122
|
+
),
|
|
101
123
|
},
|
|
102
124
|
widths: {
|
|
103
125
|
content: isListLayout ? 380 : undefined,
|
|
@@ -110,12 +132,19 @@ export default function useLayoutAreas() {
|
|
|
110
132
|
return {
|
|
111
133
|
areas: {
|
|
112
134
|
content: <PagePatterns />,
|
|
135
|
+
mobile: <PagePatterns />,
|
|
113
136
|
},
|
|
114
137
|
};
|
|
115
138
|
}
|
|
116
139
|
|
|
117
140
|
// Fallback shows the home page preview
|
|
118
141
|
return {
|
|
119
|
-
areas: {
|
|
142
|
+
areas: {
|
|
143
|
+
preview: <Editor isLoading={ isSiteEditorLoading } />,
|
|
144
|
+
mobile:
|
|
145
|
+
canvas === 'edit' ? (
|
|
146
|
+
<Editor isLoading={ isSiteEditorLoading } />
|
|
147
|
+
) : undefined,
|
|
148
|
+
},
|
|
120
149
|
};
|
|
121
150
|
}
|
|
@@ -83,6 +83,12 @@
|
|
|
83
83
|
flex-direction: column;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
.edit-site-layout__mobile {
|
|
87
|
+
position: relative;
|
|
88
|
+
width: 100%;
|
|
89
|
+
z-index: z-index(".edit-site-layout__canvas-container");
|
|
90
|
+
}
|
|
91
|
+
|
|
86
92
|
.edit-site-layout__canvas-container {
|
|
87
93
|
position: relative;
|
|
88
94
|
flex-grow: 1;
|
|
@@ -147,6 +153,7 @@
|
|
|
147
153
|
}
|
|
148
154
|
|
|
149
155
|
// This shouldn't be necessary (we should have a way to say that a skeletton is relative
|
|
156
|
+
.edit-site-layout__mobile .interface-interface-skeleton,
|
|
150
157
|
.edit-site-layout__canvas .interface-interface-skeleton,
|
|
151
158
|
.edit-site-template-pages-preview .interface-interface-skeleton {
|
|
152
159
|
position: relative !important;
|
|
@@ -225,6 +225,12 @@
|
|
|
225
225
|
* TODO: when this becomes stable, consolidate styles with the above.
|
|
226
226
|
*/
|
|
227
227
|
.edit-site-page-patterns-dataviews {
|
|
228
|
+
margin-top: 60px;
|
|
229
|
+
|
|
230
|
+
@include break-medium {
|
|
231
|
+
margin-top: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
228
234
|
.page-patterns-preview-field {
|
|
229
235
|
display: flex;
|
|
230
236
|
flex-direction: column;
|
|
@@ -283,6 +289,10 @@
|
|
|
283
289
|
text-overflow: ellipsis;
|
|
284
290
|
color: inherit;
|
|
285
291
|
}
|
|
292
|
+
|
|
293
|
+
.dataviews-pagination {
|
|
294
|
+
z-index: z-index(".edit-site-patterns__dataviews-list-pagination");
|
|
295
|
+
}
|
|
286
296
|
}
|
|
287
297
|
|
|
288
298
|
.dataviews-action-modal__duplicate-pattern {
|
|
@@ -111,6 +111,7 @@ const selectTemplatePartsAsPatterns = createSelector(
|
|
|
111
111
|
const selectThemePatterns = createSelector(
|
|
112
112
|
( select ) => {
|
|
113
113
|
const { getSettings } = unlock( select( editSiteStore ) );
|
|
114
|
+
const { getIsResolving } = select( coreStore );
|
|
114
115
|
const settings = getSettings();
|
|
115
116
|
const blockPatterns =
|
|
116
117
|
settings.__experimentalAdditionalBlockPatterns ??
|
|
@@ -136,19 +137,23 @@ const selectThemePatterns = createSelector(
|
|
|
136
137
|
__unstableSkipMigrationLogs: true,
|
|
137
138
|
} ),
|
|
138
139
|
} ) );
|
|
139
|
-
|
|
140
|
-
return { patterns, isResolving: false };
|
|
140
|
+
return { patterns, isResolving: getIsResolving( 'getBlockPatterns' ) };
|
|
141
141
|
},
|
|
142
142
|
( select ) => [
|
|
143
143
|
select( coreStore ).getBlockPatterns(),
|
|
144
|
+
select( coreStore ).getIsResolving( 'getBlockPatterns' ),
|
|
144
145
|
unlock( select( editSiteStore ) ).getSettings(),
|
|
145
146
|
]
|
|
146
147
|
);
|
|
147
148
|
|
|
148
149
|
const selectPatterns = createSelector(
|
|
149
150
|
( select, categoryId, syncStatus, search = '' ) => {
|
|
150
|
-
const {
|
|
151
|
-
|
|
151
|
+
const {
|
|
152
|
+
patterns: themePatterns,
|
|
153
|
+
isResolving: isResolvingThemePatterns,
|
|
154
|
+
} = selectThemePatterns( select );
|
|
155
|
+
const { patterns: userPatterns, isResolving: isResolvingUserPatterns } =
|
|
156
|
+
selectUserPatterns( select );
|
|
152
157
|
|
|
153
158
|
let patterns = [
|
|
154
159
|
...( themePatterns || [] ),
|
|
@@ -176,7 +181,10 @@ const selectPatterns = createSelector(
|
|
|
176
181
|
hasCategory: ( item ) => ! item.hasOwnProperty( 'categories' ),
|
|
177
182
|
} );
|
|
178
183
|
}
|
|
179
|
-
return {
|
|
184
|
+
return {
|
|
185
|
+
patterns,
|
|
186
|
+
isResolving: isResolvingThemePatterns || isResolvingUserPatterns,
|
|
187
|
+
};
|
|
180
188
|
},
|
|
181
189
|
( select ) => [
|
|
182
190
|
selectThemePatterns( select ),
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
} from '@wordpress/components';
|
|
14
14
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
15
15
|
import { __ } from '@wordpress/i18n';
|
|
16
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Internal dependencies
|
|
@@ -52,6 +53,7 @@ function SidebarScreenWrapper( { className, ...props } ) {
|
|
|
52
53
|
|
|
53
54
|
function SidebarScreens() {
|
|
54
55
|
useSyncPathWithURL();
|
|
56
|
+
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
55
57
|
|
|
56
58
|
return (
|
|
57
59
|
<>
|
|
@@ -82,9 +84,11 @@ function SidebarScreens() {
|
|
|
82
84
|
<SidebarScreenWrapper path="/:postType(wp_template)">
|
|
83
85
|
<SidebarNavigationScreenTemplates />
|
|
84
86
|
</SidebarScreenWrapper>
|
|
85
|
-
|
|
86
|
-
<
|
|
87
|
-
|
|
87
|
+
{ ! isMobileViewport && (
|
|
88
|
+
<SidebarScreenWrapper path="/patterns">
|
|
89
|
+
<SidebarNavigationScreenPatterns />
|
|
90
|
+
</SidebarScreenWrapper>
|
|
91
|
+
) }
|
|
88
92
|
<SidebarScreenWrapper path="/:postType(wp_template|wp_template_part)/all">
|
|
89
93
|
<SidebarNavigationScreenTemplatesBrowse />
|
|
90
94
|
</SidebarScreenWrapper>
|
|
@@ -14,6 +14,7 @@ import { decodeEntities } from '@wordpress/html-entities';
|
|
|
14
14
|
import { privateApis as routerPrivateApis } from '@wordpress/router';
|
|
15
15
|
import { layout, page, home, verse, plus } from '@wordpress/icons';
|
|
16
16
|
import { useSelect } from '@wordpress/data';
|
|
17
|
+
import { useViewportMatch } from '@wordpress/compose';
|
|
17
18
|
|
|
18
19
|
/**
|
|
19
20
|
* Internal dependencies
|
|
@@ -42,6 +43,7 @@ const PageItem = ( { postType = 'page', postId, ...props } ) => {
|
|
|
42
43
|
};
|
|
43
44
|
|
|
44
45
|
export default function SidebarNavigationScreenPages() {
|
|
46
|
+
const isMobileViewport = useViewportMatch( 'medium', '<' );
|
|
45
47
|
const { records: pages, isResolving: isLoadingPages } = useEntityRecords(
|
|
46
48
|
'postType',
|
|
47
49
|
'page',
|
|
@@ -220,12 +222,14 @@ export default function SidebarNavigationScreenPages() {
|
|
|
220
222
|
</Truncate>
|
|
221
223
|
</PageItem>
|
|
222
224
|
) ) }
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
225
|
+
{ ! isMobileViewport && (
|
|
226
|
+
<SidebarNavigationItem
|
|
227
|
+
className="edit-site-sidebar-navigation-screen-pages__see-all"
|
|
228
|
+
{ ...pagesLink }
|
|
229
|
+
>
|
|
230
|
+
{ __( 'Manage all pages' ) }
|
|
231
|
+
</SidebarNavigationItem>
|
|
232
|
+
) }
|
|
229
233
|
</VStack>
|
|
230
234
|
}
|
|
231
235
|
/>
|