diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index dcef922739..e236650740 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -6331,7 +6331,35 @@ footerActions = $( '#customize-footer-actions' ); 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: '
  • ' + } + } ); + 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, { params: { diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 4a6980c224..87368a93cd 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -3639,7 +3639,7 @@ final class WP_Customize_Manager { __( 'Downloading your new theme…' ), 'themePreviewWait' => __( 'Setting up your live preview. This may take a bit.' ), '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 */ 'autosaveNotice' => __( 'There is a more recent autosave of your changes than the one you are previewing. Restore the autosave' ), 'videoHeaderNotice' => __( 'This theme doesn\'t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),