Make WordPress Core

Ticket #6389: 6389-autosave.diff

File 6389-autosave.diff, 1.1 KB (added by andy, 18 years ago)
  • wp-includes/js/autosave.js

     
    5050        var res = autosave_saved(response); // parse the ajax response do the above
    5151        // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID
    5252        if ( res && res.responses.length && !res.errors ) {
     53                var tempID = jQuery('#post_ID').val();
    5354                var postID = parseInt( res.responses[0].id );
    5455                autosave_update_post_ID( postID );
     56                if ( tempID < 0 ) // update media buttons
     57                        jQuery('#media-buttons a').each(function(){
     58                                this.href = this.href.replace(tempID, postID);
     59                        });
    5560        }
    5661}
    5762
     
    137142        // This (bool) tells whether or not to write the post to the DB during the ajax request.
    138143        var doAutoSave = true;
    139144
     145        // No autosave while thickbox is open (media buttons)
     146        if ( jQuery("#TB_window").css('display') == 'block' )
     147                doAutoSave = false;
     148
    140149        /* Gotta do this up here so we can check the length when tinyMCE is in use */
    141150        if ( rich ) { tinyMCE.triggerSave(); }
    142151