@wordpress/edit-post 5.0.1-next.5df0cd52b7.0 → 5.0.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/README.md +2 -5
- package/build/components/header/fullscreen-mode-close/index.js +19 -3
- package/build/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.native.js +10 -3
- package/build/components/header/header-toolbar/index.native.js.map +1 -1
- package/build/components/header/more-menu/index.js +3 -14
- package/build/components/header/more-menu/index.js.map +1 -1
- package/build/components/header/template-title/index.js +1 -1
- package/build/components/header/template-title/index.js.map +1 -1
- package/build/components/header/writing-menu/index.js +7 -10
- package/build/components/header/writing-menu/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +1 -8
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +3 -5
- package/build/components/layout/index.js.map +1 -1
- package/build/components/layout/index.native.js +5 -1
- package/build/components/layout/index.native.js.map +1 -1
- package/build/components/meta-boxes/index.js +39 -19
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +56 -18
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +1 -0
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js +1 -1
- package/build/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build/components/sidebar/post-link/index.js +1 -1
- package/build/components/sidebar/post-link/index.js.map +1 -1
- package/build/components/sidebar/template/actions.js +6 -1
- package/build/components/sidebar/template/actions.js.map +1 -1
- package/build/components/sidebar/template-summary/index.js +2 -1
- package/build/components/sidebar/template-summary/index.js.map +1 -1
- package/build/components/visual-editor/index.js +6 -4
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +9 -5
- package/build/editor.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +1 -1
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/index.js +27 -12
- package/build/index.js.map +1 -1
- package/build/plugins/welcome-guide-menu-item/index.js +6 -7
- package/build/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build/store/actions.js +68 -59
- package/build/store/actions.js.map +1 -1
- package/build/store/defaults.js +0 -9
- package/build/store/defaults.js.map +1 -1
- package/build/store/reducer.js +20 -11
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +24 -10
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/header/fullscreen-mode-close/index.js +19 -4
- package/build-module/components/header/fullscreen-mode-close/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.native.js +11 -4
- package/build-module/components/header/header-toolbar/index.native.js.map +1 -1
- package/build-module/components/header/more-menu/index.js +5 -15
- package/build-module/components/header/more-menu/index.js.map +1 -1
- package/build-module/components/header/template-title/index.js +1 -1
- package/build-module/components/header/template-title/index.js.map +1 -1
- package/build-module/components/header/writing-menu/index.js +7 -8
- package/build-module/components/header/writing-menu/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +1 -8
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +4 -6
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/layout/index.native.js +5 -1
- package/build-module/components/layout/index.native.js.map +1 -1
- package/build-module/components/meta-boxes/index.js +40 -19
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +57 -20
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js +2 -1
- package/build-module/components/secondary-sidebar/inserter-sidebar.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +1 -0
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js +1 -1
- package/build-module/components/sidebar/plugin-sidebar/index.js.map +1 -1
- package/build-module/components/sidebar/post-link/index.js +1 -1
- package/build-module/components/sidebar/post-link/index.js.map +1 -1
- package/build-module/components/sidebar/template/actions.js +6 -1
- package/build-module/components/sidebar/template/actions.js.map +1 -1
- package/build-module/components/sidebar/template-summary/index.js +2 -1
- package/build-module/components/sidebar/template-summary/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +6 -4
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +9 -6
- package/build-module/editor.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +1 -1
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/index.js +17 -5
- package/build-module/index.js.map +1 -1
- package/build-module/plugins/welcome-guide-menu-item/index.js +7 -8
- package/build-module/plugins/welcome-guide-menu-item/index.js.map +1 -1
- package/build-module/store/actions.js +66 -59
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/defaults.js +0 -9
- package/build-module/store/defaults.js.map +1 -1
- package/build-module/store/reducer.js +20 -11
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +20 -7
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +68 -69
- package/build-style/style.css +68 -69
- package/package.json +27 -27
- package/src/components/header/fullscreen-mode-close/index.js +37 -15
- package/src/components/header/fullscreen-mode-close/style.scss +2 -2
- package/src/components/header/header-toolbar/index.native.js +8 -2
- package/src/components/header/more-menu/index.js +8 -13
- package/src/components/header/template-title/index.js +3 -1
- package/src/components/header/writing-menu/index.js +7 -8
- package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +15 -12
- package/src/components/keyboard-shortcut-help-modal/index.js +1 -3
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +2 -2
- package/src/components/keyboard-shortcuts/index.js +19 -32
- package/src/components/layout/index.js +4 -10
- package/src/components/layout/index.native.js +7 -1
- package/src/components/meta-boxes/index.js +41 -13
- package/src/components/preferences-modal/index.js +93 -30
- package/src/components/preferences-modal/style.scss +6 -56
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +334 -136
- package/src/components/secondary-sidebar/inserter-sidebar.js +1 -0
- package/src/components/secondary-sidebar/list-view-sidebar.js +1 -0
- package/src/components/sidebar/plugin-sidebar/index.js +1 -1
- package/src/components/sidebar/post-link/index.js +5 -1
- package/src/components/sidebar/template/actions.js +6 -1
- package/src/components/sidebar/template-summary/index.js +1 -1
- package/src/components/sidebar/template-summary/style.scss +2 -1
- package/src/components/text-editor/style.scss +12 -22
- package/src/components/visual-editor/index.js +16 -10
- package/src/components/visual-editor/style.scss +4 -7
- package/src/components/welcome-guide/style.scss +5 -0
- package/src/editor.js +88 -79
- package/src/hooks/validate-multiple-use/index.js +1 -1
- package/src/index.js +17 -5
- package/src/plugins/welcome-guide-menu-item/index.js +7 -12
- package/src/store/actions.js +99 -80
- package/src/store/defaults.js +0 -9
- package/src/store/reducer.js +17 -10
- package/src/store/selectors.js +27 -7
- package/src/store/test/actions.js +0 -11
- package/src/store/test/reducer.js +0 -12
- package/src/store/test/selectors.js +0 -46
- package/build/components/header/feature-toggle/index.js +0 -76
- package/build/components/header/feature-toggle/index.js.map +0 -1
- package/build-module/components/header/feature-toggle/index.js +0 -60
- package/build-module/components/header/feature-toggle/index.js.map +0 -1
- package/src/components/header/feature-toggle/index.js +0 -61
- package/src/components/header/more-menu/test/__snapshots__/index.js.snap +0 -129
- package/src/components/header/more-menu/test/index.js +0 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/edit-post",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
4
|
"description": "Edit Post module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -27,31 +27,31 @@
|
|
|
27
27
|
"react-native": "src/index",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@babel/runtime": "^7.13.10",
|
|
30
|
-
"@wordpress/a11y": "^3.2.
|
|
31
|
-
"@wordpress/api-fetch": "^5.2.
|
|
32
|
-
"@wordpress/block-editor": "^7.0.
|
|
33
|
-
"@wordpress/block-library": "^6.0.
|
|
34
|
-
"@wordpress/blocks": "^11.
|
|
35
|
-
"@wordpress/components": "^
|
|
36
|
-
"@wordpress/compose": "^5.0.
|
|
37
|
-
"@wordpress/core-data": "^4.0.
|
|
38
|
-
"@wordpress/data": "^6.
|
|
39
|
-
"@wordpress/data-controls": "^2.2.
|
|
40
|
-
"@wordpress/editor": "^
|
|
41
|
-
"@wordpress/element": "^4.0.
|
|
42
|
-
"@wordpress/hooks": "^3.2.1
|
|
43
|
-
"@wordpress/i18n": "^4.2.
|
|
44
|
-
"@wordpress/icons": "^
|
|
45
|
-
"@wordpress/interface": "^4.
|
|
46
|
-
"@wordpress/keyboard-shortcuts": "^3.0.
|
|
47
|
-
"@wordpress/keycodes": "^3.2.
|
|
48
|
-
"@wordpress/media-utils": "^3.0.
|
|
49
|
-
"@wordpress/notices": "^3.2.
|
|
50
|
-
"@wordpress/plugins": "^4.0.
|
|
51
|
-
"@wordpress/primitives": "^3.0.
|
|
52
|
-
"@wordpress/url": "^3.2.
|
|
53
|
-
"@wordpress/viewport": "^4.0.
|
|
54
|
-
"@wordpress/warning": "^2.2.2
|
|
30
|
+
"@wordpress/a11y": "^3.2.3",
|
|
31
|
+
"@wordpress/api-fetch": "^5.2.4",
|
|
32
|
+
"@wordpress/block-editor": "^7.0.4",
|
|
33
|
+
"@wordpress/block-library": "^6.0.2",
|
|
34
|
+
"@wordpress/blocks": "^11.1.2",
|
|
35
|
+
"@wordpress/components": "^19.0.0",
|
|
36
|
+
"@wordpress/compose": "^5.0.4",
|
|
37
|
+
"@wordpress/core-data": "^4.0.4",
|
|
38
|
+
"@wordpress/data": "^6.1.2",
|
|
39
|
+
"@wordpress/data-controls": "^2.2.5",
|
|
40
|
+
"@wordpress/editor": "^12.0.1",
|
|
41
|
+
"@wordpress/element": "^4.0.3",
|
|
42
|
+
"@wordpress/hooks": "^3.2.1",
|
|
43
|
+
"@wordpress/i18n": "^4.2.3",
|
|
44
|
+
"@wordpress/icons": "^6.0.1",
|
|
45
|
+
"@wordpress/interface": "^4.1.2",
|
|
46
|
+
"@wordpress/keyboard-shortcuts": "^3.0.4",
|
|
47
|
+
"@wordpress/keycodes": "^3.2.3",
|
|
48
|
+
"@wordpress/media-utils": "^3.0.3",
|
|
49
|
+
"@wordpress/notices": "^3.2.5",
|
|
50
|
+
"@wordpress/plugins": "^4.0.4",
|
|
51
|
+
"@wordpress/primitives": "^3.0.3",
|
|
52
|
+
"@wordpress/url": "^3.2.3",
|
|
53
|
+
"@wordpress/viewport": "^4.0.4",
|
|
54
|
+
"@wordpress/warning": "^2.2.2",
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"lodash": "^4.17.21",
|
|
57
57
|
"memize": "^1.1.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"publishConfig": {
|
|
62
62
|
"access": "public"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "157f4ae53ab98e574af01f72213ae5a9613159ff"
|
|
65
65
|
}
|
|
@@ -7,12 +7,17 @@ import { get } from 'lodash';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { useSelect } from '@wordpress/data';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
Button,
|
|
12
|
+
Icon,
|
|
13
|
+
__unstableMotion as motion,
|
|
14
|
+
} from '@wordpress/components';
|
|
11
15
|
import { __ } from '@wordpress/i18n';
|
|
12
16
|
import { addQueryArgs } from '@wordpress/url';
|
|
13
17
|
import { wordpress } from '@wordpress/icons';
|
|
14
18
|
import { store as editorStore } from '@wordpress/editor';
|
|
15
19
|
import { store as coreStore } from '@wordpress/core-data';
|
|
20
|
+
import { useReducedMotion } from '@wordpress/compose';
|
|
16
21
|
|
|
17
22
|
/**
|
|
18
23
|
* Internal dependencies
|
|
@@ -44,15 +49,26 @@ function FullscreenModeClose( { showTooltip, icon, href } ) {
|
|
|
44
49
|
[]
|
|
45
50
|
);
|
|
46
51
|
|
|
52
|
+
const disableMotion = useReducedMotion();
|
|
53
|
+
|
|
47
54
|
if ( ! isActive || ! postType ) {
|
|
48
55
|
return null;
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
let buttonIcon = <Icon size="36px" icon={ wordpress } />;
|
|
52
59
|
|
|
60
|
+
const effect = {
|
|
61
|
+
expand: {
|
|
62
|
+
scale: 1.7,
|
|
63
|
+
borderRadius: 0,
|
|
64
|
+
transition: { type: 'tween', duration: '0.2' },
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
|
|
53
68
|
if ( siteIconUrl ) {
|
|
54
69
|
buttonIcon = (
|
|
55
|
-
<img
|
|
70
|
+
<motion.img
|
|
71
|
+
variants={ ! disableMotion && effect }
|
|
56
72
|
alt={ __( 'Site Icon' ) }
|
|
57
73
|
className="edit-post-fullscreen-mode-close_site-icon"
|
|
58
74
|
src={ siteIconUrl }
|
|
@@ -70,19 +86,25 @@ function FullscreenModeClose( { showTooltip, icon, href } ) {
|
|
|
70
86
|
}
|
|
71
87
|
|
|
72
88
|
return (
|
|
73
|
-
<
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
href
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
<motion.div whileHover="expand">
|
|
90
|
+
<Button
|
|
91
|
+
className="edit-post-fullscreen-mode-close has-icon"
|
|
92
|
+
href={
|
|
93
|
+
href ??
|
|
94
|
+
addQueryArgs( 'edit.php', {
|
|
95
|
+
post_type: postType.slug,
|
|
96
|
+
} )
|
|
97
|
+
}
|
|
98
|
+
label={ get(
|
|
99
|
+
postType,
|
|
100
|
+
[ 'labels', 'view_items' ],
|
|
101
|
+
__( 'Back' )
|
|
102
|
+
) }
|
|
103
|
+
showTooltip={ showTooltip }
|
|
104
|
+
>
|
|
105
|
+
{ buttonIcon }
|
|
106
|
+
</Button>
|
|
107
|
+
</motion.div>
|
|
86
108
|
);
|
|
87
109
|
}
|
|
88
110
|
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
align-items: center;
|
|
12
12
|
align-self: stretch;
|
|
13
13
|
border: none;
|
|
14
|
-
background:
|
|
14
|
+
background: $gray-900;
|
|
15
15
|
color: $white;
|
|
16
16
|
border-radius: 0;
|
|
17
17
|
height: $header-height + $border-width;
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
bottom: 9px;
|
|
39
39
|
left: 9px;
|
|
40
40
|
border-radius: $radius-block-ui + $border-width + $border-width;
|
|
41
|
-
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus)
|
|
41
|
+
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-900;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
// Hover color.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { ScrollView, View } from 'react-native';
|
|
4
|
+
import { Platform, ScrollView, View } from 'react-native';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -43,7 +43,13 @@ function HeaderToolbar( {
|
|
|
43
43
|
} ) {
|
|
44
44
|
const scrollViewRef = useRef( null );
|
|
45
45
|
const scrollToStart = () => {
|
|
46
|
-
|
|
46
|
+
// scrollview doesn't seem to automatically adjust to RTL on Android so, scroll to end when Android
|
|
47
|
+
const isAndroid = Platform.OS === 'android';
|
|
48
|
+
if ( isAndroid && isRTL ) {
|
|
49
|
+
scrollViewRef.current.scrollToEnd();
|
|
50
|
+
} else {
|
|
51
|
+
scrollViewRef.current.scrollTo( { x: 0 } );
|
|
52
|
+
}
|
|
47
53
|
};
|
|
48
54
|
const renderHistoryButtons = () => {
|
|
49
55
|
const buttons = [
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* WordPress dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { __ } from '@wordpress/i18n';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
5
|
+
import { MenuGroup } from '@wordpress/components';
|
|
6
|
+
import {
|
|
7
|
+
ActionItem,
|
|
8
|
+
MoreMenuDropdown,
|
|
9
|
+
PinnedItems,
|
|
10
|
+
} from '@wordpress/interface';
|
|
8
11
|
import { useViewportMatch } from '@wordpress/compose';
|
|
9
12
|
|
|
10
13
|
/**
|
|
@@ -17,26 +20,18 @@ import WritingMenu from '../writing-menu';
|
|
|
17
20
|
|
|
18
21
|
const POPOVER_PROPS = {
|
|
19
22
|
className: 'edit-post-more-menu__content',
|
|
20
|
-
position: 'bottom left',
|
|
21
|
-
};
|
|
22
|
-
const TOGGLE_PROPS = {
|
|
23
|
-
tooltipPosition: 'bottom',
|
|
24
23
|
};
|
|
25
24
|
|
|
26
25
|
const MoreMenu = ( { showIconLabels } ) => {
|
|
27
26
|
const isLargeViewport = useViewportMatch( 'large' );
|
|
28
27
|
|
|
29
28
|
return (
|
|
30
|
-
<
|
|
29
|
+
<MoreMenuDropdown
|
|
31
30
|
className="edit-post-more-menu"
|
|
32
|
-
icon={ moreVertical }
|
|
33
|
-
/* translators: button label text should, if possible, be under 16 characters. */
|
|
34
|
-
label={ __( 'Options' ) }
|
|
35
31
|
popoverProps={ POPOVER_PROPS }
|
|
36
32
|
toggleProps={ {
|
|
37
33
|
showTooltip: ! showIconLabels,
|
|
38
34
|
...( showIconLabels && { variant: 'tertiary' } ),
|
|
39
|
-
...TOGGLE_PROPS,
|
|
40
35
|
} }
|
|
41
36
|
>
|
|
42
37
|
{ ( { onClose } ) => (
|
|
@@ -61,7 +56,7 @@ const MoreMenu = ( { showIconLabels } ) => {
|
|
|
61
56
|
</MenuGroup>
|
|
62
57
|
</>
|
|
63
58
|
) }
|
|
64
|
-
</
|
|
59
|
+
</MoreMenuDropdown>
|
|
65
60
|
);
|
|
66
61
|
};
|
|
67
62
|
|
|
@@ -28,7 +28,9 @@ function TemplateTitle() {
|
|
|
28
28
|
return {
|
|
29
29
|
template: _isEditing ? getEditedPostTemplate() : null,
|
|
30
30
|
isEditing: _isEditing,
|
|
31
|
-
title: getEditedPostAttribute( 'title' )
|
|
31
|
+
title: getEditedPostAttribute( 'title' )
|
|
32
|
+
? getEditedPostAttribute( 'title' )
|
|
33
|
+
: __( 'Untitled' ),
|
|
32
34
|
};
|
|
33
35
|
}, [] );
|
|
34
36
|
|
|
@@ -5,11 +5,7 @@ import { MenuGroup } from '@wordpress/components';
|
|
|
5
5
|
import { __, _x } from '@wordpress/i18n';
|
|
6
6
|
import { useViewportMatch } from '@wordpress/compose';
|
|
7
7
|
import { displayShortcut } from '@wordpress/keycodes';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
|
-
import FeatureToggle from '../feature-toggle';
|
|
8
|
+
import { MoreMenuFeatureToggle } from '@wordpress/interface';
|
|
13
9
|
|
|
14
10
|
function WritingMenu() {
|
|
15
11
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
@@ -19,7 +15,8 @@ function WritingMenu() {
|
|
|
19
15
|
|
|
20
16
|
return (
|
|
21
17
|
<MenuGroup label={ _x( 'View', 'noun' ) }>
|
|
22
|
-
<
|
|
18
|
+
<MoreMenuFeatureToggle
|
|
19
|
+
scope="core/edit-post"
|
|
23
20
|
feature="fixedToolbar"
|
|
24
21
|
label={ __( 'Top toolbar' ) }
|
|
25
22
|
info={ __(
|
|
@@ -28,14 +25,16 @@ function WritingMenu() {
|
|
|
28
25
|
messageActivated={ __( 'Top toolbar activated' ) }
|
|
29
26
|
messageDeactivated={ __( 'Top toolbar deactivated' ) }
|
|
30
27
|
/>
|
|
31
|
-
<
|
|
28
|
+
<MoreMenuFeatureToggle
|
|
29
|
+
scope="core/edit-post"
|
|
32
30
|
feature="focusMode"
|
|
33
31
|
label={ __( 'Spotlight mode' ) }
|
|
34
32
|
info={ __( 'Focus on one block at a time' ) }
|
|
35
33
|
messageActivated={ __( 'Spotlight mode activated' ) }
|
|
36
34
|
messageDeactivated={ __( 'Spotlight mode deactivated' ) }
|
|
37
35
|
/>
|
|
38
|
-
<
|
|
36
|
+
<MoreMenuFeatureToggle
|
|
37
|
+
scope="core/edit-post"
|
|
39
38
|
feature="fullscreenMode"
|
|
40
39
|
label={ __( 'Fullscreen mode' ) }
|
|
41
40
|
info={ __( 'Work without distraction' ) }
|
|
@@ -10,19 +10,22 @@ import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
|
10
10
|
import Shortcut from './shortcut';
|
|
11
11
|
|
|
12
12
|
function DynamicShortcut( { name } ) {
|
|
13
|
-
const { keyCombination, description, aliases } = useSelect(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
const { keyCombination, description, aliases } = useSelect(
|
|
14
|
+
( select ) => {
|
|
15
|
+
const {
|
|
16
|
+
getShortcutKeyCombination,
|
|
17
|
+
getShortcutDescription,
|
|
18
|
+
getShortcutAliases,
|
|
19
|
+
} = select( keyboardShortcutsStore );
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
return {
|
|
22
|
+
keyCombination: getShortcutKeyCombination( name ),
|
|
23
|
+
aliases: getShortcutAliases( name ),
|
|
24
|
+
description: getShortcutDescription( name ),
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
[ name ]
|
|
28
|
+
);
|
|
26
29
|
|
|
27
30
|
if ( ! keyCombination ) {
|
|
28
31
|
return null;
|
|
@@ -91,9 +91,7 @@ const ShortcutCategorySection = ( {
|
|
|
91
91
|
};
|
|
92
92
|
|
|
93
93
|
export function KeyboardShortcutHelpModal( { isModalActive, toggleModal } ) {
|
|
94
|
-
useShortcut( 'core/edit-post/keyboard-shortcuts', toggleModal
|
|
95
|
-
bindGlobal: true,
|
|
96
|
-
} );
|
|
94
|
+
useShortcut( 'core/edit-post/keyboard-shortcuts', toggleModal );
|
|
97
95
|
|
|
98
96
|
if ( ! isModalActive ) {
|
|
99
97
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`KeyboardShortcutHelpModal should match snapshot when the modal is active 1`] = `
|
|
4
|
-
<
|
|
4
|
+
<Modal
|
|
5
5
|
className="edit-post-keyboard-shortcut-help-modal"
|
|
6
6
|
closeLabel="Close"
|
|
7
7
|
onRequestClose={[Function]}
|
|
@@ -80,7 +80,7 @@ exports[`KeyboardShortcutHelpModal should match snapshot when the modal is activ
|
|
|
80
80
|
}
|
|
81
81
|
title="Text formatting"
|
|
82
82
|
/>
|
|
83
|
-
</
|
|
83
|
+
</Modal>
|
|
84
84
|
`;
|
|
85
85
|
|
|
86
86
|
exports[`KeyboardShortcutHelpModal should match snapshot when the modal is not active 1`] = `""`;
|
|
@@ -131,44 +131,31 @@ function KeyboardShortcuts() {
|
|
|
131
131
|
);
|
|
132
132
|
},
|
|
133
133
|
{
|
|
134
|
-
bindGlobal: true,
|
|
135
134
|
isDisabled: isModeToggleDisabled,
|
|
136
135
|
}
|
|
137
136
|
);
|
|
138
137
|
|
|
139
|
-
useShortcut(
|
|
140
|
-
'
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
138
|
+
useShortcut( 'core/edit-post/toggle-fullscreen', () => {
|
|
139
|
+
toggleFeature( 'fullscreenMode' );
|
|
140
|
+
} );
|
|
141
|
+
|
|
142
|
+
useShortcut( 'core/edit-post/toggle-sidebar', ( event ) => {
|
|
143
|
+
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
144
|
+
// obscure shortcuts from triggering.
|
|
145
|
+
event.preventDefault();
|
|
146
|
+
|
|
147
|
+
if ( isEditorSidebarOpened() ) {
|
|
148
|
+
closeGeneralSidebar();
|
|
149
|
+
} else {
|
|
150
|
+
const sidebarToOpen = getBlockSelectionStart()
|
|
151
|
+
? 'edit-post/block'
|
|
152
|
+
: 'edit-post/document';
|
|
153
|
+
openGeneralSidebar( sidebarToOpen );
|
|
146
154
|
}
|
|
147
|
-
);
|
|
155
|
+
} );
|
|
148
156
|
|
|
149
|
-
useShortcut(
|
|
150
|
-
|
|
151
|
-
( event ) => {
|
|
152
|
-
// This shortcut has no known clashes, but use preventDefault to prevent any
|
|
153
|
-
// obscure shortcuts from triggering.
|
|
154
|
-
event.preventDefault();
|
|
155
|
-
|
|
156
|
-
if ( isEditorSidebarOpened() ) {
|
|
157
|
-
closeGeneralSidebar();
|
|
158
|
-
} else {
|
|
159
|
-
const sidebarToOpen = getBlockSelectionStart()
|
|
160
|
-
? 'edit-post/block'
|
|
161
|
-
: 'edit-post/document';
|
|
162
|
-
openGeneralSidebar( sidebarToOpen );
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
{ bindGlobal: true }
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
useShortcut(
|
|
169
|
-
'core/edit-post/toggle-list-view',
|
|
170
|
-
() => setIsListViewOpened( ! isListViewOpened() ),
|
|
171
|
-
{ bindGlobal: true }
|
|
157
|
+
useShortcut( 'core/edit-post/toggle-list-view', () =>
|
|
158
|
+
setIsListViewOpened( ! isListViewOpened() )
|
|
172
159
|
);
|
|
173
160
|
|
|
174
161
|
return null;
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
EditorSnackbars,
|
|
16
16
|
store as editorStore,
|
|
17
17
|
} from '@wordpress/editor';
|
|
18
|
-
import {
|
|
18
|
+
import { useSelect, useDispatch } from '@wordpress/data';
|
|
19
19
|
import { BlockBreadcrumb } from '@wordpress/block-editor';
|
|
20
20
|
import { Button, ScrollLock, Popover } from '@wordpress/components';
|
|
21
21
|
import { useViewportMatch } from '@wordpress/compose';
|
|
@@ -112,12 +112,10 @@ function Layout( { styles } ) {
|
|
|
112
112
|
hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
|
|
113
113
|
previousShortcut: select(
|
|
114
114
|
keyboardShortcutsStore
|
|
115
|
-
).
|
|
116
|
-
'core/edit-post/previous-region'
|
|
117
|
-
),
|
|
115
|
+
).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),
|
|
118
116
|
nextShortcut: select(
|
|
119
117
|
keyboardShortcutsStore
|
|
120
|
-
).
|
|
118
|
+
).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),
|
|
121
119
|
showIconLabels: select( editPostStore ).isFeatureActive(
|
|
122
120
|
'showIconLabels'
|
|
123
121
|
),
|
|
@@ -175,11 +173,7 @@ function Layout( { styles } ) {
|
|
|
175
173
|
return <InserterSidebar />;
|
|
176
174
|
}
|
|
177
175
|
if ( mode === 'visual' && isListViewOpened ) {
|
|
178
|
-
return
|
|
179
|
-
<AsyncModeProvider value="true">
|
|
180
|
-
<ListViewSidebar />
|
|
181
|
-
</AsyncModeProvider>
|
|
182
|
-
);
|
|
176
|
+
return <ListViewSidebar />;
|
|
183
177
|
}
|
|
184
178
|
return null;
|
|
185
179
|
};
|
|
@@ -91,7 +91,13 @@ class Layout extends Component {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
renderHTML() {
|
|
94
|
-
|
|
94
|
+
const { globalStyles } = this.props;
|
|
95
|
+
return (
|
|
96
|
+
<HTMLTextInput
|
|
97
|
+
parentHeight={ this.state.rootViewHeight }
|
|
98
|
+
style={ globalStyles }
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
95
101
|
}
|
|
96
102
|
|
|
97
103
|
renderVisual() {
|
|
@@ -6,7 +6,9 @@ import { map } from 'lodash';
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { useSelect, useRegistry } from '@wordpress/data';
|
|
10
|
+
import { useEffect } from '@wordpress/element';
|
|
11
|
+
import { store as editorStore } from '@wordpress/editor';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* Internal dependencies
|
|
@@ -15,7 +17,44 @@ import MetaBoxesArea from './meta-boxes-area';
|
|
|
15
17
|
import MetaBoxVisibility from './meta-box-visibility';
|
|
16
18
|
import { store as editPostStore } from '../../store';
|
|
17
19
|
|
|
18
|
-
function MetaBoxes( { location
|
|
20
|
+
export default function MetaBoxes( { location } ) {
|
|
21
|
+
const registry = useRegistry();
|
|
22
|
+
const {
|
|
23
|
+
metaBoxes,
|
|
24
|
+
isVisible,
|
|
25
|
+
areMetaBoxesInitialized,
|
|
26
|
+
isEditorReady,
|
|
27
|
+
} = useSelect(
|
|
28
|
+
( select ) => {
|
|
29
|
+
const { __unstableIsEditorReady } = select( editorStore );
|
|
30
|
+
const {
|
|
31
|
+
isMetaBoxLocationVisible,
|
|
32
|
+
getMetaBoxesPerLocation,
|
|
33
|
+
areMetaBoxesInitialized: _areMetaBoxesInitialized,
|
|
34
|
+
} = select( editPostStore );
|
|
35
|
+
return {
|
|
36
|
+
metaBoxes: getMetaBoxesPerLocation( location ),
|
|
37
|
+
isVisible: isMetaBoxLocationVisible( location ),
|
|
38
|
+
areMetaBoxesInitialized: _areMetaBoxesInitialized(),
|
|
39
|
+
isEditorReady: __unstableIsEditorReady(),
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
[ location ]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// When editor is ready, initialize postboxes (wp core script) and metabox
|
|
46
|
+
// saving. This initializes all meta box locations, not just this specific
|
|
47
|
+
// one.
|
|
48
|
+
useEffect( () => {
|
|
49
|
+
if ( isEditorReady && ! areMetaBoxesInitialized ) {
|
|
50
|
+
registry.dispatch( editPostStore ).initializeMetaBoxes();
|
|
51
|
+
}
|
|
52
|
+
}, [ isEditorReady, areMetaBoxesInitialized ] );
|
|
53
|
+
|
|
54
|
+
if ( ! areMetaBoxesInitialized ) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
|
|
19
58
|
return (
|
|
20
59
|
<>
|
|
21
60
|
{ map( metaBoxes, ( { id } ) => (
|
|
@@ -25,14 +64,3 @@ function MetaBoxes( { location, isVisible, metaBoxes } ) {
|
|
|
25
64
|
</>
|
|
26
65
|
);
|
|
27
66
|
}
|
|
28
|
-
|
|
29
|
-
export default withSelect( ( select, { location } ) => {
|
|
30
|
-
const { isMetaBoxLocationVisible, getMetaBoxesPerLocation } = select(
|
|
31
|
-
editPostStore
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
metaBoxes: getMetaBoxesPerLocation( location ),
|
|
36
|
-
isVisible: isMetaBoxLocationVisible( location ),
|
|
37
|
-
};
|
|
38
|
-
} )( MetaBoxes );
|