Avoid rare autosave collision when trying to publish the post immediately after it was autosaved, fixes #6785

git-svn-id: https://develop.svn.wordpress.org/trunk@11927 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2009-09-13 23:36:09 +00:00
parent f159af5111
commit b967e7d4bd
3 changed files with 7 additions and 5 deletions

View File

@ -183,13 +183,15 @@ function autosave_loading() {
}
function autosave_enable_buttons() {
jQuery(':button, :submit', '#submitpost').removeAttr('disabled');
jQuery('#ajax-loading').css('visibility', 'hidden');
// delay that a bit to avoid some rare collisions while the DOM is being updated.
setTimeout(function(){
jQuery(':button, :submit', '#submitpost').removeAttr('disabled');
jQuery('#ajax-loading').css('visibility', 'hidden');
}, 500);
}
function autosave_disable_buttons() {
jQuery(':button, :submit', '#submitpost').attr('disabled', 'disabled');
//jQuery('#ajax-loading').css('visibility', 'visible');
// Re-enable 5 sec later. Just gives autosave a head start to avoid collisions.
setTimeout(autosave_enable_buttons, 5000);
}

File diff suppressed because one or more lines are too long

View File

@ -98,7 +98,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
) );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090825' );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20090913' );
$scripts->add_data( 'autosave', 'group', 1 );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20090504' );