Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 06733f7

Browse files
committed
Fix auto save to publish when clicked in preview or after a set interval.
1 parent 9eff34a commit 06733f7

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

js/customize-snapshots.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@
534534
*/
535535
autoSaveEditBox: function() {
536536
var snapshot = this, update,
537-
delay = 2000, status, isValidChangesetStatus;
537+
delay = 2000, status, isValidChangesetStatus, needConfirm;
538538

539539
snapshot.updatePending = false;
540540
snapshot.dirtyEditControlValues = false;
@@ -580,11 +580,17 @@
580580
return _.contains( [ 'future', 'pending', 'draft' ], api.state( 'changesetStatus' ).get() );
581581
};
582582

583+
needConfirm = function() {
584+
return snapshot.statusButton.button.data( 'confirm-text' ) === snapshot.statusButton.buttonText.get();
585+
};
586+
583587
api.bind( 'changeset-save', function() {
584588
if ( isValidChangesetStatus() ) {
585589
snapshot.updatePending = true;
586-
snapshot.statusButton.disable( true );
587-
snapshot.spinner.addClass( 'is-active' );
590+
if ( ! needConfirm() ) {
591+
snapshot.statusButton.disable( true );
592+
snapshot.spinner.addClass( 'is-active' );
593+
}
588594
if ( snapshot.submitButton ) {
589595
snapshot.submitButton.prop( 'disabled', true );
590596
}
@@ -597,9 +603,11 @@
597603

598604
if ( isValidChangesetStatus() ) {
599605
snapshot.updatePending = false;
600-
snapshot.statusButton.disableSelect.set( false );
601-
snapshot.spinner.removeClass( 'is-active' );
602-
snapshot.statusButton.updateButtonText( 'alt-text' );
606+
if ( ! needConfirm() ) {
607+
snapshot.statusButton.disableSelect.set( false );
608+
snapshot.spinner.removeClass( 'is-active' );
609+
snapshot.statusButton.updateButtonText( 'alt-text' );
610+
}
603611
}
604612
});
605613
},

0 commit comments

Comments
 (0)