@wordpress/edit-post 5.0.2 → 5.0.6
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 +1 -1
- 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/template-title/index.js +1 -1
- package/build/components/header/template-title/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 +1 -3
- 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 +1 -4
- package/build/components/meta-boxes/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +54 -16
- 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/template/actions.js +6 -1
- package/build/components/sidebar/template/actions.js.map +1 -1
- package/build/components/sidebar/template/index.js +5 -2
- package/build/components/sidebar/template/index.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/editor.js +16 -6
- 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 +6 -0
- package/build/index.js.map +1 -1
- package/build/store/selectors.js +5 -3
- 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/template-title/index.js +1 -1
- package/build-module/components/header/template-title/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 +2 -4
- 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 +1 -4
- package/build-module/components/meta-boxes/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +55 -18
- 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/template/actions.js +6 -1
- package/build-module/components/sidebar/template/actions.js.map +1 -1
- package/build-module/components/sidebar/template/index.js +5 -2
- package/build-module/components/sidebar/template/index.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/editor.js +15 -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 +5 -0
- package/build-module/index.js.map +1 -1
- package/build-module/store/selectors.js +5 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +30 -53
- package/build-style/style.css +30 -53
- package/package.json +27 -27
- package/src/components/header/fullscreen-mode-close/index.js +37 -15
- package/src/components/header/header-toolbar/index.native.js +8 -2
- package/src/components/header/template-title/index.js +3 -1
- 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-shortcuts/index.js +19 -32
- package/src/components/layout/index.js +2 -6
- package/src/components/layout/index.native.js +7 -1
- package/src/components/meta-boxes/index.js +2 -9
- package/src/components/preferences-modal/index.js +91 -26
- package/src/components/preferences-modal/style.scss +6 -56
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +330 -130
- 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/template/actions.js +6 -1
- package/src/components/sidebar/template/index.js +5 -3
- package/src/components/sidebar/template-summary/index.js +1 -1
- package/src/components/sidebar/template-summary/style.scss +2 -1
- package/src/components/visual-editor/style.scss +4 -5
- package/src/components/welcome-guide/style.scss +5 -0
- package/src/editor.js +98 -78
- package/src/hooks/validate-multiple-use/index.js +1 -1
- package/src/index.js +3 -0
- package/src/store/selectors.js +7 -3
|
@@ -7,13 +7,23 @@ 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
|
+
__experimentalText as Text,
|
|
17
|
+
__experimentalTruncate as Truncate,
|
|
18
|
+
FlexItem,
|
|
13
19
|
Modal,
|
|
14
20
|
TabPanel,
|
|
21
|
+
Button,
|
|
22
|
+
Card,
|
|
23
|
+
CardHeader,
|
|
24
|
+
CardBody,
|
|
15
25
|
} from '@wordpress/components';
|
|
16
|
-
import { __ } from '@wordpress/i18n';
|
|
26
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
17
27
|
import { useViewportMatch } from '@wordpress/compose';
|
|
18
28
|
import { useSelect, useDispatch } from '@wordpress/data';
|
|
19
29
|
import { useMemo, useCallback, useState } from '@wordpress/element';
|
|
@@ -26,6 +36,7 @@ import {
|
|
|
26
36
|
store as editorStore,
|
|
27
37
|
} from '@wordpress/editor';
|
|
28
38
|
import { store as coreStore } from '@wordpress/core-data';
|
|
39
|
+
import { chevronLeft, chevronRight, Icon } from '@wordpress/icons';
|
|
29
40
|
|
|
30
41
|
/**
|
|
31
42
|
* Internal dependencies
|
|
@@ -44,6 +55,21 @@ import BlockManager from '../block-manager';
|
|
|
44
55
|
const MODAL_NAME = 'edit-post/preferences';
|
|
45
56
|
const PREFERENCES_MENU = 'preferences-menu';
|
|
46
57
|
|
|
58
|
+
function NavigationButton( {
|
|
59
|
+
as: Tag = Button,
|
|
60
|
+
path,
|
|
61
|
+
isBack = false,
|
|
62
|
+
...props
|
|
63
|
+
} ) {
|
|
64
|
+
const navigator = useNavigator();
|
|
65
|
+
return (
|
|
66
|
+
<Tag
|
|
67
|
+
onClick={ () => navigator.push( path, { isBack } ) }
|
|
68
|
+
{ ...props }
|
|
69
|
+
/>
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
47
73
|
export default function PreferencesModal() {
|
|
48
74
|
const isLargeViewport = useViewportMatch( 'medium' );
|
|
49
75
|
const { closeModal } = useDispatch( editPostStore );
|
|
@@ -301,34 +327,73 @@ export default function PreferencesModal() {
|
|
|
301
327
|
);
|
|
302
328
|
} else {
|
|
303
329
|
modalContent = (
|
|
304
|
-
<
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
330
|
+
<NavigatorProvider initialPath="/">
|
|
331
|
+
<NavigatorScreen path="/">
|
|
332
|
+
<Card isBorderless size="small">
|
|
333
|
+
<CardBody>
|
|
334
|
+
<ItemGroup>
|
|
335
|
+
{ tabs.map( ( tab ) => {
|
|
336
|
+
return (
|
|
337
|
+
<NavigationButton
|
|
338
|
+
key={ tab.name }
|
|
339
|
+
path={ tab.name }
|
|
340
|
+
as={ Item }
|
|
341
|
+
isAction
|
|
342
|
+
>
|
|
343
|
+
<HStack justify="space-between">
|
|
344
|
+
<FlexItem>
|
|
345
|
+
<Truncate>
|
|
346
|
+
{ tab.title }
|
|
347
|
+
</Truncate>
|
|
348
|
+
</FlexItem>
|
|
349
|
+
<FlexItem>
|
|
350
|
+
<Icon
|
|
351
|
+
icon={
|
|
352
|
+
isRTL()
|
|
353
|
+
? chevronLeft
|
|
354
|
+
: chevronRight
|
|
355
|
+
}
|
|
356
|
+
/>
|
|
357
|
+
</FlexItem>
|
|
358
|
+
</HStack>
|
|
359
|
+
</NavigationButton>
|
|
360
|
+
);
|
|
361
|
+
} ) }
|
|
362
|
+
</ItemGroup>
|
|
363
|
+
</CardBody>
|
|
364
|
+
</Card>
|
|
365
|
+
</NavigatorScreen>
|
|
319
366
|
{ sections.map( ( section ) => {
|
|
320
367
|
return (
|
|
321
|
-
<
|
|
368
|
+
<NavigatorScreen
|
|
322
369
|
key={ `${ section.name }-menu` }
|
|
323
|
-
|
|
324
|
-
title={ section.tabLabel }
|
|
325
|
-
parentMenu={ PREFERENCES_MENU }
|
|
370
|
+
path={ section.name }
|
|
326
371
|
>
|
|
327
|
-
<
|
|
328
|
-
|
|
372
|
+
<Card isBorderless size="large">
|
|
373
|
+
<CardHeader
|
|
374
|
+
isBorderless={ false }
|
|
375
|
+
justify="left"
|
|
376
|
+
size="small"
|
|
377
|
+
gap="6"
|
|
378
|
+
>
|
|
379
|
+
<NavigationButton
|
|
380
|
+
path="/"
|
|
381
|
+
icon={
|
|
382
|
+
isRTL() ? chevronRight : chevronLeft
|
|
383
|
+
}
|
|
384
|
+
isBack
|
|
385
|
+
aria-label={ __(
|
|
386
|
+
'Navigate to the previous view'
|
|
387
|
+
) }
|
|
388
|
+
/>
|
|
389
|
+
<Text size="16">{ section.tabLabel }</Text>
|
|
390
|
+
</CardHeader>
|
|
391
|
+
<CardBody>{ section.content }</CardBody>
|
|
392
|
+
</Card>
|
|
393
|
+
</NavigatorScreen>
|
|
329
394
|
);
|
|
330
395
|
} ) }
|
|
331
|
-
</
|
|
396
|
+
</NavigatorProvider>
|
|
332
397
|
);
|
|
333
398
|
}
|
|
334
399
|
return (
|
|
@@ -14,7 +14,7 @@ $vertical-tabs-width: 160px;
|
|
|
14
14
|
height: 70%;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
// Clears spacing to flush fit the
|
|
17
|
+
// Clears spacing to flush fit the navigator component to the modal edges.
|
|
18
18
|
@media (max-width: #{ ($break-medium - 1) }) {
|
|
19
19
|
.components-modal__content {
|
|
20
20
|
padding: 0;
|
|
@@ -23,61 +23,10 @@ $vertical-tabs-width: 160px;
|
|
|
23
23
|
content: none;
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
padding: 0;
|
|
31
|
-
max-height: 100%;
|
|
32
|
-
overflow-y: auto;
|
|
33
|
-
|
|
34
|
-
> * {
|
|
35
|
-
// Matches spacing cleared from the modal content element.
|
|
36
|
-
padding: $grid-unit-30 $grid-unit-40;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.components-navigation__menu {
|
|
40
|
-
margin: 0;
|
|
41
|
-
color: $gray-900;
|
|
42
|
-
|
|
43
|
-
.components-navigation__item {
|
|
44
|
-
color: $gray-900; // The inheritance of some items is quite strong, so we have to duplicate this one.
|
|
45
|
-
|
|
46
|
-
& > button {
|
|
47
|
-
color: inherit;
|
|
48
|
-
padding: 3px $grid-unit-20;
|
|
49
|
-
height: $grid-unit-60;
|
|
50
|
-
// Aligns button text instead of button box.
|
|
51
|
-
margin: 0 #{-$grid-unit-20};
|
|
52
|
-
width: calc(#{$grid-unit-40} + 100%);
|
|
53
|
-
&:focus {
|
|
54
|
-
background: $gray-100;
|
|
55
|
-
font-weight: 500;
|
|
56
|
-
}
|
|
57
|
-
&:hover {
|
|
58
|
-
color: var(--wp-admin-theme-color);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
.components-toggle-control__label {
|
|
62
|
-
color: inherit;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
.components-navigation__menu-title-heading {
|
|
66
|
-
color: inherit;
|
|
67
|
-
border-bottom: 1px solid $gray-300;
|
|
68
|
-
padding-left: 0;
|
|
69
|
-
padding-right: 0;
|
|
70
|
-
}
|
|
71
|
-
.components-navigation__back-button {
|
|
72
|
-
color: inherit;
|
|
73
|
-
padding-left: 0;
|
|
74
|
-
&:hover {
|
|
75
|
-
color: var(--wp-admin-theme-color);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
.edit-post-preferences-modal__custom-fields-confirmation-button {
|
|
79
|
-
width: auto;
|
|
80
|
-
}
|
|
26
|
+
// Keep the navigator component from overflowing the modal content area
|
|
27
|
+
// to ensure that sticky position elements stick where intended.
|
|
28
|
+
.components-navigator-provider {
|
|
29
|
+
height: 100%;
|
|
81
30
|
}
|
|
82
31
|
}
|
|
83
32
|
|
|
@@ -118,6 +67,7 @@ $vertical-tabs-width: 160px;
|
|
|
118
67
|
&__section-title {
|
|
119
68
|
font-size: 0.9rem;
|
|
120
69
|
font-weight: 600;
|
|
70
|
+
margin-top: 0;
|
|
121
71
|
}
|
|
122
72
|
|
|
123
73
|
&__option {
|