Skip to content

Commit

Permalink
Update heading block on ENTER.key pressed at the end of the current h…
Browse files Browse the repository at this point in the history
…eading block, and create an empty paragraph after it. (#14642)
  • Loading branch information
daniloercoli authored Mar 27, 2019
1 parent b79710b commit 828fe40
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/block-library/src/heading/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,14 @@ class HeadingEdit extends Component {
onReplace,
} = this.props;

if ( after !== null ) {
// Append "After" content as a new paragraph block to the end of
// any other blocks being inserted after the current paragraph.
if ( after ) {
// Append "After" content as a new heading block to the end of
// any other blocks being inserted after the current heading.
const newBlock = createBlock( name, { content: after } );
blocks.push( newBlock );
} else {
const newBlock = createBlock( 'core/paragraph', { content: after } );
blocks.push( newBlock );
}

if ( blocks.length && insertBlocksAfter ) {
Expand Down

0 comments on commit 828fe40

Please sign in to comment.