Customize: Prevent drawing attention to save button if status unchanged from publish; account for changes to status/date when alerting about unsaved changes.
Also fix malformed ESLint directive from [41933]. Amends [41932]. See #39896, #42211. git-svn-id: https://develop.svn.wordpress.org/trunk@41947 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b4ede0319c
commit
d15347ae52
@ -6986,12 +6986,21 @@
|
||||
} );
|
||||
|
||||
section.expanded.bind( function( isExpanded ) {
|
||||
var defaultChangesetStatus;
|
||||
publishSettingsBtn.attr( 'aria-expanded', String( isExpanded ) );
|
||||
publishSettingsBtn.toggleClass( 'active', isExpanded );
|
||||
|
||||
if ( isExpanded ) {
|
||||
cancelHighlightScheduleButton();
|
||||
} else if ( api.state( 'selectedChangesetStatus' ).get() !== api.state( 'changesetStatus' ).get() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
defaultChangesetStatus = api.state( 'changesetStatus' ).get();
|
||||
if ( '' === defaultChangesetStatus || 'auto-draft' === defaultChangesetStatus ) {
|
||||
defaultChangesetStatus = 'publish';
|
||||
}
|
||||
|
||||
if ( api.state( 'selectedChangesetStatus' ).get() !== defaultChangesetStatus ) {
|
||||
highlightScheduleButton();
|
||||
} else if ( 'future' === api.state( 'selectedChangesetStatus' ).get() && api.state( 'selectedChangesetDate' ).get() !== api.state( 'changesetDate' ).get() ) {
|
||||
highlightScheduleButton();
|
||||
@ -8479,6 +8488,7 @@
|
||||
var isInsideIframe = false;
|
||||
|
||||
function isCleanState() {
|
||||
var defaultChangesetStatus;
|
||||
|
||||
/*
|
||||
* Handle special case of previewing theme switch since some settings (for nav menus and widgets)
|
||||
@ -8488,6 +8498,20 @@
|
||||
return 0 === api._latestRevision;
|
||||
}
|
||||
|
||||
// Dirty if the changeset status has been changed but not saved yet.
|
||||
defaultChangesetStatus = api.state( 'changesetStatus' ).get();
|
||||
if ( '' === defaultChangesetStatus || 'auto-draft' === defaultChangesetStatus ) {
|
||||
defaultChangesetStatus = 'publish';
|
||||
}
|
||||
if ( api.state( 'selectedChangesetStatus' ).get() !== defaultChangesetStatus ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Dirty if scheduled but the changeset date hasn't been saved yet.
|
||||
if ( 'future' === api.state( 'selectedChangesetStatus' ).get() && api.state( 'selectedChangesetDate' ).get() !== api.state( 'changesetDate' ).get() ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return api.state( 'saved' ).get() && 'auto-draft' !== api.state( 'changesetStatus' ).get();
|
||||
}
|
||||
|
||||
@ -8501,6 +8525,8 @@
|
||||
|
||||
function startPromptingBeforeUnload() {
|
||||
api.unbind( 'change', startPromptingBeforeUnload );
|
||||
api.state( 'selectedChangesetStatus' ).unbind( startPromptingBeforeUnload );
|
||||
api.state( 'selectedChangesetDate' ).unbind( startPromptingBeforeUnload );
|
||||
|
||||
// Prompt user with AYS dialog if leaving the Customizer with unsaved changes
|
||||
$( window ).on( 'beforeunload.customize-confirm', function() {
|
||||
@ -8513,6 +8539,8 @@
|
||||
});
|
||||
}
|
||||
api.bind( 'change', startPromptingBeforeUnload );
|
||||
api.state( 'selectedChangesetStatus' ).bind( startPromptingBeforeUnload );
|
||||
api.state( 'selectedChangesetDate' ).bind( startPromptingBeforeUnload );
|
||||
|
||||
function requestClose() {
|
||||
var clearedToClose = $.Deferred(), dismissAutoSave = false, dismissLock = false;
|
||||
|
@ -93,7 +93,7 @@ wp.mediaWidgets = ( function( $ ) {
|
||||
* @returns {void}
|
||||
*/
|
||||
initialize: function( options ) {
|
||||
var view = this, embedController; // eslint-disable-line consistent-thi
|
||||
var view = this, embedController; // eslint-disable-line consistent-this
|
||||
wp.media.view.Embed.prototype.initialize.call( view, options );
|
||||
if ( 'image' !== view.controller.options.mimeType ) {
|
||||
embedController = view.controller.states.get( 'embed' );
|
||||
|
Loading…
Reference in New Issue
Block a user