From 197b2c6cdc0bcf34a199e4255d576040ed59330a Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 19 Aug 2014 19:13:08 +0000 Subject: [PATCH] TinyMCE: fix the keycode check when removing the Edit/Delete toolbar from images on keydown, see #28705 git-svn-id: https://develop.svn.wordpress.org/trunk@29541 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/tinymce/plugins/wpeditimage/plugin.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index d616dad5ce..6725535a34 100644 --- a/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -918,9 +918,10 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { var node, wrap, P, spacer, selection = editor.selection, keyCode = event.keyCode, - dom = editor.dom; + dom = editor.dom, + VK = tinymce.util.VK; - if ( keyCode === tinymce.util.VK.ENTER ) { + if ( keyCode === VK.ENTER ) { // When pressing Enter inside a caption move the caret to a new parapraph under it node = selection.getNode(); wrap = dom.getParent( node, 'div.mceTemp' ); @@ -947,7 +948,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { editor.nodeChanged(); selection.setCursorLocation( P, 0 ); } - } else if ( keyCode === tinymce.util.VK.DELETE || keyCode === tinymce.util.VK.BACKSPACE ) { + } else if ( keyCode === VK.DELETE || keyCode === VK.BACKSPACE ) { node = selection.getNode(); if ( node.nodeName === 'DIV' && dom.hasClass( node, 'mceTemp' ) ) { @@ -965,10 +966,9 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { removeToolbar(); } - // Key presses will replace the image so we need to remove the toolbar + // Most key presses will replace the image so we need to remove the toolbar if ( toolbarActive ) { - if ( event.ctrlKey || event.metaKey || event.altKey || - ( keyCode < 48 && keyCode > 90 ) || keyCode > 186 ) { + if ( event.ctrlKey || event.metaKey || event.altKey || ( keyCode < 48 && keyCode !== VK.SPACEBAR ) ) { return; }