Make WordPress Core

Changeset 30625


Ignore:
Timestamp:
11/29/2014 02:44:37 AM (10 years ago)
Author:
azaozz
Message:

Editor: fix fading out on Escape in DFW v2. props adamsilverstein, fixes #30528.

File:
1 edited

Legend:

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

    r30593 r30625  
    877877            // fadeIn and return on Escape and keyboard shortcut Alt+Shift+W.
    878878            if ( key === 27 || ( key === 87 && event.altKey && event.shiftKey ) ) {
    879                 fadeIn();
     879                fadeIn( event );
    880880                return;
    881881            }
     
    995995        }
    996996
    997         function fadeIn() {
     997        function fadeIn( event ) {
    998998            if ( faded ) {
    999999                faded = false;
     
    10091009                $overlay.off( 'mouseenter.focus mouseleave.focus mousemove.focus touchstart.focus' );
    10101010
    1011                 $editor.on( 'mouseenter.focus', function() {
    1012                     if ( $.contains( $editor.get( 0 ), document.activeElement ) || editorHasFocus ) {
    1013                         fadeOut();
    1014                     }
    1015                 } );
     1011                /*
     1012                 * When fading in, temporarily watch for refocus and fade back out - helps
     1013                 * with 'accidental' editor exits with the mouse. When fading in and the event
     1014                 * is a key event (Escape or Alt+Shift+W) don't watch for refocus.
     1015                 */
     1016                if ( 'undefined' === typeof event ) {
     1017                    $editor.on( 'mouseenter.focus', function() {
     1018                        if ( $.contains( $editor.get( 0 ), document.activeElement ) || editorHasFocus ) {
     1019                            fadeOut();
     1020                        }
     1021                    } );
     1022                }
    10161023
    10171024                focusLostTimer = setTimeout( function() {
Note: See TracChangeset for help on using the changeset viewer.