@wordpress/edit-post 7.32.0 → 7.33.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.
- package/CHANGELOG.md +2 -0
- package/README.md +4 -196
- package/build/components/browser-url/index.js.map +1 -1
- package/build/components/editor-initialization/index.js +0 -1
- package/build/components/editor-initialization/index.js.map +1 -1
- package/build/components/editor-initialization/listener-hooks.js +1 -38
- package/build/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/index.js +4 -4
- package/build/components/header/index.js.map +1 -1
- package/build/components/header/index.native.js +1 -1
- package/build/components/header/index.native.js.map +1 -1
- package/build/components/header/main-dashboard-button/index.js.map +1 -1
- package/build/components/header/more-menu/index.js +7 -6
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/post-publish-button-or-toggle.js +9 -6
- package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build/components/header/preferences-menu-item/index.js +12 -4
- package/build/components/header/preferences-menu-item/index.js.map +1 -1
- package/build/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -36
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/actions-panel.js.map +1 -1
- package/build/components/layout/index.js +12 -20
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build/components/preferences-modal/enable-panel.js.map +1 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -21
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build/components/sidebar/post-format/index.js.map +1 -1
- package/build/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build/components/sidebar/post-slug/index.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +9 -9
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-sticky/index.js.map +1 -1
- package/build/components/sidebar/post-trash/index.js.map +1 -1
- package/build/components/sidebar/post-visibility/index.js.map +1 -1
- package/build/components/sidebar/settings-header/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +37 -40
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/components/text-editor/index.js.map +1 -1
- package/build/components/visual-editor/block-inspector-button.js +1 -1
- package/build/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build/components/visual-editor/header.native.js.map +1 -1
- package/build/components/visual-editor/index.js +4 -1
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/components/visual-editor/index.native.js.map +1 -1
- package/build/components/visual-editor/use-padding-appender.js +62 -0
- package/build/components/visual-editor/use-padding-appender.js.map +1 -0
- package/build/components/welcome-guide/default.js.map +1 -1
- package/build/components/welcome-guide/image.js.map +1 -1
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/components/welcome-guide/template.js.map +1 -1
- package/build/editor.js +2 -2
- package/build/editor.js.map +1 -1
- package/build/editor.native.js.map +1 -1
- package/build/hooks/commands/use-common-commands.js +5 -22
- package/build/hooks/commands/use-common-commands.js.map +1 -1
- package/build/hooks/components/index.js.map +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +4 -8
- package/build/index.js.map +1 -1
- package/build/index.native.js.map +1 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/plugins/copy-content-menu-item/index.js.map +1 -1
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +7 -4
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build/store/actions.js +10 -8
- package/build/store/actions.js.map +1 -1
- package/build/store/constants.js.map +1 -1
- package/build/store/index.js +1 -1
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +34 -19
- package/build/store/selectors.js.map +1 -1
- package/build/utils/meta-boxes.js.map +1 -1
- package/build-module/components/browser-url/index.js.map +1 -1
- package/build-module/components/editor-initialization/index.js +1 -2
- package/build-module/components/editor-initialization/index.js.map +1 -1
- package/build-module/components/editor-initialization/listener-hooks.js +2 -38
- package/build-module/components/editor-initialization/listener-hooks.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/index.js +3 -3
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/header/index.native.js +1 -1
- package/build-module/components/header/index.native.js.map +1 -1
- package/build-module/components/header/main-dashboard-button/index.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +5 -4
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/post-publish-button-or-toggle.js +9 -6
- package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
- package/build-module/components/header/preferences-menu-item/index.js +11 -3
- package/build-module/components/header/preferences-menu-item/index.js.map +1 -1
- package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -36
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/actions-panel.js.map +1 -1
- package/build-module/components/layout/index.js +11 -19
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/meta-boxes/meta-box-visibility.js.map +1 -1
- package/build-module/components/meta-boxes/meta-boxes-area/index.js.map +1 -1
- package/build-module/components/preferences-modal/enable-custom-fields.js.map +1 -1
- package/build-module/components/preferences-modal/enable-panel.js.map +1 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -20
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
- package/build-module/components/sidebar/post-format/index.js.map +1 -1
- package/build-module/components/sidebar/post-pending-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-slug/index.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +9 -10
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-sticky/index.js.map +1 -1
- package/build-module/components/sidebar/post-trash/index.js.map +1 -1
- package/build-module/components/sidebar/post-visibility/index.js.map +1 -1
- package/build-module/components/sidebar/settings-header/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +38 -41
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/components/text-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js +1 -1
- package/build-module/components/visual-editor/block-inspector-button.js.map +1 -1
- package/build-module/components/visual-editor/header.native.js.map +1 -1
- package/build-module/components/visual-editor/index.js +4 -1
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/components/visual-editor/index.native.js.map +1 -1
- package/build-module/components/visual-editor/use-padding-appender.js +55 -0
- package/build-module/components/visual-editor/use-padding-appender.js.map +1 -0
- package/build-module/components/welcome-guide/default.js.map +1 -1
- package/build-module/components/welcome-guide/image.js.map +1 -1
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/components/welcome-guide/template.js.map +1 -1
- package/build-module/editor.js +2 -2
- package/build-module/editor.js.map +1 -1
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/commands/use-common-commands.js +7 -24
- package/build-module/hooks/commands/use-common-commands.js.map +1 -1
- package/build-module/hooks/components/index.js.map +1 -1
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +5 -5
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js.map +1 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/plugins/copy-content-menu-item/index.js.map +1 -1
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +6 -3
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +8 -7
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/constants.js.map +1 -1
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +33 -18
- package/build-module/store/selectors.js.map +1 -1
- package/build-module/utils/meta-boxes.js.map +1 -1
- package/build-style/classic-rtl.css +2 -2
- package/build-style/classic.css +2 -2
- package/build-style/style-rtl.css +12 -448
- package/build-style/style.css +12 -448
- package/package.json +32 -34
- package/src/classic.scss +1 -1
- package/src/components/editor-initialization/index.js +1 -5
- package/src/components/editor-initialization/listener-hooks.js +1 -40
- package/src/components/editor-initialization/test/listener-hooks.js +1 -96
- package/src/components/header/index.js +2 -3
- package/src/components/header/index.native.js +1 -1
- package/src/components/header/more-menu/index.js +3 -4
- package/src/components/header/post-publish-button-or-toggle.js +8 -3
- package/src/components/header/preferences-menu-item/index.js +9 -3
- package/src/components/header/style.scss +5 -3
- package/src/components/header/test/index.js +13 -1
- package/src/components/keyboard-shortcuts/index.js +3 -44
- package/src/components/layout/index.js +14 -41
- package/src/components/preferences-modal/index.js +1 -24
- package/src/components/sidebar/post-status/index.js +6 -9
- package/src/components/sidebar/settings-sidebar/index.js +62 -58
- package/src/components/visual-editor/block-inspector-button.js +1 -1
- package/src/components/visual-editor/index.js +4 -0
- package/src/components/visual-editor/use-padding-appender.js +66 -0
- package/src/editor.js +2 -2
- package/src/hooks/commands/use-common-commands.js +11 -26
- package/src/index.js +8 -4
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +5 -3
- package/src/store/actions.js +10 -12
- package/src/store/selectors.js +41 -33
- package/src/store/test/actions.js +11 -10
- package/src/style.scss +1 -19
- package/build/components/header/plugin-more-menu-item/index.js +0 -78
- package/build/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build/components/header/plugin-sidebar-more-menu-item/index.js +0 -71
- package/build/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +0 -78
- package/build/components/keyboard-shortcut-help-modal/config.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -49
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +0 -132
- package/build/components/keyboard-shortcut-help-modal/index.js.map +0 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +0 -55
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
- package/build/components/sidebar/plugin-post-status-info/index.js +0 -73
- package/build/components/sidebar/plugin-post-status-info/index.js.map +0 -1
- package/build/components/sidebar/plugin-sidebar/index.js +0 -104
- package/build/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build/components/start-page-options/index.js +0 -107
- package/build/components/start-page-options/index.js.map +0 -1
- package/build-module/components/header/plugin-more-menu-item/index.js +0 -73
- package/build-module/components/header/plugin-more-menu-item/index.js.map +0 -1
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js +0 -65
- package/build-module/components/header/plugin-sidebar-more-menu-item/index.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +0 -71
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -41
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +0 -122
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +0 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +0 -48
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-status-info/index.js +0 -66
- package/build-module/components/sidebar/plugin-post-status-info/index.js.map +0 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +0 -98
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +0 -1
- package/build-module/components/start-page-options/index.js +0 -100
- package/build-module/components/start-page-options/index.js.map +0 -1
- package/src/components/header/plugin-more-menu-item/index.js +0 -73
- package/src/components/header/plugin-sidebar-more-menu-item/index.js +0 -64
- package/src/components/keyboard-shortcut-help-modal/config.js +0 -53
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +0 -43
- package/src/components/keyboard-shortcut-help-modal/index.js +0 -163
- package/src/components/keyboard-shortcut-help-modal/shortcut.js +0 -67
- package/src/components/keyboard-shortcut-help-modal/style.scss +0 -61
- package/src/components/keyboard-shortcut-help-modal/test/index.js +0 -36
- package/src/components/sidebar/plugin-post-status-info/index.js +0 -63
- package/src/components/sidebar/plugin-post-status-info/test/__snapshots__/index.js.snap +0 -11
- package/src/components/sidebar/plugin-post-status-info/test/index.js +0 -29
- package/src/components/sidebar/plugin-sidebar/index.js +0 -94
- package/src/components/start-page-options/index.js +0 -108
- package/src/components/start-page-options/style.scss +0 -26
|
@@ -1,53 +0,0 @@
|
|
|
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: { character: '[[' },
|
|
25
|
-
description: __( 'Insert a link to a post or page.' ),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
keyCombination: { modifier: 'primary', character: 'u' },
|
|
29
|
-
description: __( 'Underline the selected text.' ),
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
keyCombination: { modifier: 'access', character: 'd' },
|
|
33
|
-
description: __( 'Strikethrough the selected text.' ),
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
keyCombination: { modifier: 'access', character: 'x' },
|
|
37
|
-
description: __( 'Make the selected text inline code.' ),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
keyCombination: { modifier: 'access', character: '0' },
|
|
41
|
-
description: __( 'Convert the current heading to a paragraph.' ),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
keyCombination: { modifier: 'access', character: '1-6' },
|
|
45
|
-
description: __(
|
|
46
|
-
'Convert the current paragraph or heading to a heading of level 1 to 6.'
|
|
47
|
-
),
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
keyCombination: { modifier: 'primaryShift', character: '\u00a0' },
|
|
51
|
-
description: __( 'Add non breaking space.' ),
|
|
52
|
-
},
|
|
53
|
-
];
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
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
|
-
}
|
|
42
|
-
|
|
43
|
-
export default DynamicShortcut;
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import classnames from 'classnames';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { Modal } from '@wordpress/components';
|
|
10
|
-
import { __ } from '@wordpress/i18n';
|
|
11
|
-
import {
|
|
12
|
-
useShortcut,
|
|
13
|
-
store as keyboardShortcutsStore,
|
|
14
|
-
} from '@wordpress/keyboard-shortcuts';
|
|
15
|
-
import { withSelect, withDispatch, useSelect } from '@wordpress/data';
|
|
16
|
-
import { compose } from '@wordpress/compose';
|
|
17
|
-
import { store as interfaceStore } from '@wordpress/interface';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
import { textFormattingShortcuts } from './config';
|
|
23
|
-
import Shortcut from './shortcut';
|
|
24
|
-
import DynamicShortcut from './dynamic-shortcut';
|
|
25
|
-
|
|
26
|
-
export const KEYBOARD_SHORTCUT_HELP_MODAL_NAME =
|
|
27
|
-
'edit-post/keyboard-shortcut-help';
|
|
28
|
-
|
|
29
|
-
const ShortcutList = ( { shortcuts } ) => (
|
|
30
|
-
/*
|
|
31
|
-
* Disable reason: The `list` ARIA role is redundant but
|
|
32
|
-
* Safari+VoiceOver won't announce the list otherwise.
|
|
33
|
-
*/
|
|
34
|
-
/* eslint-disable jsx-a11y/no-redundant-roles */
|
|
35
|
-
<ul
|
|
36
|
-
className="edit-post-keyboard-shortcut-help-modal__shortcut-list"
|
|
37
|
-
role="list"
|
|
38
|
-
>
|
|
39
|
-
{ shortcuts.map( ( shortcut, index ) => (
|
|
40
|
-
<li
|
|
41
|
-
className="edit-post-keyboard-shortcut-help-modal__shortcut"
|
|
42
|
-
key={ index }
|
|
43
|
-
>
|
|
44
|
-
{ typeof shortcut === 'string' ? (
|
|
45
|
-
<DynamicShortcut name={ shortcut } />
|
|
46
|
-
) : (
|
|
47
|
-
<Shortcut { ...shortcut } />
|
|
48
|
-
) }
|
|
49
|
-
</li>
|
|
50
|
-
) ) }
|
|
51
|
-
</ul>
|
|
52
|
-
/* eslint-enable jsx-a11y/no-redundant-roles */
|
|
53
|
-
);
|
|
54
|
-
|
|
55
|
-
const ShortcutSection = ( { title, shortcuts, className } ) => (
|
|
56
|
-
<section
|
|
57
|
-
className={ classnames(
|
|
58
|
-
'edit-post-keyboard-shortcut-help-modal__section',
|
|
59
|
-
className
|
|
60
|
-
) }
|
|
61
|
-
>
|
|
62
|
-
{ !! title && (
|
|
63
|
-
<h2 className="edit-post-keyboard-shortcut-help-modal__section-title">
|
|
64
|
-
{ title }
|
|
65
|
-
</h2>
|
|
66
|
-
) }
|
|
67
|
-
<ShortcutList shortcuts={ shortcuts } />
|
|
68
|
-
</section>
|
|
69
|
-
);
|
|
70
|
-
|
|
71
|
-
const ShortcutCategorySection = ( {
|
|
72
|
-
title,
|
|
73
|
-
categoryName,
|
|
74
|
-
additionalShortcuts = [],
|
|
75
|
-
} ) => {
|
|
76
|
-
const categoryShortcuts = useSelect(
|
|
77
|
-
( select ) => {
|
|
78
|
-
return select( keyboardShortcutsStore ).getCategoryShortcuts(
|
|
79
|
-
categoryName
|
|
80
|
-
);
|
|
81
|
-
},
|
|
82
|
-
[ categoryName ]
|
|
83
|
-
);
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<ShortcutSection
|
|
87
|
-
title={ title }
|
|
88
|
-
shortcuts={ categoryShortcuts.concat( additionalShortcuts ) }
|
|
89
|
-
/>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
export function KeyboardShortcutHelpModal( { isModalActive, toggleModal } ) {
|
|
94
|
-
useShortcut( 'core/edit-post/keyboard-shortcuts', toggleModal );
|
|
95
|
-
|
|
96
|
-
if ( ! isModalActive ) {
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return (
|
|
101
|
-
<Modal
|
|
102
|
-
className="edit-post-keyboard-shortcut-help-modal"
|
|
103
|
-
title={ __( 'Keyboard shortcuts' ) }
|
|
104
|
-
closeButtonLabel={ __( 'Close' ) }
|
|
105
|
-
onRequestClose={ toggleModal }
|
|
106
|
-
>
|
|
107
|
-
<ShortcutSection
|
|
108
|
-
className="edit-post-keyboard-shortcut-help-modal__main-shortcuts"
|
|
109
|
-
shortcuts={ [ 'core/edit-post/keyboard-shortcuts' ] }
|
|
110
|
-
/>
|
|
111
|
-
<ShortcutCategorySection
|
|
112
|
-
title={ __( 'Global shortcuts' ) }
|
|
113
|
-
categoryName="global"
|
|
114
|
-
/>
|
|
115
|
-
|
|
116
|
-
<ShortcutCategorySection
|
|
117
|
-
title={ __( 'Selection shortcuts' ) }
|
|
118
|
-
categoryName="selection"
|
|
119
|
-
/>
|
|
120
|
-
|
|
121
|
-
<ShortcutCategorySection
|
|
122
|
-
title={ __( 'Block shortcuts' ) }
|
|
123
|
-
categoryName="block"
|
|
124
|
-
additionalShortcuts={ [
|
|
125
|
-
{
|
|
126
|
-
keyCombination: { character: '/' },
|
|
127
|
-
description: __(
|
|
128
|
-
'Change the block type after adding a new paragraph.'
|
|
129
|
-
),
|
|
130
|
-
/* translators: The forward-slash character. e.g. '/'. */
|
|
131
|
-
ariaLabel: __( 'Forward-slash' ),
|
|
132
|
-
},
|
|
133
|
-
] }
|
|
134
|
-
/>
|
|
135
|
-
<ShortcutSection
|
|
136
|
-
title={ __( 'Text formatting' ) }
|
|
137
|
-
shortcuts={ textFormattingShortcuts }
|
|
138
|
-
/>
|
|
139
|
-
<ShortcutCategorySection
|
|
140
|
-
title={ __( 'List View shortcuts' ) }
|
|
141
|
-
categoryName="list-view"
|
|
142
|
-
/>
|
|
143
|
-
</Modal>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export default compose( [
|
|
148
|
-
withSelect( ( select ) => ( {
|
|
149
|
-
isModalActive: select( interfaceStore ).isModalActive(
|
|
150
|
-
KEYBOARD_SHORTCUT_HELP_MODAL_NAME
|
|
151
|
-
),
|
|
152
|
-
} ) ),
|
|
153
|
-
withDispatch( ( dispatch, { isModalActive } ) => {
|
|
154
|
-
const { openModal, closeModal } = dispatch( interfaceStore );
|
|
155
|
-
|
|
156
|
-
return {
|
|
157
|
-
toggleModal: () =>
|
|
158
|
-
isModalActive
|
|
159
|
-
? closeModal()
|
|
160
|
-
: openModal( KEYBOARD_SHORTCUT_HELP_MODAL_NAME ),
|
|
161
|
-
};
|
|
162
|
-
} ),
|
|
163
|
-
] )( KeyboardShortcutHelpModal );
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { Fragment } from '@wordpress/element';
|
|
5
|
-
import { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';
|
|
6
|
-
|
|
7
|
-
function KeyCombination( { keyCombination, forceAriaLabel } ) {
|
|
8
|
-
const shortcut = keyCombination.modifier
|
|
9
|
-
? displayShortcutList[ keyCombination.modifier ](
|
|
10
|
-
keyCombination.character
|
|
11
|
-
)
|
|
12
|
-
: keyCombination.character;
|
|
13
|
-
const ariaLabel = keyCombination.modifier
|
|
14
|
-
? shortcutAriaLabel[ keyCombination.modifier ](
|
|
15
|
-
keyCombination.character
|
|
16
|
-
)
|
|
17
|
-
: keyCombination.character;
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<kbd
|
|
21
|
-
className="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
22
|
-
aria-label={ forceAriaLabel || ariaLabel }
|
|
23
|
-
>
|
|
24
|
-
{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(
|
|
25
|
-
( character, index ) => {
|
|
26
|
-
if ( character === '+' ) {
|
|
27
|
-
return <Fragment key={ index }>{ character }</Fragment>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return (
|
|
31
|
-
<kbd
|
|
32
|
-
key={ index }
|
|
33
|
-
className="edit-post-keyboard-shortcut-help-modal__shortcut-key"
|
|
34
|
-
>
|
|
35
|
-
{ character }
|
|
36
|
-
</kbd>
|
|
37
|
-
);
|
|
38
|
-
}
|
|
39
|
-
) }
|
|
40
|
-
</kbd>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
<div className="edit-post-keyboard-shortcut-help-modal__shortcut-description">
|
|
48
|
-
{ description }
|
|
49
|
-
</div>
|
|
50
|
-
<div className="edit-post-keyboard-shortcut-help-modal__shortcut-term">
|
|
51
|
-
<KeyCombination
|
|
52
|
-
keyCombination={ keyCombination }
|
|
53
|
-
forceAriaLabel={ ariaLabel }
|
|
54
|
-
/>
|
|
55
|
-
{ aliases.map( ( alias, index ) => (
|
|
56
|
-
<KeyCombination
|
|
57
|
-
keyCombination={ alias }
|
|
58
|
-
forceAriaLabel={ ariaLabel }
|
|
59
|
-
key={ index }
|
|
60
|
-
/>
|
|
61
|
-
) ) }
|
|
62
|
-
</div>
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export default Shortcut;
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
.edit-post-keyboard-shortcut-help-modal {
|
|
2
|
-
&__section {
|
|
3
|
-
margin: 0 0 2rem 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
&__section-title {
|
|
7
|
-
font-size: 0.9rem;
|
|
8
|
-
font-weight: 600;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
&__shortcut {
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: baseline;
|
|
14
|
-
padding: 0.6rem 0;
|
|
15
|
-
border-top: 1px solid $gray-300;
|
|
16
|
-
margin-bottom: 0;
|
|
17
|
-
|
|
18
|
-
&:last-child {
|
|
19
|
-
border-bottom: 1px solid $gray-300;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
&:empty {
|
|
23
|
-
display: none;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
&__shortcut-term {
|
|
28
|
-
font-weight: 600;
|
|
29
|
-
margin: 0 0 0 1rem;
|
|
30
|
-
text-align: right;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&__shortcut-description {
|
|
34
|
-
flex: 1;
|
|
35
|
-
margin: 0;
|
|
36
|
-
|
|
37
|
-
// IE 11 flex item fix - ensure the item does not collapse.
|
|
38
|
-
flex-basis: auto;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
&__shortcut-key-combination {
|
|
42
|
-
display: block;
|
|
43
|
-
background: none;
|
|
44
|
-
margin: 0;
|
|
45
|
-
padding: 0;
|
|
46
|
-
|
|
47
|
-
& + .edit-post-keyboard-shortcut-help-modal__shortcut-key-combination {
|
|
48
|
-
margin-top: 10px;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
&__shortcut-key {
|
|
53
|
-
padding: 0.25rem 0.5rem;
|
|
54
|
-
border-radius: 8%;
|
|
55
|
-
margin: 0 0.2rem 0 0.2rem;
|
|
56
|
-
|
|
57
|
-
&:last-child {
|
|
58
|
-
margin: 0 0 0 0.2rem;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { EditorKeyboardShortcutsRegister } from '@wordpress/editor';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import { KeyboardShortcutHelpModal } from '../index';
|
|
15
|
-
|
|
16
|
-
const noop = () => {};
|
|
17
|
-
|
|
18
|
-
describe( 'KeyboardShortcutHelpModal', () => {
|
|
19
|
-
it( 'should not render the modal when inactive', () => {
|
|
20
|
-
render(
|
|
21
|
-
<>
|
|
22
|
-
<EditorKeyboardShortcutsRegister />
|
|
23
|
-
<KeyboardShortcutHelpModal
|
|
24
|
-
isModalActive={ false }
|
|
25
|
-
toggleModal={ noop }
|
|
26
|
-
/>
|
|
27
|
-
</>
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
expect(
|
|
31
|
-
screen.queryByRole( 'dialog', {
|
|
32
|
-
name: 'Keyboard shortcuts',
|
|
33
|
-
} )
|
|
34
|
-
).not.toBeInTheDocument();
|
|
35
|
-
} );
|
|
36
|
-
} );
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Defines as extensibility slot for the Summary panel.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* WordPress dependencies
|
|
7
|
-
*/
|
|
8
|
-
import { createSlotFill, PanelRow } from '@wordpress/components';
|
|
9
|
-
|
|
10
|
-
const { Fill, Slot } = createSlotFill( 'PluginPostStatusInfo' );
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Renders a row in the Summary panel of the Document sidebar.
|
|
14
|
-
* It should be noted that this is named and implemented around the function it serves
|
|
15
|
-
* and not its location, which may change in future iterations.
|
|
16
|
-
*
|
|
17
|
-
* @param {Object} props Component properties.
|
|
18
|
-
* @param {string} [props.className] An optional class name added to the row.
|
|
19
|
-
* @param {Element} props.children Children to be rendered.
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* ```js
|
|
23
|
-
* // Using ES5 syntax
|
|
24
|
-
* var __ = wp.i18n.__;
|
|
25
|
-
* var PluginPostStatusInfo = wp.editPost.PluginPostStatusInfo;
|
|
26
|
-
*
|
|
27
|
-
* function MyPluginPostStatusInfo() {
|
|
28
|
-
* return React.createElement(
|
|
29
|
-
* PluginPostStatusInfo,
|
|
30
|
-
* {
|
|
31
|
-
* className: 'my-plugin-post-status-info',
|
|
32
|
-
* },
|
|
33
|
-
* __( 'My post status info' )
|
|
34
|
-
* )
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*
|
|
38
|
-
* @example
|
|
39
|
-
* ```jsx
|
|
40
|
-
* // Using ESNext syntax
|
|
41
|
-
* import { __ } from '@wordpress/i18n';
|
|
42
|
-
* import { PluginPostStatusInfo } from '@wordpress/edit-post';
|
|
43
|
-
*
|
|
44
|
-
* const MyPluginPostStatusInfo = () => (
|
|
45
|
-
* <PluginPostStatusInfo
|
|
46
|
-
* className="my-plugin-post-status-info"
|
|
47
|
-
* >
|
|
48
|
-
* { __( 'My post status info' ) }
|
|
49
|
-
* </PluginPostStatusInfo>
|
|
50
|
-
* );
|
|
51
|
-
* ```
|
|
52
|
-
*
|
|
53
|
-
* @return {Component} The component to be rendered.
|
|
54
|
-
*/
|
|
55
|
-
const PluginPostStatusInfo = ( { children, className } ) => (
|
|
56
|
-
<Fill>
|
|
57
|
-
<PanelRow className={ className }>{ children }</PanelRow>
|
|
58
|
-
</Fill>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
PluginPostStatusInfo.Slot = Slot;
|
|
62
|
-
|
|
63
|
-
export default PluginPostStatusInfo;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { SlotFillProvider } from '@wordpress/components';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import PluginPostStatusInfo from '../';
|
|
15
|
-
|
|
16
|
-
describe( 'PluginPostStatusInfo', () => {
|
|
17
|
-
test( 'renders fill properly', () => {
|
|
18
|
-
const { container } = render(
|
|
19
|
-
<SlotFillProvider>
|
|
20
|
-
<PluginPostStatusInfo className="my-plugin-post-status-info">
|
|
21
|
-
My plugin post status info
|
|
22
|
-
</PluginPostStatusInfo>
|
|
23
|
-
<PluginPostStatusInfo.Slot />
|
|
24
|
-
</SlotFillProvider>
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
expect( container ).toMatchSnapshot();
|
|
28
|
-
} );
|
|
29
|
-
} );
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { ComplementaryArea } from '@wordpress/interface';
|
|
5
|
-
import { useSelect } from '@wordpress/data';
|
|
6
|
-
import { __ } from '@wordpress/i18n';
|
|
7
|
-
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
8
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Renders a sidebar when activated. The contents within the `PluginSidebar` will appear as content within the sidebar.
|
|
12
|
-
* It also automatically renders a corresponding `PluginSidebarMenuItem` component when `isPinnable` flag is set to `true`.
|
|
13
|
-
* If you wish to display the sidebar, you can with use the `PluginSidebarMoreMenuItem` component or the `wp.data.dispatch` API:
|
|
14
|
-
*
|
|
15
|
-
* ```js
|
|
16
|
-
* wp.data.dispatch( 'core/edit-post' ).openGeneralSidebar( 'plugin-name/sidebar-name' );
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @see PluginSidebarMoreMenuItem
|
|
20
|
-
*
|
|
21
|
-
* @param {Object} props Element props.
|
|
22
|
-
* @param {string} props.name A string identifying the sidebar. Must be unique for every sidebar registered within the scope of your plugin.
|
|
23
|
-
* @param {string} [props.className] An optional class name added to the sidebar body.
|
|
24
|
-
* @param {string} props.title Title displayed at the top of the sidebar.
|
|
25
|
-
* @param {boolean} [props.isPinnable=true] Whether to allow to pin sidebar to the toolbar. When set to `true` it also automatically renders a corresponding menu item.
|
|
26
|
-
* @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```js
|
|
30
|
-
* // Using ES5 syntax
|
|
31
|
-
* var __ = wp.i18n.__;
|
|
32
|
-
* var el = React.createElement;
|
|
33
|
-
* var PanelBody = wp.components.PanelBody;
|
|
34
|
-
* var PluginSidebar = wp.editPost.PluginSidebar;
|
|
35
|
-
* var moreIcon = React.createElement( 'svg' ); //... svg element.
|
|
36
|
-
*
|
|
37
|
-
* function MyPluginSidebar() {
|
|
38
|
-
* return el(
|
|
39
|
-
* PluginSidebar,
|
|
40
|
-
* {
|
|
41
|
-
* name: 'my-sidebar',
|
|
42
|
-
* title: 'My sidebar title',
|
|
43
|
-
* icon: moreIcon,
|
|
44
|
-
* },
|
|
45
|
-
* el(
|
|
46
|
-
* PanelBody,
|
|
47
|
-
* {},
|
|
48
|
-
* __( 'My sidebar content' )
|
|
49
|
-
* )
|
|
50
|
-
* );
|
|
51
|
-
* }
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* ```jsx
|
|
56
|
-
* // Using ESNext syntax
|
|
57
|
-
* import { __ } from '@wordpress/i18n';
|
|
58
|
-
* import { PanelBody } from '@wordpress/components';
|
|
59
|
-
* import { PluginSidebar } from '@wordpress/edit-post';
|
|
60
|
-
* import { more } from '@wordpress/icons';
|
|
61
|
-
*
|
|
62
|
-
* const MyPluginSidebar = () => (
|
|
63
|
-
* <PluginSidebar
|
|
64
|
-
* name="my-sidebar"
|
|
65
|
-
* title="My sidebar title"
|
|
66
|
-
* icon={ more }
|
|
67
|
-
* >
|
|
68
|
-
* <PanelBody>
|
|
69
|
-
* { __( 'My sidebar content' ) }
|
|
70
|
-
* </PanelBody>
|
|
71
|
-
* </PluginSidebar>
|
|
72
|
-
* );
|
|
73
|
-
* ```
|
|
74
|
-
*/
|
|
75
|
-
export default function PluginSidebarEditPost( { className, ...props } ) {
|
|
76
|
-
const { postTitle, shortcut } = useSelect( ( select ) => {
|
|
77
|
-
return {
|
|
78
|
-
postTitle: select( editorStore ).getEditedPostAttribute( 'title' ),
|
|
79
|
-
shortcut: select(
|
|
80
|
-
keyboardShortcutsStore
|
|
81
|
-
).getShortcutRepresentation( 'core/edit-post/toggle-sidebar' ),
|
|
82
|
-
};
|
|
83
|
-
}, [] );
|
|
84
|
-
return (
|
|
85
|
-
<ComplementaryArea
|
|
86
|
-
panelClassName={ className }
|
|
87
|
-
className="edit-post-sidebar"
|
|
88
|
-
smallScreenTitle={ postTitle || __( '(no title)' ) }
|
|
89
|
-
scope="core/edit-post"
|
|
90
|
-
toggleShortcut={ shortcut }
|
|
91
|
-
{ ...props }
|
|
92
|
-
/>
|
|
93
|
-
);
|
|
94
|
-
}
|