Customizer: fix stuck urls and preview white screens after repeated save and activates. Props koopersmith. fixes #20868
git-svn-id: http://core.svn.wordpress.org/trunk@21029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
69ad7a68ff
commit
f826e49a72
|
@ -694,11 +694,6 @@
|
||||||
api.state = state;
|
api.state = state;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
api.bind( 'activated', function() {
|
|
||||||
if ( api.settings.url.activated )
|
|
||||||
window.location = api.settings.url.activated;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Temporary accordion code.
|
// Temporary accordion code.
|
||||||
$('.customize-section-title').click( function( event ) {
|
$('.customize-section-title').click( function( event ) {
|
||||||
var clicked = $( this ).parents( '.customize-section' );
|
var clicked = $( this ).parents( '.customize-section' );
|
||||||
|
@ -738,10 +733,17 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
// Pass events through to the parent.
|
// Pass events through to the parent.
|
||||||
$.each([ 'saved', 'activated' ], function( i, id ) {
|
api.bind( 'saved', function() {
|
||||||
api.bind( id, function() {
|
parent.send( 'saved' );
|
||||||
parent.send( id );
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// When activated, let the loader handle redirecting the page.
|
||||||
|
// If no loader exists, redirect the page ourselves (if a url exists).
|
||||||
|
api.bind( 'activated', function() {
|
||||||
|
if ( parent.targetWindow() )
|
||||||
|
parent.send( 'activated', api.settings.url.activated );
|
||||||
|
else if ( api.settings.url.activated )
|
||||||
|
window.location = api.settings.url.activated;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize the connection with the parent frame.
|
// Initialize the connection with the parent frame.
|
||||||
|
|
|
@ -547,7 +547,7 @@ if ( typeof wp === 'undefined' )
|
||||||
send: function( id, data ) {
|
send: function( id, data ) {
|
||||||
var message;
|
var message;
|
||||||
|
|
||||||
data = typeof data === 'undefined' ? {} : data;
|
data = typeof data === 'undefined' ? null : data;
|
||||||
|
|
||||||
if ( ! this.url() || ! this.targetWindow() )
|
if ( ! this.url() || ! this.targetWindow() )
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -98,6 +98,11 @@ if ( typeof wp === 'undefined' )
|
||||||
Loader.close();
|
Loader.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.messenger.bind( 'activated', function( location ) {
|
||||||
|
if ( location )
|
||||||
|
window.location = location;
|
||||||
|
});
|
||||||
|
|
||||||
hash = src.split('?')[1];
|
hash = src.split('?')[1];
|
||||||
|
|
||||||
// Ensure we don't call pushState if the user hit the forward button.
|
// Ensure we don't call pushState if the user hit the forward button.
|
||||||
|
|
Loading…
Reference in New Issue