Make WordPress Core

Changeset 28443


Ignore:
Timestamp:
05/16/2014 10:42:03 AM (10 years ago)
Author:
SergeyBiryukov
Message:

DFW: Properly handle Esc key when the content is focused or when switching browser tabs.

props avryl.
fixes #28279.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/wp-fullscreen.js

    r28116 r28443  
    511511            });
    512512
    513             $document.on( 'keydown.wp-fullscreen', function( event ) {
    514                 if ( 27 === event.which && s.visible ) { // Esc
     513            $( window ).on( 'keyup', function( event ) {
     514                // Turn fullscreen off when Esc is pressed.
     515                if ( 27 === event.keyCode && s.visible ) {
    515516                    api.off();
    516                     event.stopImmediatePropagation();
    517517                }
    518518            });
  • trunk/src/wp-includes/js/tinymce/plugins/wpfullscreen/plugin.js

    r27857 r28443  
    7979    editor.addCommand( 'wpFullScreen', toggleFullscreen );
    8080
     81    editor.on( 'keyup', function( event ) {
     82        // Turn fullscreen off when Esc is pressed.
     83        if ( event.keyCode === 27 && wp.editor.fullscreen.settings.visible ) {
     84            wp.editor.fullscreen.off();
     85        }
     86    } );
     87
    8188    editor.on( 'init', function() {
    8289        // Set the editor when initializing from whitin DFW
Note: See TracChangeset for help on using the changeset viewer.