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

Built from https://develop.svn.wordpress.org/trunk@30625


git-svn-id: http://core.svn.wordpress.org/trunk@30615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-11-29 02:45:22 +00:00
parent 9d1a4afda8
commit 2808edf7d1
3 changed files with 16 additions and 9 deletions

View File

@ -876,7 +876,7 @@
// fadeIn and return on Escape and keyboard shortcut Alt+Shift+W.
if ( key === 27 || ( key === 87 && event.altKey && event.shiftKey ) ) {
fadeIn();
fadeIn( event );
return;
}
@ -994,7 +994,7 @@
fadeOutSlug();
}
function fadeIn() {
function fadeIn( event ) {
if ( faded ) {
faded = false;
@ -1008,11 +1008,18 @@
$overlay.off( 'mouseenter.focus mouseleave.focus mousemove.focus touchstart.focus' );
$editor.on( 'mouseenter.focus', function() {
if ( $.contains( $editor.get( 0 ), document.activeElement ) || editorHasFocus ) {
fadeOut();
}
} );
/*
* When fading in, temporarily watch for refocus and fade back out - helps
* with 'accidental' editor exits with the mouse. When fading in and the event
* is a key event (Escape or Alt+Shift+W) don't watch for refocus.
*/
if ( 'undefined' === typeof event ) {
$editor.on( 'mouseenter.focus', function() {
if ( $.contains( $editor.get( 0 ), document.activeElement ) || editorHasFocus ) {
fadeOut();
}
} );
}
focusLostTimer = setTimeout( function() {
focusLostTimer = null;

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.1-beta2-30624';
$wp_version = '4.1-beta2-30625';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.