@wordpress/edit-post 7.31.0 → 7.32.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 (104) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +5 -127
  3. package/build/components/header/index.js +1 -1
  4. package/build/components/header/index.js.map +1 -1
  5. package/build/components/header/post-publish-button-or-toggle.js +2 -7
  6. package/build/components/header/post-publish-button-or-toggle.js.map +1 -1
  7. package/build/components/keyboard-shortcut-help-modal/index.js +3 -0
  8. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  9. package/build/components/layout/actions-panel.js +4 -7
  10. package/build/components/layout/actions-panel.js.map +1 -1
  11. package/build/components/layout/index.js +5 -2
  12. package/build/components/layout/index.js.map +1 -1
  13. package/build/components/sidebar/plugin-post-publish-panel/index.js +16 -64
  14. package/build/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  15. package/build/components/sidebar/plugin-pre-publish-panel/index.js +16 -63
  16. package/build/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  17. package/build/components/sidebar/settings-sidebar/index.js +8 -3
  18. package/build/components/sidebar/settings-sidebar/index.js.map +1 -1
  19. package/build/editor.js +7 -2
  20. package/build/editor.js.map +1 -1
  21. package/build/hooks/commands/use-common-commands.js +2 -2
  22. package/build/hooks/commands/use-common-commands.js.map +1 -1
  23. package/build/hooks/use-navigate-to-entity-record.js +36 -19
  24. package/build/hooks/use-navigate-to-entity-record.js.map +1 -1
  25. package/build/index.js +3 -4
  26. package/build/index.js.map +1 -1
  27. package/build/index.native.js +2 -4
  28. package/build/index.native.js.map +1 -1
  29. package/build/store/actions.js +36 -23
  30. package/build/store/actions.js.map +1 -1
  31. package/build/store/reducer.js +1 -15
  32. package/build/store/reducer.js.map +1 -1
  33. package/build/store/selectors.js +10 -5
  34. package/build/store/selectors.js.map +1 -1
  35. package/build-module/components/header/index.js +1 -1
  36. package/build-module/components/header/index.js.map +1 -1
  37. package/build-module/components/header/post-publish-button-or-toggle.js +2 -7
  38. package/build-module/components/header/post-publish-button-or-toggle.js.map +1 -1
  39. package/build-module/components/keyboard-shortcut-help-modal/index.js +3 -0
  40. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  41. package/build-module/components/layout/actions-panel.js +4 -5
  42. package/build-module/components/layout/actions-panel.js.map +1 -1
  43. package/build-module/components/layout/index.js +5 -2
  44. package/build-module/components/layout/index.js.map +1 -1
  45. package/build-module/components/sidebar/plugin-post-publish-panel/index.js +14 -62
  46. package/build-module/components/sidebar/plugin-post-publish-panel/index.js.map +1 -1
  47. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js +14 -61
  48. package/build-module/components/sidebar/plugin-pre-publish-panel/index.js.map +1 -1
  49. package/build-module/components/sidebar/settings-sidebar/index.js +9 -4
  50. package/build-module/components/sidebar/settings-sidebar/index.js.map +1 -1
  51. package/build-module/editor.js +7 -2
  52. package/build-module/editor.js.map +1 -1
  53. package/build-module/hooks/commands/use-common-commands.js +2 -2
  54. package/build-module/hooks/commands/use-common-commands.js.map +1 -1
  55. package/build-module/hooks/use-navigate-to-entity-record.js +37 -20
  56. package/build-module/hooks/use-navigate-to-entity-record.js.map +1 -1
  57. package/build-module/index.js +4 -4
  58. package/build-module/index.js.map +1 -1
  59. package/build-module/index.native.js +2 -4
  60. package/build-module/index.native.js.map +1 -1
  61. package/build-module/store/actions.js +30 -15
  62. package/build-module/store/actions.js.map +1 -1
  63. package/build-module/store/reducer.js +1 -13
  64. package/build-module/store/reducer.js.map +1 -1
  65. package/build-module/store/selectors.js +9 -3
  66. package/build-module/store/selectors.js.map +1 -1
  67. package/build-style/classic-rtl.css +1 -1
  68. package/build-style/classic.css +1 -1
  69. package/build-style/style-rtl.css +1 -7
  70. package/build-style/style.css +1 -7
  71. package/package.json +32 -32
  72. package/src/classic.scss +2 -1
  73. package/src/components/header/index.js +1 -1
  74. package/src/components/header/post-publish-button-or-toggle.js +2 -8
  75. package/src/components/keyboard-shortcut-help-modal/index.js +4 -0
  76. package/src/components/layout/actions-panel.js +5 -4
  77. package/src/components/layout/index.js +7 -2
  78. package/src/components/meta-boxes/meta-boxes-area/style.scss +1 -1
  79. package/src/components/sidebar/plugin-post-publish-panel/index.js +12 -67
  80. package/src/components/sidebar/plugin-pre-publish-panel/index.js +12 -66
  81. package/src/components/sidebar/settings-sidebar/index.js +6 -2
  82. package/src/editor.js +12 -2
  83. package/src/hooks/commands/use-common-commands.js +2 -2
  84. package/src/hooks/use-navigate-to-entity-record.js +37 -24
  85. package/src/index.js +3 -2
  86. package/src/index.native.js +1 -4
  87. package/src/store/actions.js +27 -12
  88. package/src/store/reducer.js +0 -13
  89. package/src/store/selectors.js +11 -3
  90. package/src/style.scss +0 -1
  91. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -107
  92. package/build/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  93. package/build/components/sidebar/template-summary/index.js +0 -36
  94. package/build/components/sidebar/template-summary/index.js.map +0 -1
  95. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -100
  96. package/build-module/components/block-settings-menu/plugin-block-settings-menu-item.js.map +0 -1
  97. package/build-module/components/sidebar/template-summary/index.js +0 -29
  98. package/build-module/components/sidebar/template-summary/index.js.map +0 -1
  99. package/src/components/block-settings-menu/plugin-block-settings-menu-item.js +0 -108
  100. package/src/components/sidebar/plugin-post-publish-panel/test/__snapshots__/index.js.snap +0 -39
  101. package/src/components/sidebar/plugin-post-publish-panel/test/index.js +0 -33
  102. package/src/components/sidebar/plugin-pre-publish-panel/test/index.js +0 -33
  103. package/src/components/sidebar/template-summary/index.js +0 -37
  104. package/src/components/sidebar/template-summary/style.scss +0 -5
@@ -447,7 +447,7 @@ body.is-fullscreen-mode .interface-interface-skeleton {
447
447
  display: none;
448
448
  margin: 0;
449
449
  }
450
- .interface-pinned-items .components-button[aria-controls="edit-post:document"], .interface-pinned-items .components-button[aria-controls="edit-post:block"], .interface-pinned-items .components-button[aria-controls="edit-site:template"], .interface-pinned-items .components-button[aria-controls="edit-site:block-inspector"], .interface-pinned-items .components-button[aria-controls="edit-site:global-styles"] {
450
+ .interface-pinned-items .components-button[aria-controls="edit-post:document"], .interface-pinned-items .components-button[aria-controls="edit-post:block"], .interface-pinned-items .components-button[aria-controls="edit-site:template"], .interface-pinned-items .components-button[aria-controls="edit-site:block-inspector"] {
451
451
  display: flex;
452
452
  }
453
453
  .interface-pinned-items .components-button svg {
@@ -1126,12 +1126,6 @@ body.is-fullscreen-mode .edit-post-layout .components-editor-notices__snackbar {
1126
1126
  margin: 8px;
1127
1127
  }
1128
1128
 
1129
- h2.edit-post-template-summary__title {
1130
- line-height: 24px;
1131
- margin: 0 0 4px;
1132
- font-weight: 500;
1133
- }
1134
-
1135
1129
  .edit-post-text-editor {
1136
1130
  position: relative;
1137
1131
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-post",
3
- "version": "7.31.0",
3
+ "version": "7.32.0",
4
4
  "description": "Edit Post module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -27,36 +27,36 @@
27
27
  "react-native": "src/index",
28
28
  "dependencies": {
29
29
  "@babel/runtime": "^7.16.0",
30
- "@wordpress/a11y": "^3.54.0",
31
- "@wordpress/api-fetch": "^6.51.0",
32
- "@wordpress/block-editor": "^12.22.0",
33
- "@wordpress/block-library": "^8.31.0",
34
- "@wordpress/blocks": "^12.31.0",
35
- "@wordpress/commands": "^0.25.0",
36
- "@wordpress/components": "^27.2.0",
37
- "@wordpress/compose": "^6.31.0",
38
- "@wordpress/core-commands": "^0.23.0",
39
- "@wordpress/core-data": "^6.31.0",
40
- "@wordpress/data": "^9.24.0",
41
- "@wordpress/deprecated": "^3.54.0",
42
- "@wordpress/dom": "^3.54.0",
43
- "@wordpress/editor": "^13.31.0",
44
- "@wordpress/element": "^5.31.0",
45
- "@wordpress/hooks": "^3.54.0",
46
- "@wordpress/i18n": "^4.54.0",
47
- "@wordpress/icons": "^9.45.0",
48
- "@wordpress/interface": "^5.31.0",
49
- "@wordpress/keyboard-shortcuts": "^4.31.0",
50
- "@wordpress/keycodes": "^3.54.0",
51
- "@wordpress/media-utils": "^4.45.0",
52
- "@wordpress/notices": "^4.22.0",
53
- "@wordpress/plugins": "^6.22.0",
54
- "@wordpress/preferences": "^3.31.0",
55
- "@wordpress/private-apis": "^0.36.0",
56
- "@wordpress/url": "^3.55.0",
57
- "@wordpress/viewport": "^5.31.0",
58
- "@wordpress/warning": "^2.54.0",
59
- "@wordpress/widgets": "^3.31.0",
30
+ "@wordpress/a11y": "^3.55.0",
31
+ "@wordpress/api-fetch": "^6.52.0",
32
+ "@wordpress/block-editor": "^12.23.0",
33
+ "@wordpress/block-library": "^8.32.0",
34
+ "@wordpress/blocks": "^12.32.0",
35
+ "@wordpress/commands": "^0.26.0",
36
+ "@wordpress/components": "^27.3.0",
37
+ "@wordpress/compose": "^6.32.0",
38
+ "@wordpress/core-commands": "^0.24.0",
39
+ "@wordpress/core-data": "^6.32.0",
40
+ "@wordpress/data": "^9.25.0",
41
+ "@wordpress/deprecated": "^3.55.0",
42
+ "@wordpress/dom": "^3.55.0",
43
+ "@wordpress/editor": "^13.32.0",
44
+ "@wordpress/element": "^5.32.0",
45
+ "@wordpress/hooks": "^3.55.0",
46
+ "@wordpress/i18n": "^4.55.0",
47
+ "@wordpress/icons": "^9.46.0",
48
+ "@wordpress/interface": "^5.32.0",
49
+ "@wordpress/keyboard-shortcuts": "^4.32.0",
50
+ "@wordpress/keycodes": "^3.55.0",
51
+ "@wordpress/media-utils": "^4.46.0",
52
+ "@wordpress/notices": "^4.23.0",
53
+ "@wordpress/plugins": "^6.23.0",
54
+ "@wordpress/preferences": "^3.32.0",
55
+ "@wordpress/private-apis": "^0.37.0",
56
+ "@wordpress/url": "^3.56.0",
57
+ "@wordpress/viewport": "^5.32.0",
58
+ "@wordpress/warning": "^2.55.0",
59
+ "@wordpress/widgets": "^3.32.0",
60
60
  "classnames": "^2.3.1",
61
61
  "memize": "^2.1.0",
62
62
  "rememo": "^4.0.2"
@@ -68,5 +68,5 @@
68
68
  "publishConfig": {
69
69
  "access": "public"
70
70
  },
71
- "gitHead": "ffc07735d0abfb3f69e91d48f25b7fe8d1ef92d2"
71
+ "gitHead": "ac2b13783c28f959770cf029a797a712f59e1958"
72
72
  }
package/src/classic.scss CHANGED
@@ -1,7 +1,8 @@
1
1
  // Provide baseline auto margin for centering blocks.
2
2
  // Specificity is kept at this level as many classic themes output
3
3
  // rules like figure { margin: 0; } which would break centering.
4
- .editor-styles-wrapper .wp-block {
4
+ // These rules should also not apply to direct children of flex layout blocks.
5
+ :where(.editor-styles-wrapper) :where(:not(.is-layout-flex, .is-layout-grid)) > .wp-block {
5
6
  margin-left: auto;
6
7
  margin-right: auto;
7
8
  }
@@ -81,7 +81,7 @@ function Header( { setEntitiesSavedStatesCallback, initialPost } ) {
81
81
  !! select( editorStore ).getEditorSettings()
82
82
  .onNavigateToPreviousEntityRecord,
83
83
  isPublishSidebarOpened:
84
- select( editPostStore ).isPublishSidebarOpened(),
84
+ select( editorStore ).isPublishSidebarOpened(),
85
85
  showIconLabels: getPreference( 'core', 'showIconLabels' ),
86
86
  };
87
87
  }, [] );
@@ -5,11 +5,6 @@ import { useViewportMatch, compose } from '@wordpress/compose';
5
5
  import { withDispatch, withSelect } from '@wordpress/data';
6
6
  import { PostPublishButton, store as editorStore } from '@wordpress/editor';
7
7
 
8
- /**
9
- * Internal dependencies
10
- */
11
- import { store as editPostStore } from '../../store';
12
-
13
8
  export function PostPublishButtonOrToggle( {
14
9
  forceIsDirty,
15
10
  hasPublishAction,
@@ -85,12 +80,11 @@ export default compose(
85
80
  isPublished: select( editorStore ).isCurrentPostPublished(),
86
81
  isPublishSidebarEnabled:
87
82
  select( editorStore ).isPublishSidebarEnabled(),
88
- isPublishSidebarOpened:
89
- select( editPostStore ).isPublishSidebarOpened(),
83
+ isPublishSidebarOpened: select( editorStore ).isPublishSidebarOpened(),
90
84
  isScheduled: select( editorStore ).isCurrentPostScheduled(),
91
85
  } ) ),
92
86
  withDispatch( ( dispatch ) => {
93
- const { togglePublishSidebar } = dispatch( editPostStore );
87
+ const { togglePublishSidebar } = dispatch( editorStore );
94
88
  return {
95
89
  togglePublishSidebar,
96
90
  };
@@ -136,6 +136,10 @@ export function KeyboardShortcutHelpModal( { isModalActive, toggleModal } ) {
136
136
  title={ __( 'Text formatting' ) }
137
137
  shortcuts={ textFormattingShortcuts }
138
138
  />
139
+ <ShortcutCategorySection
140
+ title={ __( 'List View shortcuts' ) }
141
+ categoryName="list-view"
142
+ />
139
143
  </Modal>
140
144
  );
141
145
  }
@@ -4,17 +4,18 @@
4
4
  import {
5
5
  EntitiesSavedStates,
6
6
  PostPublishPanel,
7
+ PluginPrePublishPanel,
8
+ PluginPostPublishPanel,
7
9
  store as editorStore,
8
10
  } from '@wordpress/editor';
9
11
  import { useSelect, useDispatch } from '@wordpress/data';
10
12
  import { Button, createSlotFill } from '@wordpress/components';
11
13
  import { __ } from '@wordpress/i18n';
12
14
  import { useCallback } from '@wordpress/element';
15
+
13
16
  /**
14
17
  * Internal dependencies
15
18
  */
16
- import PluginPostPublishPanel from '../sidebar/plugin-post-publish-panel';
17
- import PluginPrePublishPanel from '../sidebar/plugin-pre-publish-panel';
18
19
  import { store as editPostStore } from '../../store';
19
20
 
20
21
  const { Fill, Slot } = createSlotFill( 'ActionsPanel' );
@@ -27,7 +28,7 @@ export default function ActionsPanel( {
27
28
  isEntitiesSavedStatesOpen,
28
29
  } ) {
29
30
  const { closePublishSidebar, togglePublishSidebar } =
30
- useDispatch( editPostStore );
31
+ useDispatch( editorStore );
31
32
  const {
32
33
  publishSidebarOpened,
33
34
  hasActiveMetaboxes,
@@ -35,7 +36,7 @@ export default function ActionsPanel( {
35
36
  } = useSelect(
36
37
  ( select ) => ( {
37
38
  publishSidebarOpened:
38
- select( editPostStore ).isPublishSidebarOpened(),
39
+ select( editorStore ).isPublishSidebarOpened(),
39
40
  hasActiveMetaboxes: select( editPostStore ).hasMetaBoxes(),
40
41
  hasNonPostEntityChanges:
41
42
  select( editorStore ).hasNonPostEntityChanges(),
@@ -172,7 +172,7 @@ function Layout( { initialPost } ) {
172
172
  sidebarIsOpened: !! (
173
173
  select( interfaceStore ).getActiveComplementaryArea(
174
174
  editPostStore.name
175
- ) || select( editPostStore ).isPublishSidebarOpened()
175
+ ) || select( editorStore ).isPublishSidebarOpened()
176
176
  ),
177
177
  isFullscreenActive:
178
178
  select( editPostStore ).isFeatureActive( 'fullscreenMode' ),
@@ -258,7 +258,12 @@ function Layout( { initialPost } ) {
258
258
 
259
259
  const secondarySidebar = () => {
260
260
  if ( mode === 'visual' && isInserterOpened ) {
261
- return <InserterSidebar />;
261
+ return (
262
+ <InserterSidebar
263
+ closeGeneralSidebar={ closeGeneralSidebar }
264
+ isRightSidebarOpen={ sidebarIsOpened }
265
+ />
266
+ );
262
267
  }
263
268
  if ( mode === 'visual' && isListViewOpened ) {
264
269
  return <ListViewSidebar />;
@@ -88,7 +88,7 @@
88
88
 
89
89
  // Until checkboxes WordPress-wide are updated to match the new style,
90
90
  // checkboxes used in metaboxes have to be slightly unstyled here.
91
- // @todo: remove this entire rule once checkboxes are the same everywhere.
91
+ // @todo remove this entire rule once checkboxes are the same everywhere.
92
92
  // See: https://github.com/WordPress/gutenberg/issues/18053
93
93
  .metabox-location-side .postbox input[type="checkbox"] {
94
94
  border: $border-width solid $gray-700;
@@ -1,83 +1,28 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { usePluginContext } from '@wordpress/plugins';
5
- import { createSlotFill, PanelBody } from '@wordpress/components';
6
-
7
- const { Fill, Slot } = createSlotFill( 'PluginPostPublishPanel' );
4
+ import deprecated from '@wordpress/deprecated';
5
+ import { PluginPostPublishPanel } from '@wordpress/editor';
8
6
 
9
7
  /**
10
8
  * Renders provided content to the post-publish panel in the publish flow
11
9
  * (side panel that opens after a user publishes the post).
12
10
  *
11
+ * @deprecated since 6.6, use `wp.editor.PluginPostPublishPanel` instead.
12
+ *
13
13
  * @param {Object} props Component properties.
14
14
  * @param {string} [props.className] An optional class name added to the panel.
15
15
  * @param {string} [props.title] Title displayed at the top of the panel.
16
16
  * @param {boolean} [props.initialOpen=false] Whether to have the panel initially opened. When no title is provided it is always opened.
17
17
  * @param {WPBlockTypeIconRender} [props.icon=inherits from the plugin] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element, to be rendered when the sidebar is pinned to toolbar.
18
18
  * @param {Element} props.children Children to be rendered
19
- *
20
- * @example
21
- * ```js
22
- * // Using ES5 syntax
23
- * var __ = wp.i18n.__;
24
- * var PluginPostPublishPanel = wp.editPost.PluginPostPublishPanel;
25
- *
26
- * function MyPluginPostPublishPanel() {
27
- * return React.createElement(
28
- * PluginPostPublishPanel,
29
- * {
30
- * className: 'my-plugin-post-publish-panel',
31
- * title: __( 'My panel title' ),
32
- * initialOpen: true,
33
- * },
34
- * __( 'My panel content' )
35
- * );
36
- * }
37
- * ```
38
- *
39
- * @example
40
- * ```jsx
41
- * // Using ESNext syntax
42
- * import { __ } from '@wordpress/i18n';
43
- * import { PluginPostPublishPanel } from '@wordpress/edit-post';
44
- *
45
- * const MyPluginPostPublishPanel = () => (
46
- * <PluginPostPublishPanel
47
- * className="my-plugin-post-publish-panel"
48
- * title={ __( 'My panel title' ) }
49
- * initialOpen={ true }
50
- * >
51
- * { __( 'My panel content' ) }
52
- * </PluginPostPublishPanel>
53
- * );
54
- * ```
55
- *
56
19
  * @return {Component} The component to be rendered.
57
20
  */
58
- const PluginPostPublishPanel = ( {
59
- children,
60
- className,
61
- title,
62
- initialOpen = false,
63
- icon,
64
- } ) => {
65
- const { icon: pluginIcon } = usePluginContext();
66
-
67
- return (
68
- <Fill>
69
- <PanelBody
70
- className={ className }
71
- initialOpen={ initialOpen || ! title }
72
- title={ title }
73
- icon={ icon ?? pluginIcon }
74
- >
75
- { children }
76
- </PanelBody>
77
- </Fill>
78
- );
79
- };
80
-
81
- PluginPostPublishPanel.Slot = Slot;
82
-
83
- export default PluginPostPublishPanel;
21
+ export default function EditPostPluginPostPublishPanel( props ) {
22
+ deprecated( 'wp.editPost.PluginPostPublishPanel', {
23
+ since: '6.6',
24
+ version: '6.8',
25
+ alternative: 'wp.editor.PluginPostPublishPanel',
26
+ } );
27
+ return <PluginPostPublishPanel { ...props } />;
28
+ }
@@ -1,15 +1,15 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { createSlotFill, PanelBody } from '@wordpress/components';
5
- import { usePluginContext } from '@wordpress/plugins';
6
-
7
- const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
4
+ import deprecated from '@wordpress/deprecated';
5
+ import { PluginPrePublishPanel } from '@wordpress/editor';
8
6
 
9
7
  /**
10
8
  * Renders provided content to the pre-publish side panel in the publish flow
11
9
  * (side panel that opens when a user first pushes "Publish" from the main editor).
12
10
  *
11
+ * @deprecated since 6.6, use `wp.editor.PluginPrePublishPanel` instead.
12
+ *
13
13
  * @param {Object} props Component props.
14
14
  * @param {string} [props.className] An optional class name added to the panel.
15
15
  * @param {string} [props.title] Title displayed at the top of the panel.
@@ -20,67 +20,13 @@ const { Fill, Slot } = createSlotFill( 'PluginPrePublishPanel' );
20
20
  * the sidebar is pinned to toolbar.
21
21
  * @param {Element} props.children Children to be rendered
22
22
  *
23
- * @example
24
- * ```js
25
- * // Using ES5 syntax
26
- * var __ = wp.i18n.__;
27
- * var PluginPrePublishPanel = wp.editPost.PluginPrePublishPanel;
28
- *
29
- * function MyPluginPrePublishPanel() {
30
- * return React.createElement(
31
- * PluginPrePublishPanel,
32
- * {
33
- * className: 'my-plugin-pre-publish-panel',
34
- * title: __( 'My panel title' ),
35
- * initialOpen: true,
36
- * },
37
- * __( 'My panel content' )
38
- * );
39
- * }
40
- * ```
41
- *
42
- * @example
43
- * ```jsx
44
- * // Using ESNext syntax
45
- * import { __ } from '@wordpress/i18n';
46
- * import { PluginPrePublishPanel } from '@wordpress/edit-post';
47
- *
48
- * const MyPluginPrePublishPanel = () => (
49
- * <PluginPrePublishPanel
50
- * className="my-plugin-pre-publish-panel"
51
- * title={ __( 'My panel title' ) }
52
- * initialOpen={ true }
53
- * >
54
- * { __( 'My panel content' ) }
55
- * </PluginPrePublishPanel>
56
- * );
57
- * ```
58
- *
59
23
  * @return {Component} The component to be rendered.
60
24
  */
61
- const PluginPrePublishPanel = ( {
62
- children,
63
- className,
64
- title,
65
- initialOpen = false,
66
- icon,
67
- } ) => {
68
- const { icon: pluginIcon } = usePluginContext();
69
-
70
- return (
71
- <Fill>
72
- <PanelBody
73
- className={ className }
74
- initialOpen={ initialOpen || ! title }
75
- title={ title }
76
- icon={ icon ?? pluginIcon }
77
- >
78
- { children }
79
- </PanelBody>
80
- </Fill>
81
- );
82
- };
83
-
84
- PluginPrePublishPanel.Slot = Slot;
85
-
86
- export default PluginPrePublishPanel;
25
+ export default function EditPostPluginPrePublishPanel( props ) {
26
+ deprecated( 'wp.editPost.PluginPrePublishPanel', {
27
+ since: '6.6',
28
+ version: '6.8',
29
+ alternative: 'wp.editor.PluginPrePublishPanel',
30
+ } );
31
+ return <PluginPrePublishPanel { ...props } />;
32
+ }
@@ -25,6 +25,7 @@ import {
25
25
  PostExcerptPanel,
26
26
  PostLastRevisionPanel,
27
27
  PostTaxonomiesPanel,
28
+ privateApis as editorPrivateApis,
28
29
  } from '@wordpress/editor';
29
30
 
30
31
  /**
@@ -34,12 +35,14 @@ import SettingsHeader from '../settings-header';
34
35
  import PostStatus from '../post-status';
35
36
  import MetaBoxes from '../../meta-boxes';
36
37
  import PluginSidebarEditPost from '../plugin-sidebar';
37
- import TemplateSummary from '../template-summary';
38
38
  import { store as editPostStore } from '../../../store';
39
39
  import { privateApis as componentsPrivateApis } from '@wordpress/components';
40
40
  import { unlock } from '../../../lock-unlock';
41
41
 
42
+ const { PostCardPanel } = unlock( editorPrivateApis );
43
+
42
44
  const { Tabs } = unlock( componentsPrivateApis );
45
+ const { PatternOverridesPanel } = unlock( editorPrivateApis );
43
46
 
44
47
  const SIDEBAR_ACTIVE_BY_DEFAULT = Platform.select( {
45
48
  web: true,
@@ -110,6 +113,7 @@ const SidebarContent = ( {
110
113
  >
111
114
  <Tabs.Context.Provider value={ tabsContextValue }>
112
115
  <Tabs.TabPanel tabId={ sidebars.document } focusable={ false }>
116
+ <PostCardPanel />
113
117
  { ! isEditingTemplate && (
114
118
  <>
115
119
  <PostStatus />
@@ -119,10 +123,10 @@ const SidebarContent = ( {
119
123
  <PostExcerptPanel />
120
124
  <PostDiscussionPanel />
121
125
  <PageAttributesPanel />
126
+ <PatternOverridesPanel />
122
127
  <MetaBoxes location="side" />
123
128
  </>
124
129
  ) }
125
- { isEditingTemplate && <TemplateSummary /> }
126
130
  </Tabs.TabPanel>
127
131
  <Tabs.TabPanel tabId={ sidebars.block } focusable={ false }>
128
132
  <BlockInspector />
package/src/editor.js CHANGED
@@ -32,11 +32,14 @@ function Editor( {
32
32
  ...props
33
33
  } ) {
34
34
  const {
35
- initialPost,
36
35
  currentPost,
37
36
  onNavigateToEntityRecord,
38
37
  onNavigateToPreviousEntityRecord,
39
- } = useNavigateToEntityRecord( initialPostId, initialPostType );
38
+ } = useNavigateToEntityRecord(
39
+ initialPostId,
40
+ initialPostType,
41
+ 'post-only'
42
+ );
40
43
 
41
44
  const { post, template } = useSelect(
42
45
  ( select ) => {
@@ -80,6 +83,13 @@ function Editor( {
80
83
  [ settings, onNavigateToEntityRecord, onNavigateToPreviousEntityRecord ]
81
84
  );
82
85
 
86
+ const initialPost = useMemo( () => {
87
+ return {
88
+ type: initialPostType,
89
+ id: initialPostId,
90
+ };
91
+ }, [ initialPostType, initialPostId ] );
92
+
83
93
  if ( ! post ) {
84
94
  return null;
85
95
  }
@@ -126,13 +126,13 @@ export default function useCommonCommands() {
126
126
  icon: formatListBullets,
127
127
  callback: ( { close } ) => {
128
128
  close();
129
- toggle( 'core/edit-post', 'isPublishSidebarEnabled' );
129
+ toggle( 'core', 'isPublishSidebarEnabled' );
130
130
  createInfoNotice(
131
131
  isPublishSidebarEnabled
132
132
  ? __( 'Pre-publish checks disabled.' )
133
133
  : __( 'Pre-publish checks enabled.' ),
134
134
  {
135
- id: 'core/edit-post/publish-sidebar/notice',
135
+ id: 'core/editor/publish-sidebar/notice',
136
136
  type: 'snackbar',
137
137
  }
138
138
  );
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useCallback, useReducer, useMemo } from '@wordpress/element';
4
+ import { useCallback, useReducer } from '@wordpress/element';
5
+ import { useSelect, useDispatch } from '@wordpress/data';
6
+ import { store as editorStore } from '@wordpress/editor';
5
7
 
6
8
  /**
7
9
  * A hook that records the 'entity' history in the post editor as a user
@@ -11,20 +13,22 @@ import { useCallback, useReducer, useMemo } from '@wordpress/element';
11
13
  *
12
14
  * Used to control displaying UI elements like the back button.
13
15
  *
14
- * @param {number} initialPostId The post id of the post when the editor loaded.
15
- * @param {string} initialPostType The post type of the post when the editor loaded.
16
+ * @param {number} initialPostId The post id of the post when the editor loaded.
17
+ * @param {string} initialPostType The post type of the post when the editor loaded.
18
+ * @param {string} defaultRenderingMode The rendering mode to switch to when navigating.
16
19
  *
17
20
  * @return {Object} An object containing the `currentPost` variable and
18
21
  * `onNavigateToEntityRecord` and `onNavigateToPreviousEntityRecord` functions.
19
22
  */
20
23
  export default function useNavigateToEntityRecord(
21
24
  initialPostId,
22
- initialPostType
25
+ initialPostType,
26
+ defaultRenderingMode
23
27
  ) {
24
28
  const [ postHistory, dispatch ] = useReducer(
25
- ( historyState, { type, post } ) => {
29
+ ( historyState, { type, post, previousRenderingMode } ) => {
26
30
  if ( type === 'push' ) {
27
- return [ ...historyState, post ];
31
+ return [ ...historyState, { post, previousRenderingMode } ];
28
32
  }
29
33
  if ( type === 'pop' ) {
30
34
  // Try to leave one item in the history.
@@ -34,32 +38,41 @@ export default function useNavigateToEntityRecord(
34
38
  }
35
39
  return historyState;
36
40
  },
37
- [ { postId: initialPostId, postType: initialPostType } ]
41
+ [
42
+ {
43
+ post: { postId: initialPostId, postType: initialPostType },
44
+ },
45
+ ]
38
46
  );
39
47
 
40
- const initialPost = useMemo( () => {
41
- return {
42
- type: initialPostType,
43
- id: initialPostId,
44
- };
45
- }, [ initialPostType, initialPostId ] );
48
+ const { post, previousRenderingMode } =
49
+ postHistory[ postHistory.length - 1 ];
46
50
 
47
- const onNavigateToEntityRecord = useCallback( ( params ) => {
48
- dispatch( {
49
- type: 'push',
50
- post: { postId: params.postId, postType: params.postType },
51
- } );
52
- }, [] );
51
+ const { getRenderingMode } = useSelect( editorStore );
52
+ const { setRenderingMode } = useDispatch( editorStore );
53
+
54
+ const onNavigateToEntityRecord = useCallback(
55
+ ( params ) => {
56
+ dispatch( {
57
+ type: 'push',
58
+ post: { postId: params.postId, postType: params.postType },
59
+ // Save the current rendering mode so we can restore it when navigating back.
60
+ previousRenderingMode: getRenderingMode(),
61
+ } );
62
+ setRenderingMode( defaultRenderingMode );
63
+ },
64
+ [ getRenderingMode, setRenderingMode, defaultRenderingMode ]
65
+ );
53
66
 
54
67
  const onNavigateToPreviousEntityRecord = useCallback( () => {
55
68
  dispatch( { type: 'pop' } );
56
- }, [] );
57
-
58
- const currentPost = postHistory[ postHistory.length - 1 ];
69
+ if ( previousRenderingMode ) {
70
+ setRenderingMode( previousRenderingMode );
71
+ }
72
+ }, [ setRenderingMode, previousRenderingMode ] );
59
73
 
60
74
  return {
61
- currentPost,
62
- initialPost,
75
+ currentPost: post,
63
76
  onNavigateToEntityRecord,
64
77
  onNavigateToPreviousEntityRecord:
65
78
  postHistory.length > 1
package/src/index.js CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  registerWidgetGroupBlock,
16
16
  } from '@wordpress/widgets';
17
17
  import {
18
+ PluginBlockSettingsMenuItem,
18
19
  PluginDocumentSettingPanel,
19
20
  privateApis as editorPrivateApis,
20
21
  store as editorStore,
@@ -55,7 +56,6 @@ export function initializeEditor(
55
56
 
56
57
  dispatch( preferencesStore ).setDefaults( 'core/edit-post', {
57
58
  fullscreenMode: true,
58
- isPublishSidebarEnabled: true,
59
59
  themeStyles: true,
60
60
  welcomeGuide: true,
61
61
  welcomeGuideTemplate: true,
@@ -71,6 +71,7 @@ export function initializeEditor(
71
71
  showBlockBreadcrumbs: true,
72
72
  showIconLabels: false,
73
73
  showListViewByDefault: false,
74
+ isPublishSidebarEnabled: true,
74
75
  } );
75
76
 
76
77
  dispatch( blocksStore ).reapplyBlockTypeFilters();
@@ -161,7 +162,7 @@ export function reinitializeEditor() {
161
162
  } );
162
163
  }
163
164
 
164
- export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
165
+ export { PluginBlockSettingsMenuItem };
165
166
  export { PluginDocumentSettingPanel };
166
167
  export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
167
168
  export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';