Make WordPress Core

Ticket #7392: 7392-7.patch

File 7392-7.patch, 1.6 KB (added by azaozz, 12 years ago)
  • wp-includes/js/autosave.js

     
    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                                console.log( 'autosave will run = %s', autosaveLast !== wp.autosave.getCompareString() );
     21                        },
     22                        3000
     23                );
     24        }
     25
    2626        autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
    2727
    2828        //Disable autosave after the form has been submitted