Repository navigation
Editor: Deprecate the as prop of the plugin menu item components
#82319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
as prop of the plugin menu item components
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import deprecated from '@wordpress/deprecated'; | ||
| import { usePluginContext } from '@wordpress/plugins'; | ||
| import { ActionItem } from '@wordpress/interface'; | ||
|
|
||
|
|
@@ -60,11 +61,23 @@ import { ActionItem } from '@wordpress/interface'; | |
| */ | ||
| export default function PluginMoreMenuItem( props ) { | ||
| const context = usePluginContext(); | ||
| // `as` was never part of the contract. It is dropped so that it does not | ||
| // reach the item the menu renders. | ||
| const { as, ...itemProps } = props; | ||
|
|
||
| if ( as ) { | ||
| deprecated( 'The `as` prop of wp.editor.PluginMoreMenuItem', { | ||
| since: '7.2', | ||
| version: '7.4', | ||
| hint: 'The menu renders the item itself.', | ||
| } ); | ||
|
Comment on lines
+69
to
+72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This drops Here and everywhere else in the PR where we call
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. Even with versions specified, we never actually remove things. It's just an extra nudge for updating. |
||
| } | ||
|
|
||
| return ( | ||
| <ActionItem | ||
| name="core/plugin-more-menu" | ||
| icon={ props.icon || context.icon } | ||
| { ...props } | ||
| icon={ itemProps.icon || context.icon } | ||
| { ...itemProps } | ||
| /> | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs still say that all extra props are forwarded, so "was never documented" is not 100% accurate.
We should probably update the JSDoc and generated README to say that
asis ignored.Potentially even add a short dev note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can combine Menu migration dev notes that affect consumers in a single post.