@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.
Files changed (117) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/build/components/block-manager/category.js +3 -11
  3. package/build/components/block-manager/category.js.map +1 -1
  4. package/build/components/block-manager/checklist.js +4 -3
  5. package/build/components/block-manager/checklist.js.map +1 -1
  6. package/build/components/block-manager/index.js +3 -10
  7. package/build/components/block-manager/index.js.map +1 -1
  8. package/build/components/header/header-toolbar/index.js +2 -2
  9. package/build/components/header/header-toolbar/index.js.map +1 -1
  10. package/build/components/header/index.js +2 -2
  11. package/build/components/header/index.js.map +1 -1
  12. package/build/components/keyboard-shortcut-help-modal/config.js +12 -0
  13. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  14. package/build/components/keyboard-shortcuts/index.js +68 -0
  15. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  16. package/build/components/layout/index.js +3 -2
  17. package/build/components/layout/index.js.map +1 -1
  18. package/build/components/preferences-modal/index.js +1 -1
  19. package/build/components/preferences-modal/index.js.map +1 -1
  20. package/build/components/preferences-modal/meta-boxes-section.js +1 -1
  21. package/build/components/preferences-modal/meta-boxes-section.js.map +1 -1
  22. package/build/components/secondary-sidebar/list-view-sidebar.js +4 -4
  23. package/build/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  24. package/build/components/sidebar/post-status/index.js +1 -1
  25. package/build/components/sidebar/post-status/index.js.map +1 -1
  26. package/build/components/sidebar/post-template/index.js +2 -4
  27. package/build/components/sidebar/post-template/index.js.map +1 -1
  28. package/build/components/sidebar/settings-sidebar/index.js +7 -7
  29. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  30. package/build/editor.native.js +8 -2
  31. package/build/editor.native.js.map +1 -1
  32. package/build/hooks/validate-multiple-use/index.js +1 -7
  33. package/build/hooks/validate-multiple-use/index.js.map +1 -1
  34. package/build/plugins/index.js +3 -1
  35. package/build/plugins/index.js.map +1 -1
  36. package/build/plugins/navigation-list-view-menu-item.js +48 -0
  37. package/build/plugins/navigation-list-view-menu-item.js.map +1 -0
  38. package/build/store/actions.js +1 -7
  39. package/build/store/actions.js.map +1 -1
  40. package/build-module/components/block-manager/category.js +3 -11
  41. package/build-module/components/block-manager/category.js.map +1 -1
  42. package/build-module/components/block-manager/checklist.js +5 -4
  43. package/build-module/components/block-manager/checklist.js.map +1 -1
  44. package/build-module/components/block-manager/index.js +3 -9
  45. package/build-module/components/block-manager/index.js.map +1 -1
  46. package/build-module/components/header/header-toolbar/index.js +2 -2
  47. package/build-module/components/header/header-toolbar/index.js.map +1 -1
  48. package/build-module/components/header/index.js +2 -2
  49. package/build-module/components/header/index.js.map +1 -1
  50. package/build-module/components/keyboard-shortcut-help-modal/config.js +12 -0
  51. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -1
  52. package/build-module/components/keyboard-shortcuts/index.js +67 -0
  53. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  54. package/build-module/components/layout/index.js +3 -2
  55. package/build-module/components/layout/index.js.map +1 -1
  56. package/build-module/components/preferences-modal/index.js +1 -1
  57. package/build-module/components/preferences-modal/index.js.map +1 -1
  58. package/build-module/components/preferences-modal/meta-boxes-section.js +2 -2
  59. package/build-module/components/preferences-modal/meta-boxes-section.js.map +1 -1
  60. package/build-module/components/secondary-sidebar/list-view-sidebar.js +4 -4
  61. package/build-module/components/secondary-sidebar/list-view-sidebar.js.map +1 -1
  62. package/build-module/components/sidebar/post-status/index.js +1 -1
  63. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  64. package/build-module/components/sidebar/post-template/index.js +2 -4
  65. package/build-module/components/sidebar/post-template/index.js.map +1 -1
  66. package/build-module/components/sidebar/settings-sidebar/index.js +5 -5
  67. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  68. package/build-module/editor.native.js +7 -2
  69. package/build-module/editor.native.js.map +1 -1
  70. package/build-module/hooks/validate-multiple-use/index.js +1 -6
  71. package/build-module/hooks/validate-multiple-use/index.js.map +1 -1
  72. package/build-module/plugins/index.js +2 -1
  73. package/build-module/plugins/index.js.map +1 -1
  74. package/build-module/plugins/navigation-list-view-menu-item.js +40 -0
  75. package/build-module/plugins/navigation-list-view-menu-item.js.map +1 -0
  76. package/build-module/store/actions.js +1 -6
  77. package/build-module/store/actions.js.map +1 -1
  78. package/build-style/classic-rtl.css +14 -0
  79. package/build-style/classic.css +14 -0
  80. package/build-style/style-rtl.css +102 -66
  81. package/build-style/style.css +102 -66
  82. package/package.json +29 -29
  83. package/src/components/block-manager/category.js +3 -10
  84. package/src/components/block-manager/checklist.js +3 -6
  85. package/src/components/block-manager/index.js +6 -10
  86. package/src/components/block-manager/style.scss +4 -15
  87. package/src/components/header/header-toolbar/index.js +2 -2
  88. package/src/components/header/index.js +3 -3
  89. package/src/components/header/style.scss +3 -8
  90. package/src/components/keyboard-shortcut-help-modal/config.js +10 -0
  91. package/src/components/keyboard-shortcut-help-modal/test/__snapshots__/index.js.snap +70 -0
  92. package/src/components/keyboard-shortcuts/index.js +71 -0
  93. package/src/components/layout/index.js +4 -2
  94. package/src/components/layout/style.scss +12 -1
  95. package/src/components/preferences-modal/index.js +1 -1
  96. package/src/components/preferences-modal/meta-boxes-section.js +2 -3
  97. package/src/components/preferences-modal/options/test/__snapshots__/enable-custom-fields.js.snap +56 -4
  98. package/src/components/preferences-modal/test/__snapshots__/index.js.snap +43 -18
  99. package/src/components/preferences-modal/test/__snapshots__/meta-boxes-section.js.snap +51 -6
  100. package/src/components/secondary-sidebar/list-view-sidebar.js +4 -4
  101. package/src/components/secondary-sidebar/style.scss +3 -3
  102. package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +8 -6
  103. package/src/components/sidebar/post-schedule/style.scss +2 -1
  104. package/src/components/sidebar/post-status/index.js +1 -1
  105. package/src/components/sidebar/post-template/index.js +8 -3
  106. package/src/components/sidebar/post-template/style.scss +2 -0
  107. package/src/components/sidebar/post-url/style.scss +3 -0
  108. package/src/components/sidebar/post-visibility/style.scss +2 -0
  109. package/src/components/sidebar/settings-header/style.scss +47 -34
  110. package/src/components/sidebar/settings-sidebar/index.js +5 -5
  111. package/src/components/visual-editor/test/index.native.js +24 -13
  112. package/src/editor.native.js +14 -11
  113. package/src/hooks/validate-multiple-use/index.js +1 -7
  114. package/src/plugins/index.js +2 -0
  115. package/src/plugins/navigation-list-view-menu-item.js +56 -0
  116. package/src/store/actions.js +6 -15
  117. 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={ __( 'List View' ) }
47
- className="edit-post-editor__list-view-panel"
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-editor__list-view-panel-header components-panel__header edit-post-sidebar__panel-tabs"
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 List View Sidebar' ) }
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-editor__list-view-panel {
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-editor__list-view-panel {
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-editor__list-view-panel-header {
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={ true }
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( div.innerHTML ).toMatchSnapshot();
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
@@ -40,8 +40,8 @@ function PostStatus( { isOpened, onTogglePanel } ) {
40
40
  <>
41
41
  <PostVisibility />
42
42
  <PostSchedule />
43
- <PostURL />
44
43
  <PostTemplate />
44
+ <PostURL />
45
45
  <PostSticky />
46
46
  <PostPendingStatus />
47
47
  <PostFormat />
@@ -85,9 +85,14 @@ function PostTemplateToggle( { isOpen, onClick } ) {
85
85
  if ( ! supportsTemplateMode && availableTemplates[ templateSlug ] ) {
86
86
  return availableTemplates[ templateSlug ];
87
87
  }
88
-
89
- const template = select( editPostStore ).getEditedPostTemplate();
90
- return template?.title ?? template?.slug;
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 (
@@ -5,6 +5,8 @@
5
5
  span {
6
6
  display: block;
7
7
  width: 45%;
8
+ // Match padding on tertiary buttons for alignment.
9
+ padding: $grid-unit-15 * 0.5 0;
8
10
  }
9
11
  }
10
12
 
@@ -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
 
@@ -5,6 +5,8 @@
5
5
  span {
6
6
  display: block;
7
7
  width: 45%;
8
+ // Match padding on tertiary buttons for alignment.
9
+ padding: $grid-unit-15 * 0.5 0;
8
10
  }
9
11
  }
10
12
 
@@ -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
- display: inline-block;
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
- // This pseudo-element "duplicates" the tab label and sets the text to bold.
14
- // This ensures that the tab doesn't change width when selected.
15
- // See: https://github.com/WordPress/gutenberg/pull/9793
15
+ &:focus:not(:disabled) {
16
+ position: relative;
17
+ box-shadow: none;
18
+ }
19
+
20
+ // Tab indicator
16
21
  &::after {
17
- content: attr(data-label);
18
- display: block;
19
- font-weight: 600;
20
- height: 0;
21
- overflow: hidden;
22
- speak: none;
23
- visibility: hidden;
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
- &.is-active {
27
- // The transparent shadow ensures no jumpiness when focus animates on an active tab.
28
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) transparent, inset 0 0 -$border-width-tab 0 0 var(--wp-admin-theme-color);
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
- &:focus {
45
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
46
- position: relative;
47
- z-index: z-index(".edit-post-sidebar__panel-tab.is-active");
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
- &.is-active:focus {
51
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color), inset 0 -#{$border-width-tab * 2} 0 0 var(--wp-admin-theme-color);
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 { cog } from '@wordpress/icons';
8
+ import { useSelect } from '@wordpress/data';
9
9
  import { Platform } from '@wordpress/element';
10
- import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
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={ cog }
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( screen.getByA11yLabel( /Paragraph Block. Row 1/ ) );
41
+ fireEvent.press(
42
+ screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
43
+ );
42
44
 
43
45
  // Focus title
44
46
  fireEvent(
45
- screen.getAllByA11yLabel( 'Post title. test' )[ 0 ],
47
+ screen.getAllByLabelText( 'Post title. test' )[ 0 ],
46
48
  'select'
47
49
  );
48
50
 
49
51
  // Add new Heading block
50
- fireEvent.press( screen.getByA11yLabel( 'Add block' ) );
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.getByA11yLabel( /Paragraph Block. Row 2/ )
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.getByA11yLabel( /Paragraph Block. Row 3/ )
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( screen.getByA11yLabel( /Paragraph Block. Row 1/ ) );
75
+ fireEvent.press(
76
+ screen.getAllByLabelText( /Paragraph Block. Row 1/ )[ 0 ]
77
+ );
71
78
 
72
79
  // Focus title
73
80
  fireEvent(
74
- screen.getAllByA11yLabel( 'Post title. test' )[ 0 ],
81
+ screen.getAllByLabelText( 'Post title. test' )[ 0 ],
75
82
  'select'
76
83
  );
77
84
 
78
85
  // Focus last block
79
- fireEvent.press( screen.getByA11yLabel( /Paragraph Block. Row 2/ ) );
86
+ fireEvent.press(
87
+ screen.getAllByLabelText( /Paragraph Block. Row 2/ )[ 0 ]
88
+ );
80
89
 
81
90
  // Add new Heading block
82
- fireEvent.press( screen.getByA11yLabel( 'Add block' ) );
91
+ fireEvent.press( screen.getByLabelText( 'Add block' ) );
83
92
  fireEvent.press( screen.getByText( 'Heading' ) );
84
93
 
85
94
  expect(
86
- screen.getByA11yLabel( /Paragraph Block. Row 1/ )
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.getByA11yLabel( /Paragraph Block. Row 2/ )
101
+ screen.getAllByLabelText( /Heading Block. Row 3/ )[ 0 ]
90
102
  ).toBeDefined();
91
- expect( screen.getByA11yLabel( /Heading Block. Row 3/ ) ).toBeDefined();
92
103
  } );
93
104
  } );
@@ -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
- <SlotFillProvider>
177
- <EditorProvider
178
- settings={ editorSettings }
179
- post={ normalizedPost }
180
- initialEdits={ initialEdits }
181
- useSubRegistry={ false }
182
- { ...props }
183
- >
184
- <Layout setTitleRef={ this.setTitleRef } />
185
- </EditorProvider>
186
- </SlotFillProvider>
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 =
@@ -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;
@@ -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
- formDataToMerge,
390
- ( memo, currentFormData ) => {
391
- for ( const [ key, value ] of currentFormData ) {
392
- memo.append( key, value );
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>"`;