Make WordPress Core

Ticket #17399: 17399-fix.diff

File 17399-fix.diff, 3.2 KB (added by chrisbliss18, 14 years ago)

Patch proposal

  • wp-admin/js/wp-fullscreen.dev.js

    diff --git wp-admin/js/wp-fullscreen.dev.js wp-admin/js/wp-fullscreen.dev.js
    index e9678c9..9e15344 100644
     
    44 * A lightweight publish/subscribe implementation.
    55 * Private use only!
    66 */
    7 var PubSub, fullscreen, wptitlehint;
     7var PubSub, fullscreen, wptitlehint, wpDialogOpen = false;
    88
    99PubSub = function() {
    1010        this.topics = {};
    PubSub.prototype.publish = function( topic, args ) { 
    486486                                else
    487487                                        a = e.altKey; // Alt key for Win & Linux
    488488
    489                                 if ( 27 == c ) // Esc
    490                                         fullscreen.off();
    491489
    492490                                if ( a && (61 == c || 187 == c) ) // +
    493491                                        api.dfw_width(25);
    PubSub.prototype.publish = function( topic, args ) { 
    501499                                return true;
    502500                        });
    503501
     502                        $(document).keydown(function(e){
     503                                var c = e.charCode || e.keyCode;
     504
     505                                // The Esc key check has to be in keydown since Thickbox and tinyMCE's wpDialog
     506                                // all handle Esc presses on keydown.
     507                                if ( 27 == c && ! wpDialogOpen ) { // Esc
     508                                        fullscreen.off();
     509                                }
     510                        });
     511
    504512                        topbar.mouseenter(function(e){
    505513                                s.toolbars.addClass('fullscreen-make-sticky');
    506514                                $( document ).unbind( '.fullscreen' );
  • wp-includes/js/thickbox/thickbox.js

    diff --git wp-includes/js/thickbox/thickbox.js wp-includes/js/thickbox/thickbox.js
    index d4b3710..f367d77 100644
    if ( typeof tb_closeImage != 'string' ) { 
    1414
    1515/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
    1616
     17var wpDialogOpen = false;
     18
    1719//on page load call tb_init
    1820jQuery(document).ready(function(){
    1921        tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
    function tb_click(){ 
    3638}
    3739
    3840function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
     41        wpDialogOpen = true;
    3942
    4043        try {
    4144                if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
    function tb_remove() { 
    283286        }
    284287        document.onkeydown = "";
    285288        document.onkeyup = "";
     289
     290        // Add a small timeout just to ensure that code that checks wpDialogOpen can
     291        // run before the variable is updated.
     292        setTimeout( 'wpDialogOpen = false;', 100 );
     293
    286294        return false;
    287295}
    288296
  • wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js

    diff --git wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js
    index 620213f..8b4d459 100644
     
     1var wpDialogOpen = false;
     2
    13(function($){
    24        $.widget("wp.wpdialog", $.ui.dialog, {
    35                open: function() {
     
    1315                                return;
    1416                        }
    1517
     18                        wpDialogOpen = true;
     19
    1620                        // Open the dialog.
    1721                        $.ui.dialog.prototype.open.apply( this, arguments );
    1822                        // WebKit leaves focus in the TinyMCE editor unless we shift focus.
    1923                        this.element.focus();
    2024                        this._trigger('refresh');
     25                },
     26
     27                close: function() {
     28                        $.ui.dialog.prototype.close.apply( this, arguments );
     29
     30                        // Add a small timeout just to ensure that code that checks wpDialogOpen can
     31                        // run before the variable is updated.
     32                        setTimeout( 'wpDialogOpen = false;', 100 );
    2133                }
    2234        });
    2335})(jQuery);