Make WordPress Core

Changeset 24431


Ignore:
Timestamp:
06/09/2013 12:45:01 AM (13 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/autosave.js

    r24397 r24431  
    33jQuery(document).ready( function($) {
    44
    5         autosaveLast = ( $('#post #title').val() || '' ) + ( $('#post #content').val() || '' );
     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                                        autosaveLast = ( $('#title').val() || '' ) + ( $('#content').val() || '' );
     11                                });
     12                        }
     13                });
     14        } else {
     15                autosaveLast = ( $('#title').val() || '' ) + ( $('#content').val() || '' );
     16        }
     17
    618        autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
    719
Note: See TracChangeset for help on using the changeset viewer.