@wordpress/edit-post 6.18.0 → 7.0.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 +12 -0
- package/build/components/block-manager/category.js +3 -11
- package/build/components/block-manager/category.js.map +1 -1
- package/build/components/block-manager/checklist.js +4 -3
- package/build/components/block-manager/checklist.js.map +1 -1
- package/build/components/block-manager/index.js +3 -10
- package/build/components/block-manager/index.js.map +1 -1
- package/build/components/header/header-toolbar/index.js +2 -2
- package/build/components/header/header-toolbar/index.js.map +1 -1
- package/build/components/header/index.js +2 -2
- package/build/components/header/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +68 -0
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/layout/index.js +3 -2
- package/build/components/layout/index.js.map +1 -1
- package/build/components/preferences-modal/index.js +1 -1
- package/build/components/preferences-modal/index.js.map +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js +1 -1
- package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build/components/secondary-sidebar/list-view-sidebar.js +4 -4
- package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build/components/sidebar/post-status/index.js +1 -1
- package/build/components/sidebar/post-status/index.js.map +1 -1
- package/build/components/sidebar/post-template/index.js +2 -4
- package/build/components/sidebar/post-template/index.js.map +1 -1
- package/build/components/sidebar/settings-sidebar/index.js +7 -7
- package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build/editor.native.js +8 -2
- package/build/editor.native.js.map +1 -1
- package/build/hooks/validate-multiple-use/index.js +1 -7
- package/build/hooks/validate-multiple-use/index.js.map +1 -1
- package/build/plugins/index.js +3 -1
- package/build/plugins/index.js.map +1 -1
- package/build/plugins/navigation-list-view-menu-item.js +48 -0
- package/build/plugins/navigation-list-view-menu-item.js.map +1 -0
- package/build/store/actions.js +1 -7
- package/build/store/actions.js.map +1 -1
- package/build-module/components/block-manager/category.js +3 -11
- package/build-module/components/block-manager/category.js.map +1 -1
- package/build-module/components/block-manager/checklist.js +5 -4
- package/build-module/components/block-manager/checklist.js.map +1 -1
- package/build-module/components/block-manager/index.js +3 -9
- package/build-module/components/block-manager/index.js.map +1 -1
- package/build-module/components/header/header-toolbar/index.js +2 -2
- package/build-module/components/header/header-toolbar/index.js.map +1 -1
- package/build-module/components/header/index.js +2 -2
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +67 -0
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/layout/index.js +3 -2
- package/build-module/components/layout/index.js.map +1 -1
- package/build-module/components/preferences-modal/index.js +1 -1
- package/build-module/components/preferences-modal/index.js.map +1 -1
- package/build-module/components/preferences-modal/meta-boxes-section.js +2 -2
- package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
- package/build-module/components/secondary-sidebar/list-view-sidebar.js +4 -4
- package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
- package/build-module/components/sidebar/post-status/index.js +1 -1
- package/build-module/components/sidebar/post-status/index.js.map +1 -1
- package/build-module/components/sidebar/post-template/index.js +2 -4
- package/build-module/components/sidebar/post-template/index.js.map +1 -1
- package/build-module/components/sidebar/settings-sidebar/index.js +5 -5
- package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
- package/build-module/editor.native.js +7 -2
- package/build-module/editor.native.js.map +1 -1
- package/build-module/hooks/validate-multiple-use/index.js +1 -6
- package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
- package/build-module/plugins/index.js +2 -1
- package/build-module/plugins/index.js.map +1 -1
- package/build-module/plugins/navigation-list-view-menu-item.js +40 -0
- package/build-module/plugins/navigation-list-view-menu-item.js.map +1 -0
- package/build-module/store/actions.js +1 -6
- package/build-module/store/actions.js.map +1 -1
- package/build-style/classic-rtl.css +14 -0
- package/build-style/classic.css +14 -0
- package/build-style/style-rtl.css +102 -66
- package/build-style/style.css +102 -66
- package/package.json +29 -29
- package/src/components/block-manager/category.js +3 -10
- package/src/components/block-manager/checklist.js +3 -6
- package/src/components/block-manager/index.js +6 -10
- package/src/components/block-manager/style.scss +4 -15
- package/src/components/header/header-toolbar/index.js +2 -2
- package/src/components/header/index.js +3 -3
- package/src/components/header/style.scss +3 -8
- package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
- package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +70 -0
- package/src/components/keyboard-shortcuts/index.js +71 -0
- package/src/components/layout/index.js +4 -2
- package/src/components/layout/style.scss +12 -1
- package/src/components/preferences-modal/index.js +1 -1
- package/src/components/preferences-modal/meta-boxes-section.js +2 -3
- package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +56 -4
- package/src/components/preferences-modal/test/__snapshots__/index.js.snap +43 -18
- package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +51 -6
- package/src/components/secondary-sidebar/list-view-sidebar.js +4 -4
- package/src/components/secondary-sidebar/style.scss +3 -3
- package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +8 -6
- package/src/components/sidebar/post-schedule/style.scss +2 -1
- package/src/components/sidebar/post-status/index.js +1 -1
- package/src/components/sidebar/post-template/index.js +8 -3
- package/src/components/sidebar/post-template/style.scss +2 -0
- package/src/components/sidebar/post-url/style.scss +3 -0
- package/src/components/sidebar/post-visibility/style.scss +2 -0
- package/src/components/sidebar/settings-header/style.scss +47 -34
- package/src/components/sidebar/settings-sidebar/index.js +5 -5
- package/src/components/visual-editor/test/index.native.js +24 -13
- package/src/editor.native.js +14 -11
- package/src/hooks/validate-multiple-use/index.js +1 -7
- package/src/plugins/index.js +2 -0
- package/src/plugins/navigation-list-view-menu-item.js +56 -0
- package/src/store/actions.js +6 -15
- package/src/components/sidebar/plugin-pre-publish-panel/test/__snapshots__/index.js.snap +0 -3
|
@@ -43,17 +43,17 @@ export default function ListViewSidebar() {
|
|
|
43
43
|
return (
|
|
44
44
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
45
45
|
<div
|
|
46
|
-
aria-label={ __( '
|
|
47
|
-
className="edit-post-
|
|
46
|
+
aria-label={ __( 'Document Overview' ) }
|
|
47
|
+
className="edit-post-editor__document-overview-panel"
|
|
48
48
|
onKeyDown={ closeOnEscape }
|
|
49
49
|
>
|
|
50
50
|
<div
|
|
51
|
-
className="edit-post-
|
|
51
|
+
className="edit-post-editor__document-overview-panel-header components-panel__header edit-post-sidebar__panel-tabs"
|
|
52
52
|
ref={ headerFocusReturnRef }
|
|
53
53
|
>
|
|
54
54
|
<Button
|
|
55
55
|
icon={ closeSmall }
|
|
56
|
-
label={ __( 'Close
|
|
56
|
+
label={ __( 'Close Document Overview Sidebar' ) }
|
|
57
57
|
onClick={ () => setIsListViewOpened( false ) }
|
|
58
58
|
/>
|
|
59
59
|
<ul>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
.edit-post-editor__inserter-panel,
|
|
2
|
-
.edit-post-
|
|
2
|
+
.edit-post-editor__document-overview-panel {
|
|
3
3
|
height: 100%;
|
|
4
4
|
display: flex;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
.edit-post-
|
|
8
|
+
.edit-post-editor__document-overview-panel {
|
|
9
9
|
// Same width as the Inserter.
|
|
10
10
|
// @see packages/block-editor/src/components/inserter/style.scss
|
|
11
11
|
// Width of the list view panel.
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
.edit-post-
|
|
34
|
+
.edit-post-editor__document-overview-panel-header {
|
|
35
35
|
border-bottom: $border-width solid $gray-300;
|
|
36
36
|
display: flex;
|
|
37
37
|
justify-content: space-between;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* External dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { render, screen } from '@testing-library/react';
|
|
5
|
+
|
|
1
6
|
/**
|
|
2
7
|
* WordPress dependencies
|
|
3
8
|
*/
|
|
4
9
|
import { SlotFillProvider } from '@wordpress/components';
|
|
5
|
-
import { render } from '@wordpress/element';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Internal dependencies
|
|
@@ -11,21 +15,19 @@ import PluginPrePublishPanel from '../';
|
|
|
11
15
|
|
|
12
16
|
describe( 'PluginPrePublishPanel', () => {
|
|
13
17
|
test( 'renders fill properly', () => {
|
|
14
|
-
const div = document.createElement( 'div' );
|
|
15
18
|
render(
|
|
16
19
|
<SlotFillProvider>
|
|
17
20
|
<PluginPrePublishPanel
|
|
18
21
|
className="my-plugin-pre-publish-panel"
|
|
19
22
|
title="My panel title"
|
|
20
|
-
initialOpen
|
|
23
|
+
initialOpen
|
|
21
24
|
>
|
|
22
25
|
My panel content
|
|
23
26
|
</PluginPrePublishPanel>
|
|
24
27
|
<PluginPrePublishPanel.Slot />
|
|
25
|
-
</SlotFillProvider
|
|
26
|
-
div
|
|
28
|
+
</SlotFillProvider>
|
|
27
29
|
);
|
|
28
30
|
|
|
29
|
-
expect(
|
|
31
|
+
expect( screen.getByText( 'My panel title' ) ).toBeVisible();
|
|
30
32
|
} );
|
|
31
33
|
} );
|
|
@@ -7,13 +7,14 @@
|
|
|
7
7
|
display: block;
|
|
8
8
|
width: 45%;
|
|
9
9
|
flex-shrink: 0;
|
|
10
|
+
// Match padding on tertiary buttons for alignment.
|
|
11
|
+
padding: $grid-unit-15 * 0.5 0;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
.components-button.edit-post-post-schedule__toggle {
|
|
14
16
|
text-align: left;
|
|
15
17
|
white-space: normal;
|
|
16
|
-
height: auto;
|
|
17
18
|
|
|
18
19
|
// This span is added by the Popover in Tooltip when no anchor is
|
|
19
20
|
// provided. We set its width to 0 so that it does not cause the button text
|
|
@@ -85,9 +85,14 @@ function PostTemplateToggle( { isOpen, onClick } ) {
|
|
|
85
85
|
if ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {
|
|
86
86
|
return availableTemplates[ templateSlug ];
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
const template =
|
|
89
|
+
select( coreStore ).canUser( 'create', 'templates' ) &&
|
|
90
|
+
select( editPostStore ).getEditedPostTemplate();
|
|
91
|
+
return (
|
|
92
|
+
template?.title ||
|
|
93
|
+
template?.slug ||
|
|
94
|
+
availableTemplates?.[ templateSlug ]
|
|
95
|
+
);
|
|
91
96
|
}, [] );
|
|
92
97
|
|
|
93
98
|
return (
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
.edit-post-post-url {
|
|
2
2
|
width: 100%;
|
|
3
3
|
justify-content: flex-start;
|
|
4
|
+
align-items: flex-start;
|
|
4
5
|
|
|
5
6
|
span {
|
|
6
7
|
display: block;
|
|
7
8
|
width: 45%;
|
|
8
9
|
flex-shrink: 0;
|
|
10
|
+
// Match padding on tertiary buttons for alignment.
|
|
11
|
+
padding: $grid-unit-15 * 0.5 0;
|
|
9
12
|
}
|
|
10
13
|
}
|
|
11
14
|
|
|
@@ -1,53 +1,66 @@
|
|
|
1
|
+
// This tab style CSS is duplicated verbatim in
|
|
2
|
+
// /packages/components/src/tab-panel/style.scss
|
|
1
3
|
.components-button.edit-post-sidebar__panel-tab {
|
|
4
|
+
position: relative;
|
|
2
5
|
border-radius: 0;
|
|
3
6
|
height: $grid-unit-60;
|
|
4
7
|
background: transparent;
|
|
5
8
|
border: none;
|
|
6
9
|
box-shadow: none;
|
|
7
10
|
cursor: pointer;
|
|
8
|
-
|
|
9
|
-
padding: 3px 15px; // Use padding to offset the is-active border, this benefits Windows High Contrast mode
|
|
11
|
+
padding: 3px $grid-unit-20; // Use padding to offset the is-active border, this benefits Windows High Contrast mode
|
|
10
12
|
margin-left: 0;
|
|
11
13
|
font-weight: 500;
|
|
12
14
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
&:focus:not(:disabled) {
|
|
16
|
+
position: relative;
|
|
17
|
+
box-shadow: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Tab indicator
|
|
16
21
|
&::after {
|
|
17
|
-
content:
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
content: "";
|
|
23
|
+
position: absolute;
|
|
24
|
+
right: 0;
|
|
25
|
+
bottom: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
|
|
29
|
+
// Draw the indicator.
|
|
30
|
+
background: var(--wp-admin-theme-color);
|
|
31
|
+
height: calc(0 * var(--wp-admin-border-width-focus));
|
|
32
|
+
border-radius: 0;
|
|
33
|
+
|
|
34
|
+
// Animation
|
|
35
|
+
transition: all 0.1s linear;
|
|
36
|
+
@include reduce-motion("transition");
|
|
24
37
|
}
|
|
25
38
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
position: relative;
|
|
30
|
-
z-index: z-index(".edit-post-sidebar__panel-tab.is-active");
|
|
31
|
-
|
|
32
|
-
// This border appears in Windows High Contrast mode instead of the box-shadow.
|
|
33
|
-
&::before {
|
|
34
|
-
content: "";
|
|
35
|
-
position: absolute;
|
|
36
|
-
top: 0;
|
|
37
|
-
bottom: 1px;
|
|
38
|
-
right: 0;
|
|
39
|
-
left: 0;
|
|
40
|
-
border-bottom: $border-width-tab solid transparent;
|
|
41
|
-
}
|
|
39
|
+
// Active.
|
|
40
|
+
&.is-active::after {
|
|
41
|
+
height: calc(1 * var(--wp-admin-border-width-focus));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
// Focus.
|
|
45
|
+
&::before {
|
|
46
|
+
content: "";
|
|
47
|
+
position: absolute;
|
|
48
|
+
top: $grid-unit-15;
|
|
49
|
+
right: $grid-unit-15;
|
|
50
|
+
bottom: $grid-unit-15;
|
|
51
|
+
left: $grid-unit-15;
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
|
|
54
|
+
// Draw the indicator.
|
|
55
|
+
box-shadow: 0 0 0 0 transparent;
|
|
56
|
+
border-radius: $radius-block-ui;
|
|
57
|
+
|
|
58
|
+
// Animation
|
|
59
|
+
transition: all 0.1s linear;
|
|
60
|
+
@include reduce-motion("transition");
|
|
48
61
|
}
|
|
49
62
|
|
|
50
|
-
|
|
51
|
-
box-shadow:
|
|
63
|
+
&:focus-visible::before {
|
|
64
|
+
box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
|
|
52
65
|
}
|
|
53
66
|
}
|
|
@@ -5,10 +5,12 @@ import {
|
|
|
5
5
|
BlockInspector,
|
|
6
6
|
store as blockEditorStore,
|
|
7
7
|
} from '@wordpress/block-editor';
|
|
8
|
-
import {
|
|
8
|
+
import { useSelect } from '@wordpress/data';
|
|
9
9
|
import { Platform } from '@wordpress/element';
|
|
10
|
-
import {
|
|
10
|
+
import { isRTL, __ } from '@wordpress/i18n';
|
|
11
|
+
import { drawerLeft, drawerRight } from '@wordpress/icons';
|
|
11
12
|
import { store as interfaceStore } from '@wordpress/interface';
|
|
13
|
+
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
12
14
|
|
|
13
15
|
/**
|
|
14
16
|
* Internal dependencies
|
|
@@ -25,8 +27,6 @@ import MetaBoxes from '../../meta-boxes';
|
|
|
25
27
|
import PluginDocumentSettingPanel from '../plugin-document-setting-panel';
|
|
26
28
|
import PluginSidebarEditPost from '../plugin-sidebar';
|
|
27
29
|
import TemplateSummary from '../template-summary';
|
|
28
|
-
import { __ } from '@wordpress/i18n';
|
|
29
|
-
import { useSelect } from '@wordpress/data';
|
|
30
30
|
import { store as editPostStore } from '../../../store';
|
|
31
31
|
|
|
32
32
|
const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {
|
|
@@ -78,7 +78,7 @@ const SettingsSidebar = () => {
|
|
|
78
78
|
/* translators: button label text should, if possible, be under 16 characters. */
|
|
79
79
|
title={ __( 'Settings' ) }
|
|
80
80
|
toggleShortcut={ keyboardShortcut }
|
|
81
|
-
icon={
|
|
81
|
+
icon={ isRTL() ? drawerLeft : drawerRight }
|
|
82
82
|
isActiveByDefault={ SIDEBAR_ACTIVE_BY_DEFAULT }
|
|
83
83
|
>
|
|
84
84
|
{ ! isTemplateMode && sidebarName === 'edit-post/document' && (
|
|
@@ -38,24 +38,29 @@ describe( 'when title is focused', () => {
|
|
|
38
38
|
} );
|
|
39
39
|
|
|
40
40
|
// Focus first block
|
|
41
|
-
fireEvent.press(
|
|
41
|
+
fireEvent.press(
|
|
42
|
+
screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
|
|
43
|
+
);
|
|
42
44
|
|
|
43
45
|
// Focus title
|
|
44
46
|
fireEvent(
|
|
45
|
-
screen.
|
|
47
|
+
screen.getAllByLabelText( 'Post title. test' )[ 0 ],
|
|
46
48
|
'select'
|
|
47
49
|
);
|
|
48
50
|
|
|
49
51
|
// Add new Heading block
|
|
50
|
-
fireEvent.press( screen.
|
|
52
|
+
fireEvent.press( screen.getByLabelText( 'Add block' ) );
|
|
51
53
|
fireEvent.press( screen.getByText( 'Heading' ) );
|
|
52
54
|
|
|
53
|
-
expect( screen.getByA11yLabel( /Heading Block. Row 1/ ) ).toBeDefined();
|
|
54
55
|
expect(
|
|
55
|
-
screen.
|
|
56
|
+
screen.getAllByLabelText( /Heading Block. Row 1/ )[ 0 ]
|
|
57
|
+
).toBeDefined();
|
|
58
|
+
expect(
|
|
59
|
+
screen.getAllByLabelText( /Paragraph Block. Row 2/ )[ 0 ]
|
|
56
60
|
).toBeDefined();
|
|
61
|
+
|
|
57
62
|
expect(
|
|
58
|
-
screen.
|
|
63
|
+
screen.getAllByLabelText( /Paragraph Block. Row 3/ )[ 0 ]
|
|
59
64
|
).toBeDefined();
|
|
60
65
|
} );
|
|
61
66
|
} );
|
|
@@ -67,27 +72,33 @@ describe( 'when title is no longer focused', () => {
|
|
|
67
72
|
} );
|
|
68
73
|
|
|
69
74
|
// Focus first block
|
|
70
|
-
fireEvent.press(
|
|
75
|
+
fireEvent.press(
|
|
76
|
+
screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
|
|
77
|
+
);
|
|
71
78
|
|
|
72
79
|
// Focus title
|
|
73
80
|
fireEvent(
|
|
74
|
-
screen.
|
|
81
|
+
screen.getAllByLabelText( 'Post title. test' )[ 0 ],
|
|
75
82
|
'select'
|
|
76
83
|
);
|
|
77
84
|
|
|
78
85
|
// Focus last block
|
|
79
|
-
fireEvent.press(
|
|
86
|
+
fireEvent.press(
|
|
87
|
+
screen.getAllByLabelText( /Paragraph Block. Row 2/ )[ 0 ]
|
|
88
|
+
);
|
|
80
89
|
|
|
81
90
|
// Add new Heading block
|
|
82
|
-
fireEvent.press( screen.
|
|
91
|
+
fireEvent.press( screen.getByLabelText( 'Add block' ) );
|
|
83
92
|
fireEvent.press( screen.getByText( 'Heading' ) );
|
|
84
93
|
|
|
85
94
|
expect(
|
|
86
|
-
screen.
|
|
95
|
+
screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
|
|
96
|
+
).toBeDefined();
|
|
97
|
+
expect(
|
|
98
|
+
screen.getAllByLabelText( /Paragraph Block. Row 2/ )[ 0 ]
|
|
87
99
|
).toBeDefined();
|
|
88
100
|
expect(
|
|
89
|
-
screen.
|
|
101
|
+
screen.getAllByLabelText( /Heading Block. Row 3/ )[ 0 ]
|
|
90
102
|
).toBeDefined();
|
|
91
|
-
expect( screen.getByA11yLabel( /Heading Block. Row 3/ ) ).toBeDefined();
|
|
92
103
|
} );
|
|
93
104
|
} );
|
package/src/editor.native.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import memize from 'memize';
|
|
5
5
|
import { map } from 'lodash';
|
|
6
6
|
import { I18nManager } from 'react-native';
|
|
7
|
+
import { GestureHandlerRootView } from 'react-native-gesture-handler';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* WordPress dependencies
|
|
@@ -173,17 +174,19 @@ class Editor extends Component {
|
|
|
173
174
|
};
|
|
174
175
|
|
|
175
176
|
return (
|
|
176
|
-
<
|
|
177
|
-
<
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
177
|
+
<GestureHandlerRootView style={ { flex: 1 } }>
|
|
178
|
+
<SlotFillProvider>
|
|
179
|
+
<EditorProvider
|
|
180
|
+
settings={ editorSettings }
|
|
181
|
+
post={ normalizedPost }
|
|
182
|
+
initialEdits={ initialEdits }
|
|
183
|
+
useSubRegistry={ false }
|
|
184
|
+
{ ...props }
|
|
185
|
+
>
|
|
186
|
+
<Layout setTitleRef={ this.setTitleRef } />
|
|
187
|
+
</EditorProvider>
|
|
188
|
+
</SlotFillProvider>
|
|
189
|
+
</GestureHandlerRootView>
|
|
187
190
|
);
|
|
188
191
|
}
|
|
189
192
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -44,8 +39,7 @@ const enhance = compose(
|
|
|
44
39
|
// Otherwise, only pass `originalBlockClientId` if it refers to a different
|
|
45
40
|
// block from the current one.
|
|
46
41
|
const blocks = select( blockEditorStore ).getBlocks();
|
|
47
|
-
const firstOfSameType = find(
|
|
48
|
-
blocks,
|
|
42
|
+
const firstOfSameType = blocks.find(
|
|
49
43
|
( { name } ) => block.name === name
|
|
50
44
|
);
|
|
51
45
|
const isInvalid =
|
package/src/plugins/index.js
CHANGED
|
@@ -14,6 +14,7 @@ import CopyContentMenuItem from './copy-content-menu-item';
|
|
|
14
14
|
import KeyboardShortcutsHelpMenuItem from './keyboard-shortcuts-help-menu-item';
|
|
15
15
|
import ToolsMoreMenuGroup from '../components/header/tools-more-menu-group';
|
|
16
16
|
import WelcomeGuideMenuItem from './welcome-guide-menu-item';
|
|
17
|
+
import NavigationListViewMenuItem from './navigation-list-view-menu-item';
|
|
17
18
|
|
|
18
19
|
registerPlugin( 'edit-post', {
|
|
19
20
|
render() {
|
|
@@ -55,6 +56,7 @@ registerPlugin( 'edit-post', {
|
|
|
55
56
|
</>
|
|
56
57
|
) }
|
|
57
58
|
</ToolsMoreMenuGroup>
|
|
59
|
+
<NavigationListViewMenuItem />
|
|
58
60
|
</>
|
|
59
61
|
);
|
|
60
62
|
},
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WordPress dependencies
|
|
3
|
+
*/
|
|
4
|
+
import {
|
|
5
|
+
BlockEditorProvider,
|
|
6
|
+
__unstableBlockToolbarLastItem,
|
|
7
|
+
__unstableBlockNameContext,
|
|
8
|
+
} from '@wordpress/block-editor';
|
|
9
|
+
import { ToolbarButton, ToolbarGroup } from '@wordpress/components';
|
|
10
|
+
import { useDispatch } from '@wordpress/data';
|
|
11
|
+
import { Fragment } from '@wordpress/element';
|
|
12
|
+
import { __ } from '@wordpress/i18n';
|
|
13
|
+
import { listView } from '@wordpress/icons';
|
|
14
|
+
|
|
15
|
+
const NavMenuSidebarToggle = () => {
|
|
16
|
+
// eslint-disable-next-line @wordpress/data-no-store-string-literals
|
|
17
|
+
const { openGeneralSidebar } = useDispatch( 'core/edit-post' );
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<ToolbarGroup>
|
|
21
|
+
<ToolbarButton
|
|
22
|
+
className="components-toolbar__control"
|
|
23
|
+
label={ __( 'Open navigation list view' ) }
|
|
24
|
+
onClick={ () => openGeneralSidebar( 'edit-post/block' ) }
|
|
25
|
+
icon={ listView }
|
|
26
|
+
/>
|
|
27
|
+
</ToolbarGroup>
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
let MaybeNavMenuSidebarToggle = Fragment;
|
|
32
|
+
|
|
33
|
+
const isOffCanvasNavigationEditorEnabled =
|
|
34
|
+
window?.__experimentalEnableOffCanvasNavigationEditor === true;
|
|
35
|
+
|
|
36
|
+
if ( isOffCanvasNavigationEditorEnabled ) {
|
|
37
|
+
MaybeNavMenuSidebarToggle = NavMenuSidebarToggle;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const NavigationEditMenuItem = () => {
|
|
41
|
+
return (
|
|
42
|
+
<BlockEditorProvider>
|
|
43
|
+
<__unstableBlockToolbarLastItem>
|
|
44
|
+
<__unstableBlockNameContext.Consumer>
|
|
45
|
+
{ ( blockName ) =>
|
|
46
|
+
blockName === 'core/navigation' && (
|
|
47
|
+
<MaybeNavMenuSidebarToggle />
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
</__unstableBlockNameContext.Consumer>
|
|
51
|
+
</__unstableBlockToolbarLastItem>
|
|
52
|
+
</BlockEditorProvider>
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default NavigationEditMenuItem;
|
package/src/store/actions.js
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { reduce } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -385,16 +380,12 @@ export const requestMetaBoxUpdates =
|
|
|
385
380
|
];
|
|
386
381
|
|
|
387
382
|
// Merge all form data objects into a single one.
|
|
388
|
-
const formData = reduce(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
return memo;
|
|
395
|
-
},
|
|
396
|
-
new window.FormData()
|
|
397
|
-
);
|
|
383
|
+
const formData = formDataToMerge.reduce( ( memo, currentFormData ) => {
|
|
384
|
+
for ( const [ key, value ] of currentFormData ) {
|
|
385
|
+
memo.append( key, value );
|
|
386
|
+
}
|
|
387
|
+
return memo;
|
|
388
|
+
}, new window.FormData() );
|
|
398
389
|
additionalData.forEach( ( [ key, value ] ) =>
|
|
399
390
|
formData.append( key, value )
|
|
400
391
|
);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`PluginPrePublishPanel renders fill properly 1`] = `"<div class=\\"components-panel__body my-plugin-pre-publish-panel is-opened\\"><h2 class=\\"components-panel__body-title\\"><button type=\\"button\\" aria-expanded=\\"true\\" class=\\"components-button components-panel__body-toggle\\"><span aria-hidden=\\"true\\"><svg viewBox=\\"0 0 24 24\\" xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"24\\" height=\\"24\\" class=\\"components-panel__arrow\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z\\"></path></svg></span>My panel title</button></h2>My panel content</div>"`;
|