@wordpress/edit-site 6.0.4 → 6.2.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 (135) hide show
  1. package/CHANGELOG.md +10 -6
  2. package/build/components/add-new-page/index.js +2 -0
  3. package/build/components/add-new-page/index.js.map +1 -1
  4. package/build/components/add-new-pattern/index.js +1 -0
  5. package/build/components/add-new-pattern/index.js.map +1 -1
  6. package/build/components/app/index.js +17 -1
  7. package/build/components/app/index.js.map +1 -1
  8. package/build/components/editor/index.js +12 -13
  9. package/build/components/editor/index.js.map +1 -1
  10. package/build/components/editor-canvas-container/index.js +18 -7
  11. package/build/components/editor-canvas-container/index.js.map +1 -1
  12. package/build/components/global-styles/font-families.js +17 -17
  13. package/build/components/global-styles/font-families.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/context.js +2 -2
  15. package/build/components/global-styles/font-library-modal/context.js.map +1 -1
  16. package/build/components/global-styles/variations/variation.js +25 -19
  17. package/build/components/global-styles/variations/variation.js.map +1 -1
  18. package/build/components/global-styles/variations/variations-color.js +1 -0
  19. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  20. package/build/components/global-styles/variations/variations-typography.js +1 -0
  21. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  22. package/build/components/layout/index.js +8 -37
  23. package/build/components/layout/index.js.map +1 -1
  24. package/build/components/page/header.js +1 -0
  25. package/build/components/page/header.js.map +1 -1
  26. package/build/components/page-patterns/header.js +2 -1
  27. package/build/components/page-patterns/header.js.map +1 -1
  28. package/build/components/page-patterns/rename-category-menu-item.js +3 -1
  29. package/build/components/page-patterns/rename-category-menu-item.js.map +1 -1
  30. package/build/components/posts-app/index.js +50 -0
  31. package/build/components/posts-app/index.js.map +1 -0
  32. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
  33. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  34. package/build/hooks/commands/use-set-command-context.js +64 -0
  35. package/build/hooks/commands/use-set-command-context.js.map +1 -0
  36. package/build/index.js +15 -2
  37. package/build/index.js.map +1 -1
  38. package/build/posts.js +34 -0
  39. package/build/posts.js.map +1 -0
  40. package/build-module/components/add-new-page/index.js +2 -0
  41. package/build-module/components/add-new-page/index.js.map +1 -1
  42. package/build-module/components/add-new-pattern/index.js +1 -0
  43. package/build-module/components/add-new-pattern/index.js.map +1 -1
  44. package/build-module/components/app/index.js +17 -1
  45. package/build-module/components/app/index.js.map +1 -1
  46. package/build-module/components/editor/index.js +13 -14
  47. package/build-module/components/editor/index.js.map +1 -1
  48. package/build-module/components/editor-canvas-container/index.js +19 -8
  49. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  50. package/build-module/components/global-styles/font-families.js +18 -18
  51. package/build-module/components/global-styles/font-families.js.map +1 -1
  52. package/build-module/components/global-styles/font-library-modal/context.js +2 -2
  53. package/build-module/components/global-styles/font-library-modal/context.js.map +1 -1
  54. package/build-module/components/global-styles/variations/variation.js +25 -19
  55. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  56. package/build-module/components/global-styles/variations/variations-color.js +1 -0
  57. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  58. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  59. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  60. package/build-module/components/layout/index.js +10 -39
  61. package/build-module/components/layout/index.js.map +1 -1
  62. package/build-module/components/page/header.js +1 -0
  63. package/build-module/components/page/header.js.map +1 -1
  64. package/build-module/components/page-patterns/header.js +2 -1
  65. package/build-module/components/page-patterns/header.js.map +1 -1
  66. package/build-module/components/page-patterns/rename-category-menu-item.js +3 -1
  67. package/build-module/components/page-patterns/rename-category-menu-item.js.map +1 -1
  68. package/build-module/components/posts-app/index.js +43 -0
  69. package/build-module/components/posts-app/index.js.map +1 -0
  70. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +2 -0
  71. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  72. package/build-module/hooks/commands/use-set-command-context.js +57 -0
  73. package/build-module/hooks/commands/use-set-command-context.js.map +1 -0
  74. package/build-module/index.js +8 -2
  75. package/build-module/index.js.map +1 -1
  76. package/build-module/posts.js +27 -0
  77. package/build-module/posts.js.map +1 -0
  78. package/build-style/posts-rtl.css +1707 -0
  79. package/build-style/posts.css +1707 -0
  80. package/build-style/style-rtl.css +18 -20
  81. package/build-style/style.css +18 -20
  82. package/lib/inflate.js +3188 -3937
  83. package/lib/lib-font.browser.js +32 -2
  84. package/lib/unbrotli.js +1818 -2458
  85. package/package.json +41 -41
  86. package/src/components/add-new-page/index.js +6 -1
  87. package/src/components/add-new-pattern/index.js +1 -0
  88. package/src/components/app/index.js +17 -1
  89. package/src/components/editor/index.js +13 -22
  90. package/src/components/editor-canvas-container/index.js +20 -8
  91. package/src/components/global-styles/font-families.js +28 -19
  92. package/src/components/global-styles/font-library-modal/context.js +2 -2
  93. package/src/components/global-styles/style.scss +3 -8
  94. package/src/components/global-styles/variations/variation.js +37 -22
  95. package/src/components/global-styles/variations/variations-color.js +1 -0
  96. package/src/components/global-styles/variations/variations-typography.js +1 -0
  97. package/src/components/global-styles-sidebar/style.scss +0 -1
  98. package/src/components/layout/index.js +24 -70
  99. package/src/components/page/header.js +1 -0
  100. package/src/components/page/style.scss +6 -0
  101. package/src/components/page-patterns/header.js +8 -2
  102. package/src/components/page-patterns/rename-category-menu-item.js +2 -0
  103. package/src/components/page-patterns/style.scss +6 -0
  104. package/src/components/posts-app/index.js +39 -0
  105. package/src/components/sidebar/style.scss +4 -4
  106. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +6 -1
  107. package/src/hooks/commands/use-set-command-context.js +49 -0
  108. package/src/index.js +10 -2
  109. package/src/posts.js +29 -0
  110. package/src/posts.scss +46 -0
  111. package/build/components/block-editor/block-inspector-button.js +0 -57
  112. package/build/components/block-editor/block-inspector-button.js.map +0 -1
  113. package/build/components/block-editor/inserter-media-categories.js +0 -183
  114. package/build/components/block-editor/inserter-media-categories.js.map +0 -1
  115. package/build/components/template-part-converter/convert-to-regular.js +0 -38
  116. package/build/components/template-part-converter/convert-to-regular.js.map +0 -1
  117. package/build/components/template-part-converter/convert-to-template-part.js +0 -84
  118. package/build/components/template-part-converter/convert-to-template-part.js.map +0 -1
  119. package/build/components/template-part-converter/index.js +0 -67
  120. package/build/components/template-part-converter/index.js.map +0 -1
  121. package/build-module/components/block-editor/block-inspector-button.js +0 -50
  122. package/build-module/components/block-editor/block-inspector-button.js.map +0 -1
  123. package/build-module/components/block-editor/inserter-media-categories.js +0 -177
  124. package/build-module/components/block-editor/inserter-media-categories.js.map +0 -1
  125. package/build-module/components/template-part-converter/convert-to-regular.js +0 -31
  126. package/build-module/components/template-part-converter/convert-to-regular.js.map +0 -1
  127. package/build-module/components/template-part-converter/convert-to-template-part.js +0 -79
  128. package/build-module/components/template-part-converter/convert-to-template-part.js.map +0 -1
  129. package/build-module/components/template-part-converter/index.js +0 -59
  130. package/build-module/components/template-part-converter/index.js.map +0 -1
  131. package/src/components/block-editor/block-inspector-button.js +0 -60
  132. package/src/components/block-editor/inserter-media-categories.js +0 -225
  133. package/src/components/template-part-converter/convert-to-regular.js +0 -32
  134. package/src/components/template-part-converter/convert-to-template-part.js +0 -78
  135. package/src/components/template-part-converter/index.js +0 -59
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "6.0.4",
3
+ "version": "6.2.0",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,45 +29,45 @@
29
29
  "dependencies": {
30
30
  "@babel/runtime": "^7.16.0",
31
31
  "@react-spring/web": "^9.4.5",
32
- "@wordpress/a11y": "^4.0.1",
33
- "@wordpress/api-fetch": "^7.0.1",
34
- "@wordpress/blob": "^4.0.1",
35
- "@wordpress/block-editor": "^13.0.3",
36
- "@wordpress/block-library": "^9.0.4",
37
- "@wordpress/blocks": "^13.0.3",
38
- "@wordpress/commands": "^1.0.3",
39
- "@wordpress/components": "^28.0.3",
40
- "@wordpress/compose": "^7.0.1",
41
- "@wordpress/core-commands": "^1.0.3",
42
- "@wordpress/core-data": "^7.0.3",
43
- "@wordpress/data": "^10.0.2",
44
- "@wordpress/dataviews": "^2.0.3",
45
- "@wordpress/date": "^5.0.1",
46
- "@wordpress/deprecated": "^4.0.1",
47
- "@wordpress/dom": "^4.0.1",
48
- "@wordpress/editor": "^14.0.3",
49
- "@wordpress/element": "^6.0.1",
50
- "@wordpress/escape-html": "^3.0.1",
51
- "@wordpress/hooks": "^4.0.1",
52
- "@wordpress/html-entities": "^4.0.1",
53
- "@wordpress/i18n": "^5.0.1",
54
- "@wordpress/icons": "^10.0.2",
55
- "@wordpress/keyboard-shortcuts": "^5.0.2",
56
- "@wordpress/keycodes": "^4.0.1",
57
- "@wordpress/notices": "^5.0.2",
58
- "@wordpress/patterns": "^2.0.3",
59
- "@wordpress/plugins": "^7.0.3",
60
- "@wordpress/preferences": "^4.0.3",
61
- "@wordpress/primitives": "^4.0.1",
62
- "@wordpress/priority-queue": "^3.0.1",
63
- "@wordpress/private-apis": "^1.0.2",
64
- "@wordpress/reusable-blocks": "^5.0.3",
65
- "@wordpress/router": "^1.0.2",
66
- "@wordpress/style-engine": "^2.0.2",
67
- "@wordpress/url": "^4.0.1",
68
- "@wordpress/viewport": "^6.0.2",
69
- "@wordpress/widgets": "^4.0.3",
70
- "@wordpress/wordcount": "^4.0.1",
32
+ "@wordpress/a11y": "^4.2.0",
33
+ "@wordpress/api-fetch": "^7.2.0",
34
+ "@wordpress/blob": "^4.2.0",
35
+ "@wordpress/block-editor": "^13.2.0",
36
+ "@wordpress/block-library": "^9.2.0",
37
+ "@wordpress/blocks": "^13.2.0",
38
+ "@wordpress/commands": "^1.2.0",
39
+ "@wordpress/components": "^28.2.0",
40
+ "@wordpress/compose": "^7.2.0",
41
+ "@wordpress/core-commands": "^1.2.0",
42
+ "@wordpress/core-data": "^7.2.0",
43
+ "@wordpress/data": "^10.2.0",
44
+ "@wordpress/dataviews": "^2.2.0",
45
+ "@wordpress/date": "^5.2.0",
46
+ "@wordpress/deprecated": "^4.2.0",
47
+ "@wordpress/dom": "^4.2.0",
48
+ "@wordpress/editor": "^14.2.0",
49
+ "@wordpress/element": "^6.2.0",
50
+ "@wordpress/escape-html": "^3.2.0",
51
+ "@wordpress/hooks": "^4.2.0",
52
+ "@wordpress/html-entities": "^4.2.0",
53
+ "@wordpress/i18n": "^5.2.0",
54
+ "@wordpress/icons": "^10.2.0",
55
+ "@wordpress/keyboard-shortcuts": "^5.2.0",
56
+ "@wordpress/keycodes": "^4.2.0",
57
+ "@wordpress/notices": "^5.2.0",
58
+ "@wordpress/patterns": "^2.2.0",
59
+ "@wordpress/plugins": "^7.2.0",
60
+ "@wordpress/preferences": "^4.2.0",
61
+ "@wordpress/primitives": "^4.2.0",
62
+ "@wordpress/priority-queue": "^3.2.0",
63
+ "@wordpress/private-apis": "^1.2.0",
64
+ "@wordpress/reusable-blocks": "^5.2.0",
65
+ "@wordpress/router": "^1.2.0",
66
+ "@wordpress/style-engine": "^2.2.0",
67
+ "@wordpress/url": "^4.2.0",
68
+ "@wordpress/viewport": "^6.2.0",
69
+ "@wordpress/widgets": "^4.2.0",
70
+ "@wordpress/wordcount": "^4.2.0",
71
71
  "change-case": "^4.1.2",
72
72
  "clsx": "^2.1.1",
73
73
  "colord": "^2.9.2",
@@ -82,5 +82,5 @@
82
82
  "publishConfig": {
83
83
  "access": "public"
84
84
  },
85
- "gitHead": "9dd5f8dcfa4fc7242e5d48be20ee789ad087b432"
85
+ "gitHead": "aa5b14bb5bdbb8d8a02914e154c3bc1c2f18ace6"
86
86
  }
@@ -82,7 +82,12 @@ export default function AddNewPageModal( { onSave, onClose } ) {
82
82
  }
83
83
 
84
84
  return (
85
- <Modal title={ __( 'Draft a new page' ) } onRequestClose={ onClose }>
85
+ <Modal
86
+ title={ __( 'Draft a new page' ) }
87
+ onRequestClose={ onClose }
88
+ focusOnMount="firstContentElement"
89
+ size="small"
90
+ >
86
91
  <form onSubmit={ createPage }>
87
92
  <VStack spacing={ 3 }>
88
93
  <TextControl
@@ -55,6 +55,7 @@ export default function AddNewPattern() {
55
55
  ?.add_new_item,
56
56
  addNewTemplatePartLabel: getPostType( TEMPLATE_PART_POST_TYPE )
57
57
  ?.labels?.add_new_item,
58
+ // Blocks refers to the wp_block post type, this checks the ability to create a post of that type.
58
59
  canCreatePattern: canUser( 'create', 'blocks' ),
59
60
  canCreateTemplatePart: canUser( 'create', 'template-parts' ),
60
61
  };
@@ -17,10 +17,26 @@ import { privateApis as routerPrivateApis } from '@wordpress/router';
17
17
  */
18
18
  import Layout from '../layout';
19
19
  import { unlock } from '../../lock-unlock';
20
+ import { useCommonCommands } from '../../hooks/commands/use-common-commands';
21
+ import { useEditModeCommands } from '../../hooks/commands/use-edit-mode-commands';
22
+ import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
23
+ import useLayoutAreas from '../layout/router';
24
+ import useSetCommandContext from '../../hooks/commands/use-set-command-context';
20
25
 
21
26
  const { RouterProvider } = unlock( routerPrivateApis );
22
27
  const { GlobalStylesProvider } = unlock( editorPrivateApis );
23
28
 
29
+ function AppLayout() {
30
+ // This ensures the edited entity id and type are initialized properly.
31
+ useInitEditedEntityFromURL();
32
+ useEditModeCommands();
33
+ useCommonCommands();
34
+ useSetCommandContext();
35
+ const route = useLayoutAreas();
36
+
37
+ return <Layout route={ route } />;
38
+ }
39
+
24
40
  export default function App() {
25
41
  const { createErrorNotice } = useDispatch( noticesStore );
26
42
 
@@ -41,7 +57,7 @@ export default function App() {
41
57
  <GlobalStylesProvider>
42
58
  <UnsavedChangesWarning />
43
59
  <RouterProvider>
44
- <Layout />
60
+ <AppLayout />
45
61
  <PluginArea onError={ onPluginAreaError } />
46
62
  </RouterProvider>
47
63
  </GlobalStylesProvider>
@@ -31,13 +31,12 @@ import { store as editSiteStore } from '../../store';
31
31
  import { GlobalStylesRenderer } from '../global-styles-renderer';
32
32
  import CanvasLoader from '../canvas-loader';
33
33
  import { unlock } from '../../lock-unlock';
34
- import TemplatePartConverter from '../template-part-converter';
35
34
  import { useSpecificEditorSettings } from '../block-editor/use-site-editor-settings';
36
35
  import PluginTemplateSettingPanel from '../plugin-template-setting-panel';
37
36
  import GlobalStylesSidebar from '../global-styles-sidebar';
38
37
  import { isPreviewingTheme } from '../../utils/is-previewing-theme';
39
38
  import {
40
- getEditorCanvasContainerTitle,
39
+ getEditorCanvasContainerTitleAndIcon,
41
40
  useHasEditorCanvasContainer,
42
41
  } from '../editor-canvas-container';
43
42
  import SaveButton from '../save-button';
@@ -56,7 +55,6 @@ export default function EditSiteEditor( { isLoading } ) {
56
55
  editedPostId,
57
56
  contextPostType,
58
57
  contextPostId,
59
- editorMode,
60
58
  canvasMode,
61
59
  isEditingPage,
62
60
  supportsGlobalStyles,
@@ -65,6 +63,7 @@ export default function EditSiteEditor( { isLoading } ) {
65
63
  currentPostIsTrashed,
66
64
  } = useSelect( ( select ) => {
67
65
  const {
66
+ getEditorCanvasContainerView,
68
67
  getEditedPostContext,
69
68
  getCanvasMode,
70
69
  isPage,
@@ -73,7 +72,6 @@ export default function EditSiteEditor( { isLoading } ) {
73
72
  } = unlock( select( editSiteStore ) );
74
73
  const { get } = select( preferencesStore );
75
74
  const { getCurrentTheme } = select( coreDataStore );
76
- const { getEditorMode } = select( editorStore );
77
75
  const _context = getEditedPostContext();
78
76
 
79
77
  // The currently selected entity to display.
@@ -83,14 +81,11 @@ export default function EditSiteEditor( { isLoading } ) {
83
81
  editedPostId: getEditedPostId(),
84
82
  contextPostType: _context?.postId ? _context.postType : undefined,
85
83
  contextPostId: _context?.postId ? _context.postId : undefined,
86
- editorMode: getEditorMode(),
87
84
  canvasMode: getCanvasMode(),
88
85
  isEditingPage: isPage(),
89
86
  supportsGlobalStyles: getCurrentTheme()?.is_block_theme,
90
87
  showIconLabels: get( 'core', 'showIconLabels' ),
91
- editorCanvasView: unlock(
92
- select( editSiteStore )
93
- ).getEditorCanvasContainerView(),
88
+ editorCanvasView: getEditorCanvasContainerView(),
94
89
  currentPostIsTrashed:
95
90
  select( editorStore ).getCurrentPostAttribute( 'status' ) ===
96
91
  'trash',
@@ -100,9 +95,7 @@ export default function EditSiteEditor( { isLoading } ) {
100
95
  const _isPreviewingTheme = isPreviewingTheme();
101
96
  const hasDefaultEditorCanvasView = ! useHasEditorCanvasContainer();
102
97
  const iframeProps = useEditorIframeProps();
103
- const isViewMode = canvasMode === 'view';
104
98
  const isEditMode = canvasMode === 'edit';
105
- const showVisualEditor = isViewMode || editorMode === 'visual';
106
99
  const postWithTemplate = !! contextPostId;
107
100
  const loadingProgressId = useInstanceId(
108
101
  CanvasLoader,
@@ -116,14 +109,12 @@ export default function EditSiteEditor( { isLoading } ) {
116
109
  {
117
110
  // Forming a "block formatting context" to prevent margin collapsing.
118
111
  // @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context
119
-
120
- css: `body{${
112
+ css:
121
113
  canvasMode === 'view'
122
- ? `min-height: 100vh; ${
114
+ ? `body{min-height: 100vh; ${
123
115
  currentPostIsTrashed ? '' : 'cursor: pointer;'
124
- }`
125
- : ''
126
- }}}`,
116
+ }}`
117
+ : undefined,
127
118
  },
128
119
  ],
129
120
  [ settings.styles, canvasMode, currentPostIsTrashed ]
@@ -179,6 +170,10 @@ export default function EditSiteEditor( { isLoading } ) {
179
170
  [ history, createSuccessNotice ]
180
171
  );
181
172
 
173
+ // Replace the title and icon displayed in the DocumentBar when there's an overlay visible.
174
+ const { title, icon } =
175
+ getEditorCanvasContainerTitleAndIcon( editorCanvasView );
176
+
182
177
  const isReady = ! isLoading;
183
178
 
184
179
  return (
@@ -186,7 +181,6 @@ export default function EditSiteEditor( { isLoading } ) {
186
181
  <GlobalStylesRenderer />
187
182
  <EditorKeyboardShortcutsRegister />
188
183
  { isEditMode && <BlockKeyboardShortcuts /> }
189
- { showVisualEditor && <TemplatePartConverter /> }
190
184
  { ! isReady ? <CanvasLoader id={ loadingProgressId } /> : null }
191
185
  { isEditMode && <WelcomeGuide /> }
192
186
  { isReady && (
@@ -206,11 +200,8 @@ export default function EditSiteEditor( { isLoading } ) {
206
200
  _isPreviewingTheme && <SaveButton size="compact" />
207
201
  }
208
202
  forceDisableBlockTools={ ! hasDefaultEditorCanvasView }
209
- title={
210
- ! hasDefaultEditorCanvasView
211
- ? getEditorCanvasContainerTitle( editorCanvasView )
212
- : undefined
213
- }
203
+ title={ title }
204
+ icon={ icon }
214
205
  iframeProps={ iframeProps }
215
206
  onActionPerformed={ onActionPerformed }
216
207
  extraSidebarPanels={
@@ -9,7 +9,7 @@ import {
9
9
  import { ESCAPE } from '@wordpress/keycodes';
10
10
  import { __ } from '@wordpress/i18n';
11
11
  import { useDispatch, useSelect } from '@wordpress/data';
12
- import { closeSmall } from '@wordpress/icons';
12
+ import { backup, closeSmall, seen } from '@wordpress/icons';
13
13
  import { useFocusOnMount, useFocusReturn } from '@wordpress/compose';
14
14
  import { store as preferencesStore } from '@wordpress/preferences';
15
15
  import {
@@ -30,17 +30,26 @@ const { EditorContentSlotFill, ResizableEditor } = unlock( editorPrivateApis );
30
30
  *
31
31
  * @param {string} view Editor canvas container view.
32
32
  *
33
- * @return {string} Translated string corresponding to value of view. Default is ''.
33
+ * @return {Object} Translated string for the view title and associated icon, both defaulting to ''.
34
34
  */
35
- function getEditorCanvasContainerTitle( view ) {
35
+ function getEditorCanvasContainerTitleAndIcon( view ) {
36
36
  switch ( view ) {
37
37
  case 'style-book':
38
- return __( 'Style Book' );
38
+ return {
39
+ title: __( 'Style Book' ),
40
+ icon: seen,
41
+ };
39
42
  case 'global-styles-revisions':
40
43
  case 'global-styles-revisions:style-book':
41
- return __( 'Style Revisions' );
44
+ return {
45
+ title: __( 'Style Revisions' ),
46
+ icon: backup,
47
+ };
42
48
  default:
43
- return '';
49
+ return {
50
+ title: '',
51
+ icon: '',
52
+ };
44
53
  }
45
54
  }
46
55
 
@@ -109,7 +118,9 @@ function EditorCanvasContainer( {
109
118
  return null;
110
119
  }
111
120
 
112
- const title = getEditorCanvasContainerTitle( editorCanvasContainerView );
121
+ const { title } = getEditorCanvasContainerTitleAndIcon(
122
+ editorCanvasContainerView
123
+ );
113
124
  const shouldShowCloseButton = onClose || closeButtonLabel;
114
125
 
115
126
  return (
@@ -138,10 +149,11 @@ function EditorCanvasContainer( {
138
149
  </EditorContentSlotFill.Fill>
139
150
  );
140
151
  }
152
+
141
153
  function useHasEditorCanvasContainer() {
142
154
  const fills = useSlotFills( EditorContentSlotFill.privateKey );
143
155
  return !! fills?.length;
144
156
  }
145
157
 
146
158
  export default EditorCanvasContainer;
147
- export { useHasEditorCanvasContainer, getEditorCanvasContainerTitle };
159
+ export { useHasEditorCanvasContainer, getEditorCanvasContainerTitleAndIcon };
@@ -5,11 +5,9 @@ import { __ } from '@wordpress/i18n';
5
5
  import {
6
6
  __experimentalItemGroup as ItemGroup,
7
7
  __experimentalVStack as VStack,
8
- __experimentalHStack as HStack,
9
8
  Button,
10
9
  } from '@wordpress/components';
11
10
  import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
12
- import { settings } from '@wordpress/icons';
13
11
  import { useContext } from '@wordpress/element';
14
12
 
15
13
  /**
@@ -51,30 +49,41 @@ function FontFamilies() {
51
49
  ) }
52
50
 
53
51
  <VStack spacing={ 2 }>
54
- <HStack justify="space-between">
55
- <Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
56
- <Button
57
- onClick={ () => setModalTabOpen( 'installed-fonts' ) }
58
- label={ __( 'Manage fonts' ) }
59
- icon={ settings }
60
- size="small"
61
- />
62
- </HStack>
52
+ <Subtitle level={ 3 }>{ __( 'Fonts' ) }</Subtitle>
63
53
  { hasFonts ? (
64
- <ItemGroup isBordered isSeparated>
65
- { customFonts.map( ( font ) => (
66
- <FontFamilyItem key={ font.slug } font={ font } />
67
- ) ) }
68
- { themeFonts.map( ( font ) => (
69
- <FontFamilyItem key={ font.slug } font={ font } />
70
- ) ) }
71
- </ItemGroup>
54
+ <>
55
+ <ItemGroup isBordered isSeparated>
56
+ { customFonts.map( ( font ) => (
57
+ <FontFamilyItem
58
+ key={ font.slug }
59
+ font={ font }
60
+ />
61
+ ) ) }
62
+ { themeFonts.map( ( font ) => (
63
+ <FontFamilyItem
64
+ key={ font.slug }
65
+ font={ font }
66
+ />
67
+ ) ) }
68
+ </ItemGroup>
69
+ <Button
70
+ className="edit-site-global-styles-font-families__manage-fonts"
71
+ variant="secondary"
72
+ __next40pxDefaultSize
73
+ onClick={ () =>
74
+ setModalTabOpen( 'installed-fonts' )
75
+ }
76
+ >
77
+ { __( 'Manage fonts' ) }
78
+ </Button>
79
+ </>
72
80
  ) : (
73
81
  <>
74
82
  { __( 'No fonts installed.' ) }
75
83
  <Button
76
84
  className="edit-site-global-styles-font-families__add-fonts"
77
85
  variant="secondary"
86
+ __next40pxDefaultSize
78
87
  onClick={ () => setModalTabOpen( 'upload-fonts' ) }
79
88
  >
80
89
  { __( 'Add fonts' ) }
@@ -451,13 +451,13 @@ function FontLibraryProvider( { children } ) {
451
451
  );
452
452
 
453
453
  if ( isFaceActivated ) {
454
+ unloadFontFaceInBrowser( face, 'all' );
455
+ } else {
454
456
  loadFontFaceInBrowser(
455
457
  face,
456
458
  getDisplaySrcFromFontFace( face?.src ),
457
459
  'all'
458
460
  );
459
- } else {
460
- unloadFontFaceInBrowser( face, 'all' );
461
461
  }
462
462
  };
463
463
 
@@ -23,11 +23,6 @@
23
23
  overflow: hidden;
24
24
  }
25
25
 
26
- .edit-site-typography-panel__full-width-control {
27
- grid-column: 1 / -1;
28
- max-width: 100%;
29
- }
30
-
31
26
  .edit-site-global-styles-screen {
32
27
  margin: $grid-unit-15 $grid-unit-20 $grid-unit-20;
33
28
  }
@@ -46,7 +41,8 @@
46
41
  color: $gray-700;
47
42
  }
48
43
 
49
- .edit-site-global-styles-font-families__add-fonts {
44
+ .edit-site-global-styles-font-families__add-fonts,
45
+ .edit-site-global-styles-font-families__manage-fonts {
50
46
  justify-content: center;
51
47
  }
52
48
 
@@ -84,8 +80,7 @@
84
80
  color: $gray-800;
85
81
  font-weight: 600;
86
82
  line-height: 1.2;
87
- padding: $grid-unit-20;
88
- padding-bottom: 0;
83
+ padding: $grid-unit-20 $grid-unit-20 0;
89
84
  margin: 0;
90
85
  }
91
86
 
@@ -6,6 +6,7 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
+ import { Tooltip } from '@wordpress/components';
9
10
  import { useMemo, useContext, useState } from '@wordpress/element';
10
11
  import { ENTER } from '@wordpress/keycodes';
11
12
  import { __, sprintf } from '@wordpress/i18n';
@@ -23,7 +24,13 @@ const { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(
23
24
  blockEditorPrivateApis
24
25
  );
25
26
 
26
- export default function Variation( { variation, children, isPill, property } ) {
27
+ export default function Variation( {
28
+ variation,
29
+ children,
30
+ isPill,
31
+ property,
32
+ showTooltip,
33
+ } ) {
27
34
  const [ isFocused, setIsFocused ] = useState( false );
28
35
  const { base, user, setUserConfig } = useContext( GlobalStylesContext );
29
36
 
@@ -64,30 +71,38 @@ export default function Variation( { variation, children, isPill, property } ) {
64
71
  );
65
72
  }
66
73
 
67
- return (
68
- <GlobalStylesContext.Provider value={ context }>
74
+ const content = (
75
+ <div
76
+ className={ clsx( 'edit-site-global-styles-variations_item', {
77
+ 'is-active': isActive,
78
+ } ) }
79
+ role="button"
80
+ onClick={ selectVariation }
81
+ onKeyDown={ selectOnEnter }
82
+ tabIndex="0"
83
+ aria-label={ label }
84
+ aria-current={ isActive }
85
+ onFocus={ () => setIsFocused( true ) }
86
+ onBlur={ () => setIsFocused( false ) }
87
+ >
69
88
  <div
70
- className={ clsx( 'edit-site-global-styles-variations_item', {
71
- 'is-active': isActive,
72
- } ) }
73
- role="button"
74
- onClick={ selectVariation }
75
- onKeyDown={ selectOnEnter }
76
- tabIndex="0"
77
- aria-label={ label }
78
- aria-current={ isActive }
79
- onFocus={ () => setIsFocused( true ) }
80
- onBlur={ () => setIsFocused( false ) }
89
+ className={ clsx(
90
+ 'edit-site-global-styles-variations_item-preview',
91
+ { 'is-pill': isPill }
92
+ ) }
81
93
  >
82
- <div
83
- className={ clsx(
84
- 'edit-site-global-styles-variations_item-preview',
85
- { 'is-pill': isPill }
86
- ) }
87
- >
88
- { children( isFocused ) }
89
- </div>
94
+ { children( isFocused ) }
90
95
  </div>
96
+ </div>
97
+ );
98
+
99
+ return (
100
+ <GlobalStylesContext.Provider value={ context }>
101
+ { showTooltip ? (
102
+ <Tooltip text={ variation?.title }>{ content }</Tooltip>
103
+ ) : (
104
+ content
105
+ ) }
91
106
  </GlobalStylesContext.Provider>
92
107
  );
93
108
  }
@@ -32,6 +32,7 @@ export default function ColorVariations( { title, gap = 2 } ) {
32
32
  variation={ variation }
33
33
  isPill
34
34
  property="color"
35
+ showTooltip
35
36
  >
36
37
  { () => <StylesPreviewColors /> }
37
38
  </Variation>
@@ -39,6 +39,7 @@ export default function TypographyVariations( { title, gap = 2 } ) {
39
39
  key={ index }
40
40
  variation={ variation }
41
41
  property="typography"
42
+ showTooltip
42
43
  >
43
44
  { ( isFocused ) => (
44
45
  <PreviewIframe
@@ -47,7 +47,6 @@
47
47
  font-weight: 500;
48
48
  }
49
49
 
50
- .edit-site-typography-panel,
51
50
  .edit-site-global-styles-sidebar .block-editor-panel-color-gradient-settings {
52
51
  border: 0;
53
52
  }