Autosave to the browser's sessionStorage, compare this autosave to the post content on page load and let the user restore it when the data is not the same. First run, see #23220

git-svn-id: https://develop.svn.wordpress.org/trunk@23683 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz
2013-03-13 10:08:16 +00:00
parent 5e439e799e
commit 4ad27d6d14
7 changed files with 449 additions and 66 deletions

View File

@@ -106,7 +106,7 @@ function wp_default_scripts( &$scripts ) {
'dismiss' => __('Dismiss'),
) );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), false, 1 );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response', 'editor'), false, 1 );
$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 );
did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',
@@ -585,7 +585,8 @@ function wp_just_in_time_script_localization() {
wp_localize_script( 'autosave', 'autosaveL10n', array(
'autosaveInterval' => AUTOSAVE_INTERVAL,
'savingText' => __('Saving Draft…'),
'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')
'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
'blog_id' => get_current_blog_id(),
) );
}