Skip to content

Commit

Permalink
Inserter: Move the inserter at the bottom of the editor to the right
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed May 15, 2017
1 parent 0006673 commit 94e2153
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 4 additions & 1 deletion editor/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { connect } from 'react-redux';
import { flow, groupBy, sortBy, findIndex, filter } from 'lodash';
import classnames from 'classnames';

/**
* WordPress dependencies
Expand Down Expand Up @@ -224,9 +225,11 @@ class InserterMenu extends wp.element.Component {
render() {
const { position = 'top' } = this.props;
const visibleBlocksByCategory = this.getVisibleBlocksByCategory( wp.blocks.getBlocks() );
const positionClasses = position.split( ' ' ).map( ( pos ) => `is-${ pos }` );
const className = classnames( 'editor-inserter__menu', positionClasses );

return (
<div className={ `editor-inserter__menu is-${ position }` } tabIndex="0">
<div className={ className } tabIndex="0">
<div className="editor-inserter__arrow" />
<div role="menu" className="editor-inserter__content">
{ wp.blocks.getCategories()
Expand Down
10 changes: 10 additions & 0 deletions editor/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@
}
}
}

&.is-right {
left: -32px;
.editor-inserter__arrow {
left: 49px;
&:before {
left: 0;
}
}
}
}

.editor-inserter__arrow {
Expand Down
2 changes: 1 addition & 1 deletion editor/modes/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function VisualEditor( { blocks } ) {
{ blocks.map( ( uid ) => (
<VisualEditorBlock key={ uid } uid={ uid } />
) ) }
<Inserter />
<Inserter position="top right" />
</div>
);
}
Expand Down

0 comments on commit 94e2153

Please sign in to comment.