Customize: Ensure `autosaving` message gets sent to preview after initial change when `saved` state is first dirty.

Amends [41667].
Fixes #42475 for trunk.


git-svn-id: https://develop.svn.wordpress.org/trunk@42136 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-11-09 04:14:46 +00:00
parent ac5a3fc7a8
commit d671098003
1 changed files with 4 additions and 2 deletions

View File

@ -9191,12 +9191,14 @@
api.unbind( 'change', startAutosaving ); // Ensure startAutosaving only fires once.
api.state( 'saved' ).bind( function( isSaved ) {
function onChangeSaved( isSaved ) {
if ( ! isSaved && ! api.settings.changeset.autosaved ) {
api.settings.changeset.autosaved = true; // Once a change is made then autosaving kicks in.
api.previewer.send( 'autosaving' );
}
} );
}
api.state( 'saved' ).bind( onChangeSaved );
onChangeSaved( api.state( 'saved' ).get() );
/**
* Request changeset update and then re-schedule the next changeset update time.