Autosave fixes for attachments from andy. fixes #6389

git-svn-id: https://develop.svn.wordpress.org/trunk@7532 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Mark Jaquith 2008-03-26 20:28:40 +00:00
parent 9ce77cf8d8
commit bfc779927b
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(); }

View File

@ -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(