Skip to content

Commit

Permalink
Merge pull request #265 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 81d108d + 94e87cd commit dd3607e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions tinymce-single/tinymce/block.css
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,5 @@ div.mce-inline-toolbar-grp.block-toolbar > div.mce-stack-layout {
content: attr(data-wp-placeholder);
position: absolute;
opacity: 0.5;
pointer-events: none;
}
10 changes: 6 additions & 4 deletions tinymce-single/tinymce/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,14 @@

editor.on( 'keyup', function( event ) {
if ( event.keyCode === tinymce.util.VK.BACKSPACE ) {
var $empty = editor.$( editor.selection.getNode() ).find( ':empty' );
var block = getSelectedBlock();

$empty.append( '<br>' );
if ( ! block.textContent ) {
var p = editor.$( '<p><br></p>' );

if ( $empty.length ) {
editor.selection.setCursorLocation( $empty[0], 0 );
editor.$( block ).before( p );
editor.selection.setCursorLocation( p[0], 0 );
editor.$( block ).remove();
}
}
} );
Expand Down

0 comments on commit dd3607e

Please sign in to comment.