Customize: Eliminate use of customize-loader in core so Customizer is opened consistently in `top` window.

* Open the door for future browser history feature in #28536, which is currently not feasible when customize-loader is used.
* Remove customizer-loader from being used on admin screens for Dashboard, Themes, non-shiny theme install/update.
* Keep the customize-loader functionality available for plugins, for the time being. It may become deprecated.
* Ensure `return` param in customizer links in Themes screen update to reflect `search` updated by `pushState`.
* Persist `return` when reloading Customizer due to theme switch, autosave restoration, or changeset trashing.
* Use `location.replace()` instead of changing `location.href` when trashing.
* Hide theme browser while Themes screen is loading when there is a `search` to prevent flash of unfiltered themes.
* Use throttling instead of debouncing when searching themes to ensure that screen is updated immediately on page load.
* Fix encoding and decoding of `search` param between URL and search field.
* Add support for dismissing autosaves when closing customize-loader, when it is used by plugins.
* Skip sending changeset UUID to customize-loader for population in browser location if changeset branching is not enabled.

See #28536.
Fixes #40254.

Built from https://develop.svn.wordpress.org/trunk@41797


git-svn-id: http://core.svn.wordpress.org/trunk@41631 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2017-10-09 16:04:48 +00:00
parent c9e8431582
commit 35b5c9e762
18 changed files with 142 additions and 80 deletions

View File

@ -7,6 +7,10 @@
16.1 - Manage Themes 16.1 - Manage Themes
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
body.js .theme-browser.search-loading {
display: none;
}
.theme-browser .themes { .theme-browser .themes {
clear: both; clear: both;
} }

File diff suppressed because one or more lines are too long

View File

@ -7,6 +7,10 @@
16.1 - Manage Themes 16.1 - Manage Themes
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
body.js .theme-browser.search-loading {
display: none;
}
.theme-browser .themes { .theme-browser .themes {
clear: both; clear: both;
} }

File diff suppressed because one or more lines are too long

View File

@ -64,7 +64,14 @@ class Theme_Installer_Skin extends WP_Upgrader_Skin {
$install_actions = array(); $install_actions = array();
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$install_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>'; $customize_url = add_query_arg(
array(
'theme' => urlencode( $stylesheet ),
'return' => urlencode( admin_url( 'web' === $this->type ? 'theme-install.php' : 'themes.php' ) ),
),
admin_url( 'customize.php' )
);
$install_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
} }
$install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>'; $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';

View File

@ -49,13 +49,20 @@ class Theme_Upgrader_Skin extends WP_Upgrader_Skin {
), admin_url('themes.php') ); ), admin_url('themes.php') );
$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
$customize_url = add_query_arg(
array(
'theme' => urlencode( $stylesheet ),
'return' => urlencode( admin_url( 'themes.php' ) ),
),
admin_url( 'customize.php' )
);
if ( get_stylesheet() == $stylesheet ) { if ( get_stylesheet() == $stylesheet ) {
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>'; $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>';
} }
} elseif ( current_user_can( 'switch_themes' ) ) { } elseif ( current_user_can( 'switch_themes' ) ) {
if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
$update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>'; $update_actions['preview'] = '<a href="' . esc_url( $customize_url ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
} }
$update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>'; $update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
} }

View File

@ -16,8 +16,6 @@ wp_dashboard_setup();
wp_enqueue_script( 'dashboard' ); wp_enqueue_script( 'dashboard' );
if ( current_user_can( 'edit_theme_options' ) )
wp_enqueue_script( 'customize-loader' );
if ( current_user_can( 'install_plugins' ) ) { if ( current_user_can( 'install_plugins' ) ) {
wp_enqueue_script( 'plugin-install' ); wp_enqueue_script( 'plugin-install' );
wp_enqueue_script( 'updates' ); wp_enqueue_script( 'updates' );

View File

@ -106,7 +106,7 @@
* *
* @since 4.9.0 * @since 4.9.0
* *
* @param {string|wp.customize.Notification} - Notification object to add. Alternatively code may be supplied, and in that case the second notificationObject argument must be supplied. * @param {string|wp.customize.Notification} notification - Notification object to add. Alternatively code may be supplied, and in that case the second notificationObject argument must be supplied.
* @param {wp.customize.Notification} [notificationObject] - Notification to add when first argument is the code string. * @param {wp.customize.Notification} [notificationObject] - Notification to add when first argument is the code string.
* @returns {wp.customize.Notification} Added notification (or existing instance if it was already added). * @returns {wp.customize.Notification} Added notification (or existing instance if it was already added).
*/ */
@ -3014,7 +3014,8 @@
api.utils.parseQueryString( urlParser.search.substr( 1 ) ), api.utils.parseQueryString( urlParser.search.substr( 1 ) ),
{ {
theme: themeId, theme: themeId,
changeset_uuid: api.settings.changeset.uuid changeset_uuid: api.settings.changeset.uuid,
'return': api.settings.url['return']
} }
); );
@ -3044,7 +3045,7 @@
request.done( function() { request.done( function() {
deferred.resolve(); deferred.resolve();
$( window ).off( 'beforeunload.customize-confirm' ); $( window ).off( 'beforeunload.customize-confirm' );
window.location.href = urlParser.href; // @todo Use location.replace()? location.replace( urlParser.href );
} ); } );
request.fail( function() { request.fail( function() {
@ -6958,7 +6959,9 @@
if ( 'changeset_already_published' === response.code && response.next_changeset_uuid ) { if ( 'changeset_already_published' === response.code && response.next_changeset_uuid ) {
api.settings.changeset.uuid = response.next_changeset_uuid; api.settings.changeset.uuid = response.next_changeset_uuid;
api.state( 'changesetStatus' ).set( '' ); api.state( 'changesetStatus' ).set( '' );
if ( api.settings.changeset.branching ) {
parent.send( 'changeset-uuid', api.settings.changeset.uuid ); parent.send( 'changeset-uuid', api.settings.changeset.uuid );
}
api.previewer.send( 'changeset-uuid', api.settings.changeset.uuid ); api.previewer.send( 'changeset-uuid', api.settings.changeset.uuid );
} }
} ); } );
@ -6989,8 +6992,10 @@
api.state( 'changesetStatus' ).set( '' ); api.state( 'changesetStatus' ).set( '' );
api.settings.changeset.uuid = response.next_changeset_uuid; api.settings.changeset.uuid = response.next_changeset_uuid;
if ( api.settings.changeset.branching ) {
parent.send( 'changeset-uuid', api.settings.changeset.uuid ); parent.send( 'changeset-uuid', api.settings.changeset.uuid );
} }
}
// Prevent subsequent requestChangesetUpdate() calls from including the settings that have been saved. // Prevent subsequent requestChangesetUpdate() calls from including the settings that have been saved.
api._lastSavedRevision = Math.max( latestRevision, api._lastSavedRevision ); api._lastSavedRevision = Math.max( latestRevision, api._lastSavedRevision );
@ -7065,6 +7070,7 @@
urlParser.href = location.href; urlParser.href = location.href;
queryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) ); queryParams = api.utils.parseQueryString( urlParser.search.substr( 1 ) );
delete queryParams.changeset_uuid; delete queryParams.changeset_uuid;
queryParams['return'] = api.settings.url['return'];
urlParser.search = $.param( queryParams ); urlParser.search = $.param( queryParams );
location.replace( urlParser.href ); location.replace( urlParser.href );
}; };
@ -7418,6 +7424,7 @@
} else { } else {
queryParams.customize_autosaved = 'on'; queryParams.customize_autosaved = 'on';
} }
queryParams['return'] = api.settings.url['return'];
urlParser.search = $.param( queryParams ); urlParser.search = $.param( queryParams );
return urlParser.href; return urlParser.href;
} }
@ -7915,16 +7922,9 @@
} }
api.bind( 'change', startPromptingBeforeUnload ); api.bind( 'change', startPromptingBeforeUnload );
closeBtn.on( 'click.customize-controls-close', function( event ) { function requestClose() {
var clearedToClose = $.Deferred(); var clearedToClose = $.Deferred();
event.preventDefault(); if ( isCleanState() ) {
/*
* The isInsideIframe condition is because Customizer is not able to use a confirm()
* since customize-loader.js will also use one. So autosave restorations are disabled
* when customize-loader.js is used.
*/
if ( isInsideIframe || isCleanState() ) {
clearedToClose.resolve(); clearedToClose.resolve();
} else if ( confirm( api.l10n.saveAlert ) ) { } else if ( confirm( api.l10n.saveAlert ) ) {
@ -7954,16 +7954,28 @@
} else { } else {
clearedToClose.reject(); clearedToClose.reject();
} }
return clearedToClose.promise();
clearedToClose.done( function() {
$( window ).off( 'beforeunload.customize-confirm' );
if ( isInsideIframe ) {
parent.send( 'close' );
} else {
window.location.href = closeBtn.prop( 'href' );
} }
parent.bind( 'confirm-close', function() {
requestClose().done( function() {
parent.send( 'confirmed-close', true );
} ).fail( function() {
parent.send( 'confirmed-close', false );
} ); } );
} ); } );
closeBtn.on( 'click.customize-controls-close', function( event ) {
event.preventDefault();
if ( isInsideIframe ) {
parent.send( 'close' ); // See confirm-close logic above.
} else {
requestClose().done( function() {
$( window ).off( 'beforeunload.customize-confirm' );
window.location.href = closeBtn.prop( 'href' );
} );
}
});
})(); })();
// Pass events through to the parent. // Pass events through to the parent.
@ -7978,7 +7990,9 @@
parent.send( 'title', newTitle ); parent.send( 'title', newTitle );
}); });
if ( api.settings.changeset.branching ) {
parent.send( 'changeset-uuid', api.settings.changeset.uuid ); parent.send( 'changeset-uuid', api.settings.changeset.uuid );
}
// Initialize the connection with the parent frame. // Initialize the connection with the parent frame.
parent.send( 'ready' ); parent.send( 'ready' );

File diff suppressed because one or more lines are too long

View File

@ -77,6 +77,8 @@ themes.view.Appearance = wp.Backbone.View.extend({
// Render search form. // Render search form.
this.search(); this.search();
this.$el.removeClass( 'search-loading' );
// Render and append // Render and append
this.view.render(); this.view.render();
this.$el.empty().append( this.view.el ).addClass( 'rendered' ); this.$el.empty().append( this.view.el ).addClass( 'rendered' );
@ -1345,17 +1347,15 @@ themes.view.Search = wp.Backbone.View.extend({
event.target.value = ''; event.target.value = '';
} }
/** // Note that doSearch is throttled.
* Since doSearch is debounced, it will only run when user input comes to a rest
*/
this.doSearch( event ); this.doSearch( event );
}, },
// Runs a search on the theme collection. // Runs a search on the theme collection.
doSearch: _.debounce( function( event ) { doSearch: _.throttle( function( event ) {
var options = {}; var options = {};
this.collection.doSearch( event.target.value ); this.collection.doSearch( event.target.value.replace( /\+/g, ' ' ) );
// if search is initiated and key is not return // if search is initiated and key is not return
if ( this.searching && event.which !== 13 ) { if ( this.searching && event.which !== 13 ) {
@ -1376,7 +1376,7 @@ themes.view.Search = wp.Backbone.View.extend({
var url = themes.router.baseUrl( '' ); var url = themes.router.baseUrl( '' );
if ( event.target.value ) { if ( event.target.value ) {
url = themes.router.baseUrl( themes.router.searchPath + event.target.value ); url = themes.router.baseUrl( themes.router.searchPath + encodeURIComponent( event.target.value ) );
} }
this.searching = false; this.searching = false;
@ -1385,6 +1385,22 @@ themes.view.Search = wp.Backbone.View.extend({
} }
}); });
/**
* Navigate router.
*
* @since 4.9.0
*
* @param {string} url - URL to navigate to.
* @param {object} state - State.
* @returns {void}
*/
function navigateRouter( url, state ) {
var router = this;
if ( Backbone.history._hasPushState ) {
Backbone.Router.prototype.navigate.call( router, url, state );
}
}
// Sets up the routes events for relevant url queries // Sets up the routes events for relevant url queries
// Listens to [theme] and [search] params // Listens to [theme] and [search] params
themes.Router = Backbone.Router.extend({ themes.Router = Backbone.Router.extend({
@ -1405,18 +1421,14 @@ themes.Router = Backbone.Router.extend({
searchPath: '?search=', searchPath: '?search=',
search: function( query ) { search: function( query ) {
$( '.wp-filter-search' ).val( query ); $( '.wp-filter-search' ).val( query.replace( /\+/g, ' ' ) );
}, },
themes: function() { themes: function() {
$( '.wp-filter-search' ).val( '' ); $( '.wp-filter-search' ).val( '' );
}, },
navigate: function() { navigate: navigateRouter
if ( Backbone.history._hasPushState ) {
Backbone.Router.prototype.navigate.apply( this, arguments );
}
}
}); });
@ -1508,7 +1520,7 @@ themes.view.InstallerSearch = themes.view.Search.extend({
this.doSearch( event.target.value ); this.doSearch( event.target.value );
}, },
doSearch: _.debounce( function( value ) { doSearch: _.throttle( function( value ) {
var request = {}; var request = {};
// Don't do anything if the search terms haven't changed. // Don't do anything if the search terms haven't changed.
@ -1551,7 +1563,7 @@ themes.view.InstallerSearch = themes.view.Search.extend({
this.collection.query( request ); this.collection.query( request );
// Set route // Set route
themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + value ), { replace: true } ); themes.router.navigate( themes.router.baseUrl( themes.router.searchPath + encodeURIComponent( value ) ), { replace: true } );
}, 500 ) }, 500 )
}); });
@ -1887,14 +1899,10 @@ themes.InstallerRouter = Backbone.Router.extend({
searchPath: '?search=', searchPath: '?search=',
search: function( query ) { search: function( query ) {
$( '.wp-filter-search' ).val( query ); $( '.wp-filter-search' ).val( query.replace( /\+/g, ' ' ) );
}, },
navigate: function() { navigate: navigateRouter
if ( Backbone.history._hasPushState ) {
Backbone.Router.prototype.navigate.apply( this, arguments );
}
}
}); });
@ -2003,6 +2011,19 @@ $( document ).ready(function() {
themes.Run.init(); themes.Run.init();
} }
// Update the return param just in time.
$( document.body ).on( 'click', '.load-customize', function() {
var link = $( this ), urlParser = document.createElement( 'a' );
urlParser.href = link.prop( 'href' );
urlParser.search = $.param( _.extend(
wp.customize.utils.parseQueryString( urlParser.search.substr( 1 ) ),
{
'return': window.location.href
}
) );
link.prop( 'href', urlParser.href );
});
$( '.broken-themes .delete-theme' ).on( 'click', function() { $( '.broken-themes .delete-theme' ).on( 'click', function() {
return confirm( _wpThemeSettings.settings.confirmDelete ); return confirm( _wpThemeSettings.settings.confirmDelete );
}); });

File diff suppressed because one or more lines are too long

View File

@ -146,14 +146,13 @@ wp_localize_script( 'theme', '_wpThemeSettings', array(
add_thickbox(); add_thickbox();
wp_enqueue_script( 'theme' ); wp_enqueue_script( 'theme' );
wp_enqueue_script( 'updates' ); wp_enqueue_script( 'updates' );
wp_enqueue_script( 'customize-loader' );
require_once( ABSPATH . 'wp-admin/admin-header.php' ); require_once( ABSPATH . 'wp-admin/admin-header.php' );
?> ?>
<div class="wrap"> <div class="wrap">
<h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?> <h1 class="wp-heading-inline"><?php esc_html_e( 'Themes' ); ?>
<span class="title-count theme-count"><?php echo count( $themes ); ?></span> <span class="title-count theme-count"><?php echo ! empty( $_GET['search'] ) ? __( '&hellip;' ) : count( $themes ); ?></span>
</h1> </h1>
<?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?> <?php if ( ! is_multisite() && current_user_can( 'install_themes' ) ) : ?>
@ -234,7 +233,13 @@ if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
?> ?>
<div class="theme-browser"> <?php
$class_name = 'theme-browser';
if ( ! empty( $_GET['search'] ) ) {
$class_name .= ' search-loading';
}
?>
<div class="<?php echo esc_attr( $class_name ); ?>">
<div class="themes wp-clearfix"> <div class="themes wp-clearfix">
<?php <?php

View File

@ -173,7 +173,6 @@ if ( isset($_GET['action']) ) {
check_admin_referer('upgrade-theme_' . $theme); check_admin_referer('upgrade-theme_' . $theme);
wp_enqueue_script( 'customize-loader' );
wp_enqueue_script( 'updates' ); wp_enqueue_script( 'updates' );
$title = __('Update Theme'); $title = __('Update Theme');
@ -223,10 +222,9 @@ if ( isset($_GET['action']) ) {
check_admin_referer( 'install-theme_' . $theme ); check_admin_referer( 'install-theme_' . $theme );
$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth. $api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
if ( is_wp_error($api) ) if ( is_wp_error( $api ) ) {
wp_die( $api ); wp_die( $api );
}
wp_enqueue_script( 'customize-loader' );
$title = __('Install Themes'); $title = __('Install Themes');
$parent_file = 'themes.php'; $parent_file = 'themes.php';
@ -253,8 +251,6 @@ if ( isset($_GET['action']) ) {
$file_upload = new File_Upload_Upgrader('themezip', 'package'); $file_upload = new File_Upload_Upgrader('themezip', 'package');
wp_enqueue_script( 'customize-loader' );
$title = __('Upload Theme'); $title = __('Upload Theme');
$parent_file = 'themes.php'; $parent_file = 'themes.php';
$submenu_file = 'theme-install.php'; $submenu_file = 'theme-install.php';

View File

@ -4236,6 +4236,7 @@ final class WP_Customize_Manager {
), ),
'url' => array( 'url' => array(
'preview' => esc_url_raw( $this->get_preview_url() ), 'preview' => esc_url_raw( $this->get_preview_url() ),
'return' => esc_url_raw( $this->get_return_url() ),
'parent' => esc_url_raw( admin_url() ), 'parent' => esc_url_raw( admin_url() ),
'activated' => esc_url_raw( home_url( '/' ) ), 'activated' => esc_url_raw( home_url( '/' ) ),
'ajax' => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ), 'ajax' => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ),

View File

@ -1,4 +1,4 @@
/* global _wpCustomizeLoaderSettings, confirm */ /* global _wpCustomizeLoaderSettings */
/** /**
* Expose a public API that allows the customizer to be * Expose a public API that allows the customizer to be
* loaded on any page. * loaded on any page.
@ -208,25 +208,30 @@ window.wp = window.wp || {};
* Close the Customizer overlay. * Close the Customizer overlay.
*/ */
close: function() { close: function() {
if ( ! this.active ) { var self = this, onConfirmClose;
if ( ! self.active ) {
return; return;
} }
// Display AYS dialog if Customizer is dirty onConfirmClose = function( confirmed ) {
if ( ! this.saved() && ! confirm( Loader.settings.l10n.saveAlert ) ) { if ( confirmed ) {
// Go forward since Customizer is exited by history.back() self.active = false;
history.forward(); self.trigger( 'close' );
return;
}
this.active = false;
this.trigger( 'close' );
// Restore document title prior to opening the Live Preview // Restore document title prior to opening the Live Preview
if ( this.originalDocumentTitle ) { if ( self.originalDocumentTitle ) {
document.title = this.originalDocumentTitle; document.title = self.originalDocumentTitle;
} }
} else {
// Go forward since Customizer is exited by history.back()
history.forward();
}
self.messenger.unbind( 'confirmed-close', onConfirmClose );
};
self.messenger.bind( 'confirmed-close', onConfirmClose );
Loader.messenger.send( 'confirm-close' );
}, },
/** /**

View File

@ -1 +1 @@
window.wp=window.wp||{},function(a,b){var c,d=wp.customize;b.extend(b.support,{history:!(!window.history||!history.pushState),hashchange:"onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7)}),c=b.extend({},d.Events,{initialize:function(){this.body=b(document.body),c.settings&&b.support.postMessage&&(b.support.cors||!c.settings.isCrossDomain)&&(this.window=b(window),this.element=b('<div id="customize-container" />').appendTo(this.body),this.bind("open",this.overlay.show),this.bind("close",this.overlay.hide),b("#wpbody").on("click",".load-customize",function(a){a.preventDefault(),c.link=b(this),c.open(c.link.attr("href"))}),b.support.history&&this.window.on("popstate",c.popstate),b.support.hashchange&&(this.window.on("hashchange",c.hashchange),this.window.triggerHandler("hashchange")))},popstate:function(a){var b=a.originalEvent.state;b&&b.customize?c.open(b.customize):c.active&&c.close()},hashchange:function(){var a=window.location.toString().split("#")[1];a&&0===a.indexOf("wp_customize=on")&&c.open(c.settings.url+"?"+a),a||b.support.history||c.close()},beforeunload:function(){if(!c.saved())return c.settings.l10n.saveAlert},open:function(a){if(!this.active){if(c.settings.browser.mobile)return window.location=a;this.originalDocumentTitle=document.title,this.active=!0,this.body.addClass("customize-loading"),this.saved=new d.Value(!0),this.iframe=b("<iframe />",{src:a,title:c.settings.l10n.mainIframeTitle}).appendTo(this.element),this.iframe.one("load",this.loaded),this.messenger=new d.Messenger({url:a,channel:"loader",targetWindow:this.iframe[0].contentWindow}),history.replaceState&&this.messenger.bind("changeset-uuid",function(a){var c=document.createElement("a");c.href=location.href,c.search=b.param(_.extend(d.utils.parseQueryString(c.search.substr(1)),{changeset_uuid:a})),history.replaceState({customize:c.href},"",c.href)}),this.messenger.bind("ready",function(){c.messenger.send("back")}),this.messenger.bind("close",function(){b.support.history?history.back():b.support.hashchange?window.location.hash="":c.close()}),b(window).on("beforeunload",this.beforeunload),this.messenger.bind("saved",function(){c.saved(!0)}),this.messenger.bind("change",function(){c.saved(!1)}),this.messenger.bind("title",function(a){window.document.title=a}),this.pushState(a),this.trigger("open")}},pushState:function(a){var c=a.split("?")[1];b.support.history&&window.location.href!==a?history.pushState({customize:a},"",a):!b.support.history&&b.support.hashchange&&c&&(window.location.hash="wp_customize=on&"+c),this.trigger("open")},opened:function(){c.body.addClass("customize-active full-overlay-active").attr("aria-busy","true")},close:function(){if(this.active){if(!this.saved()&&!confirm(c.settings.l10n.saveAlert))return void history.forward();this.active=!1,this.trigger("close"),this.originalDocumentTitle&&(document.title=this.originalDocumentTitle)}},closed:function(){c.iframe.remove(),c.messenger.destroy(),c.iframe=null,c.messenger=null,c.saved=null,c.body.removeClass("customize-active full-overlay-active").removeClass("customize-loading"),b(window).off("beforeunload",c.beforeunload),c.link&&c.link.focus()},loaded:function(){c.body.removeClass("customize-loading").attr("aria-busy","false")},overlay:{show:function(){this.element.fadeIn(200,c.opened)},hide:function(){this.element.fadeOut(200,c.closed)}}}),b(function(){c.settings=_wpCustomizeLoaderSettings,c.initialize()}),d.Loader=c}(wp,jQuery); window.wp=window.wp||{},function(a,b){var c,d=wp.customize;b.extend(b.support,{history:!(!window.history||!history.pushState),hashchange:"onhashchange"in window&&(void 0===document.documentMode||document.documentMode>7)}),c=b.extend({},d.Events,{initialize:function(){this.body=b(document.body),c.settings&&b.support.postMessage&&(b.support.cors||!c.settings.isCrossDomain)&&(this.window=b(window),this.element=b('<div id="customize-container" />').appendTo(this.body),this.bind("open",this.overlay.show),this.bind("close",this.overlay.hide),b("#wpbody").on("click",".load-customize",function(a){a.preventDefault(),c.link=b(this),c.open(c.link.attr("href"))}),b.support.history&&this.window.on("popstate",c.popstate),b.support.hashchange&&(this.window.on("hashchange",c.hashchange),this.window.triggerHandler("hashchange")))},popstate:function(a){var b=a.originalEvent.state;b&&b.customize?c.open(b.customize):c.active&&c.close()},hashchange:function(){var a=window.location.toString().split("#")[1];a&&0===a.indexOf("wp_customize=on")&&c.open(c.settings.url+"?"+a),a||b.support.history||c.close()},beforeunload:function(){if(!c.saved())return c.settings.l10n.saveAlert},open:function(a){if(!this.active){if(c.settings.browser.mobile)return window.location=a;this.originalDocumentTitle=document.title,this.active=!0,this.body.addClass("customize-loading"),this.saved=new d.Value(!0),this.iframe=b("<iframe />",{src:a,title:c.settings.l10n.mainIframeTitle}).appendTo(this.element),this.iframe.one("load",this.loaded),this.messenger=new d.Messenger({url:a,channel:"loader",targetWindow:this.iframe[0].contentWindow}),history.replaceState&&this.messenger.bind("changeset-uuid",function(a){var c=document.createElement("a");c.href=location.href,c.search=b.param(_.extend(d.utils.parseQueryString(c.search.substr(1)),{changeset_uuid:a})),history.replaceState({customize:c.href},"",c.href)}),this.messenger.bind("ready",function(){c.messenger.send("back")}),this.messenger.bind("close",function(){b.support.history?history.back():b.support.hashchange?window.location.hash="":c.close()}),b(window).on("beforeunload",this.beforeunload),this.messenger.bind("saved",function(){c.saved(!0)}),this.messenger.bind("change",function(){c.saved(!1)}),this.messenger.bind("title",function(a){window.document.title=a}),this.pushState(a),this.trigger("open")}},pushState:function(a){var c=a.split("?")[1];b.support.history&&window.location.href!==a?history.pushState({customize:a},"",a):!b.support.history&&b.support.hashchange&&c&&(window.location.hash="wp_customize=on&"+c),this.trigger("open")},opened:function(){c.body.addClass("customize-active full-overlay-active").attr("aria-busy","true")},close:function(){var a,b=this;b.active&&(a=function(c){c?(b.active=!1,b.trigger("close"),b.originalDocumentTitle&&(document.title=b.originalDocumentTitle)):history.forward(),b.messenger.unbind("confirmed-close",a)},b.messenger.bind("confirmed-close",a),c.messenger.send("confirm-close"))},closed:function(){c.iframe.remove(),c.messenger.destroy(),c.iframe=null,c.messenger=null,c.saved=null,c.body.removeClass("customize-active full-overlay-active").removeClass("customize-loading"),b(window).off("beforeunload",c.beforeunload),c.link&&c.link.focus()},loaded:function(){c.body.removeClass("customize-loading").attr("aria-busy","false")},overlay:{show:function(){this.element.fadeIn(200,c.opened)},hide:function(){this.element.fadeOut(200,c.closed)}}}),b(function(){c.settings=_wpCustomizeLoaderSettings,c.initialize()}),d.Loader=c}(wp,jQuery);

View File

@ -725,7 +725,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'text-widgets', "/wp-admin/js/widgets/text-widgets$suffix.js", array( 'jquery', 'backbone', 'editor', 'wp-util', 'wp-a11y' ) ); $scripts->add( 'text-widgets', "/wp-admin/js/widgets/text-widgets$suffix.js", array( 'jquery', 'backbone', 'editor', 'wp-util', 'wp-a11y' ) );
$scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( 'code-editor', 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) ); $scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( 'code-editor', 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) );
$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 ); $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 );
$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 ); $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9-beta1-41796'; $wp_version = '4.9-beta1-41797';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.