diff --git a/editor/header/tools/publish-button.js b/editor/header/tools/publish-button.js index 8ec6d2095e7d26..930127628f2a44 100644 --- a/editor/header/tools/publish-button.js +++ b/editor/header/tools/publish-button.js @@ -12,6 +12,7 @@ import { savePost } from 'actions'; function PublishButton( { post, edits, + dirty, blocks, isSuccessful, isRequesting, @@ -27,11 +28,11 @@ function PublishButton( { buttonText = requestIsNewPost ? wp.i18n.__( 'Saving…' ) : wp.i18n.__( 'Updating…' ); - } else if ( isSuccessful ) { + } else if ( ! dirty && isSuccessful ) { buttonText = requestIsNewPost ? wp.i18n.__( 'Saved!' ) : wp.i18n.__( 'Updated!' ); - } else if ( isError ) { + } else if ( ! dirty && isError ) { buttonText = requestIsNewPost ? wp.i18n.__( 'Save failed' ) : wp.i18n.__( 'Update failed' ); @@ -63,6 +64,7 @@ export default connect( ( state ) => ( { post: state.currentPost, edits: state.editor.edits, + dirty: state.editor.dirty, blocks: state.editor.blockOrder.map( ( uid ) => ( state.editor.blocksByUid[ uid ] ) ), diff --git a/editor/state.js b/editor/state.js index aef2ab150967f5..d5a17be05f8725 100644 --- a/editor/state.js +++ b/editor/state.js @@ -39,6 +39,7 @@ export const editor = combineUndoableReducers( { dirty( state = false, action ) { switch ( action.type ) { case 'RESET_BLOCKS': + case 'REQUEST_POST_UPDATE_SUCCESS': return false; case 'UPDATE_BLOCK':