Skip to content

Commit

Permalink
Show the block appender even if the last block is non empty paragraph
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Feb 22, 2018
1 parent 38be3c9 commit 5bb5310
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions editor/components/default-block-appender/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
* External dependencies
*/
import { connect } from 'react-redux';
import { get } from 'lodash';

/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { compose } from '@wordpress/element';
import { getDefaultBlockName } from '@wordpress/blocks';
import { isUnmodifiedDefaultBlock } from '@wordpress/blocks';
import { withContext } from '@wordpress/components';

/**
Expand Down Expand Up @@ -45,10 +44,10 @@ export default compose(
( state, ownProps ) => {
const isEmpty = ! getBlockCount( state, ownProps.rootUID );
const lastBlock = getBlock( state, ownProps.lastBlockUID );
const isLastBlockDefault = get( lastBlock, 'name' ) === getDefaultBlockName();
const isLastBlockEmptyDefault = lastBlock && isUnmodifiedDefaultBlock( lastBlock );

return {
isVisible: isEmpty || ! isLastBlockDefault,
isVisible: isEmpty || ! isLastBlockEmptyDefault,
showPrompt: isEmpty,
};
},
Expand Down

0 comments on commit 5bb5310

Please sign in to comment.