Skip to content

Commit 98e1dec

Browse files
youknowriadfabiankaegy
authored andcommitted
Editor: Consistently deprecate edit-post and edit-site slots (WordPress#61134)
Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
1 parent 4d5dd10 commit 98e1dec

File tree

7 files changed

+154
-119
lines changed

7 files changed

+154
-119
lines changed

packages/edit-post/README.md

+22-36
Original file line numberDiff line numberDiff line change
@@ -41,65 +41,51 @@ _Parameters_
4141

4242
### PluginBlockSettingsMenuItem
4343

44-
Undocumented declaration.
45-
46-
### PluginDocumentSettingPanel
44+
_Related_
4745

48-
Undocumented declaration.
46+
- PluginBlockSettingsMenuItem in @wordpress/editor package.
4947

50-
### PluginMoreMenuItem
48+
### PluginDocumentSettingPanel
5149

52-
Undocumented declaration.
50+
_Related_
5351

54-
### PluginPostPublishPanel
52+
- PluginDocumentSettingPanel in @wordpress/editor package.
5553

56-
> **Deprecated** since 6.6, use `wp.editor.PluginPostPublishPanel` instead.
54+
### PluginMoreMenuItem
5755

58-
Renders provided content to the post-publish panel in the publish flow (side panel that opens after a user publishes the post).
56+
_Related_
5957

60-
_Parameters_
58+
- PluginMoreMenuItem in @wordpress/editor package.
6159

62-
- _props_ `Object`: Component properties.
63-
- _props.className_ `[string]`: An optional class name added to the panel.
64-
- _props.title_ `[string]`: Title displayed at the top of the panel.
65-
- _props.initialOpen_ `[boolean]`: Whether to have the panel initially opened. When no title is provided it is always opened.
66-
- _props.icon_ `[WPBlockTypeIconRender]`: 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.
67-
- _props.children_ `Element`: Children to be rendered
60+
### PluginPostPublishPanel
6861

69-
_Returns_
62+
_Related_
7063

71-
- `Component`: The component to be rendered.
64+
- PluginPostPublishPanel in @wordpress/editor package.
7265

7366
### PluginPostStatusInfo
7467

75-
Undocumented declaration.
76-
77-
### PluginPrePublishPanel
78-
79-
> **Deprecated** since 6.6, use `wp.editor.PluginPrePublishPanel` instead.
80-
81-
Renders provided content to the pre-publish side panel in the publish flow (side panel that opens when a user first pushes "Publish" from the main editor).
68+
_Related_
8269

83-
_Parameters_
70+
- PluginPostStatusInfo in @wordpress/editor package.
8471

85-
- _props_ `Object`: Component props.
86-
- _props.className_ `[string]`: An optional class name added to the panel.
87-
- _props.title_ `[string]`: Title displayed at the top of the panel.
88-
- _props.initialOpen_ `[boolean]`: Whether to have the panel initially opened. When no title is provided it is always opened.
89-
- _props.icon_ `[WPBlockTypeIconRender]`: 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.
90-
- _props.children_ `Element`: Children to be rendered
72+
### PluginPrePublishPanel
9173

92-
_Returns_
74+
_Related_
9375

94-
- `Component`: The component to be rendered.
76+
- PluginPrePublishPanel in @wordpress/editor package.
9577

9678
### PluginSidebar
9779

98-
Undocumented declaration.
80+
_Related_
81+
82+
- PluginSidebar in @wordpress/editor package.
9983

10084
### PluginSidebarMoreMenuItem
10185

102-
Undocumented declaration.
86+
_Related_
87+
88+
- PluginSidebarMoreMenuItem in @wordpress/editor package.
10389

10490
### reinitializeEditor
10591

packages/edit-post/src/components/sidebar/plugin-post-publish-panel/index.js

-28
This file was deleted.

packages/edit-post/src/components/sidebar/plugin-pre-publish-panel/index.js

-32
This file was deleted.

packages/edit-post/src/deprecated.js

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
import {
5+
PluginBlockSettingsMenuItem as EditorPluginBlockSettingsMenuItem,
6+
PluginDocumentSettingPanel as EditorPluginDocumentSettingPanel,
7+
PluginMoreMenuItem as EditorPluginMoreMenuItem,
8+
PluginPrePublishPanel as EditorPluginPrePublishPanel,
9+
PluginPostPublishPanel as EditorPluginPostPublishPanel,
10+
PluginPostStatusInfo as EditorPluginPostStatusInfo,
11+
PluginSidebar as EditorPluginSidebar,
12+
PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
13+
} from '@wordpress/editor';
14+
import deprecated from '@wordpress/deprecated';
15+
16+
const deprecateSlot = ( name ) => {
17+
deprecated( `wp.editPost.${ name }`, {
18+
since: '6.6',
19+
alternative: `wp.editor.${ name }`,
20+
} );
21+
};
22+
23+
/* eslint-disable jsdoc/require-param */
24+
/**
25+
* @see PluginBlockSettingsMenuItem in @wordpress/editor package.
26+
*/
27+
export function PluginBlockSettingsMenuItem( props ) {
28+
deprecateSlot( 'PluginBlockSettingsMenuItem' );
29+
return <EditorPluginBlockSettingsMenuItem { ...props } />;
30+
}
31+
32+
/**
33+
* @see PluginDocumentSettingPanel in @wordpress/editor package.
34+
*/
35+
export function PluginDocumentSettingPanel( props ) {
36+
deprecateSlot( 'PluginDocumentSettingPanel' );
37+
return <EditorPluginDocumentSettingPanel { ...props } />;
38+
}
39+
40+
/**
41+
* @see PluginMoreMenuItem in @wordpress/editor package.
42+
*/
43+
export function PluginMoreMenuItem( props ) {
44+
deprecateSlot( 'PluginMoreMenuItem' );
45+
return <EditorPluginMoreMenuItem { ...props } />;
46+
}
47+
48+
/**
49+
* @see PluginPrePublishPanel in @wordpress/editor package.
50+
*/
51+
export function PluginPrePublishPanel( props ) {
52+
deprecateSlot( 'PluginPrePublishPanel' );
53+
return <EditorPluginPrePublishPanel { ...props } />;
54+
}
55+
56+
/**
57+
* @see PluginPostPublishPanel in @wordpress/editor package.
58+
*/
59+
export function PluginPostPublishPanel( props ) {
60+
deprecateSlot( 'PluginPostPublishPanel' );
61+
return <EditorPluginPostPublishPanel { ...props } />;
62+
}
63+
64+
/**
65+
* @see PluginPostStatusInfo in @wordpress/editor package.
66+
*/
67+
export function PluginPostStatusInfo( props ) {
68+
deprecateSlot( 'PluginPostStatusInfo' );
69+
return <EditorPluginPostStatusInfo { ...props } />;
70+
}
71+
72+
/**
73+
* @see PluginSidebar in @wordpress/editor package.
74+
*/
75+
export function PluginSidebar( props ) {
76+
deprecateSlot( 'PluginSidebar' );
77+
return <EditorPluginSidebar { ...props } />;
78+
}
79+
80+
/**
81+
* @see PluginSidebarMoreMenuItem in @wordpress/editor package.
82+
*/
83+
export function PluginSidebarMoreMenuItem( props ) {
84+
deprecateSlot( 'PluginSidebarMoreMenuItem' );
85+
return <EditorPluginSidebarMoreMenuItem { ...props } />;
86+
}
87+
/* eslint-enable jsdoc/require-param */

packages/edit-post/src/index.js

+1-14
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,6 @@ import {
1515
registerWidgetGroupBlock,
1616
} from '@wordpress/widgets';
1717
import {
18-
PluginBlockSettingsMenuItem,
19-
PluginDocumentSettingPanel,
20-
PluginMoreMenuItem,
21-
PluginPostStatusInfo,
22-
PluginSidebar,
23-
PluginSidebarMoreMenuItem,
2418
privateApis as editorPrivateApis,
2519
store as editorStore,
2620
} from '@wordpress/editor';
@@ -165,15 +159,8 @@ export function reinitializeEditor() {
165159
} );
166160
}
167161

168-
export { PluginBlockSettingsMenuItem };
169-
export { PluginDocumentSettingPanel };
170-
export { PluginMoreMenuItem };
171-
export { PluginPostStatusInfo };
172-
export { PluginSidebar };
173-
export { PluginSidebarMoreMenuItem };
174-
export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
175-
export { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';
176162
export { default as __experimentalFullscreenModeClose } from './components/header/fullscreen-mode-close';
177163
export { default as __experimentalMainDashboardButton } from './components/header/main-dashboard-button';
178164
export { __experimentalPluginPostExcerpt };
179165
export { store } from './store';
166+
export * from './deprecated';

packages/edit-site/src/deprecated.js

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* WordPress dependencies
3+
*/
4+
import {
5+
PluginMoreMenuItem as EditorPluginMoreMenuItem,
6+
PluginSidebar as EditorPluginSidebar,
7+
PluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,
8+
} from '@wordpress/editor';
9+
import deprecated from '@wordpress/deprecated';
10+
11+
const deprecateSlot = ( name ) => {
12+
deprecated( `wp.editPost.${ name }`, {
13+
since: '6.6',
14+
alternative: `wp.editor.${ name }`,
15+
} );
16+
};
17+
18+
/* eslint-disable jsdoc/require-param */
19+
/**
20+
* @see PluginMoreMenuItem in @wordpress/editor package.
21+
*/
22+
export function PluginMoreMenuItem( props ) {
23+
deprecateSlot( 'PluginMoreMenuItem' );
24+
return <EditorPluginMoreMenuItem { ...props } />;
25+
}
26+
27+
/**
28+
* @see PluginSidebar in @wordpress/editor package.
29+
*/
30+
export function PluginSidebar( props ) {
31+
deprecateSlot( 'PluginSidebar' );
32+
return <EditorPluginSidebar { ...props } />;
33+
}
34+
35+
/**
36+
* @see PluginSidebarMoreMenuItem in @wordpress/editor package.
37+
*/
38+
export function PluginSidebarMoreMenuItem( props ) {
39+
deprecateSlot( 'PluginSidebarMoreMenuItem' );
40+
return <EditorPluginSidebarMoreMenuItem { ...props } />;
41+
}
42+
/* eslint-enable jsdoc/require-param */

packages/edit-site/src/index.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,7 @@ import {
1010
import { dispatch } from '@wordpress/data';
1111
import deprecated from '@wordpress/deprecated';
1212
import { createRoot } from '@wordpress/element';
13-
import {
14-
PluginMoreMenuItem,
15-
PluginSidebar,
16-
PluginSidebarMoreMenuItem,
17-
store as editorStore,
18-
} from '@wordpress/editor';
13+
import { store as editorStore } from '@wordpress/editor';
1914
import { store as preferencesStore } from '@wordpress/preferences';
2015
import {
2116
registerLegacyWidgetBlock,
@@ -102,8 +97,6 @@ export function reinitializeEditor() {
10297
} );
10398
}
10499

105-
export { PluginMoreMenuItem };
106-
export { PluginSidebar };
107-
export { PluginSidebarMoreMenuItem };
108100
export { default as PluginTemplateSettingPanel } from './components/plugin-template-setting-panel';
109101
export { store } from './store';
102+
export * from './deprecated';

0 commit comments

Comments
 (0)