Avoid racing TinyMCE, which avoids the creation of unnecessary autosaves. props azaozz. see #7392.

git-svn-id: https://develop.svn.wordpress.org/trunk@24849 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin 2013-07-29 03:37:14 +00:00
parent 949c53cae1
commit 4da2cb6d51

View File

@ -2,22 +2,11 @@ var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = fals
jQuery(document).ready( function($) {
if ( $('#wp-content-wrap').hasClass('tmce-active') && typeof tinymce != 'undefined' ) {
tinymce.onAddEditor.add( function( tinymce, editor ) {
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();
}
});
}
if ( $('#wp-content-wrap').hasClass('tmce-active') && 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();