Autosave: Don't save an autosave unnecessarily when the post editor loads and TinyMCE is the default editor.

Delete such useless autosaves when we detect them in edit-form-advanced.php.

see #7392.



git-svn-id: http://core.svn.wordpress.org/trunk@24787 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-07-24 05:37:53 +00:00
parent af708b5a71
commit 85cf232e23
2 changed files with 12 additions and 1 deletions

View File

@ -98,6 +98,9 @@ if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql
break;
}
}
// If this autosave isn't different from the current post, begone.
if ( ! $notice )
wp_delete_post_revision( $autosave->ID );
unset($autosave_field, $_autosave_field);
}

View File

@ -7,7 +7,15 @@ jQuery(document).ready( function($) {
if ( 'content' == editor.id ) {
editor.onLoad.add( function() {
editor.save();
if ( typeof switchEditors != 'undefined' ) {
autosaveLast = wp.autosave.getCompareString({
post_title : $('#title').val() || '',
content : switchEditors.pre_wpautop( $('#content').val() ) || '',
excerpt : $('#excerpt').val() || '',
});
} else {
autosaveLast = wp.autosave.getCompareString();
}
});
}
});