@wordpress/edit-site 5.3.3 → 5.4.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 (172) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +1 -20
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/app/index.js.map +1 -1
  5. package/build/components/block-editor/editor-canvas.js +1 -0
  6. package/build/components/block-editor/editor-canvas.js.map +1 -1
  7. package/build/components/editor/index.js +3 -1
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/global-styles/border-panel.js +4 -4
  10. package/build/components/global-styles/border-panel.js.map +1 -1
  11. package/build/components/global-styles/color-palette-panel.js +5 -2
  12. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  13. package/build/components/global-styles/color-utils.js +1 -1
  14. package/build/components/global-styles/color-utils.js.map +1 -1
  15. package/build/components/global-styles/context-menu.js +16 -3
  16. package/build/components/global-styles/context-menu.js.map +1 -1
  17. package/build/components/global-styles/custom-css.js +1 -1
  18. package/build/components/global-styles/custom-css.js.map +1 -1
  19. package/build/components/global-styles/dimensions-panel.js +8 -7
  20. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  21. package/build/components/global-styles/gradients-palette-panel.js +8 -3
  22. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  23. package/build/components/global-styles/header.js +3 -1
  24. package/build/components/global-styles/header.js.map +1 -1
  25. package/build/components/global-styles/hooks.js +14 -51
  26. package/build/components/global-styles/hooks.js.map +1 -1
  27. package/build/components/global-styles/palette.js +3 -1
  28. package/build/components/global-styles/palette.js.map +1 -1
  29. package/build/components/global-styles/screen-background-color.js +3 -2
  30. package/build/components/global-styles/screen-background-color.js.map +1 -1
  31. package/build/components/global-styles/screen-block-list.js +14 -3
  32. package/build/components/global-styles/screen-block-list.js.map +1 -1
  33. package/build/components/global-styles/screen-button-color.js +7 -5
  34. package/build/components/global-styles/screen-button-color.js.map +1 -1
  35. package/build/components/global-styles/screen-colors.js +8 -6
  36. package/build/components/global-styles/screen-colors.js.map +1 -1
  37. package/build/components/global-styles/screen-heading-color.js +8 -6
  38. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  39. package/build/components/global-styles/screen-link-color.js +3 -2
  40. package/build/components/global-styles/screen-link-color.js.map +1 -1
  41. package/build/components/global-styles/screen-text-color.js +3 -2
  42. package/build/components/global-styles/screen-text-color.js.map +1 -1
  43. package/build/components/global-styles/screen-typography.js +3 -1
  44. package/build/components/global-styles/screen-typography.js.map +1 -1
  45. package/build/components/global-styles/shadow-panel.js +2 -3
  46. package/build/components/global-styles/shadow-panel.js.map +1 -1
  47. package/build/components/global-styles/subtitle.js +3 -2
  48. package/build/components/global-styles/subtitle.js.map +1 -1
  49. package/build/components/global-styles/typography-panel.js +23 -300
  50. package/build/components/global-styles/typography-panel.js.map +1 -1
  51. package/build/components/navigation-inspector/index.js +0 -29
  52. package/build/components/navigation-inspector/index.js.map +1 -1
  53. package/build/components/navigation-inspector/navigation-menu.js +4 -2
  54. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  55. package/build/components/sidebar/index.js +1 -20
  56. package/build/components/sidebar/index.js.map +1 -1
  57. package/build/components/sidebar-edit-mode/index.js +1 -1
  58. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  59. package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
  60. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  61. package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
  62. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  63. package/build/components/start-template-options/index.js +175 -0
  64. package/build/components/start-template-options/index.js.map +1 -0
  65. package/build/hooks/push-changes-to-global-styles/index.js +5 -4
  66. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  67. package/build-module/components/add-new-template/new-template.js +1 -18
  68. package/build-module/components/add-new-template/new-template.js.map +1 -1
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/block-editor/editor-canvas.js +1 -0
  71. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  72. package/build-module/components/editor/index.js +2 -1
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/global-styles/border-panel.js +5 -5
  75. package/build-module/components/global-styles/border-panel.js.map +1 -1
  76. package/build-module/components/global-styles/color-palette-panel.js +5 -2
  77. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  78. package/build-module/components/global-styles/color-utils.js +2 -2
  79. package/build-module/components/global-styles/color-utils.js.map +1 -1
  80. package/build-module/components/global-styles/context-menu.js +13 -2
  81. package/build-module/components/global-styles/context-menu.js.map +1 -1
  82. package/build-module/components/global-styles/custom-css.js +1 -1
  83. package/build-module/components/global-styles/custom-css.js.map +1 -1
  84. package/build-module/components/global-styles/dimensions-panel.js +9 -8
  85. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  86. package/build-module/components/global-styles/gradients-palette-panel.js +8 -3
  87. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  88. package/build-module/components/global-styles/header.js +3 -1
  89. package/build-module/components/global-styles/header.js.map +1 -1
  90. package/build-module/components/global-styles/hooks.js +12 -49
  91. package/build-module/components/global-styles/hooks.js.map +1 -1
  92. package/build-module/components/global-styles/palette.js +3 -1
  93. package/build-module/components/global-styles/palette.js.map +1 -1
  94. package/build-module/components/global-styles/screen-background-color.js +4 -3
  95. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  96. package/build-module/components/global-styles/screen-block-list.js +12 -3
  97. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  98. package/build-module/components/global-styles/screen-button-color.js +8 -6
  99. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  100. package/build-module/components/global-styles/screen-colors.js +9 -7
  101. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  102. package/build-module/components/global-styles/screen-heading-color.js +9 -7
  103. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  104. package/build-module/components/global-styles/screen-link-color.js +4 -3
  105. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  106. package/build-module/components/global-styles/screen-text-color.js +4 -3
  107. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  108. package/build-module/components/global-styles/screen-typography.js +3 -1
  109. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  110. package/build-module/components/global-styles/shadow-panel.js +3 -4
  111. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  112. package/build-module/components/global-styles/subtitle.js +3 -2
  113. package/build-module/components/global-styles/subtitle.js.map +1 -1
  114. package/build-module/components/global-styles/typography-panel.js +27 -300
  115. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  116. package/build-module/components/navigation-inspector/index.js +0 -27
  117. package/build-module/components/navigation-inspector/index.js.map +1 -1
  118. package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
  119. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  120. package/build-module/components/sidebar/index.js +1 -18
  121. package/build-module/components/sidebar/index.js.map +1 -1
  122. package/build-module/components/sidebar-edit-mode/index.js +1 -1
  123. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  124. package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
  125. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  126. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
  127. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  128. package/build-module/components/start-template-options/index.js +156 -0
  129. package/build-module/components/start-template-options/index.js.map +1 -0
  130. package/build-module/hooks/push-changes-to-global-styles/index.js +6 -5
  131. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  132. package/build-style/style-rtl.css +73 -4
  133. package/build-style/style.css +73 -4
  134. package/package.json +31 -31
  135. package/src/components/add-new-template/new-template.js +1 -16
  136. package/src/components/app/index.js +0 -1
  137. package/src/components/block-editor/editor-canvas.js +1 -0
  138. package/src/components/editor/index.js +2 -0
  139. package/src/components/global-styles/border-panel.js +5 -5
  140. package/src/components/global-styles/color-palette-panel.js +3 -0
  141. package/src/components/global-styles/color-utils.js +2 -3
  142. package/src/components/global-styles/context-menu.js +17 -2
  143. package/src/components/global-styles/custom-css.js +1 -1
  144. package/src/components/global-styles/dimensions-panel.js +12 -8
  145. package/src/components/global-styles/gradients-palette-panel.js +4 -1
  146. package/src/components/global-styles/header.js +7 -1
  147. package/src/components/global-styles/hooks.js +17 -90
  148. package/src/components/global-styles/palette.js +1 -1
  149. package/src/components/global-styles/screen-background-color.js +3 -2
  150. package/src/components/global-styles/screen-block-list.js +19 -3
  151. package/src/components/global-styles/screen-button-color.js +8 -6
  152. package/src/components/global-styles/screen-colors.js +7 -7
  153. package/src/components/global-styles/screen-heading-color.js +9 -7
  154. package/src/components/global-styles/screen-link-color.js +3 -2
  155. package/src/components/global-styles/screen-text-color.js +3 -2
  156. package/src/components/global-styles/screen-typography.js +1 -1
  157. package/src/components/global-styles/shadow-panel.js +6 -3
  158. package/src/components/global-styles/style.scss +5 -0
  159. package/src/components/global-styles/subtitle.js +5 -2
  160. package/src/components/global-styles/typography-panel.js +30 -394
  161. package/src/components/navigation-inspector/index.js +0 -32
  162. package/src/components/navigation-inspector/navigation-menu.js +8 -2
  163. package/src/components/sidebar/index.js +4 -17
  164. package/src/components/sidebar-edit-mode/index.js +1 -1
  165. package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
  166. package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
  167. package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
  168. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
  169. package/src/components/start-template-options/index.js +171 -0
  170. package/src/components/start-template-options/style.scss +76 -0
  171. package/src/hooks/push-changes-to-global-styles/index.js +26 -21
  172. package/src/style.scss +1 -0
@@ -1,186 +1,21 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import {
5
- LineHeightControl,
6
- __experimentalFontFamilyControl as FontFamilyControl,
7
- __experimentalFontAppearanceControl as FontAppearanceControl,
8
- __experimentalLetterSpacingControl as LetterSpacingControl,
9
- __experimentalTextTransformControl as TextTransformControl,
10
- __experimentalTextDecorationControl as TextDecorationControl,
11
- privateApis as blockEditorPrivateApis,
12
- } from '@wordpress/block-editor';
13
- import {
14
- FontSizePicker,
15
- __experimentalToolsPanel as ToolsPanel,
16
- __experimentalToolsPanelItem as ToolsPanelItem,
17
- } from '@wordpress/components';
18
- import { __ } from '@wordpress/i18n';
4
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
5
+ import { useMemo } from '@wordpress/element';
19
6
 
20
7
  /**
21
8
  * Internal dependencies
22
9
  */
23
- import { getSupportedGlobalStylesPanels } from './hooks';
24
10
  import { unlock } from '../../private-apis';
11
+ import { useSupportedStyles } from './hooks';
25
12
 
26
- const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );
27
-
28
- export function useHasTypographyPanel( name ) {
29
- const hasFontFamily = useHasFontFamilyControl( name );
30
- const hasLineHeight = useHasLineHeightControl( name );
31
- const hasFontAppearance = useHasAppearanceControl( name );
32
- const hasLetterSpacing = useHasLetterSpacingControl( name );
33
- const supports = getSupportedGlobalStylesPanels( name );
34
- return (
35
- hasFontFamily ||
36
- hasLineHeight ||
37
- hasFontAppearance ||
38
- hasLetterSpacing ||
39
- supports.includes( 'fontSize' )
40
- );
41
- }
42
-
43
- function useHasFontFamilyControl( name ) {
44
- const supports = getSupportedGlobalStylesPanels( name );
45
- const [ fontFamiliesPerOrigin ] = useGlobalSetting(
46
- 'typography.fontFamilies',
47
- name
48
- );
49
- const fontFamilies =
50
- fontFamiliesPerOrigin?.custom ||
51
- fontFamiliesPerOrigin?.theme ||
52
- fontFamiliesPerOrigin?.default;
53
- return supports.includes( 'fontFamily' ) && !! fontFamilies?.length;
54
- }
55
-
56
- function useHasLineHeightControl( name ) {
57
- const supports = getSupportedGlobalStylesPanels( name );
58
- return (
59
- useGlobalSetting( 'typography.lineHeight', name )[ 0 ] &&
60
- supports.includes( 'lineHeight' )
61
- );
62
- }
63
-
64
- function useHasAppearanceControl( name ) {
65
- const supports = getSupportedGlobalStylesPanels( name );
66
- const hasFontStyles =
67
- useGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&
68
- supports.includes( 'fontStyle' );
69
- const hasFontWeights =
70
- useGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&
71
- supports.includes( 'fontWeight' );
72
- return hasFontStyles || hasFontWeights;
73
- }
74
-
75
- function useAppearanceControlLabel( name ) {
76
- const supports = getSupportedGlobalStylesPanels( name );
77
- const hasFontStyles =
78
- useGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&
79
- supports.includes( 'fontStyle' );
80
- const hasFontWeights =
81
- useGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&
82
- supports.includes( 'fontWeight' );
83
- if ( ! hasFontStyles ) {
84
- return __( 'Font weight' );
85
- }
86
- if ( ! hasFontWeights ) {
87
- return __( 'Font style' );
88
- }
89
- return __( 'Appearance' );
90
- }
91
-
92
- function useHasLetterSpacingControl( name, element ) {
93
- const setting = useGlobalSetting( 'typography.letterSpacing', name )[ 0 ];
94
- if ( ! setting ) {
95
- return false;
96
- }
97
- if ( ! name && element === 'heading' ) {
98
- return true;
99
- }
100
- const supports = getSupportedGlobalStylesPanels( name );
101
- return supports.includes( 'letterSpacing' );
102
- }
103
-
104
- function useHasTextTransformControl( name, element ) {
105
- const setting = useGlobalSetting( 'typography.textTransform', name )[ 0 ];
106
- if ( ! setting ) {
107
- return false;
108
- }
109
- if ( ! name && element === 'heading' ) {
110
- return true;
111
- }
112
- const supports = getSupportedGlobalStylesPanels( name );
113
- return supports.includes( 'textTransform' );
114
- }
115
-
116
- function useHasTextDecorationControl( name, element ) {
117
- // This is an exception for link elements.
118
- // We shouldn't allow other blocks or elements to set textDecoration
119
- // because this will be inherited by their children.
120
- return ! name && element === 'link';
121
- }
122
-
123
- function useStyleWithReset( path, blockName ) {
124
- const [ style, setStyle ] = useGlobalStyle( path, blockName );
125
- const [ userStyle ] = useGlobalStyle( path, blockName, 'user' );
126
- const hasStyle = () => !! userStyle;
127
- const resetStyle = () => setStyle( undefined );
128
- return [ style, setStyle, hasStyle, resetStyle ];
129
- }
130
-
131
- function useFontSizeWithReset( path, blockName ) {
132
- const [ fontSize, setStyleCallback ] = useGlobalStyle( path, blockName );
133
- const [ userStyle ] = useGlobalStyle( path, blockName, 'user' );
134
- const hasFontSize = () => !! userStyle;
135
- const resetFontSize = () => setStyleCallback( undefined );
136
- const setFontSize = ( newValue, metadata ) => {
137
- if ( !! metadata?.slug ) {
138
- newValue = `var:preset|font-size|${ metadata?.slug }`;
139
- }
140
- setStyleCallback( newValue );
141
- };
142
-
143
- return {
144
- fontSize,
145
- setFontSize,
146
- hasFontSize,
147
- resetFontSize,
148
- };
149
- }
150
-
151
- function useFontAppearance( prefix, name ) {
152
- const [ fontStyle, setFontStyle ] = useGlobalStyle(
153
- prefix + 'typography.fontStyle',
154
- name
155
- );
156
- const [ userFontStyle ] = useGlobalStyle(
157
- prefix + 'typography.fontStyle',
158
- name,
159
- 'user'
160
- );
161
- const [ fontWeight, setFontWeight ] = useGlobalStyle(
162
- prefix + 'typography.fontWeight',
163
- name
164
- );
165
- const [ userFontWeight ] = useGlobalStyle(
166
- prefix + 'typography.fontWeight',
167
- name,
168
- 'user'
169
- );
170
- const hasFontAppearance = () => !! userFontStyle || !! userFontWeight;
171
- const resetFontAppearance = () => {
172
- setFontStyle( undefined );
173
- setFontWeight( undefined );
174
- };
175
- return {
176
- fontStyle,
177
- setFontStyle,
178
- fontWeight,
179
- setFontWeight,
180
- hasFontAppearance,
181
- resetFontAppearance,
182
- };
183
- }
13
+ const {
14
+ useGlobalStyle,
15
+ useGlobalSetting,
16
+ overrideSettingsWithSupports,
17
+ TypographyPanel: StylesTypographyPanel,
18
+ } = unlock( blockEditorPrivateApis );
184
19
 
185
20
  export default function TypographyPanel( {
186
21
  name,
@@ -188,234 +23,35 @@ export default function TypographyPanel( {
188
23
  headingLevel,
189
24
  variation = '',
190
25
  } ) {
191
- const supports = getSupportedGlobalStylesPanels( name );
192
- let prefix = '';
26
+ let prefixParts = [];
193
27
  if ( element === 'heading' ) {
194
- prefix = `elements.${ headingLevel }.`;
28
+ prefixParts = prefixParts.concat( [ 'elements', headingLevel ] );
195
29
  } else if ( element && element !== 'text' ) {
196
- prefix = `elements.${ element }.`;
30
+ prefixParts = prefixParts.concat( [ 'elements', element ] );
197
31
  }
198
32
  if ( variation ) {
199
- prefix = prefix
200
- ? `variations.${ variation }.${ prefix }`
201
- : `variations.${ variation }`;
33
+ prefixParts = [ 'variations', variation ].concat( prefixParts );
202
34
  }
203
- const [ fontSizesPerOrigin ] = useGlobalSetting(
204
- 'typography.fontSizes',
205
- name
206
- );
207
- const fontSizes =
208
- fontSizesPerOrigin?.custom ||
209
- fontSizesPerOrigin?.theme ||
210
- fontSizesPerOrigin?.default;
35
+ const prefix = prefixParts.join( '.' );
211
36
 
212
- const disableCustomFontSizes = ! useGlobalSetting(
213
- 'typography.customFontSize',
214
- name
215
- )[ 0 ];
216
- const [ fontFamiliesPerOrigin ] = useGlobalSetting(
217
- 'typography.fontFamilies',
218
- name
37
+ const [ style ] = useGlobalStyle( prefix, name, 'user', false );
38
+ const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', {
39
+ shouldDecodeEncode: false,
40
+ } );
41
+ const [ rawSettings ] = useGlobalSetting( '', name );
42
+ const usedElement = element === 'heading' ? headingLevel : element;
43
+ const supports = useSupportedStyles( name, usedElement );
44
+ const settings = useMemo(
45
+ () => overrideSettingsWithSupports( rawSettings, supports ),
46
+ [ rawSettings, supports ]
219
47
  );
220
- const fontFamilies =
221
- fontFamiliesPerOrigin?.custom ||
222
- fontFamiliesPerOrigin?.theme ||
223
- fontFamiliesPerOrigin?.default;
224
- const hasFontStyles =
225
- useGlobalSetting( 'typography.fontStyle', name )[ 0 ] &&
226
- supports.includes( 'fontStyle' );
227
- const hasFontWeights =
228
- useGlobalSetting( 'typography.fontWeight', name )[ 0 ] &&
229
- supports.includes( 'fontWeight' );
230
- const hasFontFamilyEnabled = useHasFontFamilyControl( name );
231
- const hasLineHeightEnabled = useHasLineHeightControl( name );
232
- const hasAppearanceControl = useHasAppearanceControl( name );
233
- const appearanceControlLabel = useAppearanceControlLabel( name );
234
- const hasLetterSpacingControl = useHasLetterSpacingControl( name, element );
235
- const hasTextTransformControl = useHasTextTransformControl( name, element );
236
- const hasTextDecorationControl = useHasTextDecorationControl(
237
- name,
238
- element
239
- );
240
-
241
- /* Disable font size controls when the option to style all headings is selected. */
242
- let hasFontSizeEnabled = supports.includes( 'fontSize' );
243
- if ( element === 'heading' && headingLevel === 'heading' ) {
244
- hasFontSizeEnabled = false;
245
- }
246
-
247
- const [ fontFamily, setFontFamily, hasFontFamily, resetFontFamily ] =
248
- useStyleWithReset( prefix + 'typography.fontFamily', name );
249
- const { fontSize, setFontSize, hasFontSize, resetFontSize } =
250
- useFontSizeWithReset( prefix + 'typography.fontSize', name );
251
- const {
252
- fontStyle,
253
- setFontStyle,
254
- fontWeight,
255
- setFontWeight,
256
- hasFontAppearance,
257
- resetFontAppearance,
258
- } = useFontAppearance( prefix, name );
259
- const [ lineHeight, setLineHeight, hasLineHeight, resetLineHeight ] =
260
- useStyleWithReset( prefix + 'typography.lineHeight', name );
261
- const [
262
- letterSpacing,
263
- setLetterSpacing,
264
- hasLetterSpacing,
265
- resetLetterSpacing,
266
- ] = useStyleWithReset( prefix + 'typography.letterSpacing', name );
267
- const [
268
- textTransform,
269
- setTextTransform,
270
- hasTextTransform,
271
- resetTextTransform,
272
- ] = useStyleWithReset( prefix + 'typography.textTransform', name );
273
- const [
274
- textDecoration,
275
- setTextDecoration,
276
- hasTextDecoration,
277
- resetTextDecoration,
278
- ] = useStyleWithReset( prefix + 'typography.textDecoration', name );
279
-
280
- const resetAll = () => {
281
- resetFontFamily();
282
- resetFontSize();
283
- resetFontAppearance();
284
- resetLineHeight();
285
- resetLetterSpacing();
286
- resetTextTransform();
287
- };
288
48
 
289
49
  return (
290
- <ToolsPanel label={ __( 'Typography' ) } resetAll={ resetAll }>
291
- { hasFontFamilyEnabled && (
292
- <ToolsPanelItem
293
- label={ __( 'Font family' ) }
294
- hasValue={ hasFontFamily }
295
- onDeselect={ resetFontFamily }
296
- isShownByDefault
297
- >
298
- <FontFamilyControl
299
- fontFamilies={ fontFamilies }
300
- value={ fontFamily }
301
- onChange={ setFontFamily }
302
- size="__unstable-large"
303
- __nextHasNoMarginBottom
304
- />
305
- </ToolsPanelItem>
306
- ) }
307
- { hasFontSizeEnabled && (
308
- <ToolsPanelItem
309
- label={ __( 'Font size' ) }
310
- hasValue={ hasFontSize }
311
- onDeselect={ resetFontSize }
312
- isShownByDefault
313
- >
314
- <FontSizePicker
315
- value={ fontSize }
316
- onChange={ setFontSize }
317
- fontSizes={ fontSizes }
318
- disableCustomFontSizes={ disableCustomFontSizes }
319
- withReset={ false }
320
- withSlider
321
- size="__unstable-large"
322
- __nextHasNoMarginBottom
323
- />
324
- </ToolsPanelItem>
325
- ) }
326
- { hasAppearanceControl && (
327
- <ToolsPanelItem
328
- className="single-column"
329
- label={ appearanceControlLabel }
330
- hasValue={ hasFontAppearance }
331
- onDeselect={ resetFontAppearance }
332
- isShownByDefault
333
- >
334
- <FontAppearanceControl
335
- value={ {
336
- fontStyle,
337
- fontWeight,
338
- } }
339
- onChange={ ( {
340
- fontStyle: newFontStyle,
341
- fontWeight: newFontWeight,
342
- } ) => {
343
- setFontStyle( newFontStyle );
344
- setFontWeight( newFontWeight );
345
- } }
346
- hasFontStyles={ hasFontStyles }
347
- hasFontWeights={ hasFontWeights }
348
- size="__unstable-large"
349
- __nextHasNoMarginBottom
350
- />
351
- </ToolsPanelItem>
352
- ) }
353
- { hasLineHeightEnabled && (
354
- <ToolsPanelItem
355
- className="single-column"
356
- label={ __( 'Line height' ) }
357
- hasValue={ hasLineHeight }
358
- onDeselect={ resetLineHeight }
359
- isShownByDefault
360
- >
361
- <LineHeightControl
362
- __nextHasNoMarginBottom
363
- __unstableInputWidth="auto"
364
- value={ lineHeight }
365
- onChange={ setLineHeight }
366
- size="__unstable-large"
367
- />
368
- </ToolsPanelItem>
369
- ) }
370
- { hasLetterSpacingControl && (
371
- <ToolsPanelItem
372
- className="single-column"
373
- label={ __( 'Letter spacing' ) }
374
- hasValue={ hasLetterSpacing }
375
- onDeselect={ resetLetterSpacing }
376
- isShownByDefault
377
- >
378
- <LetterSpacingControl
379
- value={ letterSpacing }
380
- onChange={ setLetterSpacing }
381
- size="__unstable-large"
382
- __unstableInputWidth="auto"
383
- />
384
- </ToolsPanelItem>
385
- ) }
386
- { hasTextTransformControl && (
387
- <ToolsPanelItem
388
- label={ __( 'Letter case' ) }
389
- hasValue={ hasTextTransform }
390
- onDeselect={ resetTextTransform }
391
- isShownByDefault
392
- >
393
- <TextTransformControl
394
- value={ textTransform }
395
- onChange={ setTextTransform }
396
- showNone
397
- isBlock
398
- size="__unstable-large"
399
- __nextHasNoMarginBottom
400
- />
401
- </ToolsPanelItem>
402
- ) }
403
- { hasTextDecorationControl && (
404
- <ToolsPanelItem
405
- className="single-column"
406
- label={ __( 'Text decoration' ) }
407
- hasValue={ hasTextDecoration }
408
- onDeselect={ resetTextDecoration }
409
- isShownByDefault
410
- >
411
- <TextDecorationControl
412
- value={ textDecoration }
413
- onChange={ setTextDecoration }
414
- size="__unstable-large"
415
- __unstableInputWidth="auto"
416
- />
417
- </ToolsPanelItem>
418
- ) }
419
- </ToolsPanel>
50
+ <StylesTypographyPanel
51
+ inheritedValue={ inheritedStyle }
52
+ value={ style }
53
+ onChange={ setStyle }
54
+ settings={ settings }
55
+ />
420
56
  );
421
57
  }
@@ -3,14 +3,12 @@
3
3
  */
4
4
  import { useSelect } from '@wordpress/data';
5
5
  import { useState, useEffect } from '@wordpress/element';
6
- import { SelectControl } from '@wordpress/components';
7
6
  import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data';
8
7
  import {
9
8
  store as blockEditorStore,
10
9
  BlockEditorProvider,
11
10
  } from '@wordpress/block-editor';
12
11
  import { speak } from '@wordpress/a11y';
13
- import { useInstanceId } from '@wordpress/compose';
14
12
  import { __ } from '@wordpress/i18n';
15
13
 
16
14
  /**
@@ -71,11 +69,6 @@ export default function NavigationInspector( { onSelect } ) {
71
69
  };
72
70
  }, [] );
73
71
 
74
- const navMenuListId = useInstanceId(
75
- NavigationMenu,
76
- 'edit-site-navigation-inspector-menu'
77
- );
78
-
79
72
  const firstNavRefInTemplate = clientIdToRef[ firstNavigationBlockId ];
80
73
  const firstNavigationMenuRef = navigationMenus?.[ 0 ]?.id;
81
74
 
@@ -99,14 +92,6 @@ export default function NavigationInspector( { onSelect } ) {
99
92
  }
100
93
  }, [ selectedNavigationBlockId ] );
101
94
 
102
- let options = [];
103
- if ( navigationMenus ) {
104
- options = navigationMenus.map( ( { id, title } ) => ( {
105
- value: id,
106
- label: title.rendered,
107
- } ) );
108
- }
109
-
110
95
  const [ innerBlocks, onInput, onChange ] = useEntityBlockEditor(
111
96
  'postType',
112
97
  'wp_navigation',
@@ -137,8 +122,6 @@ export default function NavigationInspector( { onSelect } ) {
137
122
 
138
123
  const isLoading = ! ( hasResolvedNavigationMenus && hasLoadedInnerBlocks );
139
124
 
140
- const hasMoreThanOneNavigationMenu = navigationMenus?.length > 1;
141
-
142
125
  const hasNavigationMenus = !! navigationMenus?.length;
143
126
 
144
127
  // Entity block editor will return entities that are not currently published.
@@ -178,21 +161,6 @@ export default function NavigationInspector( { onSelect } ) {
178
161
  { ! hasResolvedNavigationMenus && (
179
162
  <div className="edit-site-navigation-inspector__placeholder" />
180
163
  ) }
181
- { hasResolvedNavigationMenus && hasMoreThanOneNavigationMenu && (
182
- <SelectControl
183
- __nextHasNoMarginBottom
184
- className="edit-site-navigation-inspector__select-menu"
185
- aria-controls={
186
- // aria-controls should only apply when referenced element is in DOM
187
- hasLoadedInnerBlocks ? navMenuListId : undefined
188
- }
189
- value={ currentMenuId || defaultNavigationMenuId }
190
- options={ options }
191
- onChange={ ( newMenuId ) =>
192
- setCurrentMenuId( Number( newMenuId ) )
193
- }
194
- />
195
- ) }
196
164
  { isLoading && (
197
165
  <>
198
166
  <div className="edit-site-navigation-inspector__placeholder is-child" />
@@ -39,7 +39,7 @@ const ALLOWED_BLOCKS = {
39
39
  export default function NavigationMenu( { innerBlocks, onSelect } ) {
40
40
  const { updateBlockListSettings } = useDispatch( blockEditorStore );
41
41
 
42
- const { OffCanvasEditor } = unlock( blockEditorPrivateApis );
42
+ const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis );
43
43
 
44
44
  //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList
45
45
  //Think through a better way of doing this, possible with adding allowed blocks to block library metadata
@@ -56,5 +56,11 @@ export default function NavigationMenu( { innerBlocks, onSelect } ) {
56
56
  } );
57
57
  }, [ updateBlockListSettings, innerBlocks ] );
58
58
 
59
- return <OffCanvasEditor blocks={ innerBlocks } onSelect={ onSelect } />;
59
+ return (
60
+ <OffCanvasEditor
61
+ blocks={ innerBlocks }
62
+ onSelect={ onSelect }
63
+ LeafMoreMenu={ LeafMoreMenu }
64
+ />
65
+ );
60
66
  }
@@ -2,9 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { memo } from '@wordpress/element';
5
- import { useSelect } from '@wordpress/data';
6
5
  import { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components';
7
- import { store as coreStore } from '@wordpress/core-data';
8
6
 
9
7
  /**
10
8
  * Internal dependencies
@@ -37,16 +35,6 @@ function SidebarScreens() {
37
35
  }
38
36
 
39
37
  function Sidebar() {
40
- const { isDirty } = useSelect( ( select ) => {
41
- const { __experimentalGetDirtyEntityRecords } = select( coreStore );
42
- const dirtyEntityRecords = __experimentalGetDirtyEntityRecords();
43
- // The currently selected entity to display.
44
- // Typically template or template part in the site editor.
45
- return {
46
- isDirty: dirtyEntityRecords.length > 0,
47
- };
48
- }, [] );
49
-
50
38
  return (
51
39
  <>
52
40
  <NavigatorProvider
@@ -55,11 +43,10 @@ function Sidebar() {
55
43
  >
56
44
  <SidebarScreens />
57
45
  </NavigatorProvider>
58
- { isDirty && (
59
- <div className="edit-site-sidebar__footer">
60
- <SaveButton />
61
- </div>
62
- ) }
46
+
47
+ <div className="edit-site-sidebar__footer">
48
+ <SaveButton />
49
+ </div>
63
50
  </>
64
51
  );
65
52
  }
@@ -69,7 +69,7 @@ export function SidebarComplementaryAreaFills() {
69
69
  identifier={ sidebarName }
70
70
  title={ __( 'Settings' ) }
71
71
  icon={ isRTL() ? drawerLeft : drawerRight }
72
- closeLabel={ __( 'Close settings sidebar' ) }
72
+ closeLabel={ __( 'Close settings' ) }
73
73
  header={ <SettingsHeader sidebarName={ sidebarName } /> }
74
74
  headerClassName="edit-site-sidebar-edit-mode__panel-tabs"
75
75
  >
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { __ } from '@wordpress/i18n';
4
5
  import { useSelect } from '@wordpress/data';
5
- import { Icon } from '@wordpress/components';
6
+ import { PanelRow, Icon } from '@wordpress/components';
6
7
  import { store as editorStore } from '@wordpress/editor';
7
8
  import { store as coreStore } from '@wordpress/core-data';
8
9
  import { decodeEntities } from '@wordpress/html-entities';
@@ -13,6 +14,7 @@ import { decodeEntities } from '@wordpress/html-entities';
13
14
  import { store as editSiteStore } from '../../../store';
14
15
  import TemplateActions from './template-actions';
15
16
  import TemplateAreas from './template-areas';
17
+ import LastRevision from './last-revision';
16
18
 
17
19
  export default function TemplateCard() {
18
20
  const {
@@ -38,20 +40,28 @@ export default function TemplateCard() {
38
40
  }
39
41
 
40
42
  return (
41
- <div className="edit-site-template-card">
42
- <Icon className="edit-site-template-card__icon" icon={ icon } />
43
- <div className="edit-site-template-card__content">
44
- <div className="edit-site-template-card__header">
45
- <h2 className="edit-site-template-card__title">
46
- { decodeEntities( title ) }
47
- </h2>
48
- <TemplateActions template={ template } />
43
+ <>
44
+ <div className="edit-site-template-card">
45
+ <Icon className="edit-site-template-card__icon" icon={ icon } />
46
+ <div className="edit-site-template-card__content">
47
+ <div className="edit-site-template-card__header">
48
+ <h2 className="edit-site-template-card__title">
49
+ { decodeEntities( title ) }
50
+ </h2>
51
+ <TemplateActions template={ template } />
52
+ </div>
53
+ <div className="edit-site-template-card__description">
54
+ { decodeEntities( description ) }
55
+ </div>
56
+ <TemplateAreas />
49
57
  </div>
50
- <div className="edit-site-template-card__description">
51
- { decodeEntities( description ) }
52
- </div>
53
- <TemplateAreas />
54
58
  </div>
55
- </div>
59
+ <PanelRow
60
+ header={ __( 'Editing history' ) }
61
+ className="edit-site-template-revisions"
62
+ >
63
+ <LastRevision />
64
+ </PanelRow>
65
+ </>
56
66
  );
57
67
  }