@wordpress/edit-site 3.0.26 → 3.0.29

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 (130) hide show
  1. package/build/components/add-new-template/new-template-part.js +4 -1
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/editor/global-styles-renderer.js +7 -3
  4. package/build/components/editor/global-styles-renderer.js.map +1 -1
  5. package/build/components/error-boundary/index.js +11 -27
  6. package/build/components/error-boundary/index.js.map +1 -1
  7. package/build/components/error-boundary/warning.js +70 -0
  8. package/build/components/error-boundary/warning.js.map +1 -0
  9. package/build/components/global-styles/screen-background-color.js +8 -9
  10. package/build/components/global-styles/screen-background-color.js.map +1 -1
  11. package/build/components/global-styles/screen-link-color.js +6 -10
  12. package/build/components/global-styles/screen-link-color.js.map +1 -1
  13. package/build/components/global-styles/screen-text-color.js +6 -10
  14. package/build/components/global-styles/screen-text-color.js.map +1 -1
  15. package/build/components/header/more-menu/index.js +68 -39
  16. package/build/components/header/more-menu/index.js.map +1 -1
  17. package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
  18. package/build/components/header/more-menu/site-export.js.map +1 -0
  19. package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  20. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  21. package/build/components/header/tools-more-menu-group/index.js +1 -5
  22. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  23. package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
  24. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  25. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
  26. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  27. package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
  28. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  29. package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
  30. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  31. package/build/components/keyboard-shortcuts/index.js +9 -0
  32. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  33. package/build/components/list/added-by.js +51 -50
  34. package/build/components/list/added-by.js.map +1 -1
  35. package/build/components/list/table.js +3 -1
  36. package/build/components/list/table.js.map +1 -1
  37. package/build/components/routes/redirect-to-homepage.js +106 -0
  38. package/build/components/routes/redirect-to-homepage.js.map +1 -0
  39. package/build/components/template-part-converter/convert-to-template-part.js +4 -1
  40. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  41. package/build/components/url-query-controller/index.js +1 -38
  42. package/build/components/url-query-controller/index.js.map +1 -1
  43. package/build/index.js +23 -4
  44. package/build/index.js.map +1 -1
  45. package/build/store/actions.js +7 -25
  46. package/build/store/actions.js.map +1 -1
  47. package/build-module/components/add-new-template/new-template-part.js +4 -1
  48. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  49. package/build-module/components/editor/global-styles-renderer.js +6 -3
  50. package/build-module/components/editor/global-styles-renderer.js.map +1 -1
  51. package/build-module/components/error-boundary/index.js +9 -26
  52. package/build-module/components/error-boundary/index.js.map +1 -1
  53. package/build-module/components/error-boundary/warning.js +60 -0
  54. package/build-module/components/error-boundary/warning.js.map +1 -0
  55. package/build-module/components/global-styles/screen-background-color.js +8 -10
  56. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  57. package/build-module/components/global-styles/screen-link-color.js +7 -11
  58. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  59. package/build-module/components/global-styles/screen-text-color.js +7 -11
  60. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  61. package/build-module/components/header/more-menu/index.js +65 -40
  62. package/build-module/components/header/more-menu/index.js.map +1 -1
  63. package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
  64. package/build-module/components/header/more-menu/site-export.js.map +1 -0
  65. package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  66. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  67. package/build-module/components/header/tools-more-menu-group/index.js +2 -5
  68. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  69. package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
  70. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  71. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
  72. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  73. package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
  74. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  75. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
  76. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  77. package/build-module/components/keyboard-shortcuts/index.js +9 -0
  78. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  79. package/build-module/components/list/added-by.js +52 -51
  80. package/build-module/components/list/added-by.js.map +1 -1
  81. package/build-module/components/list/table.js +2 -1
  82. package/build-module/components/list/table.js.map +1 -1
  83. package/build-module/components/routes/redirect-to-homepage.js +94 -0
  84. package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
  85. package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
  86. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  87. package/build-module/components/url-query-controller/index.js +3 -40
  88. package/build-module/components/url-query-controller/index.js.map +1 -1
  89. package/build-module/index.js +20 -3
  90. package/build-module/index.js.map +1 -1
  91. package/build-module/store/actions.js +7 -23
  92. package/build-module/store/actions.js.map +1 -1
  93. package/build-style/style-rtl.css +51 -0
  94. package/build-style/style.css +51 -0
  95. package/package.json +13 -13
  96. package/src/components/add-new-template/new-template-part.js +7 -1
  97. package/src/components/editor/global-styles-renderer.js +7 -1
  98. package/src/components/error-boundary/index.js +11 -28
  99. package/src/components/error-boundary/warning.js +59 -0
  100. package/src/components/global-styles/screen-background-color.js +6 -9
  101. package/src/components/global-styles/screen-link-color.js +6 -14
  102. package/src/components/global-styles/screen-text-color.js +6 -14
  103. package/src/components/header/more-menu/index.js +103 -44
  104. package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
  105. package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  106. package/src/components/header/tools-more-menu-group/index.js +2 -7
  107. package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
  108. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  109. package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
  110. package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
  111. package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
  112. package/src/components/keyboard-shortcuts/index.js +10 -0
  113. package/src/components/list/added-by.js +57 -63
  114. package/src/components/list/table.js +5 -2
  115. package/src/components/routes/redirect-to-homepage.js +94 -0
  116. package/src/components/template-part-converter/convert-to-template-part.js +6 -1
  117. package/src/components/url-query-controller/index.js +3 -35
  118. package/src/index.js +25 -2
  119. package/src/store/actions.js +7 -35
  120. package/src/store/test/actions.js +0 -90
  121. package/src/style.scss +1 -0
  122. package/build/plugins/index.js +0 -28
  123. package/build/plugins/index.js.map +0 -1
  124. package/build/plugins/site-export.js.map +0 -1
  125. package/build/plugins/welcome-guide-menu-item.js.map +0 -1
  126. package/build-module/plugins/index.js +0 -20
  127. package/build-module/plugins/index.js.map +0 -1
  128. package/build-module/plugins/site-export.js.map +0 -1
  129. package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
  130. package/src/plugins/index.js +0 -24
@@ -1772,6 +1772,57 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
1772
1772
  vertical-align: text-top;
1773
1773
  }
1774
1774
 
1775
+ .edit-site-keyboard-shortcut-help-modal__section {
1776
+ margin: 0 0 2rem 0;
1777
+ }
1778
+ .edit-site-keyboard-shortcut-help-modal__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list {
1779
+ margin-top: -25px;
1780
+ }
1781
+ .edit-site-keyboard-shortcut-help-modal__section-title {
1782
+ font-size: 0.9rem;
1783
+ font-weight: 600;
1784
+ }
1785
+ .edit-site-keyboard-shortcut-help-modal__shortcut {
1786
+ display: flex;
1787
+ align-items: baseline;
1788
+ padding: 0.6rem 0;
1789
+ border-top: 1px solid #ddd;
1790
+ margin-bottom: 0;
1791
+ }
1792
+ .edit-site-keyboard-shortcut-help-modal__shortcut:last-child {
1793
+ border-bottom: 1px solid #ddd;
1794
+ }
1795
+ .edit-site-keyboard-shortcut-help-modal__shortcut:empty {
1796
+ display: none;
1797
+ }
1798
+ .edit-site-keyboard-shortcut-help-modal__shortcut-term {
1799
+ font-weight: 600;
1800
+ margin: 0 0 0 1rem;
1801
+ text-align: right;
1802
+ }
1803
+ .edit-site-keyboard-shortcut-help-modal__shortcut-description {
1804
+ flex: 1;
1805
+ margin: 0;
1806
+ flex-basis: auto;
1807
+ }
1808
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination {
1809
+ display: block;
1810
+ background: none;
1811
+ margin: 0;
1812
+ padding: 0;
1813
+ }
1814
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination + .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination {
1815
+ margin-top: 10px;
1816
+ }
1817
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key {
1818
+ padding: 0.25rem 0.5rem;
1819
+ border-radius: 8%;
1820
+ margin: 0 0.2rem 0 0.2rem;
1821
+ }
1822
+ .edit-site-keyboard-shortcut-help-modal__shortcut-key:last-child {
1823
+ margin: 0 0 0 0.2rem;
1824
+ }
1825
+
1775
1826
  html.wp-toolbar {
1776
1827
  background: #fff;
1777
1828
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "3.0.26",
3
+ "version": "3.0.29",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -28,30 +28,30 @@
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.2.4",
31
- "@wordpress/api-fetch": "^5.2.6",
32
- "@wordpress/block-editor": "^8.0.16",
33
- "@wordpress/block-library": "^6.0.25",
31
+ "@wordpress/api-fetch": "^5.2.7",
32
+ "@wordpress/block-editor": "^8.0.18",
33
+ "@wordpress/block-library": "^6.0.28",
34
34
  "@wordpress/blocks": "^11.1.5",
35
- "@wordpress/components": "^19.2.2",
35
+ "@wordpress/components": "^19.2.3",
36
36
  "@wordpress/compose": "^5.0.7",
37
- "@wordpress/core-data": "^4.0.9",
37
+ "@wordpress/core-data": "^4.0.11",
38
38
  "@wordpress/data": "^6.1.5",
39
- "@wordpress/data-controls": "^2.2.8",
40
- "@wordpress/editor": "^12.0.20",
39
+ "@wordpress/data-controls": "^2.2.9",
40
+ "@wordpress/editor": "^12.0.22",
41
41
  "@wordpress/element": "^4.0.4",
42
42
  "@wordpress/hooks": "^3.2.2",
43
43
  "@wordpress/html-entities": "^3.2.3",
44
44
  "@wordpress/i18n": "^4.2.4",
45
45
  "@wordpress/icons": "^6.1.1",
46
- "@wordpress/interface": "^4.1.17",
46
+ "@wordpress/interface": "^4.1.18",
47
47
  "@wordpress/keyboard-shortcuts": "^3.0.7",
48
48
  "@wordpress/keycodes": "^3.2.4",
49
- "@wordpress/media-utils": "^3.0.5",
49
+ "@wordpress/media-utils": "^3.0.6",
50
50
  "@wordpress/notices": "^3.2.8",
51
51
  "@wordpress/plugins": "^4.0.7",
52
52
  "@wordpress/primitives": "^3.0.4",
53
- "@wordpress/reusable-blocks": "^3.0.22",
54
- "@wordpress/url": "^3.3.1",
53
+ "@wordpress/reusable-blocks": "^3.0.24",
54
+ "@wordpress/url": "^3.3.2",
55
55
  "@wordpress/viewport": "^4.0.7",
56
56
  "classnames": "^2.3.1",
57
57
  "downloadjs": "^1.4.7",
@@ -64,5 +64,5 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  },
67
- "gitHead": "cac1a1f3c854fc282d67b91a74936c3fe42d7d0a"
67
+ "gitHead": "342ca4cdad4dd5a974db45232a48fe53f7eb28e0"
68
68
  }
@@ -35,11 +35,17 @@ export default function NewTemplatePart( { postType } ) {
35
35
  }
36
36
 
37
37
  try {
38
+ // Currently template parts only allow latin chars.
39
+ // Fallback slug will receive suffix by default.
40
+ const cleanSlug =
41
+ kebabCase( title ).replace( /[^\w-]+/g, '' ) ||
42
+ 'wp-custom-part';
43
+
38
44
  const templatePart = await saveEntityRecord(
39
45
  'postType',
40
46
  'wp_template_part',
41
47
  {
42
- slug: kebabCase( title ),
48
+ slug: cleanSlug,
43
49
  title,
44
50
  content: '',
45
51
  area,
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { filter } from 'lodash';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -25,7 +30,8 @@ function useGlobalStylesRenderer() {
25
30
  }
26
31
 
27
32
  const currentStoreSettings = getSettings();
28
- const nonGlobalStyles = currentStoreSettings?.styles?.filter(
33
+ const nonGlobalStyles = filter(
34
+ currentStoreSettings.styles,
29
35
  ( style ) => ! style.isGlobalStyles
30
36
  );
31
37
  updateSettings( {
@@ -3,18 +3,11 @@
3
3
  */
4
4
  import { Component } from '@wordpress/element';
5
5
  import { __ } from '@wordpress/i18n';
6
- import { Button } from '@wordpress/components';
7
- import { Warning } from '@wordpress/block-editor';
8
- import { useCopyToClipboard } from '@wordpress/compose';
9
6
 
10
- function CopyButton( { text, children } ) {
11
- const ref = useCopyToClipboard( text );
12
- return (
13
- <Button variant="secondary" ref={ ref }>
14
- { children }
15
- </Button>
16
- );
17
- }
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import ErrorBoundaryWarning from './warning';
18
11
 
19
12
  export default class ErrorBoundary extends Component {
20
13
  constructor() {
@@ -42,23 +35,13 @@ export default class ErrorBoundary extends Component {
42
35
  }
43
36
 
44
37
  return (
45
- <Warning
46
- className="editor-error-boundary"
47
- actions={ [
48
- <Button
49
- key="recovery"
50
- onClick={ this.reboot }
51
- variant="secondary"
52
- >
53
- { __( 'Attempt Recovery' ) }
54
- </Button>,
55
- <CopyButton key="copy-error" text={ error.stack }>
56
- { __( 'Copy Error' ) }
57
- </CopyButton>,
58
- ] }
59
- >
60
- { __( 'The editor has encountered an unexpected error.' ) }
61
- </Warning>
38
+ <ErrorBoundaryWarning
39
+ message={ __(
40
+ 'The editor has encountered an unexpected error.'
41
+ ) }
42
+ error={ error }
43
+ reboot={ this.reboot }
44
+ />
62
45
  );
63
46
  }
64
47
  }
@@ -0,0 +1,59 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+ import { Button } from '@wordpress/components';
6
+ import { Warning } from '@wordpress/block-editor';
7
+ import { useCopyToClipboard } from '@wordpress/compose';
8
+
9
+ function CopyButton( { text, children } ) {
10
+ const ref = useCopyToClipboard( text );
11
+ return (
12
+ <Button variant="secondary" ref={ ref }>
13
+ { children }
14
+ </Button>
15
+ );
16
+ }
17
+
18
+ export default function ErrorBoundaryWarning( {
19
+ message,
20
+ error,
21
+ reboot,
22
+ dashboardLink,
23
+ } ) {
24
+ const actions = [];
25
+
26
+ if ( reboot ) {
27
+ actions.push(
28
+ <Button key="recovery" onClick={ reboot } variant="secondary">
29
+ { __( 'Attempt Recovery' ) }
30
+ </Button>
31
+ );
32
+ }
33
+
34
+ if ( error ) {
35
+ actions.push(
36
+ <CopyButton key="copy-error" text={ error.stack }>
37
+ { __( 'Copy Error' ) }
38
+ </CopyButton>
39
+ );
40
+ }
41
+
42
+ if ( dashboardLink ) {
43
+ actions.push(
44
+ <Button
45
+ key="back-to-dashboard"
46
+ variant="secondary"
47
+ href={ dashboardLink }
48
+ >
49
+ { __( 'Back to dashboard' ) }
50
+ </Button>
51
+ );
52
+ }
53
+
54
+ return (
55
+ <Warning className="editor-error-boundary" actions={ actions }>
56
+ { message }
57
+ </Warning>
58
+ );
59
+ }
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
5
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -55,7 +55,6 @@ function ScreenBackgroundColor( { name } ) {
55
55
  return null;
56
56
  }
57
57
 
58
- const settings = [];
59
58
  let backgroundSettings = {};
60
59
  if ( hasBackgroundColor ) {
61
60
  backgroundSettings = {
@@ -79,11 +78,10 @@ function ScreenBackgroundColor( { name } ) {
79
78
  }
80
79
  }
81
80
 
82
- settings.push( {
81
+ const controlProps = {
83
82
  ...backgroundSettings,
84
83
  ...gradientSettings,
85
- label: __( 'Background color' ),
86
- } );
84
+ };
87
85
 
88
86
  return (
89
87
  <>
@@ -94,10 +92,8 @@ function ScreenBackgroundColor( { name } ) {
94
92
  'Set a background color or gradient for the whole website.'
95
93
  ) }
96
94
  />
97
-
98
- <PanelColorGradientSettings
99
- title={ __( 'Color' ) }
100
- settings={ settings }
95
+ <ColorGradientControl
96
+ className="edit-site-screen-background-color__control"
101
97
  colors={ colorsPerOrigin }
102
98
  gradients={ gradientsPerOrigin }
103
99
  disableCustomColors={ ! areCustomSolidsEnabled }
@@ -106,6 +102,7 @@ function ScreenBackgroundColor( { name } ) {
106
102
  showTitle={ false }
107
103
  enableAlpha
108
104
  __experimentalIsRenderedInSidebar
105
+ { ...controlProps }
109
106
  />
110
107
  </>
111
108
  );
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
5
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -44,15 +44,6 @@ function ScreenLinkColor( { name } ) {
44
44
  return null;
45
45
  }
46
46
 
47
- const settings = [
48
- {
49
- colorValue: linkColor,
50
- onColorChange: setLinkColor,
51
- label: __( 'Link color' ),
52
- clearable: linkColor === userLinkColor,
53
- },
54
- ];
55
-
56
47
  return (
57
48
  <>
58
49
  <ScreenHeader
@@ -62,16 +53,17 @@ function ScreenLinkColor( { name } ) {
62
53
  'Set the default color used for links across the site.'
63
54
  ) }
64
55
  />
65
-
66
- <PanelColorGradientSettings
67
- title={ __( 'Color' ) }
68
- settings={ settings }
56
+ <ColorGradientControl
57
+ className="edit-site-screen-link-color__control"
69
58
  colors={ colorsPerOrigin }
70
59
  disableCustomColors={ ! areCustomSolidsEnabled }
71
60
  __experimentalHasMultipleOrigins
72
61
  showTitle={ false }
73
62
  enableAlpha
74
63
  __experimentalIsRenderedInSidebar
64
+ colorValue={ linkColor }
65
+ onColorChange={ setLinkColor }
66
+ clearable={ linkColor === userLinkColor }
75
67
  />
76
68
  </>
77
69
  );
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
5
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -36,15 +36,6 @@ function ScreenTextColor( { name } ) {
36
36
  return null;
37
37
  }
38
38
 
39
- const settings = [
40
- {
41
- colorValue: color,
42
- onColorChange: setColor,
43
- label: __( 'Text color' ),
44
- clearable: color === userColor,
45
- },
46
- ];
47
-
48
39
  return (
49
40
  <>
50
41
  <ScreenHeader
@@ -54,16 +45,17 @@ function ScreenTextColor( { name } ) {
54
45
  'Set the default color used for text across the site.'
55
46
  ) }
56
47
  />
57
-
58
- <PanelColorGradientSettings
59
- title={ __( 'Color' ) }
60
- settings={ settings }
48
+ <ColorGradientControl
49
+ className="edit-site-screen-text-color__control"
61
50
  colors={ colorsPerOrigin }
62
51
  disableCustomColors={ ! areCustomSolidsEnabled }
63
52
  __experimentalHasMultipleOrigins
64
53
  showTitle={ false }
65
54
  enableAlpha
66
55
  __experimentalIsRenderedInSidebar
56
+ colorValue={ color }
57
+ onColorChange={ setColor }
58
+ clearable={ color === userColor }
67
59
  />
68
60
  </>
69
61
  );
@@ -2,15 +2,26 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __, _x } from '@wordpress/i18n';
5
- import { moreVertical } from '@wordpress/icons';
6
- import { DropdownMenu, MenuGroup } from '@wordpress/components';
5
+ import { useReducer } from '@wordpress/element';
6
+ import { useShortcut } from '@wordpress/keyboard-shortcuts';
7
+ import { displayShortcut } from '@wordpress/keycodes';
8
+ import { external, moreVertical } from '@wordpress/icons';
9
+ import {
10
+ DropdownMenu,
11
+ MenuGroup,
12
+ MenuItem,
13
+ VisuallyHidden,
14
+ } from '@wordpress/components';
7
15
  import { ActionItem } from '@wordpress/interface';
8
16
 
9
17
  /**
10
18
  * Internal dependencies
11
19
  */
20
+ import KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';
12
21
  import FeatureToggle from '../feature-toggle';
13
22
  import ToolsMoreMenuGroup from '../tools-more-menu-group';
23
+ import SiteExport from './site-export';
24
+ import WelcomeGuideMenuItem from './welcome-guide-menu-item';
14
25
 
15
26
  const POPOVER_PROPS = {
16
27
  className: 'edit-site-more-menu__content',
@@ -20,46 +31,94 @@ const TOGGLE_PROPS = {
20
31
  tooltipPosition: 'bottom',
21
32
  };
22
33
 
23
- const MoreMenu = () => (
24
- <DropdownMenu
25
- className="edit-site-more-menu"
26
- icon={ moreVertical }
27
- label={ __( 'More tools & options' ) }
28
- popoverProps={ POPOVER_PROPS }
29
- toggleProps={ TOGGLE_PROPS }
30
- >
31
- { ( { onClose } ) => (
32
- <>
33
- <MenuGroup label={ _x( 'View', 'noun' ) }>
34
- <FeatureToggle
35
- feature="fixedToolbar"
36
- label={ __( 'Top toolbar' ) }
37
- info={ __(
38
- 'Access all block and document tools in a single place'
39
- ) }
40
- messageActivated={ __( 'Top toolbar activated' ) }
41
- messageDeactivated={ __( 'Top toolbar deactivated' ) }
42
- />
43
- <FeatureToggle
44
- feature="focusMode"
45
- label={ __( 'Spotlight mode' ) }
46
- info={ __( 'Focus on one block at a time' ) }
47
- messageActivated={ __( 'Spotlight mode activated' ) }
48
- messageDeactivated={ __(
49
- 'Spotlight mode deactivated'
50
- ) }
51
- />
52
- <ActionItem.Slot
53
- name="core/edit-site/plugin-more-menu"
54
- label={ __( 'Plugins' ) }
55
- as={ MenuGroup }
56
- fillProps={ { onClick: onClose } }
57
- />
58
- </MenuGroup>
59
- <ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />
60
- </>
61
- ) }
62
- </DropdownMenu>
63
- );
34
+ export default function MoreMenu() {
35
+ const [ isModalActive, toggleModal ] = useReducer(
36
+ ( isActive ) => ! isActive,
37
+ false
38
+ );
64
39
 
65
- export default MoreMenu;
40
+ useShortcut( 'core/edit-site/keyboard-shortcuts', toggleModal );
41
+
42
+ return (
43
+ <>
44
+ <DropdownMenu
45
+ className="edit-site-more-menu"
46
+ icon={ moreVertical }
47
+ label={ __( 'More tools & options' ) }
48
+ popoverProps={ POPOVER_PROPS }
49
+ toggleProps={ TOGGLE_PROPS }
50
+ >
51
+ { ( { onClose } ) => (
52
+ <>
53
+ <MenuGroup label={ _x( 'View', 'noun' ) }>
54
+ <FeatureToggle
55
+ feature="fixedToolbar"
56
+ label={ __( 'Top toolbar' ) }
57
+ info={ __(
58
+ 'Access all block and document tools in a single place'
59
+ ) }
60
+ messageActivated={ __(
61
+ 'Top toolbar activated'
62
+ ) }
63
+ messageDeactivated={ __(
64
+ 'Top toolbar deactivated'
65
+ ) }
66
+ />
67
+ <FeatureToggle
68
+ feature="focusMode"
69
+ label={ __( 'Spotlight mode' ) }
70
+ info={ __( 'Focus on one block at a time' ) }
71
+ messageActivated={ __(
72
+ 'Spotlight mode activated'
73
+ ) }
74
+ messageDeactivated={ __(
75
+ 'Spotlight mode deactivated'
76
+ ) }
77
+ />
78
+ <ActionItem.Slot
79
+ name="core/edit-site/plugin-more-menu"
80
+ label={ __( 'Plugins' ) }
81
+ as={ MenuGroup }
82
+ fillProps={ { onClick: onClose } }
83
+ />
84
+ </MenuGroup>
85
+ <MenuGroup label={ __( 'Tools' ) }>
86
+ <SiteExport />
87
+ <MenuItem
88
+ onClick={ toggleModal }
89
+ shortcut={ displayShortcut.access( 'h' ) }
90
+ >
91
+ { __( 'Keyboard shortcuts' ) }
92
+ </MenuItem>
93
+ <WelcomeGuideMenuItem />
94
+ <MenuItem
95
+ icon={ external }
96
+ role="menuitem"
97
+ href={ __(
98
+ 'https://wordpress.org/support/article/site-editor/'
99
+ ) }
100
+ target="_blank"
101
+ rel="noopener noreferrer"
102
+ >
103
+ { __( 'Help' ) }
104
+ <VisuallyHidden as="span">
105
+ {
106
+ /* translators: accessibility text */
107
+ __( '(opens in a new tab)' )
108
+ }
109
+ </VisuallyHidden>
110
+ </MenuItem>
111
+ <ToolsMoreMenuGroup.Slot
112
+ fillProps={ { onClose } }
113
+ />
114
+ </MenuGroup>
115
+ </>
116
+ ) }
117
+ </DropdownMenu>
118
+ <KeyboardShortcutHelpModal
119
+ isModalActive={ isModalActive }
120
+ toggleModal={ toggleModal }
121
+ />
122
+ </>
123
+ );
124
+ }
@@ -8,7 +8,7 @@ import { MenuItem } from '@wordpress/components';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
11
- import { store as editSiteStore } from '../store';
11
+ import { store as editSiteStore } from '../../../store';
12
12
 
13
13
  export default function WelcomeGuideMenuItem() {
14
14
  const { toggleFeature } = useDispatch( editSiteStore );
@@ -6,8 +6,7 @@ import { isEmpty } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { createSlotFill, MenuGroup } from '@wordpress/components';
10
- import { __ } from '@wordpress/i18n';
9
+ import { createSlotFill } from '@wordpress/components';
11
10
 
12
11
  const { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(
13
12
  'EditSiteToolsMoreMenuGroup'
@@ -15,11 +14,7 @@ const { Fill: ToolsMoreMenuGroup, Slot } = createSlotFill(
15
14
 
16
15
  ToolsMoreMenuGroup.Slot = ( { fillProps } ) => (
17
16
  <Slot fillProps={ fillProps }>
18
- { ( fills ) =>
19
- ! isEmpty( fills ) && (
20
- <MenuGroup label={ __( 'Tools' ) }>{ fills }</MenuGroup>
21
- )
22
- }
17
+ { ( fills ) => ! isEmpty( fills ) && fills }
23
18
  </Slot>
24
19
  );
25
20
 
@@ -0,0 +1,27 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __ } from '@wordpress/i18n';
5
+
6
+ export const textFormattingShortcuts = [
7
+ {
8
+ keyCombination: { modifier: 'primary', character: 'b' },
9
+ description: __( 'Make the selected text bold.' ),
10
+ },
11
+ {
12
+ keyCombination: { modifier: 'primary', character: 'i' },
13
+ description: __( 'Make the selected text italic.' ),
14
+ },
15
+ {
16
+ keyCombination: { modifier: 'primary', character: 'k' },
17
+ description: __( 'Convert the selected text into a link.' ),
18
+ },
19
+ {
20
+ keyCombination: { modifier: 'primaryShift', character: 'k' },
21
+ description: __( 'Remove a link.' ),
22
+ },
23
+ {
24
+ keyCombination: { modifier: 'primary', character: 'u' },
25
+ description: __( 'Underline the selected text.' ),
26
+ },
27
+ ];
@@ -0,0 +1,41 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { useSelect } from '@wordpress/data';
5
+ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
6
+
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import Shortcut from './shortcut';
11
+
12
+ export default function DynamicShortcut( { name } ) {
13
+ const { keyCombination, description, aliases } = useSelect(
14
+ ( select ) => {
15
+ const {
16
+ getShortcutKeyCombination,
17
+ getShortcutDescription,
18
+ getShortcutAliases,
19
+ } = select( keyboardShortcutsStore );
20
+
21
+ return {
22
+ keyCombination: getShortcutKeyCombination( name ),
23
+ aliases: getShortcutAliases( name ),
24
+ description: getShortcutDescription( name ),
25
+ };
26
+ },
27
+ [ name ]
28
+ );
29
+
30
+ if ( ! keyCombination ) {
31
+ return null;
32
+ }
33
+
34
+ return (
35
+ <Shortcut
36
+ keyCombination={ keyCombination }
37
+ description={ description }
38
+ aliases={ aliases }
39
+ />
40
+ );
41
+ }