Autosave: always expose the `wp.autosave.local` methods, fixes #28924.

Built from https://develop.svn.wordpress.org/trunk@29192


git-svn-id: http://core.svn.wordpress.org/trunk@28976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-07-16 18:34:16 +00:00
parent cd497224a3
commit 100e5ca40b
2 changed files with 6 additions and 12 deletions

View File

@ -211,7 +211,7 @@ window.autosave = function() {
var postData, compareString, var postData, compareString,
result = false; result = false;
if ( isSuspended ) { if ( isSuspended || ! hasStorage ) {
return false; return false;
} }
@ -399,21 +399,15 @@ window.autosave = function() {
return false; return false;
} }
// Initialize and run checkPost() on loading the script (before TinyMCE init)
blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id; blog_id = typeof window.autosaveL10n !== 'undefined' && window.autosaveL10n.blog_id;
// Check if the browser supports sessionStorage and it's not disabled // Check if the browser supports sessionStorage and it's not disabled,
if ( ! checkStorage() ) { // then initialize and run checkPost().
return;
}
// Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'. // Don't run if the post type supports neither 'editor' (textarea#content) nor 'excerpt'.
if ( ! blog_id || ( ! $('#content').length && ! $('#excerpt').length ) ) { if ( checkStorage() && blog_id && ( $('#content').length || $('#excerpt').length ) ) {
return; $document.ready( run );
} }
$document.ready( run );
return { return {
hasStorage: hasStorage, hasStorage: hasStorage,
getSavedPostData: getSavedPostData, getSavedPostData: getSavedPostData,

File diff suppressed because one or more lines are too long