Skip to content

Commit

Permalink
Automatically disable the save button in release builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nylen committed May 15, 2017
1 parent 762b618 commit f28c84f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion editor/header/tools/publish-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ function PublishButton( {
saveCallback = onSaveDraft;
}

const buttonDisabledHint = process.env.NODE_ENV === 'production'
? wp.i18n.__( 'The Save button is disabled during early alpha releases.' )
: null;

return (
<Button
isPrimary
isLarge
onClick={ () => saveCallback( post, edits, blocks ) }
disabled={ ! buttonEnabled }
disabled={ ! buttonEnabled || process.env.NODE_ENV === 'production' }
title={ buttonDisabledHint }
>
{ buttonText }
</Button>
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const config = {
},
plugins: [
new webpack.DefinePlugin( {
'process.env.NODE_ENV': JSON.stringify( process.env.NODE_ENV ),
'process.env.NODE_ENV': JSON.stringify( process.env.NODE_ENV || 'development' ),
} ),
new ExtractTextPlugin( {
filename: './[name]/build/style.css',
Expand Down

0 comments on commit f28c84f

Please sign in to comment.