diff --git a/wp-includes/js/autosave.js b/wp-includes/js/autosave.js index 54333f8173..9bfe48375b 100644 --- a/wp-includes/js/autosave.js +++ b/wp-includes/js/autosave.js @@ -50,8 +50,13 @@ function autosave_saved_new(response) { var res = autosave_saved(response); // parse the ajax response do the above // if no errors: update post_ID from the temporary value, grab new save-nonce for that new ID if ( res && res.responses.length && !res.errors ) { + var tempID = jQuery('#post_ID').val(); var postID = parseInt( res.responses[0].id ); autosave_update_post_ID( postID ); + if ( tempID < 0 ) // update media buttons + jQuery('#media-buttons a').each(function(){ + this.href = this.href.replace(tempID, postID); + }); } } @@ -137,6 +142,10 @@ var autosave = function() { // This (bool) tells whether or not to write the post to the DB during the ajax request. var doAutoSave = true; + // No autosave while thickbox is open (media buttons) + if ( jQuery("#TB_window").css('display') == 'block' ) + doAutoSave = false; + /* Gotta do this up here so we can check the length when tinyMCE is in use */ if ( rich ) { tinyMCE.triggerSave(); } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 7c89dc5005..e6af2928f2 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -47,7 +47,7 @@ class WP_Scripts { 'broken' => __('An unidentified error has occurred.') ) ); - $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080322' ); + $this->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20080326' ); $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); $this->localize( 'wp-ajax', 'WPAjaxL10n', array(