Make WordPress Core

Ticket #7392: 7392-6.patch

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

     
    11var autosave, autosaveLast = '', autosavePeriodical, autosaveDelayPreview = false, notSaved = true, blockSave = false, fullscreen, autosaveLockRelease = true;
    22
    3 jQuery(document).ready( function($) {
     3if ( jQuery('#wp-content-wrap').hasClass('tmce-active') ) {
     4        jQuery(document).on( '_tinymce-body-onload.autosave', function( e, editor ) {
     5                if ( 'content' === editor.id && ! editor.isHidden() ) {
     6                        setTimeout( function(){
     7                                editor.save();
     8                                autosaveLast = wp.autosave.getCompareString();
    49
    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                         }
    21                 });
    22         } else {
    23                 autosaveLast = wp.autosave.getCompareString();
    24         }
     10                                // temp debug
     11                                if ( 'console' in window )
     12                                        console.log( 'autosave will run = %s', autosaveLast !== wp.autosave.getCompareString() );
     13                        }, 1000 );
     14                }
     15        });
     16}
    2517
     18jQuery(document).ready( function($) {
     19        autosaveLast = wp.autosave.getCompareString();
    2620        autosavePeriodical = $.schedule({time: autosaveL10n.autosaveInterval * 1000, func: function() { autosave(); }, repeat: true, protect: true});
    2721
    2822        //Disable autosave after the form has been submitted
  • wp-includes/js/tinymce/plugins/wordpress/editor_plugin_src.js

     
    236236                                        o.content = switchEditors.pre_wpautop(o.content);
    237237                        });
    238238
     239                        ed.onLoad.add( function(ed) {
     240                                if ( typeof jQuery === 'function' )
     241                                        jQuery(document).trigger( '_tinymce-body-onload', [ ed ] );
     242                        });
     243
    239244                        /* disable for now
    240245                        ed.onBeforeSetContent.add(function(ed, o) {
    241246                                o.content = t._setEmbed(o.content);