mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 09:37:42 +01:00
Customize: Add button in Publish Settings to discard unsaved changes (including drafted and scheduled), reverting Customizer to the last published state.
Props westonruter, melchoyce. Amends [41667]. See #39896, #21666. Built from https://develop.svn.wordpress.org/trunk@41694 git-svn-id: http://core.svn.wordpress.org/trunk@41528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
882a2a8042
commit
8d79246606
@ -6331,7 +6331,35 @@
|
|||||||
footerActions = $( '#customize-footer-actions' );
|
footerActions = $( '#customize-footer-actions' );
|
||||||
|
|
||||||
api.section( 'publish_settings', function( section ) {
|
api.section( 'publish_settings', function( section ) {
|
||||||
var updateButtonsState, previewLinkControl, previewLinkControlId = 'changeset_preview_link', updateSectionActive, isSectionActive;
|
var updateButtonsState, previewLinkControl, TrashControl, trashControlInstance, trashControlId = 'trash_changeset', previewLinkControlId = 'changeset_preview_link', updateSectionActive, isSectionActive;
|
||||||
|
|
||||||
|
TrashControl = api.Control.extend( {
|
||||||
|
|
||||||
|
// This is a temporary hack while waiting for richer JS templating and dynamic instantiation.
|
||||||
|
embed: function() {
|
||||||
|
var control = this;
|
||||||
|
control.templateSelector = 'customize-trash-changeset-control';
|
||||||
|
return api.Control.prototype.embed.apply( control, arguments );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
|
trashControlInstance = new TrashControl( trashControlId, {
|
||||||
|
params: {
|
||||||
|
type: 'button',
|
||||||
|
section: section.id,
|
||||||
|
active: true,
|
||||||
|
priority: 30,
|
||||||
|
content: '<li id="customize-control-' + trashControlId + '" class="customize-control"></li>'
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
api.control.add( trashControlId, trashControlInstance );
|
||||||
|
trashControlInstance.deferred.embedded.done( function() {
|
||||||
|
trashControlInstance.container.find( 'button' ).on( 'click', function() {
|
||||||
|
if ( confirm( api.l10n.trashConfirm ) ) {
|
||||||
|
wp.customize.previewer.trash();
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
|
||||||
previewLinkControl = new api.PreviewLinkControl( previewLinkControlId, {
|
previewLinkControl = new api.PreviewLinkControl( previewLinkControlId, {
|
||||||
params: {
|
params: {
|
||||||
|
4
wp-admin/js/customize-controls.min.js
vendored
4
wp-admin/js/customize-controls.min.js
vendored
File diff suppressed because one or more lines are too long
@ -3639,7 +3639,7 @@ final class WP_Customize_Manager {
|
|||||||
</div>
|
</div>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/html" id="tmpl-customize-trash-changeset-control">
|
<script type="text/html" id="tmpl-customize-trash-changeset-control">
|
||||||
<button type="button" class="button-link button-link-delete"><?php _e( 'Trash unpublished changes' ); ?></button>
|
<button type="button" class="button-link button-link-delete"><?php _e( 'Discard changes' ); ?></button>
|
||||||
</script>
|
</script>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -574,7 +574,7 @@ function wp_default_scripts( &$scripts ) {
|
|||||||
'themeDownloading' => __( 'Downloading your new theme…' ),
|
'themeDownloading' => __( 'Downloading your new theme…' ),
|
||||||
'themePreviewWait' => __( 'Setting up your live preview. This may take a bit.' ),
|
'themePreviewWait' => __( 'Setting up your live preview. This may take a bit.' ),
|
||||||
'revertingChanges' => __( 'Reverting unpublished changes…' ),
|
'revertingChanges' => __( 'Reverting unpublished changes…' ),
|
||||||
'trashConfirm' => __( 'Are you sure you would like to discard your unpublished changes?' ),
|
'trashConfirm' => __( 'Are you sure you’d like to discard your unpublished changes?' ),
|
||||||
/* translators: %s: URL to the Customizer to load the autosaved version */
|
/* translators: %s: URL to the Customizer to load the autosaved version */
|
||||||
'autosaveNotice' => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
|
'autosaveNotice' => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
|
||||||
'videoHeaderNotice' => __( 'This theme doesn\'t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
|
'videoHeaderNotice' => __( 'This theme doesn\'t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.9-alpha-41693';
|
$wp_version = '4.9-alpha-41694';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
|
Loading…
Reference in New Issue
Block a user