Skip to content

Commit

Permalink
Merge pull request #264 from WordPress/update/tinymce-single/mock-ups
Browse files Browse the repository at this point in the history
Update/tinymce single/mock ups
  • Loading branch information
ellatrix authored Mar 14, 2017
2 parents 0fdff89 + 9abc4b8 commit 81d108d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tinymce-single/tinymce/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,21 @@
}
} );

editor.on( 'newBlock', function( event ) {
editor.$( event.newBlock )
.attr( 'data-wp-placeholder', null )
.attr( 'data-wp-block-selected', null );
} );

editor.on( 'keyup', function( event ) {
if ( event.keyCode === tinymce.util.VK.ENTER ) {
editor.$( editor.selection.getNode() ).attr( 'data-wp-placeholder', null );
if ( event.keyCode === tinymce.util.VK.BACKSPACE ) {
var $empty = editor.$( editor.selection.getNode() ).find( ':empty' );

$empty.append( '<br>' );

if ( $empty.length ) {
editor.selection.setCursorLocation( $empty[0], 0 );
}
}
} );

Expand Down

0 comments on commit 81d108d

Please sign in to comment.