@wordpress/edit-post 5.0.1-next.253d9b6e21.0 → 5.0.3
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/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/meta-boxes/index.js +39 -19
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +46 -19
- 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/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/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/index.js +22 -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/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/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 +47 -21
- 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/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/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/index.js +13 -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 +52 -35
- package/build-style/style.css +52 -35
- package/package.json +27 -27
- 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/meta-boxes/index.js +41 -13
- package/src/components/preferences-modal/index.js +90 -36
- package/src/components/preferences-modal/style.scss +1 -17
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +297 -142
- package/src/components/secondary-sidebar/inserter-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/text-editor/style.scss +12 -22
- package/src/components/visual-editor/index.js +16 -10
- package/src/components/visual-editor/style.scss +3 -5
- package/src/components/welcome-guide/style.scss +5 -0
- package/src/editor.js +88 -79
- package/src/index.js +15 -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
|
@@ -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
|
};
|
|
@@ -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 );
|
|
@@ -7,13 +7,21 @@ import { get } from 'lodash';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
__experimentalNavigatorProvider as NavigatorProvider,
|
|
11
|
+
__experimentalNavigatorScreen as NavigatorScreen,
|
|
12
|
+
__experimentalUseNavigator as useNavigator,
|
|
13
|
+
__experimentalItemGroup as ItemGroup,
|
|
14
|
+
__experimentalItem as Item,
|
|
15
|
+
__experimentalHStack as HStack,
|
|
16
|
+
__experimentalTruncate as Truncate,
|
|
17
|
+
FlexItem,
|
|
13
18
|
Modal,
|
|
14
19
|
TabPanel,
|
|
20
|
+
Button,
|
|
21
|
+
Card,
|
|
22
|
+
CardBody,
|
|
15
23
|
} from '@wordpress/components';
|
|
16
|
-
import { __ } from '@wordpress/i18n';
|
|
24
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
17
25
|
import { useViewportMatch } from '@wordpress/compose';
|
|
18
26
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
19
27
|
import { useMemo, useCallback, useState } from '@wordpress/element';
|
|
@@ -26,6 +34,7 @@ import {
|
|
|
26
34
|
store as editorStore,
|
|
27
35
|
} from '@wordpress/editor';
|
|
28
36
|
import { store as coreStore } from '@wordpress/core-data';
|
|
37
|
+
import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
|
|
29
38
|
|
|
30
39
|
/**
|
|
31
40
|
* Internal dependencies
|
|
@@ -44,6 +53,21 @@ import BlockManager from '../block-manager';
|
|
|
44
53
|
const MODAL_NAME = 'edit-post/preferences';
|
|
45
54
|
const PREFERENCES_MENU = 'preferences-menu';
|
|
46
55
|
|
|
56
|
+
function NavigationButton( {
|
|
57
|
+
as: Tag = Button,
|
|
58
|
+
path,
|
|
59
|
+
isBack = false,
|
|
60
|
+
...props
|
|
61
|
+
} ) {
|
|
62
|
+
const navigator = useNavigator();
|
|
63
|
+
return (
|
|
64
|
+
<Tag
|
|
65
|
+
onClick={ () => navigator.push( path, { isBack } ) }
|
|
66
|
+
{ ...props }
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
47
71
|
export default function PreferencesModal() {
|
|
48
72
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
49
73
|
const { closeModal } = useDispatch( editPostStore );
|
|
@@ -243,14 +267,12 @@ export default function PreferencesModal() {
|
|
|
243
267
|
/>
|
|
244
268
|
</PageAttributesCheck>
|
|
245
269
|
</Section>
|
|
246
|
-
<
|
|
270
|
+
<MetaBoxesSection
|
|
247
271
|
title={ __( 'Additional' ) }
|
|
248
272
|
description={ __(
|
|
249
273
|
'Add extra areas to the editor.'
|
|
250
274
|
) }
|
|
251
|
-
|
|
252
|
-
<MetaBoxesSection />
|
|
253
|
-
</Section>
|
|
275
|
+
/>
|
|
254
276
|
</>
|
|
255
277
|
),
|
|
256
278
|
},
|
|
@@ -303,34 +325,66 @@ export default function PreferencesModal() {
|
|
|
303
325
|
);
|
|
304
326
|
} else {
|
|
305
327
|
modalContent = (
|
|
306
|
-
<
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
328
|
+
<Card isBorderless>
|
|
329
|
+
<CardBody>
|
|
330
|
+
<NavigatorProvider initialPath="/">
|
|
331
|
+
<NavigatorScreen path="/">
|
|
332
|
+
<ItemGroup>
|
|
333
|
+
{ tabs.map( ( tab ) => {
|
|
334
|
+
return (
|
|
335
|
+
<NavigationButton
|
|
336
|
+
key={ tab.name }
|
|
337
|
+
path={ tab.name }
|
|
338
|
+
as={ Item }
|
|
339
|
+
isAction
|
|
340
|
+
>
|
|
341
|
+
<HStack justify="space-between">
|
|
342
|
+
<FlexItem>
|
|
343
|
+
<Truncate>
|
|
344
|
+
{ tab.title }
|
|
345
|
+
</Truncate>
|
|
346
|
+
</FlexItem>
|
|
347
|
+
<FlexItem>
|
|
348
|
+
<Icon
|
|
349
|
+
icon={
|
|
350
|
+
isRTL()
|
|
351
|
+
? chevronLeft
|
|
352
|
+
: chevronRight
|
|
353
|
+
}
|
|
354
|
+
/>
|
|
355
|
+
</FlexItem>
|
|
356
|
+
</HStack>
|
|
357
|
+
</NavigationButton>
|
|
358
|
+
);
|
|
359
|
+
} ) }
|
|
360
|
+
</ItemGroup>
|
|
361
|
+
</NavigatorScreen>
|
|
362
|
+
{ sections.map( ( section ) => {
|
|
363
|
+
return (
|
|
364
|
+
<NavigatorScreen
|
|
365
|
+
key={ `${ section.name }-menu` }
|
|
366
|
+
path={ section.name }
|
|
367
|
+
>
|
|
368
|
+
<NavigationButton
|
|
369
|
+
path="/"
|
|
370
|
+
icon={
|
|
371
|
+
isRTL() ? chevronRight : chevronLeft
|
|
372
|
+
}
|
|
373
|
+
isBack
|
|
374
|
+
aria-label={ __(
|
|
375
|
+
'Navigate to the previous view'
|
|
376
|
+
) }
|
|
377
|
+
>
|
|
378
|
+
{ __( 'Back' ) }
|
|
379
|
+
</NavigationButton>
|
|
380
|
+
<h2>{ section.tabLabel }</h2>
|
|
381
|
+
{ section.content }
|
|
382
|
+
</NavigatorScreen>
|
|
383
|
+
);
|
|
384
|
+
} ) }
|
|
385
|
+
</NavigatorProvider>
|
|
386
|
+
</CardBody>
|
|
387
|
+
</Card>
|
|
334
388
|
);
|
|
335
389
|
}
|
|
336
390
|
return (
|
|
@@ -26,10 +26,10 @@ $vertical-tabs-width: 160px;
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
.components-navigation {
|
|
29
|
-
background-color: $white;
|
|
30
29
|
padding: 0;
|
|
31
30
|
max-height: 100%;
|
|
32
31
|
overflow-y: auto;
|
|
32
|
+
color: $black;
|
|
33
33
|
|
|
34
34
|
> * {
|
|
35
35
|
// Matches spacing cleared from the modal content element.
|
|
@@ -38,42 +38,26 @@ $vertical-tabs-width: 160px;
|
|
|
38
38
|
|
|
39
39
|
.components-navigation__menu {
|
|
40
40
|
margin: 0;
|
|
41
|
-
color: $gray-900;
|
|
42
41
|
|
|
43
42
|
.components-navigation__item {
|
|
44
|
-
color: $gray-900; // The inheritance of some items is quite strong, so we have to duplicate this one.
|
|
45
|
-
|
|
46
43
|
& > button {
|
|
47
|
-
color: inherit;
|
|
48
44
|
padding: 3px $grid-unit-20;
|
|
49
45
|
height: $grid-unit-60;
|
|
50
46
|
// Aligns button text instead of button box.
|
|
51
47
|
margin: 0 #{-$grid-unit-20};
|
|
52
48
|
width: calc(#{$grid-unit-40} + 100%);
|
|
53
49
|
&:focus {
|
|
54
|
-
background: $gray-100;
|
|
55
50
|
font-weight: 500;
|
|
56
51
|
}
|
|
57
|
-
&:hover {
|
|
58
|
-
color: var(--wp-admin-theme-color);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
.components-toggle-control__label {
|
|
62
|
-
color: inherit;
|
|
63
52
|
}
|
|
64
53
|
}
|
|
65
54
|
.components-navigation__menu-title-heading {
|
|
66
|
-
color: inherit;
|
|
67
55
|
border-bottom: 1px solid $gray-300;
|
|
68
56
|
padding-left: 0;
|
|
69
57
|
padding-right: 0;
|
|
70
58
|
}
|
|
71
59
|
.components-navigation__back-button {
|
|
72
|
-
color: inherit;
|
|
73
60
|
padding-left: 0;
|
|
74
|
-
&:hover {
|
|
75
|
-
color: var(--wp-admin-theme-color);
|
|
76
|
-
}
|
|
77
61
|
}
|
|
78
62
|
.edit-post-preferences-modal__custom-fields-confirmation-button {
|
|
79
63
|
width: auto;
|