Skip to content

Commit

Permalink
rename to PluginPreviewMenuItem
Browse files Browse the repository at this point in the history
  • Loading branch information
lezama committed Aug 30, 2024
1 parent 6b926ab commit 1a975c8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions packages/editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -862,15 +862,15 @@ _Returns_

- `Component`: The component to be rendered.

### PluginPreviewDropdownItem
### PluginPreviewMenuItem

Renders a menu item in the Preview dropdown, which can be used as a button or link depending on the props provided. The text within the component appears as the menu item label.

_Usage_

```jsx
import { __ } from '@wordpress/i18n';
import { PreviewDropdownMenuItem } from './preview-dropdown-menu-item';
import { PluginPreviewMenuItem } from '@wordpress/editor';
import { external } from '@wordpress/icons';

function onPreviewClick() {
Expand All @@ -882,6 +882,9 @@ const ExternalPreviewMenuItem = () => (
{ __( 'Preview in new tab' ) }
</PreviewDropdownMenuItem>
);
registerPlugin( 'external-preview-menu-item', {
render: ExternalPreviewMenuItem,
} );
```

_Parameters_
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export { default as PluginMoreMenuItem } from './plugin-more-menu-item';
export { default as PluginPostPublishPanel } from './plugin-post-publish-panel';
export { default as PluginPostStatusInfo } from './plugin-post-status-info';
export { default as PluginPrePublishPanel } from './plugin-pre-publish-panel';
export { default as PluginPreviewDropdownItem } from './plugin-preview-dropdown-item';
export { default as PluginPreviewMenuItem } from './plugin-preview-menu-item';
export { default as PluginSidebar } from './plugin-sidebar';
export { default as PluginSidebarMoreMenuItem } from './plugin-sidebar-more-menu-item';
export { default as PostTemplatePanel } from './post-template/panel';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default compose(
return {
as: ownProps.as ?? MenuItem,
icon: ownProps.icon || context.icon,
name: 'core/plugin-preview-dropdown-menu',
name: 'core/plugin-preview-menu',
};
} )
)( ActionItem );
2 changes: 1 addition & 1 deletion packages/editor/src/components/preview-dropdown/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default function PreviewDropdown( { forceIsAutosaveable, disabled } ) {
</MenuGroup>
) }
<ActionItem.Slot
name="core/plugin-preview-dropdown-menu"
name="core/plugin-preview-menu"
as={ MenuGroup }
fillProps={ { onClick: onClose } }
/>
Expand Down

0 comments on commit 1a975c8

Please sign in to comment.