@wordpress/edit-site 3.0.22 → 3.0.27

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 (126) 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/index.js +11 -1
  4. package/build/components/editor/index.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/routes/redirect-to-homepage.js +106 -0
  36. package/build/components/routes/redirect-to-homepage.js.map +1 -0
  37. package/build/components/template-part-converter/convert-to-template-part.js +4 -1
  38. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  39. package/build/components/url-query-controller/index.js +1 -38
  40. package/build/components/url-query-controller/index.js.map +1 -1
  41. package/build/index.js +23 -4
  42. package/build/index.js.map +1 -1
  43. package/build/store/actions.js +7 -25
  44. package/build/store/actions.js.map +1 -1
  45. package/build-module/components/add-new-template/new-template-part.js +4 -1
  46. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  47. package/build-module/components/editor/index.js +11 -1
  48. package/build-module/components/editor/index.js.map +1 -1
  49. package/build-module/components/error-boundary/index.js +9 -26
  50. package/build-module/components/error-boundary/index.js.map +1 -1
  51. package/build-module/components/error-boundary/warning.js +60 -0
  52. package/build-module/components/error-boundary/warning.js.map +1 -0
  53. package/build-module/components/global-styles/screen-background-color.js +8 -10
  54. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  55. package/build-module/components/global-styles/screen-link-color.js +7 -11
  56. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  57. package/build-module/components/global-styles/screen-text-color.js +7 -11
  58. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  59. package/build-module/components/header/more-menu/index.js +65 -40
  60. package/build-module/components/header/more-menu/index.js.map +1 -1
  61. package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
  62. package/build-module/components/header/more-menu/site-export.js.map +1 -0
  63. package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  64. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  65. package/build-module/components/header/tools-more-menu-group/index.js +2 -5
  66. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  67. package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
  68. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  69. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
  70. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  71. package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
  72. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  73. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
  74. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  75. package/build-module/components/keyboard-shortcuts/index.js +9 -0
  76. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  77. package/build-module/components/list/added-by.js +52 -51
  78. package/build-module/components/list/added-by.js.map +1 -1
  79. package/build-module/components/routes/redirect-to-homepage.js +94 -0
  80. package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
  81. package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
  82. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  83. package/build-module/components/url-query-controller/index.js +3 -40
  84. package/build-module/components/url-query-controller/index.js.map +1 -1
  85. package/build-module/index.js +20 -3
  86. package/build-module/index.js.map +1 -1
  87. package/build-module/store/actions.js +7 -23
  88. package/build-module/store/actions.js.map +1 -1
  89. package/build-style/style-rtl.css +55 -5
  90. package/build-style/style.css +55 -5
  91. package/package.json +9 -9
  92. package/src/components/add-new-template/new-template-part.js +7 -1
  93. package/src/components/block-editor/style.scss +6 -6
  94. package/src/components/editor/index.js +14 -0
  95. package/src/components/error-boundary/index.js +11 -28
  96. package/src/components/error-boundary/warning.js +59 -0
  97. package/src/components/global-styles/screen-background-color.js +6 -9
  98. package/src/components/global-styles/screen-link-color.js +6 -14
  99. package/src/components/global-styles/screen-text-color.js +6 -14
  100. package/src/components/header/more-menu/index.js +103 -44
  101. package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
  102. package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  103. package/src/components/header/tools-more-menu-group/index.js +2 -7
  104. package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
  105. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  106. package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
  107. package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
  108. package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
  109. package/src/components/keyboard-shortcuts/index.js +10 -0
  110. package/src/components/list/added-by.js +57 -63
  111. package/src/components/routes/redirect-to-homepage.js +94 -0
  112. package/src/components/template-part-converter/convert-to-template-part.js +6 -1
  113. package/src/components/url-query-controller/index.js +3 -35
  114. package/src/index.js +25 -2
  115. package/src/store/actions.js +7 -35
  116. package/src/store/test/actions.js +0 -90
  117. package/src/style.scss +1 -0
  118. package/build/plugins/index.js +0 -28
  119. package/build/plugins/index.js.map +0 -1
  120. package/build/plugins/site-export.js.map +0 -1
  121. package/build/plugins/welcome-guide-menu-item.js.map +0 -1
  122. package/build-module/plugins/index.js +0 -20
  123. package/build-module/plugins/index.js.map +0 -1
  124. package/build-module/plugins/site-export.js.map +0 -1
  125. package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
  126. package/src/plugins/index.js +0 -24
@@ -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
+ }
@@ -0,0 +1,135 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+ import { isString } from 'lodash';
6
+
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+ import { Modal } from '@wordpress/components';
11
+ import { __ } from '@wordpress/i18n';
12
+ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
13
+ import { useSelect } from '@wordpress/data';
14
+
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { textFormattingShortcuts } from './config';
19
+ import Shortcut from './shortcut';
20
+ import DynamicShortcut from './dynamic-shortcut';
21
+
22
+ const ShortcutList = ( { shortcuts } ) => (
23
+ /*
24
+ * Disable reason: The `list` ARIA role is redundant but
25
+ * Safari+VoiceOver won't announce the list otherwise.
26
+ */
27
+ /* eslint-disable jsx-a11y/no-redundant-roles */
28
+ <ul
29
+ className="edit-site-keyboard-shortcut-help-modal__shortcut-list"
30
+ role="list"
31
+ >
32
+ { shortcuts.map( ( shortcut, index ) => (
33
+ <li
34
+ className="edit-site-keyboard-shortcut-help-modal__shortcut"
35
+ key={ index }
36
+ >
37
+ { isString( shortcut ) ? (
38
+ <DynamicShortcut name={ shortcut } />
39
+ ) : (
40
+ <Shortcut { ...shortcut } />
41
+ ) }
42
+ </li>
43
+ ) ) }
44
+ </ul>
45
+ /* eslint-enable jsx-a11y/no-redundant-roles */
46
+ );
47
+
48
+ const ShortcutSection = ( { title, shortcuts, className } ) => (
49
+ <section
50
+ className={ classnames(
51
+ 'edit-site-keyboard-shortcut-help-modal__section',
52
+ className
53
+ ) }
54
+ >
55
+ { !! title && (
56
+ <h2 className="edit-site-keyboard-shortcut-help-modal__section-title">
57
+ { title }
58
+ </h2>
59
+ ) }
60
+ <ShortcutList shortcuts={ shortcuts } />
61
+ </section>
62
+ );
63
+
64
+ const ShortcutCategorySection = ( {
65
+ title,
66
+ categoryName,
67
+ additionalShortcuts = [],
68
+ } ) => {
69
+ const categoryShortcuts = useSelect(
70
+ ( select ) => {
71
+ return select( keyboardShortcutsStore ).getCategoryShortcuts(
72
+ categoryName
73
+ );
74
+ },
75
+ [ categoryName ]
76
+ );
77
+
78
+ return (
79
+ <ShortcutSection
80
+ title={ title }
81
+ shortcuts={ categoryShortcuts.concat( additionalShortcuts ) }
82
+ />
83
+ );
84
+ };
85
+
86
+ export default function KeyboardShortcutHelpModal( {
87
+ isModalActive,
88
+ toggleModal,
89
+ } ) {
90
+ if ( ! isModalActive ) {
91
+ return null;
92
+ }
93
+
94
+ return (
95
+ <Modal
96
+ className="edit-site-keyboard-shortcut-help-modal"
97
+ title={ __( 'Keyboard shortcuts' ) }
98
+ closeLabel={ __( 'Close' ) }
99
+ onRequestClose={ toggleModal }
100
+ >
101
+ <ShortcutSection
102
+ className="edit-site-keyboard-shortcut-help-modal__main-shortcuts"
103
+ shortcuts={ [ 'core/edit-site/keyboard-shortcuts' ] }
104
+ />
105
+ <ShortcutCategorySection
106
+ title={ __( 'Global shortcuts' ) }
107
+ categoryName="global"
108
+ />
109
+
110
+ <ShortcutCategorySection
111
+ title={ __( 'Selection shortcuts' ) }
112
+ categoryName="selection"
113
+ />
114
+
115
+ <ShortcutCategorySection
116
+ title={ __( 'Block shortcuts' ) }
117
+ categoryName="block"
118
+ additionalShortcuts={ [
119
+ {
120
+ keyCombination: { character: '/' },
121
+ description: __(
122
+ 'Change the block type after adding a new paragraph.'
123
+ ),
124
+ /* translators: The forward-slash character. e.g. '/'. */
125
+ ariaLabel: __( 'Forward-slash' ),
126
+ },
127
+ ] }
128
+ />
129
+ <ShortcutSection
130
+ title={ __( 'Text formatting' ) }
131
+ shortcuts={ textFormattingShortcuts }
132
+ />
133
+ </Modal>
134
+ );
135
+ }
@@ -0,0 +1,73 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { castArray } from 'lodash';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { Fragment } from '@wordpress/element';
10
+ import { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';
11
+
12
+ function KeyCombination( { keyCombination, forceAriaLabel } ) {
13
+ const shortcut = keyCombination.modifier
14
+ ? displayShortcutList[ keyCombination.modifier ](
15
+ keyCombination.character
16
+ )
17
+ : keyCombination.character;
18
+ const ariaLabel = keyCombination.modifier
19
+ ? shortcutAriaLabel[ keyCombination.modifier ](
20
+ keyCombination.character
21
+ )
22
+ : keyCombination.character;
23
+
24
+ return (
25
+ <kbd
26
+ className="edit-site-keyboard-shortcut-help-modal__shortcut-key-combination"
27
+ aria-label={ forceAriaLabel || ariaLabel }
28
+ >
29
+ { castArray( shortcut ).map( ( character, index ) => {
30
+ if ( character === '+' ) {
31
+ return <Fragment key={ index }>{ character }</Fragment>;
32
+ }
33
+
34
+ return (
35
+ <kbd
36
+ key={ index }
37
+ className="edit-site-keyboard-shortcut-help-modal__shortcut-key"
38
+ >
39
+ { character }
40
+ </kbd>
41
+ );
42
+ } ) }
43
+ </kbd>
44
+ );
45
+ }
46
+
47
+ export default function Shortcut( {
48
+ description,
49
+ keyCombination,
50
+ aliases = [],
51
+ ariaLabel,
52
+ } ) {
53
+ return (
54
+ <>
55
+ <div className="edit-site-keyboard-shortcut-help-modal__shortcut-description">
56
+ { description }
57
+ </div>
58
+ <div className="edit-site-keyboard-shortcut-help-modal__shortcut-term">
59
+ <KeyCombination
60
+ keyCombination={ keyCombination }
61
+ forceAriaLabel={ ariaLabel }
62
+ />
63
+ { aliases.map( ( alias, index ) => (
64
+ <KeyCombination
65
+ keyCombination={ alias }
66
+ forceAriaLabel={ ariaLabel }
67
+ key={ index }
68
+ />
69
+ ) ) }
70
+ </div>
71
+ </>
72
+ );
73
+ }
@@ -0,0 +1,66 @@
1
+ .edit-site-keyboard-shortcut-help-modal {
2
+ &__section {
3
+ margin: 0 0 2rem 0;
4
+ }
5
+
6
+ &__main-shortcuts .edit-site-keyboard-shortcut-help-modal__shortcut-list {
7
+ // Push the shortcut to be flush with top modal header.
8
+ margin-top: -$grid-unit-30 -$border-width;
9
+ }
10
+
11
+ &__section-title {
12
+ font-size: 0.9rem;
13
+ font-weight: 600;
14
+ }
15
+
16
+ &__shortcut {
17
+ display: flex;
18
+ align-items: baseline;
19
+ padding: 0.6rem 0;
20
+ border-top: 1px solid $gray-300;
21
+ margin-bottom: 0;
22
+
23
+ &:last-child {
24
+ border-bottom: 1px solid $gray-300;
25
+ }
26
+
27
+ &:empty {
28
+ display: none;
29
+ }
30
+ }
31
+
32
+ &__shortcut-term {
33
+ font-weight: 600;
34
+ margin: 0 0 0 1rem;
35
+ text-align: right;
36
+ }
37
+
38
+ &__shortcut-description {
39
+ flex: 1;
40
+ margin: 0;
41
+
42
+ // IE 11 flex item fix - ensure the item does not collapse.
43
+ flex-basis: auto;
44
+ }
45
+
46
+ &__shortcut-key-combination {
47
+ display: block;
48
+ background: none;
49
+ margin: 0;
50
+ padding: 0;
51
+
52
+ & + .edit-site-keyboard-shortcut-help-modal__shortcut-key-combination {
53
+ margin-top: 10px;
54
+ }
55
+ }
56
+
57
+ &__shortcut-key {
58
+ padding: 0.25rem 0.5rem;
59
+ border-radius: 8%;
60
+ margin: 0 0.2rem 0 0.2rem;
61
+
62
+ &:last-child {
63
+ margin: 0 0 0 0.2rem;
64
+ }
65
+ }
66
+ }
@@ -137,6 +137,16 @@ function KeyboardShortcutsRegister() {
137
137
  },
138
138
  } );
139
139
 
140
+ registerShortcut( {
141
+ name: 'core/edit-site/keyboard-shortcuts',
142
+ category: 'main',
143
+ description: __( 'Display these keyboard shortcuts.' ),
144
+ keyCombination: {
145
+ modifier: 'access',
146
+ character: 'h',
147
+ },
148
+ } );
149
+
140
150
  registerShortcut( {
141
151
  name: 'core/edit-site/next-region',
142
152
  category: 'global',