@wordpress/edit-post 7.32.0 → 7.34.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 +4 -0
- package/README.md +17 -223
- 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 +20 -51
- 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 +17 -42
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
- package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build/components/init-pattern-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +0 -123
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +28 -29
- 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/index.js +3 -32
- 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/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 +35 -12
- 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 +68 -41
- 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/deprecated.js +132 -0
- package/build/deprecated.js.map +1 -0
- 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 +19 -62
- 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/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 +22 -53
- 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 +17 -42
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
- package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
- package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
- package/build-module/components/init-pattern-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -124
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +28 -29
- 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/index.js +4 -32
- 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/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 +36 -14
- 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 +71 -44
- 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/deprecated.js +116 -0
- package/build-module/deprecated.js.map +1 -0
- 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 +2 -15
- 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/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 +18 -589
- package/build-style/style.css +18 -589
- 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 +25 -71
- package/src/components/header/index.native.js +1 -1
- package/src/components/header/more-menu/index.js +27 -43
- package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
- package/src/components/header/style.scss +5 -82
- package/src/components/keyboard-shortcuts/index.js +2 -148
- package/src/components/layout/index.js +26 -47
- package/src/components/layout/style.scss +7 -80
- package/src/components/preferences-modal/index.js +3 -46
- package/src/components/sidebar/post-status/index.js +61 -24
- package/src/components/sidebar/settings-sidebar/index.js +113 -73
- 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/deprecated.js +107 -0
- package/src/editor.js +2 -2
- package/src/hooks/commands/use-common-commands.js +11 -26
- package/src/index.js +3 -20
- 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/header/post-publish-button-or-toggle.js +0 -91
- package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build/components/header/preferences-menu-item/index.js +0 -31
- package/build/components/header/preferences-menu-item/index.js.map +0 -1
- package/build/components/header/tools-more-menu-group/index.js +0 -26
- package/build/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build/components/header/writing-menu/index.js +0 -71
- package/build/components/header/writing-menu/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/layout/actions-panel.js +0 -86
- package/build/components/layout/actions-panel.js.map +0 -1
- package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
- package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
- package/build/components/sidebar/plugin-post-publish-panel/index.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-pre-publish-panel/index.js +0 -43
- package/build/components/sidebar/plugin-pre-publish-panel/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/plugins/copy-content-menu-item/index.js +0 -39
- package/build/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build/plugins/index.js +0 -69
- package/build/plugins/index.js.map +0 -1
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -41
- package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build/plugins/welcome-guide-menu-item/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/header/post-publish-button-or-toggle.js +0 -83
- package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
- package/build-module/components/header/preferences-menu-item/index.js +0 -24
- package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
- package/build-module/components/header/tools-more-menu-group/index.js +0 -19
- package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
- package/build-module/components/header/writing-menu/index.js +0 -64
- package/build-module/components/header/writing-menu/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/layout/actions-panel.js +0 -78
- package/build-module/components/layout/actions-panel.js.map +0 -1
- package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
- package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
- package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
- package/build-module/components/sidebar/plugin-post-publish-panel/index.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-pre-publish-panel/index.js +0 -36
- package/build-module/components/sidebar/plugin-pre-publish-panel/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/build-module/plugins/copy-content-menu-item/index.js +0 -32
- package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
- package/build-module/plugins/index.js +0 -65
- package/build-module/plugins/index.js.map +0 -1
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -33
- package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
- package/build-module/plugins/welcome-guide-menu-item/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/header/post-publish-button-or-toggle.js +0 -92
- package/src/components/header/preferences-menu-item/index.js +0 -25
- package/src/components/header/test/index.js +0 -51
- package/src/components/header/tools-more-menu-group/index.js +0 -20
- package/src/components/header/writing-menu/index.js +0 -73
- 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/layout/actions-panel.js +0 -103
- package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
- package/src/components/preferences-modal/test/index.js +0 -28
- package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
- 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-pre-publish-panel/index.js +0 -32
- 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
- package/src/plugins/copy-content-menu-item/index.js +0 -29
- package/src/plugins/index.js +0 -85
- package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -34
- /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { useDispatch } from '@wordpress/data';
|
|
5
|
-
import { MenuGroup } from '@wordpress/components';
|
|
6
|
-
import { __, _x } from '@wordpress/i18n';
|
|
7
|
-
import { useViewportMatch } from '@wordpress/compose';
|
|
8
|
-
import { displayShortcut } from '@wordpress/keycodes';
|
|
9
|
-
import {
|
|
10
|
-
PreferenceToggleMenuItem,
|
|
11
|
-
store as preferencesStore,
|
|
12
|
-
} from '@wordpress/preferences';
|
|
13
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
14
|
-
|
|
15
|
-
function WritingMenu() {
|
|
16
|
-
const { set: setPreference } = useDispatch( preferencesStore );
|
|
17
|
-
const { toggleDistractionFree } = useDispatch( editorStore );
|
|
18
|
-
|
|
19
|
-
const turnOffDistractionFree = () => {
|
|
20
|
-
setPreference( 'core', 'distractionFree', false );
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const isLargeViewport = useViewportMatch( 'medium' );
|
|
24
|
-
if ( ! isLargeViewport ) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
30
|
-
<PreferenceToggleMenuItem
|
|
31
|
-
scope="core"
|
|
32
|
-
name="fixedToolbar"
|
|
33
|
-
onToggle={ turnOffDistractionFree }
|
|
34
|
-
label={ __( 'Top toolbar' ) }
|
|
35
|
-
info={ __(
|
|
36
|
-
'Access all block and document tools in a single place'
|
|
37
|
-
) }
|
|
38
|
-
messageActivated={ __( 'Top toolbar activated' ) }
|
|
39
|
-
messageDeactivated={ __( 'Top toolbar deactivated' ) }
|
|
40
|
-
/>
|
|
41
|
-
<PreferenceToggleMenuItem
|
|
42
|
-
scope="core"
|
|
43
|
-
name="distractionFree"
|
|
44
|
-
handleToggling={ false }
|
|
45
|
-
onToggle={ toggleDistractionFree }
|
|
46
|
-
label={ __( 'Distraction free' ) }
|
|
47
|
-
info={ __( 'Write with calmness' ) }
|
|
48
|
-
messageActivated={ __( 'Distraction free mode activated' ) }
|
|
49
|
-
messageDeactivated={ __( 'Distraction free mode deactivated' ) }
|
|
50
|
-
shortcut={ displayShortcut.primaryShift( '\\' ) }
|
|
51
|
-
/>
|
|
52
|
-
<PreferenceToggleMenuItem
|
|
53
|
-
scope="core"
|
|
54
|
-
name="focusMode"
|
|
55
|
-
label={ __( 'Spotlight mode' ) }
|
|
56
|
-
info={ __( 'Focus on one block at a time' ) }
|
|
57
|
-
messageActivated={ __( 'Spotlight mode activated' ) }
|
|
58
|
-
messageDeactivated={ __( 'Spotlight mode deactivated' ) }
|
|
59
|
-
/>
|
|
60
|
-
<PreferenceToggleMenuItem
|
|
61
|
-
scope="core/edit-post"
|
|
62
|
-
name="fullscreenMode"
|
|
63
|
-
label={ __( 'Fullscreen mode' ) }
|
|
64
|
-
info={ __( 'Show and hide the admin user interface' ) }
|
|
65
|
-
messageActivated={ __( 'Fullscreen mode activated' ) }
|
|
66
|
-
messageDeactivated={ __( 'Fullscreen mode deactivated' ) }
|
|
67
|
-
shortcut={ displayShortcut.secondary( 'f' ) }
|
|
68
|
-
/>
|
|
69
|
-
</MenuGroup>
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export default WritingMenu;
|
|
@@ -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,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import {
|
|
5
|
-
EntitiesSavedStates,
|
|
6
|
-
PostPublishPanel,
|
|
7
|
-
PluginPrePublishPanel,
|
|
8
|
-
PluginPostPublishPanel,
|
|
9
|
-
store as editorStore,
|
|
10
|
-
} from '@wordpress/editor';
|
|
11
|
-
import { useSelect, useDispatch } from '@wordpress/data';
|
|
12
|
-
import { Button, createSlotFill } from '@wordpress/components';
|
|
13
|
-
import { __ } from '@wordpress/i18n';
|
|
14
|
-
import { useCallback } from '@wordpress/element';
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Internal dependencies
|
|
18
|
-
*/
|
|
19
|
-
import { store as editPostStore } from '../../store';
|
|
20
|
-
|
|
21
|
-
const { Fill, Slot } = createSlotFill( 'ActionsPanel' );
|
|
22
|
-
|
|
23
|
-
export const ActionsPanelFill = Fill;
|
|
24
|
-
|
|
25
|
-
export default function ActionsPanel( {
|
|
26
|
-
setEntitiesSavedStatesCallback,
|
|
27
|
-
closeEntitiesSavedStates,
|
|
28
|
-
isEntitiesSavedStatesOpen,
|
|
29
|
-
} ) {
|
|
30
|
-
const { closePublishSidebar, togglePublishSidebar } =
|
|
31
|
-
useDispatch( editorStore );
|
|
32
|
-
const {
|
|
33
|
-
publishSidebarOpened,
|
|
34
|
-
hasActiveMetaboxes,
|
|
35
|
-
hasNonPostEntityChanges,
|
|
36
|
-
} = useSelect(
|
|
37
|
-
( select ) => ( {
|
|
38
|
-
publishSidebarOpened:
|
|
39
|
-
select( editorStore ).isPublishSidebarOpened(),
|
|
40
|
-
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
41
|
-
hasNonPostEntityChanges:
|
|
42
|
-
select( editorStore ).hasNonPostEntityChanges(),
|
|
43
|
-
} ),
|
|
44
|
-
[]
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
const openEntitiesSavedStates = useCallback(
|
|
48
|
-
() => setEntitiesSavedStatesCallback( true ),
|
|
49
|
-
[]
|
|
50
|
-
);
|
|
51
|
-
|
|
52
|
-
// It is ok for these components to be unmounted when not in visual use.
|
|
53
|
-
// We don't want more than one present at a time, decide which to render.
|
|
54
|
-
let unmountableContent;
|
|
55
|
-
if ( publishSidebarOpened ) {
|
|
56
|
-
unmountableContent = (
|
|
57
|
-
<PostPublishPanel
|
|
58
|
-
onClose={ closePublishSidebar }
|
|
59
|
-
forceIsDirty={ hasActiveMetaboxes }
|
|
60
|
-
PrePublishExtension={ PluginPrePublishPanel.Slot }
|
|
61
|
-
PostPublishExtension={ PluginPostPublishPanel.Slot }
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
} else if ( hasNonPostEntityChanges ) {
|
|
65
|
-
unmountableContent = (
|
|
66
|
-
<div className="edit-post-layout__toggle-entities-saved-states-panel">
|
|
67
|
-
<Button
|
|
68
|
-
variant="secondary"
|
|
69
|
-
className="edit-post-layout__toggle-entities-saved-states-panel-button"
|
|
70
|
-
onClick={ openEntitiesSavedStates }
|
|
71
|
-
aria-expanded={ false }
|
|
72
|
-
>
|
|
73
|
-
{ __( 'Open save panel' ) }
|
|
74
|
-
</Button>
|
|
75
|
-
</div>
|
|
76
|
-
);
|
|
77
|
-
} else {
|
|
78
|
-
unmountableContent = (
|
|
79
|
-
<div className="edit-post-layout__toggle-publish-panel">
|
|
80
|
-
<Button
|
|
81
|
-
variant="secondary"
|
|
82
|
-
className="edit-post-layout__toggle-publish-panel-button"
|
|
83
|
-
onClick={ togglePublishSidebar }
|
|
84
|
-
aria-expanded={ false }
|
|
85
|
-
>
|
|
86
|
-
{ __( 'Open publish panel' ) }
|
|
87
|
-
</Button>
|
|
88
|
-
</div>
|
|
89
|
-
);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Since EntitiesSavedStates controls its own panel, we can keep it
|
|
93
|
-
// always mounted to retain its own component state (such as checkboxes).
|
|
94
|
-
return (
|
|
95
|
-
<>
|
|
96
|
-
{ isEntitiesSavedStatesOpen && (
|
|
97
|
-
<EntitiesSavedStates close={ closeEntitiesSavedStates } />
|
|
98
|
-
) }
|
|
99
|
-
<Slot bubblesVirtually />
|
|
100
|
-
{ ! isEntitiesSavedStatesOpen && unmountableContent }
|
|
101
|
-
</>
|
|
102
|
-
);
|
|
103
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { compose } from '@wordpress/compose';
|
|
5
|
-
import { withSelect, withDispatch } from '@wordpress/data';
|
|
6
|
-
import { ifViewportMatches } from '@wordpress/viewport';
|
|
7
|
-
import { store as editorStore } from '@wordpress/editor';
|
|
8
|
-
import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Internal dependencies
|
|
12
|
-
*/
|
|
13
|
-
import { unlock } from '../../lock-unlock';
|
|
14
|
-
|
|
15
|
-
const { PreferenceBaseOption } = unlock( preferencesPrivateApis );
|
|
16
|
-
|
|
17
|
-
export default compose(
|
|
18
|
-
withSelect( ( select ) => ( {
|
|
19
|
-
isChecked: select( editorStore ).isPublishSidebarEnabled(),
|
|
20
|
-
} ) ),
|
|
21
|
-
withDispatch( ( dispatch ) => {
|
|
22
|
-
const { enablePublishSidebar, disablePublishSidebar } =
|
|
23
|
-
dispatch( editorStore );
|
|
24
|
-
return {
|
|
25
|
-
onChange: ( isEnabled ) =>
|
|
26
|
-
isEnabled ? enablePublishSidebar() : disablePublishSidebar(),
|
|
27
|
-
};
|
|
28
|
-
} ),
|
|
29
|
-
// In < medium viewports we override this option and always show the publish sidebar.
|
|
30
|
-
// See the edit-post's header component for the specific logic.
|
|
31
|
-
ifViewportMatches( 'medium' )
|
|
32
|
-
)( PreferenceBaseOption );
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { useSelect } from '@wordpress/data';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
|
-
import EditPostPreferencesModal from '../';
|
|
15
|
-
|
|
16
|
-
// This allows us to tweak the returned value on each test.
|
|
17
|
-
jest.mock( '@wordpress/data/src/components/use-select', () => jest.fn() );
|
|
18
|
-
jest.mock( '@wordpress/compose/src/hooks/use-viewport-match', () => jest.fn() );
|
|
19
|
-
|
|
20
|
-
describe( 'EditPostPreferencesModal', () => {
|
|
21
|
-
it( 'should not render when the modal is not active', () => {
|
|
22
|
-
useSelect.mockImplementation( () => [ false, false, false ] );
|
|
23
|
-
render( <EditPostPreferencesModal /> );
|
|
24
|
-
expect(
|
|
25
|
-
screen.queryByRole( 'dialog', { name: 'Preferences' } )
|
|
26
|
-
).not.toBeInTheDocument();
|
|
27
|
-
} );
|
|
28
|
-
} );
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
|
-
import deprecated from '@wordpress/deprecated';
|
|
5
|
-
import { PluginPostPublishPanel } from '@wordpress/editor';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Renders provided content to the post-publish panel in the publish flow
|
|
9
|
-
* (side panel that opens after a user publishes the post).
|
|
10
|
-
*
|
|
11
|
-
* @deprecated since 6.6, use `wp.editor.PluginPostPublishPanel` instead.
|
|
12
|
-
*
|
|
13
|
-
* @param {Object} props Component properties.
|
|
14
|
-
* @param {string} [props.className] An optional class name added to the panel.
|
|
15
|
-
* @param {string} [props.title] Title displayed at the top of the panel.
|
|
16
|
-
* @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
|
|
17
|
-
* @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.
|
|
18
|
-
* @param {Element} props.children Children to be rendered
|
|
19
|
-
* @return {Component} The component to be rendered.
|
|
20
|
-
*/
|
|
21
|
-
export default function EditPostPluginPostPublishPanel( props ) {
|
|
22
|
-
deprecated( 'wp.editPost.PluginPostPublishPanel', {
|
|
23
|
-
since: '6.6',
|
|
24
|
-
version: '6.8',
|
|
25
|
-
alternative: 'wp.editor.PluginPostPublishPanel',
|
|
26
|
-
} );
|
|
27
|
-
return <PluginPostPublishPanel { ...props } />;
|
|
28
|
-
}
|