Make WordPress Core

Ticket #29386: 29386.patch

File 29386.patch, 2.3 KB (added by iseulde, 10 years ago)
  • src/wp-admin/edit-form-advanced.php

     
    388388        echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
    389389?></h2>
    390390<?php if ( $notice ) : ?>
    391 <div id="notice" class="error"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
     391<div id="notice" class="error"><p><?php echo $notice ?></p></div>
    392392<?php endif; ?>
    393393<?php if ( $message ) : ?>
    394394<div id="message" class="updated"><p><?php echo $message; ?></p></div>
  • src/wp-includes/js/autosave.js

     
    77( function( $, window ) {
    88        function autosave() {
    99                var initialCompareString,
    10                 lastTriggerSave = 0,
    11                 $document = $(document);
     10                        lastTriggerSave = 0,
     11                        $window = $( window ),
     12                        $editorWindow = $(),
     13                        $document = $( document );
    1214
    1315                /**
    1416                 * Returns the data saved in both local and remote autosave
     
    323325                                }
    324326
    325327                                // There is a newer autosave. Don't show two "restore" notices at the same time.
    326                                 if ( $( '#has-newer-autosave' ).length ) {
     328                                if ( $( '#notice' ).length ) {
    327329                                        return;
    328330                                }
    329331
     
    528530                        }).on( 'heartbeat-tick.autosave', function( event, data ) {
    529531                                if ( data.wp_autosave ) {
    530532                                        response( data.wp_autosave );
     533
     534                                        $window.add( $editorWindow ).on( 'mousemove.autosave', function() {
     535                                                var $notice = $( '#notice' );
     536
     537                                                window.scrollBy( 0, -$notice.outerHeight( true ) );
     538                                                $notice.remove();
     539                                                $window.add( $editorWindow ).off( 'mousemove.autosave' );
     540                                        } );
    531541                                }
    532542                        }).on( 'heartbeat-connection-lost.autosave', function( event, error, status ) {
    533543                                // When connection is lost, keep user from submitting changes.
     
    567577                                        editor.save();
    568578                                        initialCompareString = getCompareString();
    569579                                }, 1000 );
     580
     581                                $editorWindow = $( editor.getWin() );
    570582                        }
    571583                }).ready( function() {
    572584                        // Set the initial compare string in case TinyMCE is not used or not loaded first