Autosave: properly set autosaveLast when TinyMCE is the default editor. Prevents firing autosave when there are no changes. See #23220

git-svn-id: http://core.svn.wordpress.org/trunk@24431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-06-09 00:45:01 +00:00
parent 6ce2016042
commit aff66a7d07
1 changed files with 13 additions and 1 deletions

View File

@ -2,7 +2,19 @@ var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = fals
jQuery(document).ready( function($) {
autosaveLast = ( $('#post #title').val() || '' ) + ( $('#post #content').val() || '' );
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();
autosaveLast = ( $('#title').val() || '' ) + ( $('#content').val() || '' );
});
}
});
} else {
autosaveLast = ( $('#title').val() || '' ) + ( $('#content').val() || '' );
}
autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
//Disable autosave after the form has been submitted