mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Customizer: Export Preview instance to wp.customize.preview.
see #30409, #30726. git-svn-id: https://develop.svn.wordpress.org/trunk@30891 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
daf16cdb63
commit
8f323ecf9a
@ -67,14 +67,14 @@
|
||||
if ( ! api.settings )
|
||||
return;
|
||||
|
||||
var preview, bg;
|
||||
var bg;
|
||||
|
||||
preview = new api.Preview({
|
||||
api.preview = new api.Preview({
|
||||
url: window.location.href,
|
||||
channel: api.settings.channel
|
||||
});
|
||||
|
||||
preview.bind( 'settings', function( values ) {
|
||||
api.preview.bind( 'settings', function( values ) {
|
||||
$.each( values, function( id, value ) {
|
||||
if ( api.has( id ) )
|
||||
api( id ).set( value );
|
||||
@ -83,9 +83,9 @@
|
||||
});
|
||||
});
|
||||
|
||||
preview.trigger( 'settings', api.settings.values );
|
||||
api.preview.trigger( 'settings', api.settings.values );
|
||||
|
||||
preview.bind( 'setting', function( args ) {
|
||||
api.preview.bind( 'setting', function( args ) {
|
||||
var value;
|
||||
|
||||
args = args.slice();
|
||||
@ -94,22 +94,22 @@
|
||||
value.set.apply( value, args );
|
||||
});
|
||||
|
||||
preview.bind( 'sync', function( events ) {
|
||||
api.preview.bind( 'sync', function( events ) {
|
||||
$.each( events, function( event, args ) {
|
||||
preview.trigger( event, args );
|
||||
api.preview.trigger( event, args );
|
||||
});
|
||||
preview.send( 'synced' );
|
||||
api.preview.send( 'synced' );
|
||||
});
|
||||
|
||||
preview.bind( 'active', function() {
|
||||
api.preview.bind( 'active', function() {
|
||||
if ( api.settings.nonce ) {
|
||||
preview.send( 'nonce', api.settings.nonce );
|
||||
api.preview.send( 'nonce', api.settings.nonce );
|
||||
}
|
||||
|
||||
preview.send( 'documentTitle', document.title );
|
||||
api.preview.send( 'documentTitle', document.title );
|
||||
});
|
||||
|
||||
preview.send( 'ready', {
|
||||
api.preview.send( 'ready', {
|
||||
activePanels: api.settings.activePanels,
|
||||
activeSections: api.settings.activeSections,
|
||||
activeControls: api.settings.activeControls
|
||||
@ -154,6 +154,8 @@
|
||||
this.bind( update );
|
||||
});
|
||||
});
|
||||
|
||||
api.trigger( 'preview-ready' );
|
||||
});
|
||||
|
||||
})( wp, jQuery );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user