Skip to content

Commit

Permalink
Allow links in Plugins group in the More Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Nov 26, 2018
1 parent 97d1171 commit 68491d0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/**
* External dependencies
*/
import { noop } from 'lodash';

/**
* WordPress dependencies
*/
import { compose } from '@wordpress/compose';
import { MenuItem } from '@wordpress/components';
import { withPluginContext } from '@wordpress/plugins';

/**
* Internal dependencies
*/
import PluginsMoreMenuGroup from '../plugins-more-menu-group';

const PluginMoreMenuItem = ( { children, icon, url, onClick = noop } ) => (
<PluginsMoreMenuGroup>
{ ( fillProps ) => (
<MenuItem
href={ url }
icon={ icon }
onClick={ compose( onClick, fillProps.onClose ) }
>
{ children }
</MenuItem>
) }
</PluginsMoreMenuGroup>
);

export default compose(
withPluginContext( ( context, ownProps ) => {
return {
icon: ownProps.icon || context.icon,
};
} ),
)( PluginMoreMenuItem );
1 change: 1 addition & 0 deletions packages/edit-post/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export function initializeEditor( id, postType, postId, settings, initialEdits )
}

export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
export { default as PluginMoreMenuItem } from './components/header/plugin-more-menu-item';
export { default as PluginPostPublishPanel } from './components/sidebar/plugin-post-publish-panel';
export { default as PluginPostStatusInfo } from './components/sidebar/plugin-post-status-info';
export { default as PluginPrePublishPanel } from './components/sidebar/plugin-pre-publish-panel';
Expand Down

0 comments on commit 68491d0

Please sign in to comment.