Make WordPress Core

Ticket #7392: 7392.6.diff

File 7392.6.diff, 1.8 KB (added by markjaquith, 12 years ago)

with refresh if the bug is not triggered. Leave it running to test.

  • wp-includes/js/autosave.js

    var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = fals 
    22
    33jQuery(document).ready( function($) {
    44
    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() || ''
    2110                });
    2211        } else {
    2312                autosaveLast = wp.autosave.getCompareString();
    2413        }
    2514
     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
    2629        autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
    2730
    2831        //Disable autosave after the form has been submitted