Make WordPress Core

Ticket #24756: 24756.diff

File 24756.diff, 859 bytes (added by nacin, 11 years ago)
  • wp-includes/js/autosave.js

     
    524524        init: function( settings ) {
    525525                var self = this;
    526526
    527                 // Run only on the Add/Edit Post screens and in browsers that have sessionStorage
    528                 if ( 'post' != window.pagenow || ! this.checkStorage() )
     527                // Check if the browser supports sessionStorage and editor.js is loaded
     528                if ( ! this.checkStorage() || typeof switchEditors == 'undefined' )
    529529                        return;
    530                 // editor.js has to be loaded before autosave.js
    531                 if ( typeof switchEditors == 'undefined' )
     530
     531                // Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'.
     532                if ( ! $('#content').length && ! $('#excerpt').length )
    532533                        return;
    533534
    534535                if ( settings )