mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-16 14:50:29 +00:00
Customizer: When a block theme is active, add an information about Site Editor in the Customizer.
This change adds an information notice to the customizer when a block theme is active and the customizer is also available (for example when a plugin activates it), to encourage people to use the Site Editor for the best full site customization experience. Props ironprogrammer, antonvlasenko, Clorith, audrasjb, psmits1567, tobifjellner, costdev, webcommsat. Fixes #54939. git-svn-id: https://develop.svn.wordpress.org/trunk@53024 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+31
@@ -8334,6 +8334,33 @@
|
||||
history.replaceState( {}, document.title, urlParser.href );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a Site Editor notification when a block theme is activated.
|
||||
*
|
||||
* @since 4.9.0
|
||||
*
|
||||
* @param {string} [notification] - A notification to display.
|
||||
* @return {void}
|
||||
*/
|
||||
function addSiteEditorNotification( notification ) {
|
||||
api.notifications.add( new api.Notification( 'site_editor_block_theme_notice', {
|
||||
message: notification,
|
||||
type: 'info',
|
||||
dismissible: false,
|
||||
render: function() {
|
||||
var notification = api.Notification.prototype.render.call( this ),
|
||||
button = notification.find( 'button.switch-to-editor' );
|
||||
|
||||
button.on( 'click', function( event ) {
|
||||
event.preventDefault();
|
||||
location.assign( button.data( 'action' ) );
|
||||
} );
|
||||
|
||||
return notification;
|
||||
}
|
||||
} ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss autosave.
|
||||
*
|
||||
@@ -8408,6 +8435,10 @@
|
||||
if ( api.settings.changeset.latestAutoDraftUuid || api.settings.changeset.hasAutosaveRevision ) {
|
||||
addAutosaveRestoreNotification();
|
||||
}
|
||||
var shouldDisplayBlockThemeNotification = !! parseInt( $( '#customize-info' ).data( 'block-theme' ), 10 );
|
||||
if (shouldDisplayBlockThemeNotification) {
|
||||
addSiteEditorNotification( api.l10n.blockThemeNotification );
|
||||
}
|
||||
})();
|
||||
|
||||
// Check if preview url is valid and load the preview frame.
|
||||
|
||||
Reference in New Issue
Block a user