@wordpress/edit-site 5.12.3 → 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.
- package/build/components/header-edit-mode/more-menu/index.js +12 -16
- package/build/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +17 -4
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/page-library/grid-item.js +1 -1
- package/build/components/page-library/grid-item.js.map +1 -1
- package/build/components/preferences-modal/index.js +13 -4
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/hooks/commands/use-edit-mode-commands.js +23 -0
- package/build/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-module/components/header-edit-mode/more-menu/index.js +9 -17
- package/build-module/components/header-edit-mode/more-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +15 -6
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/page-library/grid-item.js +1 -1
- package/build-module/components/page-library/grid-item.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +14 -8
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js +22 -1
- package/build-module/hooks/commands/use-edit-mode-commands.js.map +1 -1
- package/build-style/style-rtl.css +1 -5
- package/build-style/style.css +1 -5
- package/package.json +14 -14
- package/src/components/header-edit-mode/more-menu/index.js +26 -27
- package/src/components/keyboard-shortcut-help-modal/index.js +21 -7
- package/src/components/page-library/grid-item.js +1 -1
- package/src/components/preferences-modal/index.js +13 -7
- package/src/components/sidebar-navigation-item/style.scss +1 -0
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +0 -5
- package/src/components/start-template-options/style.scss +0 -3
- 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 {
|
|
12
|
-
|
|
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
|
-
|
|
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: '
|
|
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
|
|
19
|
+
import { store as editSiteStore } from '../../store';
|
|
19
20
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
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(
|
|
32
|
+
useDispatch( editSiteStore );
|
|
27
33
|
|
|
28
34
|
const { set: setPreference } = useDispatch( preferencesStore );
|
|
29
35
|
const toggleDistractionFree = () => {
|
|
@@ -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,
|