Post type support for local autosaves. props azaozz. see #24756.

git-svn-id: https://develop.svn.wordpress.org/trunk@24747 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Nacin
2013-07-19 00:22:22 +00:00
parent 76dae29fc7
commit d1a1f8daa1

View File

@@ -524,11 +524,12 @@ wp.autosave.local = {
init: function( settings ) {
var self = this;
// Run only on the Add/Edit Post screens and in browsers that have sessionStorage
if ( 'post' != window.pagenow || ! this.checkStorage() )
// Check if the browser supports sessionStorage and editor.js is loaded
if ( ! this.checkStorage() || typeof switchEditors == 'undefined' )
return;
// editor.js has to be loaded before autosave.js
if ( typeof switchEditors == 'undefined' )
// Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'.
if ( ! $('#content').length && ! $('#excerpt').length )
return;
if ( settings )