Customizer: Redirect back to referrer. If referrer is a front end page, load that page in the customizer preview. Props nacin, koopersmith. fixes #20877

git-svn-id: https://develop.svn.wordpress.org/trunk@21028 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2012-06-08 18:45:12 +00:00
parent be6b3ffe21
commit 6e10d0d0b4
4 changed files with 28 additions and 8 deletions
+14 -4
View File
@@ -403,7 +403,8 @@
*/
initialize: function( params, options ) {
var self = this,
rscheme = /^https?/;
rscheme = /^https?/,
url;
$.extend( this, options || {} );
@@ -444,6 +445,9 @@
this.container = api.ensure( params.container );
this.allowedUrls = params.allowedUrls;
url = params.url;
delete params.url;
api.Messenger.prototype.initialize.call( this, params );
// We're dynamically generating the iframe, so the origin is set
@@ -488,7 +492,10 @@
return result ? result : null;
});
// Refresh the preview when the URL is changed.
// Set the url.
this.url( url );
// Refresh the preview when the URL is changed (but not yet).
this.url.bind( this.refresh );
this.scroll = 0;
@@ -635,8 +642,11 @@
} ) );
});
// Load the preview frame.
previewer.refresh();
// Check if preview url is valid and load the preview frame.
if ( previewer.url() )
previewer.refresh();
else
previewer.url( api.settings.url.home );
// Save and activated states
(function() {