@wordpress/edit-site 5.12.2 → 5.12.4

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 (31) hide show
  1. package/build/components/header-edit-mode/more-menu/index.js +12 -16
  2. package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
  3. package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
  4. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  5. package/build/components/page-library/grid-item.js +1 -1
  6. package/build/components/page-library/grid-item.js.map +1 -1
  7. package/build/components/preferences-modal/index.js +13 -4
  8. package/build/components/preferences-modal/index.js.map +1 -1
  9. package/build/hooks/commands/use-edit-mode-commands.js +23 -0
  10. package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
  11. package/build-module/components/header-edit-mode/more-menu/index.js +9 -17
  12. package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
  13. package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
  14. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  15. package/build-module/components/page-library/grid-item.js +1 -1
  16. package/build-module/components/page-library/grid-item.js.map +1 -1
  17. package/build-module/components/preferences-modal/index.js +14 -8
  18. package/build-module/components/preferences-modal/index.js.map +1 -1
  19. package/build-module/hooks/commands/use-edit-mode-commands.js +22 -1
  20. package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
  21. package/build-style/style-rtl.css +1 -5
  22. package/build-style/style.css +1 -5
  23. package/package.json +14 -14
  24. package/src/components/header-edit-mode/more-menu/index.js +26 -27
  25. package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
  26. package/src/components/page-library/grid-item.js +1 -1
  27. package/src/components/preferences-modal/index.js +13 -7
  28. package/src/components/sidebar-navigation-item/style.scss +1 -0
  29. package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +0 -5
  30. package/src/components/start-template-options/style.scss +0 -3
  31. package/src/hooks/commands/use-edit-mode-commands.js +24 -2
@@ -8,8 +8,12 @@ import classnames from 'classnames';
8
8
  */
9
9
  import { Modal } from '@wordpress/components';
10
10
  import { __ } from '@wordpress/i18n';
11
- import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
12
- import { useSelect } from '@wordpress/data';
11
+ import {
12
+ useShortcut,
13
+ store as keyboardShortcutsStore,
14
+ } from '@wordpress/keyboard-shortcuts';
15
+ import { store as interfaceStore } from '@wordpress/interface';
16
+ import { useSelect, useDispatch } from '@wordpress/data';
13
17
 
14
18
  /**
15
19
  * Internal dependencies
@@ -18,6 +22,9 @@ import { textFormattingShortcuts } from './config';
18
22
  import Shortcut from './shortcut';
19
23
  import DynamicShortcut from './dynamic-shortcut';
20
24
 
25
+ export const KEYBOARD_SHORTCUT_HELP_MODAL_NAME =
26
+ 'edit-site/keyboard-shortcut-help';
27
+
21
28
  const ShortcutList = ( { shortcuts } ) => (
22
29
  /*
23
30
  * Disable reason: The `list` ARIA role is redundant but
@@ -82,14 +89,21 @@ const ShortcutCategorySection = ( {
82
89
  );
83
90
  };
84
91
 
85
- export default function KeyboardShortcutHelpModal( {
86
- isModalActive,
87
- toggleModal,
88
- } ) {
92
+ export default function KeyboardShortcutHelpModal() {
93
+ const isModalActive = useSelect( ( select ) =>
94
+ select( interfaceStore ).isModalActive(
95
+ KEYBOARD_SHORTCUT_HELP_MODAL_NAME
96
+ )
97
+ );
98
+ const { closeModal, openModal } = useDispatch( interfaceStore );
99
+ const toggleModal = () =>
100
+ isModalActive
101
+ ? closeModal()
102
+ : openModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );
103
+ useShortcut( 'core/edit-site/keyboard-shortcuts', toggleModal );
89
104
  if ( ! isModalActive ) {
90
105
  return null;
91
106
  }
92
-
93
107
  return (
94
108
  <Modal
95
109
  className="edit-site-keyboard-shortcut-help-modal"
@@ -46,7 +46,7 @@ export default function GridItem( { categoryId, composite, icon, item } ) {
46
46
  postId: item.type === USER_PATTERNS ? item.id : item.name,
47
47
  categoryId,
48
48
  categoryType: item.type,
49
- canvas: 'edit',
49
+ canvas: 'view',
50
50
  } );
51
51
 
52
52
  const onKeyDown = ( event ) => {
@@ -5,25 +5,31 @@ import {
5
5
  PreferencesModal,
6
6
  PreferencesModalTabs,
7
7
  PreferencesModalSection,
8
+ store as interfaceStore,
8
9
  } from '@wordpress/interface';
9
10
  import { useMemo } from '@wordpress/element';
10
11
  import { __ } from '@wordpress/i18n';
11
- import { useDispatch, useRegistry } from '@wordpress/data';
12
+ import { useSelect, useDispatch, useRegistry } from '@wordpress/data';
12
13
  import { store as preferencesStore } from '@wordpress/preferences';
13
14
 
14
15
  /**
15
16
  * Internal dependencies
16
17
  */
17
18
  import EnableFeature from './enable-feature';
18
- import { store as siteEditorStore } from '../../store';
19
+ import { store as editSiteStore } from '../../store';
19
20
 
20
- export default function EditSitePreferencesModal( {
21
- isModalActive,
22
- toggleModal,
23
- } ) {
21
+ export const PREFERENCES_MODAL_NAME = 'edit-site/preferences';
22
+
23
+ export default function EditSitePreferencesModal() {
24
+ const isModalActive = useSelect( ( select ) =>
25
+ select( interfaceStore ).isModalActive( PREFERENCES_MODAL_NAME )
26
+ );
27
+ const { closeModal, openModal } = useDispatch( interfaceStore );
28
+ const toggleModal = () =>
29
+ isModalActive ? closeModal() : openModal( PREFERENCES_MODAL_NAME );
24
30
  const registry = useRegistry();
25
31
  const { closeGeneralSidebar, setIsListViewOpened, setIsInserterOpened } =
26
- useDispatch( siteEditorStore );
32
+ useDispatch( editSiteStore );
27
33
 
28
34
  const { set: setPreference } = useDispatch( preferencesStore );
29
35
  const toggleDistractionFree = () => {
@@ -15,6 +15,7 @@
15
15
 
16
16
  &[aria-current] {
17
17
  background: var(--wp-admin-theme-color);
18
+ color: $white;
18
19
  }
19
20
 
20
21
  .edit-site-sidebar-navigation-item__drilldown-indicator {
@@ -8,8 +8,3 @@
8
8
  }
9
9
  }
10
10
  }
11
-
12
- .sidebar-navigation__rename-modal-form {
13
- // Fix for input focus style being cut off by the modal.
14
- padding-top: 1px;
15
- }
@@ -29,9 +29,6 @@ $actions-height: 92px;
29
29
  column-count: 2;
30
30
  column-gap: $grid-unit-30;
31
31
 
32
- // Small top padding required to avoid cutting off the visible outline when hovering items
33
- padding-top: $border-width-focus-fallback;
34
-
35
32
  @include break-medium() {
36
33
  column-count: 3;
37
34
  }
@@ -4,8 +4,6 @@
4
4
  import { useSelect, useDispatch } from '@wordpress/data';
5
5
  import { __, isRTL } from '@wordpress/i18n';
6
6
  import {
7
- code,
8
- cog,
9
7
  trash,
10
8
  backup,
11
9
  layout,
@@ -13,6 +11,9 @@ import {
13
11
  drawerLeft,
14
12
  drawerRight,
15
13
  blockDefault,
14
+ cog,
15
+ code,
16
+ keyboardClose,
16
17
  } from '@wordpress/icons';
17
18
  import { useCommandLoader } from '@wordpress/commands';
18
19
  import { privateApis as routerPrivateApis } from '@wordpress/router';
@@ -26,6 +27,8 @@ import { store as editSiteStore } from '../../store';
26
27
  import useEditedEntityRecord from '../../components/use-edited-entity-record';
27
28
  import isTemplateRemovable from '../../utils/is-template-removable';
28
29
  import isTemplateRevertable from '../../utils/is-template-revertable';
30
+ import { KEYBOARD_SHORTCUT_HELP_MODAL_NAME } from '../../components/keyboard-shortcut-help-modal';
31
+ import { PREFERENCES_MODAL_NAME } from '../../components/preferences-modal';
29
32
  import { unlock } from '../../lock-unlock';
30
33
 
31
34
  const { useHistory } = unlock( routerPrivateApis );
@@ -142,6 +145,7 @@ function useEditUICommands() {
142
145
  } ),
143
146
  []
144
147
  );
148
+ const { openModal } = useDispatch( interfaceStore );
145
149
  const { toggle } = useDispatch( preferencesStore );
146
150
 
147
151
  if ( canvasMode !== 'edit' ) {
@@ -208,6 +212,24 @@ function useEditUICommands() {
208
212
  },
209
213
  } );
210
214
 
215
+ commands.push( {
216
+ name: 'core/open-preferences',
217
+ label: __( 'Open editor preferences' ),
218
+ icon: cog,
219
+ callback: () => {
220
+ openModal( PREFERENCES_MODAL_NAME );
221
+ },
222
+ } );
223
+
224
+ commands.push( {
225
+ name: 'core/open-shortcut-help',
226
+ label: __( 'Open keyboard shortcuts' ),
227
+ icon: keyboardClose,
228
+ callback: () => {
229
+ openModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME );
230
+ },
231
+ } );
232
+
211
233
  return {
212
234
  isLoading: false,
213
235
  commands,