Skip to content

Commit

Permalink
Inserter: Append end-of-content inserter block to end
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Oct 6, 2017
1 parent ac2888c commit e3e0741
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions editor/modes/visual-editor/inserter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { createBlock } from '@wordpress/blocks';
*/
import Inserter from '../../inserter';
import { insertBlock } from '../../actions';
import { getBlockCount } from '../../selectors';

export class VisualEditorInserter extends Component {
constructor() {
Expand All @@ -42,6 +43,7 @@ export class VisualEditorInserter extends Component {
}

render() {
const { blockCount } = this.props;
const { isShowingControls } = this.state;
const classes = classnames( 'editor-visual-editor__inserter', {
'is-showing-controls': isShowingControls,
Expand All @@ -53,7 +55,9 @@ export class VisualEditorInserter extends Component {
onFocus={ this.showControls }
onBlur={ this.hideControls }
>
<Inserter position="top right" />
<Inserter
insertIndex={ blockCount }
position="top right" />
<IconButton
icon="editor-paragraph"
className="editor-inserter__block"
Expand All @@ -76,6 +80,10 @@ export class VisualEditorInserter extends Component {
}

export default connect(
null,
( state ) => {
return {
blockCount: getBlockCount( state ),
};
},
{ onInsertBlock: insertBlock },
)( VisualEditorInserter );

0 comments on commit e3e0741

Please sign in to comment.