Customize: Prevent showing confirmation dialog when leaving Customizer after previewing theme switch without making any changes.

Fixes #42173.


git-svn-id: https://develop.svn.wordpress.org/trunk@41845 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-10-12 05:16:40 +00:00
parent 5e9991f7e4
commit 88c2d8ba25

View File

@ -8384,6 +8384,15 @@
var isInsideIframe = false;
function isCleanState() {
/*
* Handle special case of previewing theme switch since some settings (for nav menus and widgets)
* are pre-dirty and non-active themes can only ever be auto-drafts.
*/
if ( ! api.state( 'activated' ).get() ) {
return 0 === api._latestRevision;
}
return api.state( 'saved' ).get() && 'auto-draft' !== api.state( 'changesetStatus' ).get();
}