Skip to content

Commit

Permalink
Chrome: display a publish confirmation while still in Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad committed Jun 15, 2017
1 parent 37d76c8 commit 423a2af
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions editor/header/tools/publish-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import { __ } from 'i18n';
import { Button } from 'components';

/**
Expand All @@ -33,11 +34,11 @@ function PublishButton( {
const buttonEnabled = ! isSaving && isPublishable;
let buttonText;
if ( isPublished ) {
buttonText = wp.i18n.__( 'Update' );
buttonText = __( 'Update' );
} else if ( isBeingScheduled ) {
buttonText = wp.i18n.__( 'Schedule' );
buttonText = __( 'Schedule' );
} else {
buttonText = wp.i18n.__( 'Publish' );
buttonText = __( 'Publish' );
}
let publishStatus = 'publish';
if ( isBeingScheduled ) {
Expand All @@ -47,8 +48,13 @@ function PublishButton( {
}
const className = classnames( 'editor-tools__publish-button', { 'is-saving': isSaving } );
const onClick = () => {
onStatusChange( publishStatus );
onSave();
const doSave = isPublished ||
! process.env.NODE_ENV === 'production' ||
window.confirm( __( 'Keep in mind this is in Beta and may not display correctly on your theme' ) ); // eslint-disable-line no-alert
if ( doSave ) {
onStatusChange( publishStatus );
onSave();
}
};

return (
Expand Down

0 comments on commit 423a2af

Please sign in to comment.