Make WordPress Core


Ignore:
Timestamp:
03/13/2013 10:08:16 AM (12 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/misc.php

    r23681 r23683  
    633633}
    634634add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );
     635
     636/**
     637 * Output the HTML for restoring the post data from DOM storage
     638 *
     639 * @since 3.6
     640 * @access private
     641 */
     642function _local_storage_notice() {
     643    $screen = get_current_screen();
     644    if ( ! $screen || 'post' != $screen->id )
     645        return;
     646
     647    ?>
     648    <div id="local-storage-notice" class="hidden">
     649    <p class="local-restore">
     650        <?php _e('The backup of this post in your browser is different from the version below.'); ?>
     651        <a class="restore-backup" href="#"><?php _e('Restore the backup.'); ?></a>
     652    </p>
     653    <p class="undo-restore hidden">
     654        <?php _e('Post restored successfully.'); ?>
     655        <a class="undo-restore-backup" href="#"><?php _e('Undo.'); ?></a>
     656    </p>
     657    </div>
     658    <?php
     659}
     660add_action( 'admin_footer', '_local_storage_notice' );
Note: See TracChangeset for help on using the changeset viewer.