Local autosave: remove the temp cookie after first use. Prevents false negative if the browser crashes. Add some temp logging to aid testing. See #23220

git-svn-id: http://core.svn.wordpress.org/trunk@23705 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-03-15 06:15:14 +00:00
parent 0fc6c4eca2
commit 9a695d70bf
1 changed files with 11 additions and 0 deletions

View File

@ -487,6 +487,10 @@ wp.autosave.local = {
post_data['status'] = $('#post_status').val() || '';
result = this.setData( post_data );
// temp logging
if ( this.debug )
console.log( 'saved, post content = %s', post_data.content );
if ( result )
this.lastsaveddata = post_data.post_title + ': ' + post_data.content;
@ -583,10 +587,17 @@ wp.autosave.local = {
if ( ! post_data )
return;
if ( cookie )
wpCookies.remove( 'wp-saving-post-' + post_id );
// There is a newer autosave. Don't show two "restore" notices at the same time.
if ( $('#has-newer-autosave').length )
return;
// temp logging
if ( typeof console != 'undefined' )
console.log( 'checkPost, post content = %s', post_data.content );
if ( cookie == 'saved' ) {
return;
} else if ( cookie != 'check' ) {