Skip to content

Commit

Permalink
Move components to edit-post
Browse files Browse the repository at this point in the history
  • Loading branch information
oandregal committed Jul 26, 2018
1 parent 434f365 commit 398a9a8
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 18 deletions.
4 changes: 0 additions & 4 deletions edit-post/components/block-settings-menu/index.js

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { createSlotFill } from '@wordpress/components';
import { Fragment } from '@wordpress/element';
import { withSelect } from '@wordpress/data';

const { Fill: BlockSettingsMenuPluginsGroup, Slot } = createSlotFill( 'BlockSettingsMenuPluginsGroup' );
const { Fill: PluginBlockSettingsMenuGroup, Slot } = createSlotFill( 'BlockSettingsMenuPluginsGroup' );

const BlockSettingsMenuPluginsGroupSlot = ( { fillProps, selectedBlocks } ) => {
const PluginBlockSettingsMenuGroupSlot = ( { fillProps, selectedBlocks } ) => {
selectedBlocks = map( selectedBlocks, ( block ) => block.name );
return (
<Slot fillProps={ { ...fillProps, selectedBlocks } } >
Expand All @@ -26,8 +26,8 @@ const BlockSettingsMenuPluginsGroupSlot = ( { fillProps, selectedBlocks } ) => {
);
};

BlockSettingsMenuPluginsGroup.Slot = withSelect( ( select, { fillProps: { clientIds } } ) => ( {
PluginBlockSettingsMenuGroup.Slot = withSelect( ( select, { fillProps: { clientIds } } ) => ( {
selectedBlocks: select( 'core/editor' ).getBlocksByUID( clientIds ),
} ) )( BlockSettingsMenuPluginsGroupSlot );
} ) )( PluginBlockSettingsMenuGroupSlot );

export default BlockSettingsMenuPluginsGroup;
export default PluginBlockSettingsMenuGroup;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { compose } from '@wordpress/element';
/**
* Internal dependencies
*/
import BlockSettingsMenuPluginsGroup from './block-settings-menu-plugins-group';
import PluginBlockSettingsMenuGroup from './plugin-block-settings-menu-group';

const isEverySelectedBlockAllowed = ( selected, allowed ) => difference( selected, allowed ).length === 0;

Expand All @@ -30,8 +30,8 @@ const isEverySelectedBlockAllowed = ( selected, allowed ) => difference( selecte
const shouldRenderItem = ( selectedBlockNames, allowedBlockNames ) => ! Array.isArray( allowedBlockNames ) ||
isEverySelectedBlockAllowed( selectedBlockNames, allowedBlockNames );

const BlockSettingsMenuPluginsItem = ( { allowedBlocks, icon, label, onClick, small, role } ) => (
<BlockSettingsMenuPluginsGroup>
const PluginBlockSettingsMenuItem = ( { allowedBlocks, icon, label, onClick, small, role } ) => (
<PluginBlockSettingsMenuGroup>
{ ( { selectedBlocks, onClose } ) => {
if ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {
return null;
Expand All @@ -46,7 +46,7 @@ const BlockSettingsMenuPluginsItem = ( { allowedBlocks, icon, label, onClick, sm
{ ! small && label }
</IconButton> );
} }
</BlockSettingsMenuPluginsGroup>
</PluginBlockSettingsMenuGroup>
);

export default BlockSettingsMenuPluginsItem;
export default PluginBlockSettingsMenuItem;
3 changes: 2 additions & 1 deletion edit-post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ export function initializeEditor( id, postType, postId, settings, overridePost )
};
}

export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu';
export { default as PluginBlockSettingsMenuItem } from './components/block-settings-menu/plugin-block-settings-menu-item';
export { default as PluginBlockSettingsMenuGroup } from './components/block-settings-menu/plugin-block-settings-menu-group';
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
4 changes: 2 additions & 2 deletions editor/components/block-settings-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import BlockHTMLConvertButton from './block-html-convert-button';
import BlockUnknownConvertButton from './block-unknown-convert-button';
import _BlockSettingsMenuFirstItem from './block-settings-menu-first-item';
import withDeprecatedUniqueId from '../with-deprecated-unique-id';
import _BlockSettingsMenuPluginsGroup from './block-settings-menu-plugins-group';

export class BlockSettingsMenu extends Component {
constructor() {
Expand Down Expand Up @@ -57,6 +56,7 @@ export class BlockSettingsMenu extends Component {
focus,
rootClientId,
isHidden,
PluginExtension,
} = this.props;
const { isFocused } = this.state;
const blockClientIds = castArray( clientIds );
Expand Down Expand Up @@ -128,7 +128,7 @@ export class BlockSettingsMenu extends Component {
itemsRole="menuitem"
/>
) }
<_BlockSettingsMenuPluginsGroup.Slot fillProps={ { clientIds, onClose } } />
{ PluginExtension && ( <PluginExtension fillProps={ { clientIds, onClose } } /> ) }
<div className="editor-block-settings-menu__separator" />
{ count === 1 && (
<SharedBlockDeleteButton
Expand Down
1 change: 0 additions & 1 deletion editor/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export { default as BlockMover } from './block-mover';
export { default as BlockSelectionClearer } from './block-selection-clearer';
export { default as BlockSettingsMenu } from './block-settings-menu';
export { default as _BlockSettingsMenuFirstItem } from './block-settings-menu/block-settings-menu-first-item';
export { default as _BlockSettingsMenuPluginsItem } from './block-settings-menu/block-settings-menu-plugins-item';
export { default as BlockTitle } from './block-title';
export { default as BlockToolbar } from './block-toolbar';
export { default as CopyHandler } from './copy-handler';
Expand Down

0 comments on commit 398a9a8

Please sign in to comment.