@wordpress/edit-site 4.1.0-next.e230fbab09.0 → 4.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 (86) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/add-new-template/new-template-part.js +2 -9
  3. package/build/components/add-new-template/new-template-part.js.map +1 -1
  4. package/build/components/add-new-template/new-template.js +28 -12
  5. package/build/components/add-new-template/new-template.js.map +1 -1
  6. package/build/components/editor/index.js +9 -3
  7. package/build/components/editor/index.js.map +1 -1
  8. package/build/components/global-styles/border-panel.js +25 -24
  9. package/build/components/global-styles/border-panel.js.map +1 -1
  10. package/build/components/global-styles/dimensions-panel.js +1 -28
  11. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  12. package/build/components/header/document-actions/index.js +13 -11
  13. package/build/components/header/document-actions/index.js.map +1 -1
  14. package/build/components/header/index.js +5 -3
  15. package/build/components/header/index.js.map +1 -1
  16. package/build/components/header/more-menu/index.js +9 -1
  17. package/build/components/header/more-menu/index.js.map +1 -1
  18. package/build/components/header/more-menu/site-export.js +5 -2
  19. package/build/components/header/more-menu/site-export.js.map +1 -1
  20. package/build/components/header/plugin-more-menu-item/index.js +5 -0
  21. package/build/components/header/plugin-more-menu-item/index.js.map +1 -1
  22. package/build/components/list/actions/rename-menu-item.js +3 -10
  23. package/build/components/list/actions/rename-menu-item.js.map +1 -1
  24. package/build/components/preferences-modal/enable-feature.js +40 -0
  25. package/build/components/preferences-modal/enable-feature.js.map +1 -0
  26. package/build/components/preferences-modal/index.js +68 -0
  27. package/build/components/preferences-modal/index.js.map +1 -0
  28. package/build/index.js +1 -0
  29. package/build/index.js.map +1 -1
  30. package/build/store/actions.js +3 -3
  31. package/build/store/actions.js.map +1 -1
  32. package/build/store/selectors.js +3 -1
  33. package/build/store/selectors.js.map +1 -1
  34. package/build-module/components/add-new-template/new-template-part.js +3 -10
  35. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  36. package/build-module/components/add-new-template/new-template.js +27 -12
  37. package/build-module/components/add-new-template/new-template.js.map +1 -1
  38. package/build-module/components/editor/index.js +8 -3
  39. package/build-module/components/editor/index.js.map +1 -1
  40. package/build-module/components/global-styles/border-panel.js +27 -26
  41. package/build-module/components/global-styles/border-panel.js.map +1 -1
  42. package/build-module/components/global-styles/dimensions-panel.js +2 -29
  43. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  44. package/build-module/components/header/document-actions/index.js +13 -11
  45. package/build-module/components/header/document-actions/index.js.map +1 -1
  46. package/build-module/components/header/index.js +5 -3
  47. package/build-module/components/header/index.js.map +1 -1
  48. package/build-module/components/header/more-menu/index.js +8 -1
  49. package/build-module/components/header/more-menu/index.js.map +1 -1
  50. package/build-module/components/header/more-menu/site-export.js +5 -2
  51. package/build-module/components/header/more-menu/site-export.js.map +1 -1
  52. package/build-module/components/header/plugin-more-menu-item/index.js +4 -0
  53. package/build-module/components/header/plugin-more-menu-item/index.js.map +1 -1
  54. package/build-module/components/list/actions/rename-menu-item.js +4 -11
  55. package/build-module/components/list/actions/rename-menu-item.js.map +1 -1
  56. package/build-module/components/preferences-modal/enable-feature.js +27 -0
  57. package/build-module/components/preferences-modal/enable-feature.js.map +1 -0
  58. package/build-module/components/preferences-modal/index.js +57 -0
  59. package/build-module/components/preferences-modal/index.js.map +1 -0
  60. package/build-module/index.js +1 -0
  61. package/build-module/index.js.map +1 -1
  62. package/build-module/store/actions.js +3 -3
  63. package/build-module/store/actions.js.map +1 -1
  64. package/build-module/store/selectors.js +3 -1
  65. package/build-module/store/selectors.js.map +1 -1
  66. package/build-style/style-rtl.css +35 -1
  67. package/build-style/style.css +35 -1
  68. package/package.json +29 -29
  69. package/src/components/add-new-template/new-template-part.js +3 -12
  70. package/src/components/add-new-template/new-template.js +49 -12
  71. package/src/components/editor/index.js +13 -0
  72. package/src/components/global-styles/border-panel.js +32 -26
  73. package/src/components/global-styles/dimensions-panel.js +1 -34
  74. package/src/components/header/document-actions/index.js +14 -10
  75. package/src/components/header/index.js +6 -1
  76. package/src/components/header/more-menu/index.js +15 -0
  77. package/src/components/header/more-menu/site-export.js +13 -2
  78. package/src/components/header/plugin-more-menu-item/index.js +2 -0
  79. package/src/components/header/style.scss +45 -0
  80. package/src/components/list/actions/rename-menu-item.js +3 -13
  81. package/src/components/preferences-modal/enable-feature.js +24 -0
  82. package/src/components/preferences-modal/index.js +76 -0
  83. package/src/index.js +1 -0
  84. package/src/store/actions.js +4 -4
  85. package/src/store/selectors.js +10 -0
  86. package/src/store/test/selectors.js +4 -0
@@ -304,7 +304,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
304
304
  display: flex;
305
305
  flex-direction: column;
306
306
  overflow: auto;
307
- z-index: 91;
307
+ z-index: 20;
308
308
  }
309
309
 
310
310
  .interface-interface-skeleton__secondary-sidebar,
@@ -944,6 +944,40 @@ body.is-navigation-sidebar-open .edit-site-header .edit-site-header_end .compone
944
944
  }
945
945
  }
946
946
 
947
+ .show-icon-labels .edit-site-header .components-button.has-icon {
948
+ width: auto;
949
+ }
950
+ .show-icon-labels .edit-site-header .components-button.has-icon svg {
951
+ display: none;
952
+ }
953
+ .show-icon-labels .edit-site-header .components-button.has-icon::after {
954
+ content: attr(aria-label);
955
+ }
956
+ .show-icon-labels .edit-site-header .components-button.has-icon[aria-disabled=true] {
957
+ background-color: transparent;
958
+ }
959
+ .show-icon-labels .edit-site-header .is-tertiary:active {
960
+ box-shadow: 0 0 0 1.5px var(--wp-admin-theme-color);
961
+ background-color: transparent;
962
+ }
963
+ .show-icon-labels .edit-site-header .edit-site-save-button__button {
964
+ padding-left: 6px;
965
+ padding-right: 6px;
966
+ margin-right: 4px;
967
+ }
968
+ .show-icon-labels .edit-site-header .block-editor-post-preview__button-toggle {
969
+ margin-right: 4px;
970
+ }
971
+ .show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle,
972
+ .show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info {
973
+ height: 36px;
974
+ padding: 0 6px;
975
+ }
976
+ .show-icon-labels .edit-site-header .edit-site-header-toolbar__inserter-toggle.edit-site-header-toolbar__inserter-toggle::after,
977
+ .show-icon-labels .edit-site-header .edit-site-document-actions__get-info.edit-site-document-actions__get-info.edit-site-document-actions__get-info::after {
978
+ content: none;
979
+ }
980
+
947
981
  .edit-site-document-actions {
948
982
  display: flex;
949
983
  flex-direction: column;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "4.1.0-next.e230fbab09.0",
3
+ "version": "4.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",
@@ -27,33 +27,33 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.4.0-next.e230fbab09.0",
31
- "@wordpress/api-fetch": "^6.1.0-next.e230fbab09.0",
32
- "@wordpress/block-editor": "^8.3.0-next.e230fbab09.0",
33
- "@wordpress/block-library": "^7.1.0-next.e230fbab09.0",
34
- "@wordpress/blocks": "^11.3.0-next.e230fbab09.0",
35
- "@wordpress/components": "^19.7.0-next.e230fbab09.0",
36
- "@wordpress/compose": "^5.2.0-next.e230fbab09.0",
37
- "@wordpress/core-data": "^4.2.0-next.e230fbab09.0",
38
- "@wordpress/data": "^6.4.0-next.e230fbab09.0",
39
- "@wordpress/deprecated": "^3.4.0-next.e230fbab09.0",
40
- "@wordpress/editor": "^12.4.0-next.e230fbab09.0",
41
- "@wordpress/element": "^4.3.0-next.e230fbab09.0",
42
- "@wordpress/hooks": "^3.4.0-next.e230fbab09.0",
43
- "@wordpress/html-entities": "^3.4.0-next.e230fbab09.0",
44
- "@wordpress/i18n": "^4.4.0-next.e230fbab09.0",
45
- "@wordpress/icons": "^7.1.0-next.e230fbab09.0",
46
- "@wordpress/interface": "^4.3.0-next.e230fbab09.0",
47
- "@wordpress/keyboard-shortcuts": "^3.2.0-next.e230fbab09.0",
48
- "@wordpress/keycodes": "^3.4.0-next.e230fbab09.0",
49
- "@wordpress/media-utils": "^3.2.0-next.e230fbab09.0",
50
- "@wordpress/notices": "^3.4.0-next.e230fbab09.0",
51
- "@wordpress/plugins": "^4.2.0-next.e230fbab09.0",
52
- "@wordpress/preferences": "^1.0.0-prerelease",
53
- "@wordpress/reusable-blocks": "^3.2.0-next.e230fbab09.0",
54
- "@wordpress/style-engine": "^0.3.0-next.e230fbab09.0",
55
- "@wordpress/url": "^3.5.0-next.e230fbab09.0",
56
- "@wordpress/viewport": "^4.2.0-next.e230fbab09.0",
30
+ "@wordpress/a11y": "^3.5.0",
31
+ "@wordpress/api-fetch": "^6.2.0",
32
+ "@wordpress/block-editor": "^8.4.0",
33
+ "@wordpress/block-library": "^7.2.0",
34
+ "@wordpress/blocks": "^11.4.0",
35
+ "@wordpress/components": "^19.7.0",
36
+ "@wordpress/compose": "^5.3.0",
37
+ "@wordpress/core-data": "^4.3.0",
38
+ "@wordpress/data": "^6.5.0",
39
+ "@wordpress/deprecated": "^3.5.0",
40
+ "@wordpress/editor": "^12.4.0",
41
+ "@wordpress/element": "^4.3.0",
42
+ "@wordpress/hooks": "^3.5.0",
43
+ "@wordpress/html-entities": "^3.5.0",
44
+ "@wordpress/i18n": "^4.5.0",
45
+ "@wordpress/icons": "^8.1.0",
46
+ "@wordpress/interface": "^4.4.0",
47
+ "@wordpress/keyboard-shortcuts": "^3.3.0",
48
+ "@wordpress/keycodes": "^3.5.0",
49
+ "@wordpress/media-utils": "^3.3.0",
50
+ "@wordpress/notices": "^3.5.0",
51
+ "@wordpress/plugins": "^4.3.0",
52
+ "@wordpress/preferences": "^1.1.0",
53
+ "@wordpress/reusable-blocks": "^3.3.0",
54
+ "@wordpress/style-engine": "^0.4.0",
55
+ "@wordpress/url": "^3.6.0",
56
+ "@wordpress/viewport": "^4.3.0",
57
57
  "classnames": "^2.3.1",
58
58
  "downloadjs": "^1.4.7",
59
59
  "history": "^5.1.0",
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "308df03e6a96ded732f9c4e32471b1b4f8dea54a"
71
+ "gitHead": "aa003c3634016cc4ab6348b2106907e371c648e1"
72
72
  }
@@ -7,7 +7,7 @@ import { kebabCase } from 'lodash';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { useState } from '@wordpress/element';
10
- import { useSelect, useDispatch } from '@wordpress/data';
10
+ import { useDispatch } from '@wordpress/data';
11
11
  import { Button } from '@wordpress/components';
12
12
  import { __ } from '@wordpress/i18n';
13
13
  import { store as noticesStore } from '@wordpress/notices';
@@ -24,7 +24,6 @@ export default function NewTemplatePart( { postType } ) {
24
24
  const [ isModalOpen, setIsModalOpen ] = useState( false );
25
25
  const { createErrorNotice } = useDispatch( noticesStore );
26
26
  const { saveEntityRecord } = useDispatch( coreStore );
27
- const { getLastEntitySaveError } = useSelect( coreStore );
28
27
 
29
28
  async function createTemplatePart( { title, area } ) {
30
29
  if ( ! title ) {
@@ -49,18 +48,10 @@ export default function NewTemplatePart( { postType } ) {
49
48
  title,
50
49
  content: '',
51
50
  area,
52
- }
51
+ },
52
+ { throwOnError: true }
53
53
  );
54
54
 
55
- const lastEntitySaveError = getLastEntitySaveError(
56
- 'postType',
57
- 'wp_template_part',
58
- templatePart.id
59
- );
60
- if ( lastEntitySaveError ) {
61
- throw lastEntitySaveError;
62
- }
63
-
64
55
  setIsModalOpen( false );
65
56
 
66
57
  // Navigate to the created template part editor.
@@ -15,6 +15,21 @@ import {
15
15
  import { useSelect, useDispatch } from '@wordpress/data';
16
16
  import { store as coreStore } from '@wordpress/core-data';
17
17
  import { store as editorStore } from '@wordpress/editor';
18
+ import {
19
+ archive,
20
+ blockMeta,
21
+ category,
22
+ home,
23
+ list,
24
+ media,
25
+ notFound,
26
+ page,
27
+ post,
28
+ postAuthor,
29
+ postDate,
30
+ search,
31
+ tag,
32
+ } from '@wordpress/icons';
18
33
  import { __ } from '@wordpress/i18n';
19
34
  import { store as noticesStore } from '@wordpress/notices';
20
35
 
@@ -27,12 +42,33 @@ const DEFAULT_TEMPLATE_SLUGS = [
27
42
  'front-page',
28
43
  'single-post',
29
44
  'page',
45
+ 'index',
30
46
  'archive',
47
+ 'author',
48
+ 'category',
49
+ 'date',
50
+ 'tag',
51
+ 'taxonomy',
31
52
  'search',
32
53
  '404',
33
- 'index',
34
54
  ];
35
55
 
56
+ const TEMPLATE_ICONS = {
57
+ 'front-page': home,
58
+ 'single-post': post,
59
+ page,
60
+ archive,
61
+ search,
62
+ 404: notFound,
63
+ index: list,
64
+ category,
65
+ author: postAuthor,
66
+ taxonomy: blockMeta,
67
+ date: postDate,
68
+ tag,
69
+ attachment: media,
70
+ };
71
+
36
72
  export default function NewTemplate( { postType } ) {
37
73
  const history = useHistory();
38
74
  const { templates, defaultTemplateTypes } = useSelect(
@@ -50,7 +86,6 @@ export default function NewTemplate( { postType } ) {
50
86
  );
51
87
  const { saveEntityRecord } = useDispatch( coreStore );
52
88
  const { createErrorNotice } = useDispatch( noticesStore );
53
- const { getLastEntitySaveError } = useSelect( coreStore );
54
89
 
55
90
  async function createTemplate( { slug } ) {
56
91
  try {
@@ -67,18 +102,10 @@ export default function NewTemplate( { postType } ) {
67
102
  slug: slug.toString(),
68
103
  status: 'publish',
69
104
  title,
70
- }
105
+ },
106
+ { throwOnError: true }
71
107
  );
72
108
 
73
- const lastEntitySaveError = getLastEntitySaveError(
74
- 'postType',
75
- 'wp_template',
76
- template.id
77
- );
78
- if ( lastEntitySaveError ) {
79
- throw lastEntitySaveError;
80
- }
81
-
82
109
  // Navigate to the created template editor.
83
110
  history.push( {
84
111
  postId: template.id,
@@ -111,6 +138,14 @@ export default function NewTemplate( { postType } ) {
111
138
  return null;
112
139
  }
113
140
 
141
+ // Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.
142
+ missingTemplates.sort( ( template1, template2 ) => {
143
+ return (
144
+ DEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -
145
+ DEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )
146
+ );
147
+ } );
148
+
114
149
  return (
115
150
  <DropdownMenu
116
151
  className="edit-site-new-template-dropdown"
@@ -131,6 +166,8 @@ export default function NewTemplate( { postType } ) {
131
166
  missingTemplates,
132
167
  ( { title, description, slug } ) => (
133
168
  <MenuItem
169
+ icon={ TEMPLATE_ICONS[ slug ] }
170
+ iconPosition="left"
134
171
  info={ description }
135
172
  key={ slug }
136
173
  onClick={ () => {
@@ -21,6 +21,7 @@ import {
21
21
  ShortcutProvider,
22
22
  store as keyboardShortcutsStore,
23
23
  } from '@wordpress/keyboard-shortcuts';
24
+ import { store as preferencesStore } from '@wordpress/preferences';
24
25
 
25
26
  /**
26
27
  * Internal dependencies
@@ -61,6 +62,7 @@ function Editor( { onError } ) {
61
62
  previousShortcut,
62
63
  nextShortcut,
63
64
  editorMode,
65
+ showIconLabels,
64
66
  } = useSelect( ( select ) => {
65
67
  const {
66
68
  isInserterOpened,
@@ -105,6 +107,10 @@ function Editor( { onError } ) {
105
107
  keyboardShortcutsStore
106
108
  ).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),
107
109
  editorMode: getEditorMode(),
110
+ showIconLabels: select( preferencesStore ).get(
111
+ 'core/edit-site',
112
+ 'showIconLabels'
113
+ ),
108
114
  };
109
115
  }, [] );
110
116
  const { setPage, setIsInserterOpened } = useDispatch( editSiteStore );
@@ -203,6 +209,10 @@ function Editor( { onError } ) {
203
209
  <SidebarComplementaryAreaFills />
204
210
  <InterfaceSkeleton
205
211
  labels={ interfaceLabels }
212
+ className={
213
+ showIconLabels &&
214
+ 'show-icon-labels'
215
+ }
206
216
  secondarySidebar={ secondarySidebar() }
207
217
  sidebar={
208
218
  sidebarIsOpened && (
@@ -217,6 +227,9 @@ function Editor( { onError } ) {
217
227
  openEntitiesSavedStates={
218
228
  openEntitiesSavedStates
219
229
  }
230
+ showIconLabels={
231
+ showIconLabels
232
+ }
220
233
  />
221
234
  }
222
235
  notices={ <EditorSnackbars /> }
@@ -4,7 +4,7 @@
4
4
  import {
5
5
  __experimentalBorderRadiusControl as BorderRadiusControl,
6
6
  __experimentalBorderStyleControl as BorderStyleControl,
7
- __experimentalColorGradientControl as ColorGradientControl,
7
+ __experimentalColorGradientSettingsDropdown as ColorGradientSettingsDropdown,
8
8
  } from '@wordpress/block-editor';
9
9
  import {
10
10
  __experimentalToolsPanel as ToolsPanel,
@@ -17,14 +17,15 @@ import { __ } from '@wordpress/i18n';
17
17
  /**
18
18
  * Internal dependencies
19
19
  */
20
- import { getSupportedGlobalStylesPanels, useSetting, useStyle } from './hooks';
20
+ import {
21
+ getSupportedGlobalStylesPanels,
22
+ useColorsPerOrigin,
23
+ useSetting,
24
+ useStyle,
25
+ } from './hooks';
21
26
 
22
27
  const MIN_BORDER_WIDTH = 0;
23
28
 
24
- // Defining empty array here instead of inline avoids unnecessary re-renders of
25
- // color control.
26
- const EMPTY_ARRAY = [];
27
-
28
29
  export function useHasBorderPanel( name ) {
29
30
  const controls = [
30
31
  useHasBorderColorControl( name ),
@@ -100,13 +101,32 @@ export default function BorderPanel( { name } ) {
100
101
  const showBorderStyle = useHasBorderStyleControl( name );
101
102
  const [ borderStyle, setBorderStyle ] = useStyle( 'border.style', name );
102
103
 
104
+ // When we set a border color or width ensure we have a style so the user
105
+ // can see a visible border.
106
+ const handleOnChangeWithStyle = ( setStyle ) => ( value ) => {
107
+ if ( !! value && ! borderStyle ) {
108
+ setBorderStyle( 'solid' );
109
+ }
110
+
111
+ setStyle( value || undefined );
112
+ };
113
+
103
114
  // Border color.
104
115
  const showBorderColor = useHasBorderColorControl( name );
105
116
  const [ borderColor, setBorderColor ] = useStyle( 'border.color', name );
106
- const [ colors = EMPTY_ARRAY ] = useSetting( 'color.palette' );
107
117
  const disableCustomColors = ! useSetting( 'color.custom' )[ 0 ];
108
118
  const disableCustomGradients = ! useSetting( 'color.customGradient' )[ 0 ];
109
119
 
120
+ const borderColorSettings = [
121
+ {
122
+ label: __( 'Color' ),
123
+ colors: useColorsPerOrigin( name ),
124
+ colorValue: borderColor,
125
+ onColorChange: handleOnChangeWithStyle( setBorderColor ),
126
+ clearable: false,
127
+ },
128
+ ];
129
+
110
130
  // Border radius.
111
131
  const showBorderRadius = useHasBorderRadiusControl( name );
112
132
  const [ borderRadiusValues, setBorderRadius ] = useStyle(
@@ -128,16 +148,6 @@ export default function BorderPanel( { name } ) {
128
148
  setBorderWidth( undefined );
129
149
  };
130
150
 
131
- // When we set a border color or width ensure we have a style so the user
132
- // can see a visible border.
133
- const handleOnChangeWithStyle = ( setStyle ) => ( value ) => {
134
- if ( !! value && ! borderStyle ) {
135
- setBorderStyle( 'solid' );
136
- }
137
-
138
- setStyle( value || undefined );
139
- };
140
-
141
151
  return (
142
152
  <ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>
143
153
  { showBorderWidth && (
@@ -178,17 +188,13 @@ export default function BorderPanel( { name } ) {
178
188
  onDeselect={ createResetCallback( setBorderColor ) }
179
189
  isShownByDefault={ true }
180
190
  >
181
- <ColorGradientControl
182
- label={ __( 'Color' ) }
183
- colorValue={ borderColor }
184
- colors={ colors }
185
- gradients={ undefined }
191
+ <ColorGradientSettingsDropdown
192
+ __experimentalHasMultipleOrigins
193
+ __experimentalIsRenderedInSidebar
186
194
  disableCustomColors={ disableCustomColors }
187
195
  disableCustomGradients={ disableCustomGradients }
188
- onColorChange={ handleOnChangeWithStyle(
189
- setBorderColor
190
- ) }
191
- clearable={ false }
196
+ enableAlpha
197
+ settings={ borderColorSettings }
192
198
  />
193
199
  </ToolsPanelItem>
194
200
  ) }
@@ -6,7 +6,6 @@ import {
6
6
  __experimentalToolsPanel as ToolsPanel,
7
7
  __experimentalToolsPanelItem as ToolsPanelItem,
8
8
  __experimentalBoxControl as BoxControl,
9
- __experimentalUnitControl as UnitControl,
10
9
  __experimentalUseCustomUnits as useCustomUnits,
11
10
  } from '@wordpress/components';
12
11
  import { __experimentalUseCustomSides as useCustomSides } from '@wordpress/block-editor';
@@ -21,9 +20,8 @@ const AXIAL_SIDES = [ 'horizontal', 'vertical' ];
21
20
  export function useHasDimensionsPanel( name ) {
22
21
  const hasPadding = useHasPadding( name );
23
22
  const hasMargin = useHasMargin( name );
24
- const hasGap = useHasGap( name );
25
23
 
26
- return hasPadding || hasMargin || hasGap;
24
+ return hasPadding || hasMargin;
27
25
  }
28
26
 
29
27
  function useHasPadding( name ) {
@@ -40,13 +38,6 @@ function useHasMargin( name ) {
40
38
  return settings && supports.includes( 'margin' );
41
39
  }
42
40
 
43
- function useHasGap( name ) {
44
- const supports = getSupportedGlobalStylesPanels( name );
45
- const [ settings ] = useSetting( 'spacing.blockGap', name );
46
-
47
- return settings && supports.includes( '--wp--style--block-gap' );
48
- }
49
-
50
41
  function filterValuesBySides( values, sides ) {
51
42
  if ( ! sides ) {
52
43
  // If no custom side configuration all sides are opted into by default.
@@ -88,7 +79,6 @@ function splitStyleValue( value ) {
88
79
  export default function DimensionsPanel( { name } ) {
89
80
  const showPaddingControl = useHasPadding( name );
90
81
  const showMarginControl = useHasMargin( name );
91
- const showGapControl = useHasGap( name );
92
82
  const units = useCustomUnits( {
93
83
  availableUnits: useSetting( 'spacing.units', name )[ 0 ] || [
94
84
  '%',
@@ -128,15 +118,9 @@ export default function DimensionsPanel( { name } ) {
128
118
  const resetMarginValue = () => setMarginValues( {} );
129
119
  const hasMarginValue = () =>
130
120
  !! marginValues && Object.keys( marginValues ).length;
131
-
132
- const [ gapValue, setGapValue ] = useStyle( 'spacing.blockGap', name );
133
- const resetGapValue = () => setGapValue( undefined );
134
- const hasGapValue = () => !! gapValue;
135
-
136
121
  const resetAll = () => {
137
122
  resetPaddingValue();
138
123
  resetMarginValue();
139
- resetGapValue();
140
124
  };
141
125
 
142
126
  return (
@@ -177,23 +161,6 @@ export default function DimensionsPanel( { name } ) {
177
161
  />
178
162
  </ToolsPanelItem>
179
163
  ) }
180
- { showGapControl && (
181
- <ToolsPanelItem
182
- hasValue={ hasGapValue }
183
- label={ __( 'Block spacing' ) }
184
- onDeselect={ resetGapValue }
185
- isShownByDefault={ true }
186
- >
187
- <UnitControl
188
- label={ __( 'Block spacing' ) }
189
- __unstableInputWidth="80px"
190
- min={ 0 }
191
- onChange={ setGapValue }
192
- units={ units }
193
- value={ gapValue }
194
- />
195
- </ToolsPanelItem>
196
- ) }
197
164
  </ToolsPanel>
198
165
  );
199
166
  }
@@ -53,21 +53,23 @@ function useSecondaryText() {
53
53
  }
54
54
 
55
55
  /**
56
- * @param {Object} props Props for the DocumentActions component.
57
- * @param {string} props.entityTitle The title to display.
58
- * @param {string} props.entityLabel A label to use for entity-related options.
59
- * E.g. "template" would be used for "edit
60
- * template" and "show template details".
61
- * @param {boolean} props.isLoaded Whether the data is available.
62
- * @param {Function} props.children React component to use for the
63
- * information dropdown area. Should be a
64
- * function which accepts dropdown props.
56
+ * @param {Object} props Props for the DocumentActions component.
57
+ * @param {string} props.entityTitle The title to display.
58
+ * @param {string} props.entityLabel A label to use for entity-related options.
59
+ * E.g. "template" would be used for "edit
60
+ * template" and "show template details".
61
+ * @param {boolean} props.isLoaded Whether the data is available.
62
+ * @param {Function} props.children React component to use for the
63
+ * information dropdown area. Should be a
64
+ * function which accepts dropdown props.
65
+ * @param {boolean} props.showIconLabels Whether buttons display icons or text labels.
65
66
  */
66
67
  export default function DocumentActions( {
67
68
  entityTitle,
68
69
  entityLabel,
69
70
  isLoaded,
70
71
  children: dropdownContent,
72
+ showIconLabels,
71
73
  } ) {
72
74
  const { label } = useSecondaryText();
73
75
 
@@ -144,7 +146,9 @@ export default function DocumentActions( {
144
146
  __( 'Show %s details' ),
145
147
  entityLabel
146
148
  ) }
147
- />
149
+ >
150
+ { showIconLabels && __( 'Details' ) }
151
+ </Button>
148
152
  ) }
149
153
  contentClassName="edit-site-document-actions__info-dropdown"
150
154
  renderContent={ dropdownContent }
@@ -34,6 +34,7 @@ const preventDefault = ( event ) => {
34
34
  export default function Header( {
35
35
  openEntitiesSavedStates,
36
36
  isEntitiesSavedStatesOpen,
37
+ showIconLabels,
37
38
  } ) {
38
39
  const inserterButton = useRef();
39
40
  const {
@@ -122,7 +123,10 @@ export default function Header( {
122
123
  'Toggle block inserter',
123
124
  'Generic label for block inserter button'
124
125
  ) }
125
- />
126
+ >
127
+ { showIconLabels &&
128
+ ( ! isInserterOpen ? __( 'Add' ) : __( 'Close' ) ) }
129
+ </Button>
126
130
  { isLargeViewport && (
127
131
  <>
128
132
  <ToolbarItem
@@ -155,6 +159,7 @@ export default function Header( {
155
159
  : 'template'
156
160
  }
157
161
  isLoaded={ isLoaded }
162
+ showIconLabels={ showIconLabels }
158
163
  >
159
164
  { ( { onClose } ) => (
160
165
  <TemplateDetails
@@ -14,6 +14,7 @@ import { PreferenceToggleMenuItem } from '@wordpress/preferences';
14
14
  * Internal dependencies
15
15
  */
16
16
  import KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';
17
+ import EditSitePreferencesModal from '../../preferences-modal';
17
18
  import ToolsMoreMenuGroup from '../tools-more-menu-group';
18
19
  import SiteExport from './site-export';
19
20
  import WelcomeGuideMenuItem from './welcome-guide-menu-item';
@@ -26,6 +27,11 @@ export default function MoreMenu() {
26
27
  false
27
28
  );
28
29
 
30
+ const [ isPreferencesModalActive, togglePreferencesModal ] = useReducer(
31
+ ( isActive ) => ! isActive,
32
+ false
33
+ );
34
+
29
35
  useShortcut( 'core/edit-site/keyboard-shortcuts', toggleModal );
30
36
 
31
37
  return (
@@ -99,6 +105,11 @@ export default function MoreMenu() {
99
105
  fillProps={ { onClose } }
100
106
  />
101
107
  </MenuGroup>
108
+ <MenuGroup>
109
+ <MenuItem onClick={ togglePreferencesModal }>
110
+ { __( 'Preferences' ) }
111
+ </MenuItem>
112
+ </MenuGroup>
102
113
  </>
103
114
  ) }
104
115
  </MoreMenuDropdown>
@@ -106,6 +117,10 @@ export default function MoreMenu() {
106
117
  isModalActive={ isModalActive }
107
118
  toggleModal={ toggleModal }
108
119
  />
120
+ <EditSitePreferencesModal
121
+ isModalActive={ isPreferencesModalActive }
122
+ toggleModal={ togglePreferencesModal }
123
+ />
109
124
  </>
110
125
  );
111
126
  }
@@ -23,8 +23,17 @@ export default function SiteExport() {
23
23
  parse: false,
24
24
  } );
25
25
  const blob = await response.blob();
26
+ const contentDisposition = response.headers.get(
27
+ 'content-disposition'
28
+ );
29
+ const contentDispositionMatches = contentDisposition.match(
30
+ /=(.+)\.zip/
31
+ );
32
+ const fileName = contentDispositionMatches[ 1 ]
33
+ ? contentDispositionMatches[ 1 ]
34
+ : 'edit-site-export';
26
35
 
27
- downloadjs( blob, 'edit-site-export.zip', 'application/zip' );
36
+ downloadjs( blob, fileName + '.zip', 'application/zip' );
28
37
  } catch ( errorResponse ) {
29
38
  let error = {};
30
39
  try {
@@ -44,7 +53,9 @@ export default function SiteExport() {
44
53
  role="menuitem"
45
54
  icon={ download }
46
55
  onClick={ handleExport }
47
- info={ __( 'Download your templates and styles as a theme.' ) }
56
+ info={ __(
57
+ 'Download your theme with updated templates and styles.'
58
+ ) }
48
59
  >
49
60
  { _x( 'Export', 'site exporter menu item' ) }
50
61
  </MenuItem>
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { ActionItem } from '@wordpress/interface';
5
5
  import { compose } from '@wordpress/compose';
6
+ import { MenuItem } from '@wordpress/components';
6
7
  import { withPluginContext } from '@wordpress/plugins';
7
8
 
8
9
  /**
@@ -64,6 +65,7 @@ import { withPluginContext } from '@wordpress/plugins';
64
65
  export default compose(
65
66
  withPluginContext( ( context, ownProps ) => {
66
67
  return {
68
+ as: ownProps.as ?? MenuItem,
67
69
  icon: ownProps.icon || context.icon,
68
70
  name: 'core/edit-site/plugin-more-menu',
69
71
  };