@wordpress/edit-site 5.12.12 → 5.12.14

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.
Files changed (71) hide show
  1. package/build/components/block-editor/constants.js +1 -1
  2. package/build/components/block-editor/constants.js.map +1 -1
  3. package/build/components/editor/index.js +2 -3
  4. package/build/components/editor/index.js.map +1 -1
  5. package/build/components/header-edit-mode/document-actions/index.js +1 -1
  6. package/build/components/header-edit-mode/document-actions/index.js.map +1 -1
  7. package/build/components/layout/index.js +3 -2
  8. package/build/components/layout/index.js.map +1 -1
  9. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  10. package/build/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  11. package/build/components/page-patterns/grid.js +2 -1
  12. package/build/components/page-patterns/grid.js.map +1 -1
  13. package/build/components/page-patterns/patterns-list.js +17 -3
  14. package/build/components/page-patterns/patterns-list.js.map +1 -1
  15. package/build/components/page-patterns/use-patterns.js +20 -3
  16. package/build/components/page-patterns/use-patterns.js.map +1 -1
  17. package/build/components/sidebar-navigation-screen/index.js +9 -1
  18. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  19. package/build/components/sidebar-navigation-screen-global-styles/index.js +28 -34
  20. package/build/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  21. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -1
  22. package/build/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  23. package/build/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  24. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  25. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  26. package/build/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  27. package/build-module/components/block-editor/constants.js +1 -1
  28. package/build-module/components/block-editor/constants.js.map +1 -1
  29. package/build-module/components/editor/index.js +2 -3
  30. package/build-module/components/editor/index.js.map +1 -1
  31. package/build-module/components/header-edit-mode/document-actions/index.js +3 -3
  32. package/build-module/components/header-edit-mode/document-actions/index.js.map +1 -1
  33. package/build-module/components/layout/index.js +3 -2
  34. package/build-module/components/layout/index.js.map +1 -1
  35. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  36. package/build-module/components/page-content-focus-manager/disable-non-page-content-blocks.js.map +1 -1
  37. package/build-module/components/page-patterns/grid.js +3 -2
  38. package/build-module/components/page-patterns/grid.js.map +1 -1
  39. package/build-module/components/page-patterns/patterns-list.js +17 -3
  40. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  41. package/build-module/components/page-patterns/use-patterns.js +19 -3
  42. package/build-module/components/page-patterns/use-patterns.js.map +1 -1
  43. package/build-module/components/sidebar-navigation-screen/index.js +8 -1
  44. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  45. package/build-module/components/sidebar-navigation-screen-global-styles/index.js +28 -34
  46. package/build-module/components/sidebar-navigation-screen-global-styles/index.js.map +1 -1
  47. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +2 -2
  48. package/build-module/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js.map +1 -1
  49. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +0 -5
  50. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  51. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -1
  52. package/build-module/components/sync-state-with-url/use-sync-canvas-mode-with-url.js.map +1 -1
  53. package/build-style/style-rtl.css +34 -30
  54. package/build-style/style.css +34 -30
  55. package/package.json +15 -15
  56. package/src/components/block-editor/constants.js +5 -1
  57. package/src/components/editor/index.js +2 -3
  58. package/src/components/header-edit-mode/document-actions/index.js +4 -3
  59. package/src/components/header-edit-mode/document-actions/style.scss +30 -25
  60. package/src/components/layout/index.js +27 -20
  61. package/src/components/layout/style.scss +2 -2
  62. package/src/components/page-content-focus-manager/disable-non-page-content-blocks.js +1 -1
  63. package/src/components/page-patterns/grid.js +8 -3
  64. package/src/components/page-patterns/patterns-list.js +15 -2
  65. package/src/components/page-patterns/use-patterns.js +19 -3
  66. package/src/components/sidebar-navigation-screen/index.js +11 -1
  67. package/src/components/sidebar-navigation-screen/style.scss +4 -0
  68. package/src/components/sidebar-navigation-screen-global-styles/index.js +42 -38
  69. package/src/components/sidebar-navigation-screen-navigation-menus/navigation-menu-content.js +1 -4
  70. package/src/components/sidebar-navigation-screen-patterns/category-item.js +5 -13
  71. package/src/components/sync-state-with-url/use-sync-canvas-mode-with-url.js +1 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.12.12",
3
+ "version": "5.12.14",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,40 +29,40 @@
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.35.1",
31
31
  "@wordpress/api-fetch": "^6.32.1",
32
- "@wordpress/block-editor": "^12.3.10",
33
- "@wordpress/block-library": "^8.12.12",
34
- "@wordpress/blocks": "^12.12.6",
35
- "@wordpress/commands": "^0.6.9",
36
- "@wordpress/components": "^25.1.9",
32
+ "@wordpress/block-editor": "^12.3.12",
33
+ "@wordpress/block-library": "^8.12.14",
34
+ "@wordpress/blocks": "^12.12.7",
35
+ "@wordpress/commands": "^0.6.11",
36
+ "@wordpress/components": "^25.1.10",
37
37
  "@wordpress/compose": "^6.12.2",
38
- "@wordpress/core-commands": "^0.4.10",
39
- "@wordpress/core-data": "^6.12.10",
38
+ "@wordpress/core-commands": "^0.4.12",
39
+ "@wordpress/core-data": "^6.12.12",
40
40
  "@wordpress/data": "^9.5.5",
41
41
  "@wordpress/date": "^4.35.1",
42
42
  "@wordpress/deprecated": "^3.35.1",
43
43
  "@wordpress/dom": "^3.35.1",
44
- "@wordpress/editor": "^13.12.10",
44
+ "@wordpress/editor": "^13.12.12",
45
45
  "@wordpress/element": "^5.12.1",
46
46
  "@wordpress/escape-html": "^2.35.1",
47
47
  "@wordpress/hooks": "^3.35.1",
48
48
  "@wordpress/html-entities": "^3.35.1",
49
49
  "@wordpress/i18n": "^4.35.1",
50
50
  "@wordpress/icons": "^9.26.2",
51
- "@wordpress/interface": "^5.12.9",
51
+ "@wordpress/interface": "^5.12.10",
52
52
  "@wordpress/keyboard-shortcuts": "^4.12.5",
53
53
  "@wordpress/keycodes": "^3.35.1",
54
54
  "@wordpress/media-utils": "^4.26.1",
55
55
  "@wordpress/notices": "^4.3.5",
56
- "@wordpress/plugins": "^6.3.9",
57
- "@wordpress/preferences": "^3.12.9",
56
+ "@wordpress/plugins": "^6.3.10",
57
+ "@wordpress/preferences": "^3.12.10",
58
58
  "@wordpress/primitives": "^3.33.1",
59
59
  "@wordpress/private-apis": "^0.17.2",
60
- "@wordpress/reusable-blocks": "^4.12.10",
60
+ "@wordpress/reusable-blocks": "^4.12.12",
61
61
  "@wordpress/router": "^0.4.2",
62
62
  "@wordpress/style-engine": "^1.18.1",
63
63
  "@wordpress/url": "^3.36.1",
64
64
  "@wordpress/viewport": "^5.12.5",
65
- "@wordpress/widgets": "^3.12.10",
65
+ "@wordpress/widgets": "^3.12.12",
66
66
  "@wordpress/wordcount": "^3.35.1",
67
67
  "change-case": "^4.1.2",
68
68
  "classnames": "^2.3.1",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "609a9df27d25e3d224dd1e2b97beb1bc02693255"
87
+ "gitHead": "53cd9574a54a643c73e76fe1abaa8d1be489f8f7"
88
88
  }
@@ -1 +1,5 @@
1
- export const FOCUSABLE_ENTITIES = [ 'wp_template_part', 'wp_navigation' ];
1
+ export const FOCUSABLE_ENTITIES = [
2
+ 'wp_template_part',
3
+ 'wp_navigation',
4
+ 'wp_block',
5
+ ];
@@ -58,7 +58,7 @@ const interfaceLabels = {
58
58
  };
59
59
 
60
60
  const typeLabels = {
61
- wp_template: __( 'Template Part' ),
61
+ wp_template: __( 'Template' ),
62
62
  wp_template_part: __( 'Template Part' ),
63
63
  wp_block: __( 'Pattern' ),
64
64
  };
@@ -165,12 +165,11 @@ export default function Editor( { isLoading } ) {
165
165
 
166
166
  let title;
167
167
  if ( hasLoadedPost ) {
168
- const type = typeLabels[ editedPostType ] ?? __( 'Template' );
169
168
  title = sprintf(
170
169
  // translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).
171
170
  __( '%1$s ‹ %2$s ‹ Editor' ),
172
171
  getTitle(),
173
- type
172
+ typeLabels[ editedPostType ] ?? typeLabels.wp_template
174
173
  );
175
174
  }
176
175
 
@@ -6,7 +6,7 @@ import classnames from 'classnames';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { sprintf, __ } from '@wordpress/i18n';
9
+ import { sprintf, __, isRTL } from '@wordpress/i18n';
10
10
  import { useSelect, useDispatch } from '@wordpress/data';
11
11
  import {
12
12
  Button,
@@ -17,7 +17,8 @@ import {
17
17
  import { BlockIcon } from '@wordpress/block-editor';
18
18
  import { store as commandsStore } from '@wordpress/commands';
19
19
  import {
20
- chevronLeftSmall as chevronLeftSmallIcon,
20
+ chevronLeftSmall,
21
+ chevronRightSmall,
21
22
  page as pageIcon,
22
23
  navigation as navigationIcon,
23
24
  symbol,
@@ -153,7 +154,7 @@ function BaseDocumentActions( { className, icon, children, onBack } ) {
153
154
  { onBack && (
154
155
  <Button
155
156
  className="edit-site-document-actions__back"
156
- icon={ chevronLeftSmallIcon }
157
+ icon={ isRTL() ? chevronRightSmall : chevronLeftSmall }
157
158
  onClick={ ( event ) => {
158
159
  event.stopPropagation();
159
160
  onBack();
@@ -1,7 +1,9 @@
1
1
  .edit-site-document-actions {
2
- display: grid;
3
- grid-template-columns: 1fr 2fr 1fr;
2
+ display: flex;
3
+ align-items: center;
4
+ gap: $grid-unit;
4
5
  height: $button-size;
6
+ justify-content: space-between;
5
7
  // Flex items will, by default, refuse to shrink below a minimum
6
8
  // intrinsic width. In order to shrink this flexbox item, and
7
9
  // subsequently truncate child text, we set an explicit min-width.
@@ -10,11 +12,17 @@
10
12
  background: $gray-100;
11
13
  border-radius: 4px;
12
14
  width: min(100%, 450px);
13
- overflow: hidden;
14
15
 
15
- &:hover {
16
- color: currentColor;
17
- background: $gray-200;
16
+ // Make the document title shorter in top-toolbar mode, as it has to be covered.
17
+ .has-fixed-toolbar & {
18
+ width: min(100%, 380px);
19
+ }
20
+
21
+ .components-button {
22
+ &:hover {
23
+ color: var(--wp-block-synced-color);
24
+ background: $gray-200;
25
+ }
18
26
  }
19
27
 
20
28
  @include break-medium() {
@@ -27,21 +35,23 @@
27
35
  }
28
36
 
29
37
  .edit-site-document-actions__command {
30
- grid-column: 1 / -1;
31
- display: grid;
32
- grid-template-columns: 1fr 2fr 1fr;
33
- grid-row: 1;
38
+ flex-grow: 1;
39
+ color: var(--wp-block-synced-color);
40
+ overflow: hidden;
34
41
  }
35
42
 
36
-
37
43
  .edit-site-document-actions__title {
38
44
  flex-grow: 1;
39
45
  color: var(--wp-block-synced-color);
40
46
  overflow: hidden;
41
- grid-column: 2 / 3;
47
+
48
+ &:hover {
49
+ color: var(--wp-block-synced-color);
50
+ }
42
51
 
43
52
  .block-editor-block-icon {
44
53
  min-width: $grid-unit-30;
54
+ flex-shrink: 0;
45
55
  }
46
56
 
47
57
  h1 {
@@ -70,26 +80,21 @@
70
80
  }
71
81
  }
72
82
 
73
- .edit-site-document-actions__shortcut,
74
- .edit-site-document-actions__back {
75
- color: $gray-800;
76
-
77
- .edit-site-document-actions:hover & {
78
- color: $gray-900;
79
- }
80
- }
81
-
82
83
  .edit-site-document-actions__shortcut {
83
- text-align: right;
84
+ color: $gray-800;
84
85
  }
85
86
 
86
- .edit-site-document-actions__back {
87
+ .edit-site-document-actions__back.components-button.has-icon.has-text {
87
88
  min-width: $button-size;
88
89
  flex-shrink: 0;
89
- grid-column: 1 / 2;
90
- grid-row: 1;
90
+ color: $gray-700;
91
+ gap: 0;
91
92
  z-index: 1;
92
93
 
94
+ &:hover {
95
+ color: currentColor;
96
+ }
97
+
93
98
  .edit-site-document-actions.is-animated & {
94
99
  animation: edit-site-document-actions__slide-in-left 0.3s;
95
100
  @include reduce-motion("animation");
@@ -260,28 +260,35 @@ export default function Layout() {
260
260
  </motion.div>
261
261
 
262
262
  <div className="edit-site-layout__content">
263
- <motion.div
264
- // The sidebar is needed for routing on mobile
265
- // (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),
266
- // so we can't remove the element entirely. Using `inert` will make
267
- // it inaccessible to screen readers and keyboard navigation.
268
- inert={ showSidebar ? undefined : 'inert' }
269
- animate={ { opacity: showSidebar ? 1 : 0 } }
270
- transition={ {
271
- type: 'tween',
272
- duration:
273
- // Disable transition in mobile to emulate a full page transition.
274
- disableMotion || isMobileViewport
275
- ? 0
276
- : ANIMATION_DURATION,
277
- ease: 'easeOut',
278
- } }
279
- className="edit-site-layout__sidebar"
263
+ { /*
264
+ The NavigableRegion must always be rendered and not use
265
+ `inert` otherwise `useNavigateRegions` will fail.
266
+ */ }
267
+ <NavigableRegion
268
+ ariaLabel={ __( 'Navigation' ) }
269
+ className="edit-site-layout__sidebar-region"
280
270
  >
281
- <NavigableRegion ariaLabel={ __( 'Navigation' ) }>
271
+ <motion.div
272
+ // The sidebar is needed for routing on mobile
273
+ // (https://github.com/WordPress/gutenberg/pull/51558/files#r1231763003),
274
+ // so we can't remove the element entirely. Using `inert` will make
275
+ // it inaccessible to screen readers and keyboard navigation.
276
+ inert={ showSidebar ? undefined : 'inert' }
277
+ animate={ { opacity: showSidebar ? 1 : 0 } }
278
+ transition={ {
279
+ type: 'tween',
280
+ duration:
281
+ // Disable transition in mobile to emulate a full page transition.
282
+ disableMotion || isMobileViewport
283
+ ? 0
284
+ : ANIMATION_DURATION,
285
+ ease: 'easeOut',
286
+ } }
287
+ className="edit-site-layout__sidebar"
288
+ >
282
289
  <Sidebar />
283
- </NavigableRegion>
284
- </motion.div>
290
+ </motion.div>
291
+ </NavigableRegion>
285
292
 
286
293
  <SavePanel />
287
294
 
@@ -58,7 +58,7 @@
58
58
  display: flex;
59
59
  }
60
60
 
61
- .edit-site-layout__sidebar {
61
+ .edit-site-layout__sidebar-region {
62
62
  z-index: z-index(".edit-site-layout__sidebar");
63
63
  width: 100vw;
64
64
  flex-shrink: 0;
@@ -75,7 +75,7 @@
75
75
  top: 0;
76
76
  }
77
77
 
78
- > div {
78
+ .edit-site-layout__sidebar {
79
79
  display: flex;
80
80
  flex-direction: column;
81
81
  height: 100%;
@@ -49,7 +49,7 @@ export function useDisableNonPageContentBlocks() {
49
49
 
50
50
  const withDisableNonPageContentBlocks = createHigherOrderComponent(
51
51
  ( BlockEdit ) => ( props ) => {
52
- const isDescendentOfQueryLoop = !! props.context.queryId;
52
+ const isDescendentOfQueryLoop = props.context.queryId !== undefined;
53
53
  const isPageContent =
54
54
  PAGE_CONTENT_BLOCK_TYPES.includes( props.name ) &&
55
55
  ! isDescendentOfQueryLoop;
@@ -6,7 +6,7 @@ import {
6
6
  __experimentalText as Text,
7
7
  Button,
8
8
  } from '@wordpress/components';
9
- import { useRef, useState, useMemo } from '@wordpress/element';
9
+ import { useRef, useMemo } from '@wordpress/element';
10
10
  import { __, _x, _n, sprintf } from '@wordpress/i18n';
11
11
  import { useAsyncList } from '@wordpress/compose';
12
12
 
@@ -82,8 +82,13 @@ function Pagination( { currentPage, numPages, changePage, totalItems } ) {
82
82
  );
83
83
  }
84
84
 
85
- export default function Grid( { categoryId, items, ...props } ) {
86
- const [ currentPage, setCurrentPage ] = useState( 1 );
85
+ export default function Grid( {
86
+ categoryId,
87
+ items,
88
+ currentPage,
89
+ setCurrentPage,
90
+ ...props
91
+ } ) {
87
92
  const gridRef = useRef();
88
93
  const totalItems = items.length;
89
94
  const pageIndex = currentPage - 1;
@@ -48,6 +48,7 @@ const SYNC_DESCRIPTIONS = {
48
48
  };
49
49
 
50
50
  export default function PatternsList( { categoryId, type } ) {
51
+ const [ currentPage, setCurrentPage ] = useState( 1 );
51
52
  const location = useLocation();
52
53
  const history = useHistory();
53
54
  const isMobileViewport = useViewportMatch( 'medium', '<' );
@@ -73,6 +74,16 @@ export default function PatternsList( { categoryId, type } ) {
73
74
  }
74
75
  );
75
76
 
77
+ const updateSearchFilter = ( value ) => {
78
+ setCurrentPage( 1 );
79
+ setFilterValue( value );
80
+ };
81
+
82
+ const updateSyncFilter = ( value ) => {
83
+ setCurrentPage( 1 );
84
+ setSyncFilter( value );
85
+ };
86
+
76
87
  const id = useId();
77
88
  const titleId = `${ id }-title`;
78
89
  const descriptionId = `${ id }-description`;
@@ -109,7 +120,7 @@ export default function PatternsList( { categoryId, type } ) {
109
120
  <FlexBlock className="edit-site-patterns__search-block">
110
121
  <SearchControl
111
122
  className="edit-site-patterns__search"
112
- onChange={ ( value ) => setFilterValue( value ) }
123
+ onChange={ ( value ) => updateSearchFilter( value ) }
113
124
  placeholder={ __( 'Search patterns' ) }
114
125
  label={ __( 'Search patterns' ) }
115
126
  value={ filterValue }
@@ -123,7 +134,7 @@ export default function PatternsList( { categoryId, type } ) {
123
134
  label={ __( 'Filter by sync status' ) }
124
135
  value={ syncFilter }
125
136
  isBlock
126
- onChange={ ( value ) => setSyncFilter( value ) }
137
+ onChange={ ( value ) => updateSyncFilter( value ) }
127
138
  __nextHasNoMarginBottom
128
139
  >
129
140
  { Object.entries( SYNC_FILTERS ).map(
@@ -157,6 +168,8 @@ export default function PatternsList( { categoryId, type } ) {
157
168
  items={ patterns }
158
169
  aria-labelledby={ titleId }
159
170
  aria-describedby={ descriptionId }
171
+ currentPage={ currentPage }
172
+ setCurrentPage={ setCurrentPage }
160
173
  />
161
174
  ) }
162
175
  { ! isResolving && ! hasPatterns && <NoPatterns /> }
@@ -4,6 +4,7 @@
4
4
  import { parse } from '@wordpress/blocks';
5
5
  import { useSelect } from '@wordpress/data';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
+ import { store as editorStore } from '@wordpress/editor';
7
8
  import { decodeEntities } from '@wordpress/html-entities';
8
9
 
9
10
  /**
@@ -39,14 +40,12 @@ const templatePartToPattern = ( templatePart ) => ( {
39
40
  templatePart,
40
41
  } );
41
42
 
42
- const templatePartHasCategory = ( item, category ) =>
43
- item.templatePart.area === category;
44
-
45
43
  const selectTemplatePartsAsPatterns = (
46
44
  select,
47
45
  { categoryId, search = '' } = {}
48
46
  ) => {
49
47
  const { getEntityRecords, getIsResolving } = select( coreStore );
48
+ const { __experimentalGetDefaultTemplatePartAreas } = select( editorStore );
50
49
  const query = { per_page: -1 };
51
50
  const rawTemplateParts =
52
51
  getEntityRecords( 'postType', TEMPLATE_PARTS, query ) ??
@@ -55,6 +54,23 @@ const selectTemplatePartsAsPatterns = (
55
54
  templatePartToPattern( templatePart )
56
55
  );
57
56
 
57
+ // In the case where a custom template part area has been removed we need
58
+ // the current list of areas to cross check against so orphaned template
59
+ // parts can be treated as uncategorized.
60
+ const knownAreas = __experimentalGetDefaultTemplatePartAreas() || [];
61
+ const templatePartAreas = knownAreas.map( ( area ) => area.area );
62
+
63
+ const templatePartHasCategory = ( item, category ) => {
64
+ if ( category !== 'uncategorized' ) {
65
+ return item.templatePart.area === category;
66
+ }
67
+
68
+ return (
69
+ item.templatePart.area === category ||
70
+ ! templatePartAreas.includes( item.templatePart.area )
71
+ );
72
+ };
73
+
58
74
  const isResolving = getIsResolving( 'getEntityRecords', [
59
75
  'postType',
60
76
  'wp_template_part',
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -51,7 +56,12 @@ export default function SidebarNavigationScreen( {
51
56
  return (
52
57
  <>
53
58
  <VStack
54
- className="edit-site-sidebar-navigation-screen__main"
59
+ className={ classnames(
60
+ 'edit-site-sidebar-navigation-screen__main',
61
+ {
62
+ 'has-footer': !! footer,
63
+ }
64
+ ) }
55
65
  spacing={ 0 }
56
66
  justify="flex-start"
57
67
  >
@@ -9,6 +9,10 @@
9
9
  // Ensure the sidebar is always at least as tall as the viewport.
10
10
  // This allows the footer section to be sticky at the bottom of the viewport.
11
11
  flex-grow: 1;
12
+ margin-bottom: $grid-unit-20;
13
+ &.has-footer {
14
+ margin-bottom: 0;
15
+ }
12
16
  }
13
17
 
14
18
  .edit-site-sidebar-navigation-screen__content {
@@ -108,30 +108,10 @@ function SidebarNavigationScreenGlobalStylesContent() {
108
108
  );
109
109
  }
110
110
 
111
- function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
112
- const { revisions, isLoading } = useGlobalStylesRevisions();
113
- const { revisionsCount } = useSelect( ( select ) => {
114
- const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
115
- select( coreStore );
116
-
117
- const globalStylesId = __experimentalGetCurrentGlobalStylesId();
118
- const globalStyles = globalStylesId
119
- ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
120
- : undefined;
121
-
122
- return {
123
- revisionsCount:
124
- globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0,
125
- };
126
- }, [] );
127
-
128
- const hasRevisions = revisionsCount >= 2;
129
- const modified = revisions?.[ 0 ]?.modified;
130
-
131
- if ( ! hasRevisions || isLoading || ! modified ) {
132
- return null;
133
- }
134
-
111
+ function SidebarNavigationScreenGlobalStylesFooter( {
112
+ modifiedDateTime,
113
+ onClickRevisions,
114
+ } ) {
135
115
  return (
136
116
  <VStack className="edit-site-sidebar-navigation-screen-global-styles__footer">
137
117
  <SidebarNavigationItem
@@ -150,8 +130,8 @@ function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
150
130
  { __( 'Last modified' ) }
151
131
  </span>
152
132
  <span>
153
- <time dateTime={ modified }>
154
- { humanTimeDiff( modified ) }
133
+ <time dateTime={ modifiedDateTime }>
134
+ { humanTimeDiff( modifiedDateTime ) }
155
135
  </time>
156
136
  </span>
157
137
  <Icon icon={ backup } style={ { fill: 'currentcolor' } } />
@@ -162,6 +142,8 @@ function SidebarNavigationScreenGlobalStylesFooter( { onClickRevisions } ) {
162
142
  }
163
143
 
164
144
  export default function SidebarNavigationScreenGlobalStyles() {
145
+ const { revisions, isLoading: isLoadingRevisions } =
146
+ useGlobalStylesRevisions();
165
147
  const { openGeneralSidebar, setIsListViewOpened } =
166
148
  useDispatch( editSiteStore );
167
149
  const isMobileViewport = useViewportMatch( 'medium', '<' );
@@ -171,15 +153,28 @@ export default function SidebarNavigationScreenGlobalStyles() {
171
153
  const { createNotice } = useDispatch( noticesStore );
172
154
  const { set: setPreference } = useDispatch( preferencesStore );
173
155
  const { get: getPrefference } = useSelect( preferencesStore );
174
- const { isViewMode, isStyleBookOpened } = useSelect( ( select ) => {
175
- const { getCanvasMode, getEditorCanvasContainerView } = unlock(
176
- select( editSiteStore )
177
- );
178
- return {
179
- isViewMode: 'view' === getCanvasMode(),
180
- isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(),
181
- };
182
- }, [] );
156
+ const { isViewMode, isStyleBookOpened, revisionsCount } = useSelect(
157
+ ( select ) => {
158
+ const { getCanvasMode, getEditorCanvasContainerView } = unlock(
159
+ select( editSiteStore )
160
+ );
161
+ const { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =
162
+ select( coreStore );
163
+ const globalStylesId = __experimentalGetCurrentGlobalStylesId();
164
+ const globalStyles = globalStylesId
165
+ ? getEntityRecord( 'root', 'globalStyles', globalStylesId )
166
+ : undefined;
167
+ return {
168
+ isViewMode: 'view' === getCanvasMode(),
169
+ isStyleBookOpened:
170
+ 'style-book' === getEditorCanvasContainerView(),
171
+ revisionsCount:
172
+ globalStyles?._links?.[ 'version-history' ]?.[ 0 ]?.count ??
173
+ 0,
174
+ };
175
+ },
176
+ []
177
+ );
183
178
 
184
179
  const turnOffDistractionFreeMode = useCallback( () => {
185
180
  const isDistractionFree = getPrefference(
@@ -226,6 +221,12 @@ export default function SidebarNavigationScreenGlobalStyles() {
226
221
  setEditorCanvasContainerView( 'global-styles-revisions' );
227
222
  }, [ openGlobalStyles, setEditorCanvasContainerView ] );
228
223
 
224
+ // If there are no revisions, do not render a footer.
225
+ const hasRevisions = revisionsCount >= 2;
226
+ const modifiedDateTime = revisions?.[ 0 ]?.modified;
227
+ const shouldShowGlobalStylesFooter =
228
+ hasRevisions && ! isLoadingRevisions && modifiedDateTime;
229
+
229
230
  return (
230
231
  <>
231
232
  <SidebarNavigationScreen
@@ -235,9 +236,12 @@ export default function SidebarNavigationScreenGlobalStyles() {
235
236
  ) }
236
237
  content={ <SidebarNavigationScreenGlobalStylesContent /> }
237
238
  footer={
238
- <SidebarNavigationScreenGlobalStylesFooter
239
- onClickRevisions={ openRevisions }
240
- />
239
+ shouldShowGlobalStylesFooter && (
240
+ <SidebarNavigationScreenGlobalStylesFooter
241
+ modifiedDateTime={ modifiedDateTime }
242
+ onClickRevisions={ openRevisions }
243
+ />
244
+ )
241
245
  }
242
246
  actions={
243
247
  <>
@@ -5,7 +5,6 @@ import {
5
5
  privateApis as blockEditorPrivateApis,
6
6
  store as blockEditorStore,
7
7
  BlockList,
8
- BlockTools,
9
8
  } from '@wordpress/block-editor';
10
9
  import { useDispatch, useSelect } from '@wordpress/data';
11
10
  import { createBlock } from '@wordpress/blocks';
@@ -106,9 +105,7 @@ export default function NavigationMenuContent( { rootClientId } ) {
106
105
  />
107
106
  ) }
108
107
  <div className="edit-site-sidebar-navigation-screen-navigation-menus__helper-block-editor">
109
- <BlockTools>
110
- <BlockList />
111
- </BlockTools>
108
+ <BlockList />
112
109
  </div>
113
110
  </>
114
111
  );
@@ -12,19 +12,11 @@ export default function CategoryItem( {
12
12
  label,
13
13
  type,
14
14
  } ) {
15
- const linkInfo = useLink(
16
- {
17
- path: '/patterns',
18
- categoryType: type,
19
- categoryId: id,
20
- },
21
- {
22
- // Keep a record of where we came from in state so we can
23
- // use the browser's back button to go back to Patterns.
24
- // See the implementation of the back button in patterns-list.
25
- backPath: '/patterns',
26
- }
27
- );
15
+ const linkInfo = useLink( {
16
+ path: '/patterns',
17
+ categoryType: type,
18
+ categoryId: id,
19
+ } );
28
20
 
29
21
  if ( ! count ) {
30
22
  return;
@@ -58,10 +58,7 @@ export default function useSyncCanvasModeWithURL() {
58
58
 
59
59
  useEffect( () => {
60
60
  currentCanvasInUrl.current = canvasInUrl;
61
- if (
62
- canvasInUrl === undefined &&
63
- currentCanvasMode.current !== 'view'
64
- ) {
61
+ if ( canvasInUrl !== 'edit' && currentCanvasMode.current !== 'view' ) {
65
62
  setCanvasMode( 'view' );
66
63
  } else if (
67
64
  canvasInUrl === 'edit' &&