Changeset 23796
- Timestamp:
- 03/25/2013 11:43:06 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/js/autosave.js
r23735 r23796 424 424 425 425 /** 426 * Set (save) post data in the storage 427 * 426 * Set (save or delete) post data in the storage. 427 * 428 * If stored_data evaluates to 'false' the storage key for the current post will be removed 429 * 430 * $param stored_data The post data to store or null/false/empty to delete the key 428 431 * @return bool 429 432 */ … … 434 437 return false; 435 438 436 stored[ 'post_' + post_id ] = stored_data; 439 if ( stored_data ) 440 stored[ 'post_' + post_id ] = stored_data; 441 else if ( stored.hasOwnProperty( 'post_' + post_id ) ) 442 delete stored[ 'post_' + post_id ]; 443 else 444 return false; 437 445 438 446 return this.setStorage(stored); … … 471 479 472 480 // temp logging 473 if ( t his.debug)474 console.log( ' saved, post content = %s', post_data.content );481 if ( typeof console != 'undefined' ) 482 console.log( 'Local autosave: saved, post content = %s', post_data.content ); 475 483 476 484 if ( result ) … … 567 575 post_id = $('#post_ID').val() || 0, cookie = wpCookies.get( 'wp-saving-post-' + post_id ); 568 576 577 // temp logging 578 if ( typeof console != 'undefined' ) 579 console.log( 'Local autosave: checkPost, cookie = %s, post content = %s', cookie, post_data && post_data.content ); 580 569 581 if ( ! post_data ) 570 582 return; 571 583 572 if ( cookie ) 584 if ( cookie ) { 573 585 wpCookies.remove( 'wp-saving-post-' + post_id ); 586 587 if ( cookie == 'saved' ) { 588 // The post was saved properly, remove old data and bail 589 this.setData( false ); 590 return; 591 } 592 } 574 593 575 594 // There is a newer autosave. Don't show two "restore" notices at the same time. … … 577 596 return; 578 597 579 // temp logging 580 if ( typeof console != 'undefined' ) 581 console.log( 'checkPost, post content = %s', post_data.content ); 582 583 if ( cookie == 'saved' ) { 584 return; 585 } else if ( cookie != 'check' ) { 598 // cookie == 'check' means the post was not saved properly, always show #local-storage-notice 599 if ( cookie != 'check' ) { 586 600 content = $('#content').val(); 587 601 check_data = $.extend( {}, post_data );
Note: See TracChangeset
for help on using the changeset viewer.