Ticket #7392: 7392.6.diff
File 7392.6.diff, 1.8 KB (added by , 12 years ago) |
---|
-
wp-includes/js/autosave.js
var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = fals 2 2 3 3 jQuery(document).ready( function($) { 4 4 5 if ( $('#wp-content-wrap').hasClass('tmce-active') && typeof tinymce != 'undefined' ) { 6 tinymce.onAddEditor.add( function( tinymce, editor ) { 7 if ( 'content' == editor.id ) { 8 editor.onLoad.add( function() { 9 editor.save(); 10 if ( typeof switchEditors != 'undefined' ) { 11 autosaveLast = wp.autosave.getCompareString({ 12 post_title : $('#title').val() || '', 13 content : switchEditors.pre_wpautop( $('#content').val() ) || '', 14 excerpt : $('#excerpt').val() || '', 15 }); 16 } else { 17 autosaveLast = wp.autosave.getCompareString(); 18 } 19 }); 20 } 5 if ( $('#wp-content-wrap').hasClass('tmce-active') && typeof switchEditors != 'undefined' ) { 6 autosaveLast = wp.autosave.getCompareString({ 7 post_title : $('#title').val() || '', 8 content : switchEditors.pre_wpautop( $('#content').val() ) || '', 9 excerpt : $('#excerpt').val() || '' 21 10 }); 22 11 } else { 23 12 autosaveLast = wp.autosave.getCompareString(); 24 13 } 25 14 15 // temp debug 16 if ( 'console' in window ) { 17 setTimeout( 18 function() { 19 tinymce.get('content').save() 20 if ( autosaveLast === wp.autosave.getCompareString() ) { 21 window.location = window.location; 22 } 23 console.log( 'autosave will run = %s', autosaveLast !== wp.autosave.getCompareString() ); 24 }, 25 3000 26 ); 27 } 28 26 29 autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true}); 27 30 28 31 //Disable autosave after the form has been submitted