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
This commit is contained in:
Andrew Ozz 2014-07-16 18:33:03 +00:00
parent 72c8cf3233
commit 67c5474701
1 changed files with 5 additions and 11 deletions

View File

@ -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,