Autosave fixes for attachments from andy. fixes #6389

git-svn-id: http://svn.automattic.com/wordpress/trunk@7532 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith
2008-03-26 20:28:40 +00:00
parent bba593e250
commit 740f33ea4b
2 changed files with 10 additions and 1 deletions

View File

@@ -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(); }