From 67c547470163738661059e83854f36b5a4764fa4 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 16 Jul 2014 18:33:03 +0000 Subject: [PATCH] Autosave: always expose the `wp.autosave.local` methods, fixes #28924. git-svn-id: https://develop.svn.wordpress.org/trunk@29192 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/autosave.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/wp-includes/js/autosave.js b/src/wp-includes/js/autosave.js index def54298eb..dd08cb4e35 100644 --- a/src/wp-includes/js/autosave.js +++ b/src/wp-includes/js/autosave.js @@ -211,7 +211,7 @@ window.autosave = function() { var postData, compareString, result = false; - if ( isSuspended ) { + if ( isSuspended || ! hasStorage ) { return false; } @@ -399,21 +399,15 @@ window.autosave = function() { return false; } - // Initialize and run checkPost() on loading the script (before TinyMCE init) blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id; - // Check if the browser supports sessionStorage and it's not disabled - if ( ! checkStorage() ) { - return; - } - + // Check if the browser supports sessionStorage and it's not disabled, + // then initialize and run checkPost(). // Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'. - if ( ! blog_id || ( ! $('#content').length && ! $('#excerpt').length ) ) { - return; + if ( checkStorage() && blog_id && ( $('#content').length || $('#excerpt').length ) ) { + $document.ready( run ); } - $document.ready( run ); - return { hasStorage: hasStorage, getSavedPostData: getSavedPostData,