@wordpress/edit-site 5.8.0 → 5.9.0

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 (122) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +2 -1
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/block-editor/index.js +7 -7
  5. package/build/components/block-editor/index.js.map +1 -1
  6. package/build/components/editor-canvas-container/index.js +117 -0
  7. package/build/components/editor-canvas-container/index.js.map +1 -0
  8. package/build/components/global-styles/border-panel.js +50 -4
  9. package/build/components/global-styles/border-panel.js.map +1 -1
  10. package/build/components/global-styles/filters-panel.js +6 -1
  11. package/build/components/global-styles/filters-panel.js.map +1 -1
  12. package/build/components/global-styles/global-styles-provider.js +4 -18
  13. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  14. package/build/components/global-styles/ui.js +7 -14
  15. package/build/components/global-styles/ui.js.map +1 -1
  16. package/build/components/header-edit-mode/index.js +11 -7
  17. package/build/components/header-edit-mode/index.js.map +1 -1
  18. package/build/components/layout/index.js +9 -7
  19. package/build/components/layout/index.js.map +1 -1
  20. package/build/components/list/table.js +3 -3
  21. package/build/components/list/table.js.map +1 -1
  22. package/build/components/sidebar-edit-mode/global-styles-sidebar.js +28 -13
  23. package/build/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  24. package/build/components/site-hub/index.js +38 -16
  25. package/build/components/site-hub/index.js.map +1 -1
  26. package/build/components/site-icon/index.js +8 -7
  27. package/build/components/site-icon/index.js.map +1 -1
  28. package/build/components/start-template-options/index.js +9 -8
  29. package/build/components/start-template-options/index.js.map +1 -1
  30. package/build/components/style-book/index.js +9 -41
  31. package/build/components/style-book/index.js.map +1 -1
  32. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
  33. package/build/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  34. package/build/components/template-details/index.js +3 -1
  35. package/build/components/template-details/index.js.map +1 -1
  36. package/build/hooks/commands/use-navigation-commands.js +9 -0
  37. package/build/hooks/commands/use-navigation-commands.js.map +1 -1
  38. package/build/hooks/commands/use-wp-admin-commands.js +4 -1
  39. package/build/hooks/commands/use-wp-admin-commands.js.map +1 -1
  40. package/build/store/private-actions.js +19 -1
  41. package/build/store/private-actions.js.map +1 -1
  42. package/build/store/private-selectors.js +13 -0
  43. package/build/store/private-selectors.js.map +1 -1
  44. package/build/store/reducer.js +23 -1
  45. package/build/store/reducer.js.map +1 -1
  46. package/build-module/components/add-new-template/new-template.js +3 -2
  47. package/build-module/components/add-new-template/new-template.js.map +1 -1
  48. package/build-module/components/block-editor/index.js +6 -6
  49. package/build-module/components/block-editor/index.js.map +1 -1
  50. package/build-module/components/editor-canvas-container/index.js +100 -0
  51. package/build-module/components/editor-canvas-container/index.js.map +1 -0
  52. package/build-module/components/global-styles/border-panel.js +51 -4
  53. package/build-module/components/global-styles/border-panel.js.map +1 -1
  54. package/build-module/components/global-styles/filters-panel.js +6 -1
  55. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  56. package/build-module/components/global-styles/global-styles-provider.js +5 -19
  57. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  58. package/build-module/components/global-styles/ui.js +6 -14
  59. package/build-module/components/global-styles/ui.js.map +1 -1
  60. package/build-module/components/header-edit-mode/index.js +10 -7
  61. package/build-module/components/header-edit-mode/index.js.map +1 -1
  62. package/build-module/components/layout/index.js +8 -7
  63. package/build-module/components/layout/index.js.map +1 -1
  64. package/build-module/components/list/table.js +3 -3
  65. package/build-module/components/list/table.js.map +1 -1
  66. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js +28 -15
  67. package/build-module/components/sidebar-edit-mode/global-styles-sidebar.js.map +1 -1
  68. package/build-module/components/site-hub/index.js +40 -18
  69. package/build-module/components/site-hub/index.js.map +1 -1
  70. package/build-module/components/site-icon/index.js +8 -7
  71. package/build-module/components/site-icon/index.js.map +1 -1
  72. package/build-module/components/start-template-options/index.js +9 -8
  73. package/build-module/components/start-template-options/index.js.map +1 -1
  74. package/build-module/components/style-book/index.js +10 -41
  75. package/build-module/components/style-book/index.js.map +1 -1
  76. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js +5 -3
  77. package/build-module/components/sync-state-with-url/use-init-edited-entity-from-url.js.map +1 -1
  78. package/build-module/components/template-details/index.js +3 -1
  79. package/build-module/components/template-details/index.js.map +1 -1
  80. package/build-module/hooks/commands/use-navigation-commands.js +8 -0
  81. package/build-module/hooks/commands/use-navigation-commands.js.map +1 -1
  82. package/build-module/hooks/commands/use-wp-admin-commands.js +3 -1
  83. package/build-module/hooks/commands/use-wp-admin-commands.js.map +1 -1
  84. package/build-module/store/private-actions.js +15 -0
  85. package/build-module/store/private-actions.js.map +1 -1
  86. package/build-module/store/private-selectors.js +11 -0
  87. package/build-module/store/private-selectors.js.map +1 -1
  88. package/build-module/store/reducer.js +23 -1
  89. package/build-module/store/reducer.js.map +1 -1
  90. package/build-style/style-rtl.css +113 -61
  91. package/build-style/style.css +113 -61
  92. package/package.json +34 -34
  93. package/src/components/add-new-template/new-template.js +3 -0
  94. package/src/components/block-editor/index.js +8 -8
  95. package/src/components/editor-canvas-container/index.js +115 -0
  96. package/src/components/editor-canvas-container/style.scss +19 -0
  97. package/src/components/global-styles/border-panel.js +43 -2
  98. package/src/components/global-styles/filters-panel.js +7 -1
  99. package/src/components/global-styles/global-styles-provider.js +4 -18
  100. package/src/components/global-styles/ui.js +10 -6
  101. package/src/components/header-edit-mode/index.js +14 -5
  102. package/src/components/layout/index.js +9 -16
  103. package/src/components/layout/style.scss +31 -4
  104. package/src/components/list/table.js +16 -2
  105. package/src/components/secondary-sidebar/style.scss +23 -5
  106. package/src/components/sidebar/style.scss +2 -1
  107. package/src/components/sidebar-edit-mode/global-styles-sidebar.js +36 -17
  108. package/src/components/site-hub/index.js +50 -22
  109. package/src/components/site-icon/index.js +6 -11
  110. package/src/components/site-icon/style.scss +8 -3
  111. package/src/components/start-template-options/index.js +13 -12
  112. package/src/components/start-template-options/style.scss +12 -30
  113. package/src/components/style-book/index.js +7 -51
  114. package/src/components/style-book/style.scss +0 -18
  115. package/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +4 -3
  116. package/src/components/template-details/index.js +1 -0
  117. package/src/hooks/commands/use-navigation-commands.js +9 -0
  118. package/src/hooks/commands/use-wp-admin-commands.js +3 -1
  119. package/src/store/private-actions.js +14 -0
  120. package/src/store/private-selectors.js +11 -0
  121. package/src/store/reducer.js +18 -0
  122. package/src/style.scss +1 -0
@@ -24,6 +24,7 @@ import {
24
24
  post,
25
25
  postAuthor,
26
26
  postDate,
27
+ postList,
27
28
  search,
28
29
  tag,
29
30
  layout as customGenericTemplateIcon,
@@ -51,6 +52,7 @@ import { unlock } from '../../private-apis';
51
52
 
52
53
  const DEFAULT_TEMPLATE_SLUGS = [
53
54
  'front-page',
55
+ 'home',
54
56
  'single',
55
57
  'page',
56
58
  'index',
@@ -66,6 +68,7 @@ const DEFAULT_TEMPLATE_SLUGS = [
66
68
 
67
69
  const TEMPLATE_ICONS = {
68
70
  'front-page': home,
71
+ home: postList,
69
72
  single: post,
70
73
  page,
71
74
  archive,
@@ -36,8 +36,8 @@ import { store as editSiteStore } from '../../store';
36
36
  import BackButton from './back-button';
37
37
  import ResizableEditor from './resizable-editor';
38
38
  import EditorCanvas from './editor-canvas';
39
- import StyleBook from '../style-book';
40
39
  import { unlock } from '../../private-apis';
40
+ import EditorCanvasContainer from '../editor-canvas-container';
41
41
 
42
42
  const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );
43
43
 
@@ -165,19 +165,19 @@ export default function BlockEditor() {
165
165
  <SidebarInspectorFill>
166
166
  <BlockInspector />
167
167
  </SidebarInspectorFill>
168
- { /* Potentially this could be a generic slot (e.g. EditorCanvas.Slot) if there are other uses for it. */ }
169
- <StyleBook.Slot>
170
- { ( [ styleBook ] ) =>
171
- styleBook ? (
168
+ <EditorCanvasContainer.Slot>
169
+ { ( [ editorCanvasView ] ) =>
170
+ editorCanvasView ? (
172
171
  <div className="edit-site-visual-editor is-focus-mode">
173
172
  <ResizableEditor enableResizing>
174
- { styleBook }
173
+ { editorCanvasView }
175
174
  </ResizableEditor>
176
175
  </div>
177
176
  ) : (
178
177
  <BlockTools
179
178
  className={ classnames( 'edit-site-visual-editor', {
180
- 'is-focus-mode': isTemplatePart || !! styleBook,
179
+ 'is-focus-mode':
180
+ isTemplatePart || !! editorCanvasView,
181
181
  'is-view-mode': isViewMode,
182
182
  } ) }
183
183
  __unstableContentRef={ contentRef }
@@ -211,7 +211,7 @@ export default function BlockEditor() {
211
211
  </BlockTools>
212
212
  )
213
213
  }
214
- </StyleBook.Slot>
214
+ </EditorCanvasContainer.Slot>
215
215
  <ReusableBlocksMenuItems />
216
216
  </ExperimentalBlockEditorProvider>
217
217
  );
@@ -0,0 +1,115 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { Children, cloneElement, useState, useMemo } from '@wordpress/element';
5
+ import {
6
+ Button,
7
+ privateApis as componentsPrivateApis,
8
+ } from '@wordpress/components';
9
+ import { ESCAPE } from '@wordpress/keycodes';
10
+ import { __ } from '@wordpress/i18n';
11
+ import { useDispatch, useSelect } from '@wordpress/data';
12
+ import { closeSmall } from '@wordpress/icons';
13
+ import { useFocusOnMount, useFocusReturn } from '@wordpress/compose';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { unlock } from '../../private-apis';
19
+ import { store as editSiteStore } from '../../store';
20
+
21
+ /**
22
+ * Returns a translated string for the title of the editor canvas container.
23
+ *
24
+ * @param {string} view Editor canvas container view.
25
+ *
26
+ * @return {string} Translated string corresponding to value of view. Default is ''.
27
+ */
28
+ export function getEditorCanvasContainerTitle( view ) {
29
+ switch ( view ) {
30
+ case 'style-book':
31
+ return __( 'Style Book' );
32
+ default:
33
+ return '';
34
+ }
35
+ }
36
+
37
+ // Creates a private slot fill.
38
+ const { createPrivateSlotFill } = unlock( componentsPrivateApis );
39
+ const SLOT_FILL_NAME = 'EditSiteEditorCanvasContainerSlot';
40
+ const { Slot: EditorCanvasContainerSlot, Fill: EditorCanvasContainerFill } =
41
+ createPrivateSlotFill( SLOT_FILL_NAME );
42
+
43
+ function EditorCanvasContainer( {
44
+ children,
45
+ closeButtonLabel,
46
+ onClose = () => {},
47
+ } ) {
48
+ const editorCanvasContainerView = useSelect(
49
+ ( select ) =>
50
+ unlock( select( editSiteStore ) ).getEditorCanvasContainerView(),
51
+ []
52
+ );
53
+ const [ isClosed, setIsClosed ] = useState( false );
54
+ const { setEditorCanvasContainerView } = unlock(
55
+ useDispatch( editSiteStore )
56
+ );
57
+ const focusOnMountRef = useFocusOnMount( 'firstElement' );
58
+ const sectionFocusReturnRef = useFocusReturn();
59
+ const title = useMemo(
60
+ () => getEditorCanvasContainerTitle( editorCanvasContainerView ),
61
+ [ editorCanvasContainerView ]
62
+ );
63
+ function onCloseContainer() {
64
+ onClose();
65
+ setEditorCanvasContainerView( undefined );
66
+ setIsClosed( true );
67
+ }
68
+
69
+ function closeOnEscape( event ) {
70
+ if ( event.keyCode === ESCAPE && ! event.defaultPrevented ) {
71
+ event.preventDefault();
72
+ onCloseContainer();
73
+ }
74
+ }
75
+
76
+ const childrenWithProps = Array.isArray( children )
77
+ ? Children.map( children, ( child, index ) =>
78
+ index === 0
79
+ ? cloneElement( child, {
80
+ ref: sectionFocusReturnRef,
81
+ } )
82
+ : child
83
+ )
84
+ : cloneElement( children, {
85
+ ref: sectionFocusReturnRef,
86
+ } );
87
+
88
+ if ( isClosed ) {
89
+ return null;
90
+ }
91
+
92
+ return (
93
+ <EditorCanvasContainerFill>
94
+ { /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */ }
95
+ <section
96
+ className="edit-site-editor-canvas-container"
97
+ ref={ focusOnMountRef }
98
+ onKeyDown={ closeOnEscape }
99
+ aria-label={ title }
100
+ >
101
+ <Button
102
+ className="edit-site-editor-canvas-container__close-button"
103
+ icon={ closeSmall }
104
+ label={ closeButtonLabel || __( 'Close' ) }
105
+ onClick={ onCloseContainer }
106
+ showTooltip={ false }
107
+ />
108
+ { childrenWithProps }
109
+ </section>
110
+ </EditorCanvasContainerFill>
111
+ );
112
+ }
113
+
114
+ EditorCanvasContainer.Slot = EditorCanvasContainerSlot;
115
+ export default EditorCanvasContainer;
@@ -0,0 +1,19 @@
1
+ .edit-site-editor-canvas-container {
2
+ background: $white; // Fallback color, overridden by JavaScript.
3
+ border-radius: $radius-block-ui;
4
+ bottom: 0;
5
+ left: 0;
6
+ overflow: hidden;
7
+ position: absolute;
8
+ right: 0;
9
+ top: 0;
10
+ transition: all 0.3s; // Match .block-editor-iframe__body transition.
11
+ }
12
+
13
+ .edit-site-editor-canvas-container__close-button {
14
+ position: absolute;
15
+ right: $grid-unit-10;
16
+ top: math.div($grid-unit-60 - $button-size, 2); // ( tab height - button size ) / 2
17
+ z-index: 1;
18
+ background: $white;
19
+ }
@@ -16,6 +16,41 @@ const {
16
16
  BorderPanel: StylesBorderPanel,
17
17
  } = unlock( blockEditorPrivateApis );
18
18
 
19
+ function applyFallbackStyle( border ) {
20
+ if ( ! border ) {
21
+ return border;
22
+ }
23
+
24
+ const hasColorOrWidth = border.color || border.width;
25
+
26
+ if ( ! border.style && hasColorOrWidth ) {
27
+ return { ...border, style: 'solid' };
28
+ }
29
+
30
+ if ( border.style && ! hasColorOrWidth ) {
31
+ return undefined;
32
+ }
33
+
34
+ return border;
35
+ }
36
+
37
+ function applyAllFallbackStyles( border ) {
38
+ if ( ! border ) {
39
+ return border;
40
+ }
41
+
42
+ if ( hasSplitBorders( border ) ) {
43
+ return {
44
+ top: applyFallbackStyle( border.top ),
45
+ right: applyFallbackStyle( border.right ),
46
+ bottom: applyFallbackStyle( border.bottom ),
47
+ left: applyFallbackStyle( border.left ),
48
+ };
49
+ }
50
+
51
+ return applyFallbackStyle( border );
52
+ }
53
+
19
54
  export default function BorderPanel( { name, variation = '' } ) {
20
55
  let prefixParts = [];
21
56
  if ( variation ) {
@@ -31,6 +66,11 @@ export default function BorderPanel( { name, variation = '' } ) {
31
66
  const settings = useSettingsForBlockElement( rawSettings, name );
32
67
 
33
68
  const onChange = ( newStyle ) => {
69
+ if ( ! newStyle?.border ) {
70
+ setStyle( newStyle );
71
+ return;
72
+ }
73
+
34
74
  // As Global Styles can't conditionally generate styles based on if
35
75
  // other style properties have been set, we need to force split
36
76
  // border definitions for user set global border styles. Border
@@ -42,7 +82,8 @@ export default function BorderPanel( { name, variation = '' } ) {
42
82
  // the `border` style property. This means if the theme.json defined
43
83
  // split borders and the user condenses them into a flat border or
44
84
  // vice-versa we'd get both sets of styles which would conflict.
45
- const { border } = newStyle;
85
+ const { radius, ...newBorder } = newStyle.border;
86
+ const border = applyAllFallbackStyles( newBorder );
46
87
  const updatedBorder = ! hasSplitBorders( border )
47
88
  ? {
48
89
  top: border,
@@ -57,7 +98,7 @@ export default function BorderPanel( { name, variation = '' } ) {
57
98
  ...border,
58
99
  };
59
100
 
60
- setStyle( { ...newStyle, border: updatedBorder } );
101
+ setStyle( { ...newStyle, border: { ...updatedBorder, radius } } );
61
102
  };
62
103
 
63
104
  return (
@@ -27,7 +27,13 @@ export default function FiltersPanel( { name } ) {
27
27
  inheritedValue={ inheritedStyle }
28
28
  value={ style }
29
29
  onChange={ setStyle }
30
- settings={ settings }
30
+ settings={ {
31
+ ...settings,
32
+ color: {
33
+ ...settings.color,
34
+ customDuotone: false, //TO FIX: Custom duotone only works on the block level right now
35
+ },
36
+ } }
31
37
  />
32
38
  );
33
39
  }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { mergeWith, isEmpty } from 'lodash';
4
+ import { mergeWith } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -17,7 +17,9 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
17
17
  import CanvasSpinner from '../canvas-spinner';
18
18
  import { unlock } from '../../private-apis';
19
19
 
20
- const { GlobalStylesContext } = unlock( blockEditorPrivateApis );
20
+ const { GlobalStylesContext, cleanEmptyObject } = unlock(
21
+ blockEditorPrivateApis
22
+ );
21
23
 
22
24
  function mergeTreesCustomizer( _, srcValue ) {
23
25
  // We only pass as arrays the presets,
@@ -32,22 +34,6 @@ export function mergeBaseAndUserConfigs( base, user ) {
32
34
  return mergeWith( {}, base, user, mergeTreesCustomizer );
33
35
  }
34
36
 
35
- const cleanEmptyObject = ( object ) => {
36
- if (
37
- object === null ||
38
- typeof object !== 'object' ||
39
- Array.isArray( object )
40
- ) {
41
- return object;
42
- }
43
- const cleanedNestedObjects = Object.fromEntries(
44
- Object.entries( object )
45
- .map( ( [ key, value ] ) => [ key, cleanEmptyObject( value ) ] )
46
- .filter( ( [ , value ] ) => Boolean( value ) )
47
- );
48
- return isEmpty( cleanedNestedObjects ) ? undefined : cleanedNestedObjects;
49
- };
50
-
51
37
  function useGlobalStylesUserConfig() {
52
38
  const { globalStylesId, isReady, settings, styles } = useSelect(
53
39
  ( select ) => {
@@ -42,6 +42,7 @@ import StyleBook from '../style-book';
42
42
  import ScreenCSS from './screen-css';
43
43
  import { unlock } from '../../private-apis';
44
44
  import ScreenEffects from './screen-effects';
45
+ import { store as editSiteStore } from '../../store';
45
46
 
46
47
  const SLOT_FILL_NAME = 'GlobalStylesMenu';
47
48
  const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =
@@ -239,7 +240,7 @@ function ContextScreens( { name, parentMenu = '', variation = '' } ) {
239
240
  );
240
241
  }
241
242
 
242
- function GlobalStylesStyleBook( { onClose } ) {
243
+ function GlobalStylesStyleBook() {
243
244
  const navigator = useNavigator();
244
245
  const { path } = navigator.location;
245
246
  return (
@@ -257,7 +258,6 @@ function GlobalStylesStyleBook( { onClose } ) {
257
258
  // Now go to the selected block.
258
259
  navigator.goTo( '/blocks/' + encodeURIComponent( blockName ) );
259
260
  } }
260
- onClose={ onClose }
261
261
  />
262
262
  );
263
263
  }
@@ -296,9 +296,13 @@ function GlobalStylesBlockLink() {
296
296
  }, [ selectedBlockClientId, selectedBlockName, blockHasGlobalStyles ] );
297
297
  }
298
298
 
299
- function GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {
299
+ function GlobalStylesUI() {
300
300
  const blocks = getBlockTypes();
301
-
301
+ const editorCanvasContainerView = useSelect(
302
+ ( select ) =>
303
+ unlock( select( editSiteStore ) ).getEditorCanvasContainerView(),
304
+ []
305
+ );
302
306
  return (
303
307
  <NavigatorProvider
304
308
  className="edit-site-global-styles-sidebar__navigator-provider"
@@ -343,8 +347,8 @@ function GlobalStylesUI( { isStyleBookOpened, onCloseStyleBook } ) {
343
347
  />
344
348
  );
345
349
  } ) }
346
- { isStyleBookOpened && (
347
- <GlobalStylesStyleBook onClose={ onCloseStyleBook } />
350
+ { 'style-book' === editorCanvasContainerView && (
351
+ <GlobalStylesStyleBook />
348
352
  ) }
349
353
 
350
354
  <GlobalStylesActionMenu />
@@ -38,7 +38,8 @@ import UndoButton from './undo-redo/undo';
38
38
  import RedoButton from './undo-redo/redo';
39
39
  import DocumentActions from './document-actions';
40
40
  import { store as editSiteStore } from '../../store';
41
- import { useHasStyleBook } from '../style-book';
41
+ import { getEditorCanvasContainerTitle } from '../editor-canvas-container';
42
+ import { unlock } from '../../private-apis';
42
43
 
43
44
  const preventDefault = ( event ) => {
44
45
  event.preventDefault();
@@ -56,6 +57,7 @@ export default function HeaderEditMode() {
56
57
  blockEditorMode,
57
58
  homeUrl,
58
59
  showIconLabels,
60
+ editorCanvasView,
59
61
  } = useSelect( ( select ) => {
60
62
  const {
61
63
  __experimentalGetPreviewDeviceType,
@@ -88,6 +90,9 @@ export default function HeaderEditMode() {
88
90
  'core/edit-site',
89
91
  'showIconLabels'
90
92
  ),
93
+ editorCanvasView: unlock(
94
+ select( editSiteStore )
95
+ ).getEditorCanvasContainerView(),
91
96
  };
92
97
  }, [] );
93
98
 
@@ -117,7 +122,7 @@ export default function HeaderEditMode() {
117
122
  [ setIsListViewOpened, isListViewOpen ]
118
123
  );
119
124
 
120
- const hasStyleBook = useHasStyleBook();
125
+ const hasDefaultEditorCanvasView = ! editorCanvasView;
121
126
 
122
127
  const isFocusMode = templateType === 'wp_template_part';
123
128
 
@@ -138,7 +143,7 @@ export default function HeaderEditMode() {
138
143
  'show-icon-labels': showIconLabels,
139
144
  } ) }
140
145
  >
141
- { ! hasStyleBook && (
146
+ { hasDefaultEditorCanvasView && (
142
147
  <NavigableToolbar
143
148
  className="edit-site-header-edit-mode__start"
144
149
  aria-label={ __( 'Document tools' ) }
@@ -223,12 +228,16 @@ export default function HeaderEditMode() {
223
228
  ) }
224
229
 
225
230
  <div className="edit-site-header-edit-mode__center">
226
- { hasStyleBook ? __( 'Style Book' ) : <DocumentActions /> }
231
+ { ! hasDefaultEditorCanvasView ? (
232
+ getEditorCanvasContainerTitle( editorCanvasView )
233
+ ) : (
234
+ <DocumentActions />
235
+ ) }
227
236
  </div>
228
237
 
229
238
  <div className="edit-site-header-edit-mode__end">
230
239
  <div className="edit-site-header-edit-mode__actions">
231
- { ! isFocusMode && ! hasStyleBook && (
240
+ { ! isFocusMode && hasDefaultEditorCanvasView && (
232
241
  <div
233
242
  className={ classnames(
234
243
  'edit-site-header-edit-mode__preview-options',
@@ -23,6 +23,7 @@ import { useState, useRef } from '@wordpress/element';
23
23
  import { NavigableRegion } from '@wordpress/interface';
24
24
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
25
25
  import { CommandMenu } from '@wordpress/commands';
26
+ import { store as preferencesStore } from '@wordpress/preferences';
26
27
 
27
28
  /**
28
29
  * Internal dependencies
@@ -68,8 +69,8 @@ export default function Layout() {
68
69
  const { params } = useLocation();
69
70
  const isListPage = getIsListPage( params );
70
71
  const isEditorPage = ! isListPage;
71
- const { canvasMode, previousShortcut, nextShortcut } = useSelect(
72
- ( select ) => {
72
+ const { hasFixedToolbar, canvasMode, previousShortcut, nextShortcut } =
73
+ useSelect( ( select ) => {
73
74
  const { getAllShortcutKeyCombinations } = select(
74
75
  keyboardShortcutsStore
75
76
  );
@@ -82,10 +83,10 @@ export default function Layout() {
82
83
  nextShortcut: getAllShortcutKeyCombinations(
83
84
  'core/edit-site/next-region'
84
85
  ),
86
+ hasFixedToolbar:
87
+ select( preferencesStore ).get( 'fixedToolbar' ),
85
88
  };
86
- },
87
- []
88
- );
89
+ }, [] );
89
90
  const navigateRegionsProps = useNavigateRegions( {
90
91
  previous: previousShortcut,
91
92
  next: nextShortcut,
@@ -139,19 +140,11 @@ export default function Layout() {
139
140
  {
140
141
  'is-full-canvas': isFullCanvas,
141
142
  'is-edit-mode': canvasMode === 'edit',
143
+ 'has-fixed-toolbar': hasFixedToolbar,
142
144
  }
143
145
  ) }
144
146
  >
145
- <SiteHub
146
- ref={ hubRef }
147
- className="edit-site-layout__hub"
148
- style={ {
149
- width:
150
- isResizingEnabled && forcedWidth
151
- ? forcedWidth - 48
152
- : undefined,
153
- } }
154
- />
147
+ <SiteHub ref={ hubRef } className="edit-site-layout__hub" />
155
148
 
156
149
  <AnimatePresence initial={ false }>
157
150
  { isEditorPage && canvasMode === 'edit' && (
@@ -176,7 +169,7 @@ export default function Layout() {
176
169
  ease: 'easeOut',
177
170
  } }
178
171
  >
179
- { canvasMode === 'edit' && <Header /> }
172
+ <Header />
180
173
  </NavigableRegion>
181
174
  ) }
182
175
  </AnimatePresence>
@@ -15,7 +15,7 @@
15
15
  z-index: z-index(".edit-site-layout__hub");
16
16
 
17
17
  .edit-site-layout.is-full-canvas.is-edit-mode & {
18
- width: auto;
18
+ width: $header-height;
19
19
  padding-right: 0;
20
20
  }
21
21
 
@@ -135,6 +135,7 @@
135
135
 
136
136
  & > div {
137
137
  border-radius: 0;
138
+ box-shadow: none;
138
139
  }
139
140
  }
140
141
  }
@@ -148,13 +149,20 @@
148
149
  .edit-site-layout__view-mode-toggle.components-button {
149
150
  position: relative;
150
151
  color: $white;
151
- height: 100%;
152
- width: 100%;
153
- border-radius: $radius-block-ui;
152
+ border-radius: 0;
153
+ height: $header-height;
154
+ width: $header-height;
155
+ overflow: hidden;
154
156
  padding: 0;
155
157
  display: flex;
156
158
  align-items: center;
157
159
  justify-content: center;
160
+ border-bottom: 1px solid transparent;
161
+
162
+ .edit-site-layout.is-full-canvas.is-edit-mode & {
163
+ border-bottom-color: $gray-200;
164
+ transition: border-bottom-color 0.15s 0.4s ease-out;
165
+ }
158
166
 
159
167
  &:hover,
160
168
  &:active {
@@ -189,6 +197,10 @@
189
197
  .edit-site-layout__view-mode-toggle-icon {
190
198
  display: flex;
191
199
  border-radius: $radius-block-ui;
200
+ height: $grid-unit-80;
201
+ width: $grid-unit-80;
202
+ justify-content: center;
203
+ align-items: center;
192
204
  }
193
205
  }
194
206
 
@@ -220,3 +232,18 @@
220
232
  border-left: $border-width solid $gray-300;
221
233
  }
222
234
  }
235
+
236
+ .edit-site-layout.has-fixed-toolbar {
237
+ // making the header be lower than the content
238
+ // so the fixed toolbar can be positioned on top of it
239
+ // but only on desktop
240
+ @include break-medium() {
241
+ .edit-site-site-hub {
242
+ z-index: 4;
243
+ }
244
+ .edit-site-layout__header:focus-within {
245
+ z-index: 3;
246
+ }
247
+ }
248
+
249
+ }
@@ -18,19 +18,33 @@ import Actions from './actions';
18
18
  import AddedBy from './added-by';
19
19
 
20
20
  export default function Table( { templateType } ) {
21
- const { records: templates, isResolving: isLoading } = useEntityRecords(
21
+ const { records: allTemplates } = useEntityRecords(
22
22
  'postType',
23
23
  templateType,
24
24
  {
25
25
  per_page: -1,
26
26
  }
27
27
  );
28
+
29
+ const templates = useSelect(
30
+ ( select ) =>
31
+ allTemplates?.filter(
32
+ ( template ) =>
33
+ ! select( coreStore ).isDeletingEntityRecord(
34
+ 'postType',
35
+ templateType,
36
+ template.id
37
+ )
38
+ ),
39
+ [ allTemplates ]
40
+ );
41
+
28
42
  const postType = useSelect(
29
43
  ( select ) => select( coreStore ).getPostType( templateType ),
30
44
  [ templateType ]
31
45
  );
32
46
 
33
- if ( ! templates || isLoading ) {
47
+ if ( ! templates ) {
34
48
  return null;
35
49
  }
36
50
 
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Note that this CSS file should be in sync with its counterpart in the other editor:
3
+ * packages/edit-post/src/components/secondary-sidebar/style.scss
4
+ */
5
+
1
6
  .edit-site-editor__inserter-panel,
2
7
  .edit-site-editor__list-view-panel {
3
8
  height: 100%;
@@ -6,9 +11,11 @@
6
11
  }
7
12
 
8
13
  .edit-site-editor__list-view-panel {
9
- // Same width as the Inserter.
10
- // @see packages/block-editor/src/components/inserter/style.scss
11
- min-width: 350px;
14
+ @include break-medium() {
15
+ // Same width as the Inserter.
16
+ // @see packages/block-editor/src/components/inserter/style.scss
17
+ width: 350px;
18
+ }
12
19
  }
13
20
 
14
21
  .edit-site-editor__inserter-panel-header {
@@ -42,6 +49,17 @@
42
49
  }
43
50
 
44
51
  .edit-site-editor__list-view-panel-content {
45
- overflow-y: auto;
46
- padding: $grid-unit-10;
52
+ height: 100%;
53
+
54
+ // Include custom scrollbars, invisible until hovered.
55
+ @include custom-scrollbars-on-hover(transparent, $gray-600);
56
+ overflow: auto;
57
+
58
+ // Only reserve space for scrollbars when there is content to scroll.
59
+ // This allows items in the list view to have equidistant padding left and right
60
+ // right up until a scrollbar is present.
61
+ scrollbar-gutter: auto;
62
+
63
+ // The table cells use an extra pixels of space left and right. We compensate for that here.
64
+ padding: $grid-unit-10 ($grid-unit-10 - $border-width - $border-width);
47
65
  }
@@ -3,7 +3,8 @@
3
3
  overflow-y: auto;
4
4
 
5
5
  .components-navigator-screen {
6
- @include custom-scrollbars-on-hover;
6
+ @include custom-scrollbars-on-hover(transparent, $gray-700);
7
+ scrollbar-gutter: stable;
7
8
  }
8
9
  }
9
10