WordPress.org

Make WordPress Core

Changeset 29541


Ignore:
Timestamp:
08/19/2014 07:13:08 PM (7 years ago)
Author:
azaozz
Message:

TinyMCE: fix the keycode check when removing the Edit/Delete toolbar from images on keydown, see #28705

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js

    r29540 r29541  
    919919            selection = editor.selection,
    920920            keyCode = event.keyCode,
    921             dom = editor.dom;
    922 
    923         if ( keyCode === tinymce.util.VK.ENTER ) {
     921            dom = editor.dom,
     922            VK = tinymce.util.VK;
     923
     924        if ( keyCode === VK.ENTER ) {
    924925            // When pressing Enter inside a caption move the caret to a new parapraph under it
    925926            node = selection.getNode();
     
    948949                selection.setCursorLocation( P, 0 );
    949950            }
    950         } else if ( keyCode === tinymce.util.VK.DELETE || keyCode === tinymce.util.VK.BACKSPACE ) {
     951        } else if ( keyCode === VK.DELETE || keyCode === VK.BACKSPACE ) {
    951952            node = selection.getNode();
    952953
     
    966967        }
    967968
    968         // Key presses will replace the image so we need to remove the toolbar
     969        // Most key presses will replace the image so we need to remove the toolbar
    969970        if ( toolbarActive ) {
    970             if ( event.ctrlKey || event.metaKey || event.altKey ||
    971                 ( keyCode < 48 && keyCode > 90 ) || keyCode > 186 ) {
     971            if ( event.ctrlKey || event.metaKey || event.altKey || ( keyCode < 48 && keyCode !== VK.SPACEBAR ) ) {
    972972                return;
    973973            }
Note: See TracChangeset for help on using the changeset viewer.