Consolidate "close on Escape" in the media modal, DFW, wpLink and Thickbox. Props kovshenin, fixes #26854.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz
2014-02-03 05:31:14 +00:00
parent 87c3c8adc0
commit 2f6d9d37cc
9 changed files with 21 additions and 52 deletions
-11
View File
@@ -701,15 +701,4 @@ $(document).ready( function() {
}
})();
// internal use
$(document).bind( 'wp_CloseOnEscape', function( e, data ) {
if ( typeof(data.cb) != 'function' )
return;
if ( typeof(data.condition) != 'function' || data.condition() )
data.cb();
return true;
});
}( jQuery, window ));
+1 -1
View File
File diff suppressed because one or more lines are too long
+7 -17
View File
@@ -477,23 +477,6 @@
a = e.altKey; // Alt key for Win & Linux
}
if ( 27 == c ) { // Esc
data = {
event: e,
what: 'dfw',
cb: api.off,
condition: function(){
if ( $('#TB_window').is(':visible') || $('.wp-dialog').is(':visible') )
return false;
return true;
}
};
if ( ! $(document).triggerHandler( 'wp_CloseOnEscape', [data] ) ) {
api.off();
}
}
if ( a && (61 == c || 107 == c || 187 == c) ) { // +
api.dfwWidth( 25 );
e.preventDefault();
@@ -510,6 +493,13 @@
}
});
$document.on( 'keydown.wp-fullscreen', function( event ) {
if ( 27 === event.which && s.visible ) { // Esc
api.off();
event.stopImmediatePropagation();
}
});
toolbar.on( 'mouseenter', function() {
toggleUI('show');
}).on( 'mouseleave', function() {
+1 -1
View File
File diff suppressed because one or more lines are too long