Skip to content

Commit

Permalink
Merge pull request #156 from WordPress/tinymce-single/mimic-ui-prototype
Browse files Browse the repository at this point in the history
Tinymce single/mimic ui prototype
  • Loading branch information
ellatrix authored Mar 1, 2017
2 parents 84507cb + 88c8e70 commit f8c7b89
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion tinymce-single/tinymce/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@

if ( settings ) {
if ( ! blockToolbars[ settings._id ] ) {
blockToolbars[ settings._id ] = editor.wp._createToolbar( settings.buttons.concat( [ 'block-remove' ] ) );
blockToolbars[ settings._id ] = editor.wp._createToolbar( settings.buttons );
blockToolbars[ settings._id ].reposition = function () {
if (!element) return

Expand Down Expand Up @@ -553,6 +553,24 @@
event.preventDefault();
}
}
} else {
if ( keyCode === VK.BACKSPACE ) {
var selection = window.getSelection();

if ( ! selection.isCollapsed && editor.dom.isBlock( selection.focusNode ) ) {
if ( selection.anchorOffset === 0 && selection.focusOffset === 0 ) {
if ( element.nextSibling && element.nextSibling.contains( selection.focusNode ) ) {
removeBlock();
event.preventDefault();
}
}

if ( selection.anchorOffset === 0 && selection.anchorNode === selection.focusNode ) {
removeBlock();
event.preventDefault();
}
}
}
}

if ( VK.metaKeyPressed( event ) ) {
Expand Down

0 comments on commit f8c7b89

Please sign in to comment.