Skip to content
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

Fix property name in PluginBlockSettingsMenuItem #14741

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/edit-post/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function MyPluginBlockSettingsMenuItem() {
return wp.element.createElement(
PluginBlockSettingsMenuItem,
{
allowedBlockNames: [ 'core/paragraph' ],
allowedBlocks: [ 'core/paragraph' ],
icon: 'dashicon-name',
label: __( 'Menu item text' ),
onClick: doOnClick,
Expand All @@ -81,7 +81,7 @@ const doOnClick = ( ) => {

const MyPluginBlockSettingsMenuItem = () => (
<PluginBlockSettingsMenuItem
allowedBlockNames=[ 'core/paragraph' ]
allowedBlocks=[ 'core/paragraph' ]
icon='dashicon-name'
label=__( 'Menu item text' )
onClick={ doOnClick } />
Expand All @@ -91,7 +91,7 @@ const MyPluginBlockSettingsMenuItem = () => (
_Parameters_

- _props_ `Object`: Component props.
- _props.allowedBlockNames_ `[Array]`: An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the whitelist.
- _props.allowedBlocks_ `[Array]`: An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the whitelist.
- _props.icon_ `[(string|Element)]`: The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
- _props.label_ `string`: The menu item text.
- _props.onClick_ `Function`: Callback function to be executed when the user click the menu item.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const isEverySelectedBlockAllowed = ( selected, allowed ) => difference( selecte

/**
* Plugins may want to add an item to the menu either for every block
* or only for the specific ones provided in the `allowedBlocks` component property.
* or only for the specific ones provided in the `allowedBlockNames` component property.
swissspidy marked this conversation as resolved.
Show resolved Hide resolved
*
* If there are multiple blocks selected the item will be rendered if every block
* is of one allowed type (not necessarily the same).
Expand All @@ -34,7 +34,7 @@ const shouldRenderItem = ( selectedBlockNames, allowedBlockNames ) => ! Array.is
* Renders a new item in the block settings menu.
*
* @param {Object} props Component props.
* @param {Array} [props.allowedBlockNames] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the whitelist.
* @param {Array} [props.allowedBlocks] An array containing a list of block names for which the item should be shown. If not present, it'll be rendered for any block. If multiple blocks are selected, it'll be shown if and only if all of them are in the whitelist.
* @param {string|Element} [props.icon] The [Dashicon](https://developer.wordpress.org/resource/dashicons/) icon slug string, or an SVG WP element.
* @param {string} props.label The menu item text.
* @param {Function} props.onClick Callback function to be executed when the user click the menu item.
Expand All @@ -53,7 +53,7 @@ const shouldRenderItem = ( selectedBlockNames, allowedBlockNames ) => ! Array.is
* return wp.element.createElement(
* PluginBlockSettingsMenuItem,
* {
* allowedBlockNames: [ 'core/paragraph' ],
* allowedBlocks: [ 'core/paragraph' ],
* icon: 'dashicon-name',
* label: __( 'Menu item text' ),
* onClick: doOnClick,
Expand All @@ -74,7 +74,7 @@ const shouldRenderItem = ( selectedBlockNames, allowedBlockNames ) => ! Array.is
*
* const MyPluginBlockSettingsMenuItem = () => (
* <PluginBlockSettingsMenuItem
* allowedBlockNames=[ 'core/paragraph' ]
* allowedBlocks=[ 'core/paragraph' ]
* icon='dashicon-name'
* label=__( 'Menu item text' )
* onClick={ doOnClick } />
Expand Down