@wordpress/edit-post 7.33.0 → 7.34.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 (121) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +22 -36
  3. package/build/components/header/index.js +17 -48
  4. package/build/components/header/index.js.map +1 -1
  5. package/build/components/header/more-menu/index.js +17 -43
  6. package/build/components/header/more-menu/index.js.map +1 -1
  7. package/build/components/header/more-menu/manage-patterns-menu-item.js +40 -0
  8. package/build/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
  9. package/build/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
  10. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  11. package/build/components/keyboard-shortcuts/index.js +0 -88
  12. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  13. package/build/components/layout/index.js +18 -11
  14. package/build/components/layout/index.js.map +1 -1
  15. package/build/components/preferences-modal/index.js +2 -11
  16. package/build/components/preferences-modal/index.js.map +1 -1
  17. package/build/components/sidebar/post-status/index.js +29 -6
  18. package/build/components/sidebar/post-status/index.js.map +1 -1
  19. package/build/components/sidebar/settings-sidebar/index.js +40 -10
  20. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  21. package/build/deprecated.js +132 -0
  22. package/build/deprecated.js.map +1 -0
  23. package/build/index.js +19 -58
  24. package/build/index.js.map +1 -1
  25. package/build-module/components/header/index.js +20 -51
  26. package/build-module/components/header/index.js.map +1 -1
  27. package/build-module/components/header/more-menu/index.js +17 -43
  28. package/build-module/components/header/more-menu/index.js.map +1 -1
  29. package/build-module/components/header/more-menu/manage-patterns-menu-item.js +33 -0
  30. package/build-module/components/header/more-menu/manage-patterns-menu-item.js.map +1 -0
  31. package/build-module/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +1 -1
  32. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  33. package/build-module/components/keyboard-shortcuts/index.js +1 -89
  34. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  35. package/build-module/components/layout/index.js +18 -11
  36. package/build-module/components/layout/index.js.map +1 -1
  37. package/build-module/components/preferences-modal/index.js +3 -12
  38. package/build-module/components/preferences-modal/index.js.map +1 -1
  39. package/build-module/components/sidebar/post-status/index.js +30 -7
  40. package/build-module/components/sidebar/post-status/index.js.map +1 -1
  41. package/build-module/components/sidebar/settings-sidebar/index.js +43 -13
  42. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  43. package/build-module/deprecated.js +116 -0
  44. package/build-module/deprecated.js.map +1 -0
  45. package/build-module/index.js +2 -15
  46. package/build-module/index.js.map +1 -1
  47. package/build-style/style-rtl.css +6 -141
  48. package/build-style/style.css +6 -141
  49. package/package.json +31 -31
  50. package/src/components/header/index.js +24 -69
  51. package/src/components/header/more-menu/index.js +27 -42
  52. package/src/components/header/more-menu/manage-patterns-menu-item.js +33 -0
  53. package/src/components/header/style.scss +0 -79
  54. package/src/components/keyboard-shortcuts/index.js +1 -106
  55. package/src/components/layout/index.js +12 -6
  56. package/src/components/layout/style.scss +7 -80
  57. package/src/components/preferences-modal/index.js +2 -22
  58. package/src/components/sidebar/post-status/index.js +57 -17
  59. package/src/components/sidebar/settings-sidebar/index.js +60 -24
  60. package/src/deprecated.js +107 -0
  61. package/src/index.js +3 -24
  62. package/build/components/header/post-publish-button-or-toggle.js +0 -94
  63. package/build/components/header/post-publish-button-or-toggle.js.map +0 -1
  64. package/build/components/header/preferences-menu-item/index.js +0 -39
  65. package/build/components/header/preferences-menu-item/index.js.map +0 -1
  66. package/build/components/header/tools-more-menu-group/index.js +0 -26
  67. package/build/components/header/tools-more-menu-group/index.js.map +0 -1
  68. package/build/components/header/writing-menu/index.js +0 -71
  69. package/build/components/header/writing-menu/index.js.map +0 -1
  70. package/build/components/layout/actions-panel.js +0 -86
  71. package/build/components/layout/actions-panel.js.map +0 -1
  72. package/build/components/preferences-modal/enable-publish-sidebar.js +0 -38
  73. package/build/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
  74. package/build/components/sidebar/plugin-post-publish-panel/index.js +0 -39
  75. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
  76. package/build/components/sidebar/plugin-pre-publish-panel/index.js +0 -43
  77. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
  78. package/build/plugins/copy-content-menu-item/index.js +0 -39
  79. package/build/plugins/copy-content-menu-item/index.js.map +0 -1
  80. package/build/plugins/index.js +0 -69
  81. package/build/plugins/index.js.map +0 -1
  82. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -44
  83. package/build/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
  84. package/build/plugins/welcome-guide-menu-item/index.js.map +0 -1
  85. package/build-module/components/header/post-publish-button-or-toggle.js +0 -86
  86. package/build-module/components/header/post-publish-button-or-toggle.js.map +0 -1
  87. package/build-module/components/header/preferences-menu-item/index.js +0 -32
  88. package/build-module/components/header/preferences-menu-item/index.js.map +0 -1
  89. package/build-module/components/header/tools-more-menu-group/index.js +0 -19
  90. package/build-module/components/header/tools-more-menu-group/index.js.map +0 -1
  91. package/build-module/components/header/writing-menu/index.js +0 -64
  92. package/build-module/components/header/writing-menu/index.js.map +0 -1
  93. package/build-module/components/layout/actions-panel.js +0 -78
  94. package/build-module/components/layout/actions-panel.js.map +0 -1
  95. package/build-module/components/preferences-modal/enable-publish-sidebar.js +0 -31
  96. package/build-module/components/preferences-modal/enable-publish-sidebar.js.map +0 -1
  97. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +0 -32
  98. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +0 -1
  99. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +0 -36
  100. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +0 -1
  101. package/build-module/plugins/copy-content-menu-item/index.js +0 -32
  102. package/build-module/plugins/copy-content-menu-item/index.js.map +0 -1
  103. package/build-module/plugins/index.js +0 -65
  104. package/build-module/plugins/index.js.map +0 -1
  105. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -36
  106. package/build-module/plugins/keyboard-shortcuts-help-menu-item/index.js.map +0 -1
  107. package/build-module/plugins/welcome-guide-menu-item/index.js.map +0 -1
  108. package/src/components/header/post-publish-button-or-toggle.js +0 -97
  109. package/src/components/header/preferences-menu-item/index.js +0 -31
  110. package/src/components/header/test/index.js +0 -63
  111. package/src/components/header/tools-more-menu-group/index.js +0 -20
  112. package/src/components/header/writing-menu/index.js +0 -73
  113. package/src/components/layout/actions-panel.js +0 -103
  114. package/src/components/preferences-modal/enable-publish-sidebar.js +0 -32
  115. package/src/components/preferences-modal/test/index.js +0 -28
  116. package/src/components/sidebar/plugin-post-publish-panel/index.js +0 -28
  117. package/src/components/sidebar/plugin-pre-publish-panel/index.js +0 -32
  118. package/src/plugins/copy-content-menu-item/index.js +0 -29
  119. package/src/plugins/index.js +0 -85
  120. package/src/plugins/keyboard-shortcuts-help-menu-item/index.js +0 -36
  121. /package/src/{plugins/welcome-guide-menu-item/index.js → components/header/more-menu/welcome-guide-menu-item.js} +0 -0
@@ -2,14 +2,12 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useEffect } from '@wordpress/element';
5
- import { useSelect, useDispatch } from '@wordpress/data';
5
+ import { useDispatch } from '@wordpress/data';
6
6
  import {
7
7
  useShortcut,
8
8
  store as keyboardShortcutsStore,
9
9
  } from '@wordpress/keyboard-shortcuts';
10
10
  import { __ } from '@wordpress/i18n';
11
- import { store as blockEditorStore } from '@wordpress/block-editor';
12
- import { createBlock } from '@wordpress/blocks';
13
11
 
14
12
  /**
15
13
  * Internal dependencies
@@ -19,37 +17,6 @@ import { store as editPostStore } from '../../store';
19
17
  function KeyboardShortcuts() {
20
18
  const { toggleFeature } = useDispatch( editPostStore );
21
19
  const { registerShortcut } = useDispatch( keyboardShortcutsStore );
22
- const { replaceBlocks } = useDispatch( blockEditorStore );
23
- const { getBlockName, getSelectedBlockClientId, getBlockAttributes } =
24
- useSelect( blockEditorStore );
25
-
26
- const handleTextLevelShortcut = ( event, level ) => {
27
- event.preventDefault();
28
- const destinationBlockName =
29
- level === 0 ? 'core/paragraph' : 'core/heading';
30
- const currentClientId = getSelectedBlockClientId();
31
- if ( currentClientId === null ) {
32
- return;
33
- }
34
- const blockName = getBlockName( currentClientId );
35
- if ( blockName !== 'core/paragraph' && blockName !== 'core/heading' ) {
36
- return;
37
- }
38
- const attributes = getBlockAttributes( currentClientId );
39
- const textAlign =
40
- blockName === 'core/paragraph' ? 'align' : 'textAlign';
41
- const destinationTextAlign =
42
- destinationBlockName === 'core/paragraph' ? 'align' : 'textAlign';
43
-
44
- replaceBlocks(
45
- currentClientId,
46
- createBlock( destinationBlockName, {
47
- level,
48
- content: attributes.content,
49
- ...{ [ destinationTextAlign ]: attributes[ textAlign ] },
50
- } )
51
- );
52
- };
53
20
 
54
21
  useEffect( () => {
55
22
  registerShortcut( {
@@ -61,84 +28,12 @@ function KeyboardShortcuts() {
61
28
  character: 'f',
62
29
  },
63
30
  } );
64
-
65
- registerShortcut( {
66
- name: 'core/edit-post/next-region',
67
- category: 'global',
68
- description: __( 'Navigate to the next part of the editor.' ),
69
- keyCombination: {
70
- modifier: 'ctrl',
71
- character: '`',
72
- },
73
- aliases: [
74
- {
75
- modifier: 'access',
76
- character: 'n',
77
- },
78
- ],
79
- } );
80
-
81
- registerShortcut( {
82
- name: 'core/edit-post/previous-region',
83
- category: 'global',
84
- description: __( 'Navigate to the previous part of the editor.' ),
85
- keyCombination: {
86
- modifier: 'ctrlShift',
87
- character: '`',
88
- },
89
- aliases: [
90
- {
91
- modifier: 'access',
92
- character: 'p',
93
- },
94
- {
95
- modifier: 'ctrlShift',
96
- character: '~',
97
- },
98
- ],
99
- } );
100
-
101
- registerShortcut( {
102
- name: 'core/edit-post/transform-heading-to-paragraph',
103
- category: 'block-library',
104
- description: __( 'Transform heading to paragraph.' ),
105
- keyCombination: {
106
- modifier: 'access',
107
- character: `0`,
108
- },
109
- } );
110
-
111
- [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
112
- registerShortcut( {
113
- name: `core/edit-post/transform-paragraph-to-heading-${ level }`,
114
- category: 'block-library',
115
- description: __( 'Transform paragraph to heading.' ),
116
- keyCombination: {
117
- modifier: 'access',
118
- character: `${ level }`,
119
- },
120
- } );
121
- } );
122
31
  }, [] );
123
32
 
124
33
  useShortcut( 'core/edit-post/toggle-fullscreen', () => {
125
34
  toggleFeature( 'fullscreenMode' );
126
35
  } );
127
36
 
128
- useShortcut( 'core/edit-post/transform-heading-to-paragraph', ( event ) =>
129
- handleTextLevelShortcut( event, 0 )
130
- );
131
-
132
- [ 1, 2, 3, 4, 5, 6 ].forEach( ( level ) => {
133
- //the loop is based off on a constant therefore
134
- //the hook will execute the same way every time
135
- //eslint-disable-next-line react-hooks/rules-of-hooks
136
- useShortcut(
137
- `core/edit-post/transform-paragraph-to-heading-${ level }`,
138
- ( event ) => handleTextLevelShortcut( event, level )
139
- );
140
- } );
141
-
142
37
  return null;
143
38
  }
144
39
 
@@ -34,6 +34,7 @@ import { store as noticesStore } from '@wordpress/notices';
34
34
  import { store as preferencesStore } from '@wordpress/preferences';
35
35
  import { privateApis as commandsPrivateApis } from '@wordpress/commands';
36
36
  import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
37
+ import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
37
38
 
38
39
  /**
39
40
  * Internal dependencies
@@ -41,14 +42,12 @@ import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands
41
42
  import TextEditor from '../text-editor';
42
43
  import VisualEditor from '../visual-editor';
43
44
  import EditPostKeyboardShortcuts from '../keyboard-shortcuts';
44
- import EditPostPreferencesModal from '../preferences-modal';
45
45
  import InitPatternModal from '../init-pattern-modal';
46
46
  import BrowserURL from '../browser-url';
47
47
  import Header from '../header';
48
48
  import SettingsSidebar from '../sidebar/settings-sidebar';
49
49
  import MetaBoxes from '../meta-boxes';
50
50
  import WelcomeGuide from '../welcome-guide';
51
- import ActionsPanel from './actions-panel';
52
51
  import { store as editPostStore } from '../../store';
53
52
  import { unlock } from '../../lock-unlock';
54
53
  import useCommonCommands from '../../hooks/commands/use-common-commands';
@@ -61,9 +60,11 @@ const {
61
60
  ListViewSidebar,
62
61
  ComplementaryArea,
63
62
  FullscreenMode,
63
+ SavePublishPanels,
64
64
  InterfaceSkeleton,
65
65
  interfaceStore,
66
66
  } = unlock( editorPrivateApis );
67
+ const { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );
67
68
 
68
69
  const interfaceLabels = {
69
70
  /* translators: accessibility text for the editor top bar landmark region. */
@@ -158,6 +159,7 @@ function Layout( { initialPost } ) {
158
159
  showMetaBoxes,
159
160
  documentLabel,
160
161
  hasHistory,
162
+ hasBlockBreadcrumbs,
161
163
  } = useSelect( ( select ) => {
162
164
  const { get } = select( preferencesStore );
163
165
  const { getEditorSettings, getPostTypeLabel } = select( editorStore );
@@ -180,10 +182,10 @@ function Layout( { initialPost } ) {
180
182
  hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
181
183
  previousShortcut: select(
182
184
  keyboardShortcutsStore
183
- ).getAllShortcutKeyCombinations( 'core/edit-post/previous-region' ),
185
+ ).getAllShortcutKeyCombinations( 'core/editor/previous-region' ),
184
186
  nextShortcut: select(
185
187
  keyboardShortcutsStore
186
- ).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),
188
+ ).getAllShortcutKeyCombinations( 'core/editor/next-region' ),
187
189
  showIconLabels: get( 'core', 'showIconLabels' ),
188
190
  isDistractionFree: get( 'core', 'distractionFree' ),
189
191
  showBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),
@@ -192,6 +194,7 @@ function Layout( { initialPost } ) {
192
194
  hasBlockSelected:
193
195
  !! select( blockEditorStore ).getBlockSelectionStart(),
194
196
  hasHistory: !! getEditorSettings().onNavigateToPreviousEntityRecord,
197
+ hasBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),
195
198
  };
196
199
  }, [] );
197
200
 
@@ -242,6 +245,8 @@ function Layout( { initialPost } ) {
242
245
  'has-metaboxes': hasActiveMetaboxes,
243
246
  'is-distraction-free': isDistractionFree && isWideViewport,
244
247
  'is-entity-save-view-open': !! entitiesSavedStatesCallback,
248
+ 'has-block-breadcrumbs':
249
+ hasBlockBreadcrumbs && ! isDistractionFree && isWideViewport,
245
250
  } );
246
251
 
247
252
  const secondarySidebarLabel = isListViewOpened
@@ -286,6 +291,7 @@ function Layout( { initialPost } ) {
286
291
  <EditPostKeyboardShortcuts />
287
292
  <EditorKeyboardShortcutsRegister />
288
293
  <EditorKeyboardShortcuts />
294
+ <BlockKeyboardShortcuts />
289
295
 
290
296
  <InterfaceSkeleton
291
297
  isDistractionFree={ isDistractionFree && isWideViewport }
@@ -343,7 +349,7 @@ function Layout( { initialPost } ) {
343
349
  )
344
350
  }
345
351
  actions={
346
- <ActionsPanel
352
+ <SavePublishPanels
347
353
  closeEntitiesSavedStates={ closeEntitiesSavedStates }
348
354
  isEntitiesSavedStatesOpen={
349
355
  entitiesSavedStatesCallback
@@ -351,6 +357,7 @@ function Layout( { initialPost } ) {
351
357
  setEntitiesSavedStatesCallback={
352
358
  setEntitiesSavedStatesCallback
353
359
  }
360
+ forceIsDirtyPublishPanel={ hasActiveMetaboxes }
354
361
  />
355
362
  }
356
363
  shortcuts={ {
@@ -358,7 +365,6 @@ function Layout( { initialPost } ) {
358
365
  next: nextShortcut,
359
366
  } }
360
367
  />
361
- <EditPostPreferencesModal />
362
368
  <WelcomeGuide />
363
369
  <InitPatternModal />
364
370
  <PluginArea onError={ onPluginAreaError } />
@@ -7,95 +7,22 @@
7
7
  .edit-post-layout .components-editor-notices__snackbar {
8
8
  position: fixed;
9
9
  right: 0;
10
- bottom: 40px;
10
+ bottom: 16px;
11
11
  padding-left: 16px;
12
12
  padding-right: 16px;
13
13
  }
14
14
 
15
15
  .is-distraction-free {
16
16
  .components-editor-notices__snackbar {
17
- bottom: 20px;
17
+ bottom: 16px;
18
18
  }
19
19
  }
20
20
 
21
- @include editor-left(".edit-post-layout .components-editor-notices__snackbar");
22
-
23
- .edit-post-layout .editor-post-publish-panel {
24
- position: fixed;
25
- z-index: z-index(".edit-post-layout .edit-post-post-publish-panel");
26
- top: $admin-bar-height-big;
27
- bottom: 0;
28
- right: 0;
29
- left: 0;
30
- overflow: auto;
31
-
32
- @include break-medium() {
33
- z-index: z-index(".edit-post-layout .edit-post-post-publish-panel {greater than small}");
34
- top: $admin-bar-height;
35
- left: auto;
36
- width: $sidebar-width + $border-width;
37
- border-left: $border-width solid $gray-300;
38
- transform: translateX(+100%);
39
- animation: edit-post-post-publish-panel__slide-in-animation 0.1s forwards;
40
- @include reduce-motion("animation");
41
-
42
- body.is-fullscreen-mode & {
43
- top: 0;
44
- }
45
-
46
- // Keep it open on focus to avoid conflict with navigate-regions animation.
47
- [role="region"]:focus & {
48
- transform: translateX(0%);
49
- }
50
- }
51
- }
52
-
53
- @keyframes edit-post-post-publish-panel__slide-in-animation {
54
- 100% {
55
- transform: translateX(0%);
56
- }
57
- }
58
-
59
- .edit-post-layout .editor-post-publish-panel__header-publish-button {
60
- justify-content: center;
61
- }
62
-
63
- .edit-post-layout__toggle-publish-panel,
64
- .edit-post-layout__toggle-sidebar-panel,
65
- .edit-post-layout__toggle-entities-saved-states-panel {
66
- z-index: z-index(".edit-post-layout__toggle-sidebar-panel");
67
- position: fixed !important; // Need to override the default relative positionning
68
- top: -9999em;
69
- bottom: auto;
70
- left: auto;
71
- right: 0;
72
- box-sizing: border-box;
73
- width: $sidebar-width;
74
- background-color: $white;
75
- border: 1px dotted $gray-300;
76
- height: auto !important; // Need to override the default sidebar positionnings
77
- padding: $grid-unit-30;
78
- display: flex;
79
- justify-content: center;
80
- }
81
-
82
- .edit-post-layout__toggle-sidebar-panel {
83
- .interface-interface-skeleton__sidebar:focus &,
84
- .interface-interface-skeleton__sidebar:focus-within & {
85
- top: auto;
86
- bottom: 0;
87
- }
88
- }
89
-
90
- .edit-post-layout__toggle-entities-saved-states-panel,
91
- .edit-post-layout__toggle-publish-panel {
92
- .interface-interface-skeleton__actions:focus &,
93
- .interface-interface-skeleton__actions:focus-within & {
94
- top: auto;
95
- bottom: 0;
21
+ // Adjust the position of the notices when breadcrumbs are present
22
+ .has-block-breadcrumbs {
23
+ .components-editor-notices__snackbar {
24
+ bottom: 40px;
96
25
  }
97
26
  }
98
27
 
99
- .edit-post-layout .entities-saved-states__panel-header {
100
- height: $header-height + $border-width;
101
- }
28
+ @include editor-left(".edit-post-layout .components-editor-notices__snackbar");
@@ -3,7 +3,6 @@
3
3
  */
4
4
 
5
5
  import { __ } from '@wordpress/i18n';
6
- import { useViewportMatch } from '@wordpress/compose';
7
6
  import { privateApis as preferencesPrivateApis } from '@wordpress/preferences';
8
7
  import { privateApis as editorPrivateApis } from '@wordpress/editor';
9
8
 
@@ -12,32 +11,13 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
12
11
  */
13
12
  import { unlock } from '../../lock-unlock';
14
13
  import MetaBoxesSection from './meta-boxes-section';
15
- import EnablePublishSidebarOption from './enable-publish-sidebar';
16
14
 
17
- const { PreferencesModalSection, PreferenceToggleControl } = unlock(
18
- preferencesPrivateApis
19
- );
15
+ const { PreferenceToggleControl } = unlock( preferencesPrivateApis );
20
16
  const { PreferencesModal } = unlock( editorPrivateApis );
21
17
 
22
18
  export default function EditPostPreferencesModal() {
23
- const isLargeViewport = useViewportMatch( 'medium' );
24
-
25
19
  const extraSections = {
26
- general: (
27
- <>
28
- { isLargeViewport && (
29
- <PreferencesModalSection title={ __( 'Publishing' ) }>
30
- <EnablePublishSidebarOption
31
- help={ __(
32
- 'Review settings, such as visibility and tags.'
33
- ) }
34
- label={ __( 'Enable pre-publish checks' ) }
35
- />
36
- </PreferencesModalSection>
37
- ) }
38
- <MetaBoxesSection title={ __( 'Advanced' ) } />
39
- </>
40
- ),
20
+ general: <MetaBoxesSection title={ __( 'Advanced' ) } />,
41
21
  appearance: (
42
22
  <PreferenceToggleControl
43
23
  scope="core/edit-post"
@@ -4,6 +4,7 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import {
6
6
  __experimentalHStack as HStack,
7
+ __experimentalVStack as VStack,
7
8
  PanelBody,
8
9
  } from '@wordpress/components';
9
10
  import { useDispatch, useSelect } from '@wordpress/data';
@@ -28,7 +29,12 @@ import PostSlug from '../post-slug';
28
29
  import PostFormat from '../post-format';
29
30
  import { unlock } from '../../../lock-unlock';
30
31
 
31
- const { PostStatus: PostStatusPanel } = unlock( editorPrivateApis );
32
+ const {
33
+ PostStatus: PostStatusPanel,
34
+ PrivatePostExcerptPanel,
35
+ PostContentInformation,
36
+ PostLastEditedPanel,
37
+ } = unlock( editorPrivateApis );
32
38
 
33
39
  /**
34
40
  * Module Constants
@@ -36,16 +42,30 @@ const { PostStatus: PostStatusPanel } = unlock( editorPrivateApis );
36
42
  const PANEL_NAME = 'post-status';
37
43
 
38
44
  export default function PostStatus() {
39
- const { isOpened, isRemoved } = useSelect( ( select ) => {
40
- // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
41
- // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
42
- const { isEditorPanelRemoved, isEditorPanelOpened } =
43
- select( editorStore );
44
- return {
45
- isRemoved: isEditorPanelRemoved( PANEL_NAME ),
46
- isOpened: isEditorPanelOpened( PANEL_NAME ),
47
- };
48
- }, [] );
45
+ const { isOpened, isRemoved, showPostContentPanels } = useSelect(
46
+ ( select ) => {
47
+ // We use isEditorPanelRemoved to hide the panel if it was programatically removed. We do
48
+ // not use isEditorPanelEnabled since this panel should not be disabled through the UI.
49
+ const {
50
+ isEditorPanelRemoved,
51
+ isEditorPanelOpened,
52
+ getCurrentPostType,
53
+ } = select( editorStore );
54
+ const postType = getCurrentPostType();
55
+ return {
56
+ isRemoved: isEditorPanelRemoved( PANEL_NAME ),
57
+ isOpened: isEditorPanelOpened( PANEL_NAME ),
58
+ // Post excerpt panel is rendered in different place depending on the post type.
59
+ // So we cannot make this check inside the PostExcerpt component based on the current edited entity.
60
+ showPostContentPanels: ! [
61
+ 'wp_template',
62
+ 'wp_template_part',
63
+ 'wp_block',
64
+ ].includes( postType ),
65
+ };
66
+ },
67
+ []
68
+ );
49
69
  const { toggleEditorPanelOpened } = useDispatch( editorStore );
50
70
 
51
71
  if ( isRemoved ) {
@@ -62,12 +82,32 @@ export default function PostStatus() {
62
82
  <PluginPostStatusInfo.Slot>
63
83
  { ( fills ) => (
64
84
  <>
65
- <PostStatusPanel />
66
- <PostFeaturedImagePanel withPanelBody={ false } />
67
- <PostSchedulePanel />
68
- <PostTemplatePanel />
69
- <PostURLPanel />
70
- <PostSyncStatus />
85
+ { showPostContentPanels && (
86
+ <VStack
87
+ spacing={ 3 }
88
+ // TODO: this needs to be consolidated with the panel in site editor, when we unify them.
89
+ style={ { marginBlockEnd: '24px' } }
90
+ >
91
+ <PostFeaturedImagePanel
92
+ withPanelBody={ false }
93
+ />
94
+ <PrivatePostExcerptPanel />
95
+ <VStack spacing={ 1 }>
96
+ <PostContentInformation />
97
+ <PostLastEditedPanel />
98
+ </VStack>
99
+ </VStack>
100
+ ) }
101
+ <VStack
102
+ spacing={ 1 }
103
+ style={ { marginBlockEnd: '12px' } }
104
+ >
105
+ <PostStatusPanel />
106
+ <PostSchedulePanel />
107
+ <PostTemplatePanel />
108
+ <PostURLPanel />
109
+ <PostSyncStatus />
110
+ </VStack>
71
111
  <PostSticky />
72
112
  <PostFormat />
73
113
  <PostSlug />
@@ -13,7 +13,7 @@ import {
13
13
  useEffect,
14
14
  useRef,
15
15
  } from '@wordpress/element';
16
- import { isRTL, __ } from '@wordpress/i18n';
16
+ import { isRTL, __, sprintf } from '@wordpress/i18n';
17
17
  import { drawerLeft, drawerRight } from '@wordpress/icons';
18
18
  import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
19
19
  import {
@@ -22,12 +22,12 @@ import {
22
22
  PluginDocumentSettingPanel,
23
23
  PluginSidebar,
24
24
  PostDiscussionPanel,
25
- PostExcerptPanel,
26
25
  PostLastRevisionPanel,
27
26
  PostTaxonomiesPanel,
28
27
  privateApis as editorPrivateApis,
29
28
  } from '@wordpress/editor';
30
29
  import { addQueryArgs } from '@wordpress/url';
30
+ import { store as noticesStore } from '@wordpress/notices';
31
31
 
32
32
  /**
33
33
  * Internal dependencies
@@ -54,15 +54,6 @@ export const sidebars = {
54
54
  block: 'edit-post/block',
55
55
  };
56
56
 
57
- function onActionPerformed( actionId, items ) {
58
- if ( actionId === 'move-to-trash' ) {
59
- const postType = items[ 0 ].type;
60
- document.location.href = addQueryArgs( 'edit.php', {
61
- post_type: postType,
62
- } );
63
- }
64
- }
65
-
66
57
  const SidebarContent = ( { tabName, keyboardShortcut, isEditingTemplate } ) => {
67
58
  const tabListRef = useRef( null );
68
59
  // Because `PluginSidebar` renders a `ComplementaryArea`, we
@@ -96,6 +87,56 @@ const SidebarContent = ( { tabName, keyboardShortcut, isEditingTemplate } ) => {
96
87
  selectedTabElement?.focus();
97
88
  }
98
89
  }, [ tabName ] );
90
+ const { createSuccessNotice } = useDispatch( noticesStore );
91
+
92
+ const onActionPerformed = useCallback(
93
+ ( actionId, items ) => {
94
+ switch ( actionId ) {
95
+ case 'move-to-trash':
96
+ {
97
+ const postType = items[ 0 ].type;
98
+ document.location.href = addQueryArgs( 'edit.php', {
99
+ post_type: postType,
100
+ } );
101
+ }
102
+ break;
103
+ case 'duplicate-post':
104
+ {
105
+ const newItem = items[ 0 ];
106
+ const title =
107
+ typeof newItem.title === 'string'
108
+ ? newItem.title
109
+ : newItem.title?.rendered;
110
+ createSuccessNotice(
111
+ sprintf(
112
+ // translators: %s: Title of the created post e.g: "Post 1".
113
+ __( '"%s" successfully created.' ),
114
+ title
115
+ ),
116
+ {
117
+ type: 'snackbar',
118
+ id: 'duplicate-post-action',
119
+ actions: [
120
+ {
121
+ label: __( 'Edit' ),
122
+ onClick: () => {
123
+ const postId = newItem.id;
124
+ document.location.href =
125
+ addQueryArgs( 'post.php', {
126
+ post: postId,
127
+ action: 'edit',
128
+ } );
129
+ },
130
+ },
131
+ ],
132
+ }
133
+ );
134
+ }
135
+ break;
136
+ }
137
+ },
138
+ [ createSuccessNotice ]
139
+ );
99
140
 
100
141
  return (
101
142
  <PluginSidebar
@@ -126,19 +167,14 @@ const SidebarContent = ( { tabName, keyboardShortcut, isEditingTemplate } ) => {
126
167
  />
127
168
  }
128
169
  />
129
- { ! isEditingTemplate && (
130
- <>
131
- <PostStatus />
132
- <PluginDocumentSettingPanel.Slot />
133
- <PostLastRevisionPanel />
134
- <PostTaxonomiesPanel />
135
- <PostExcerptPanel />
136
- <PostDiscussionPanel />
137
- <PageAttributesPanel />
138
- <PatternOverridesPanel />
139
- <MetaBoxes location="side" />
140
- </>
141
- ) }
170
+ { ! isEditingTemplate && <PostStatus /> }
171
+ <PluginDocumentSettingPanel.Slot />
172
+ <PostLastRevisionPanel />
173
+ <PostTaxonomiesPanel />
174
+ <PostDiscussionPanel />
175
+ <PageAttributesPanel />
176
+ <PatternOverridesPanel />
177
+ { ! isEditingTemplate && <MetaBoxes location="side" /> }
142
178
  </Tabs.TabPanel>
143
179
  <Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
144
180
  <BlockInspector />