Disable Save button when entry has not been changed.
This commit is contained in:
@ -47,6 +47,7 @@ class EntryEditor extends Component {
|
||||
fieldsErrors,
|
||||
getAsset,
|
||||
onChange,
|
||||
hasChanged,
|
||||
showDelete,
|
||||
onDelete,
|
||||
onValidate,
|
||||
@ -131,6 +132,7 @@ class EntryEditor extends Component {
|
||||
onCancelEdit={onCancelEdit}
|
||||
onDelete={onDelete}
|
||||
showDelete={showDelete}
|
||||
hasChanged={hasChanged}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@ -149,6 +151,7 @@ EntryEditor.propTypes = {
|
||||
onChange: PropTypes.func.isRequired,
|
||||
onValidate: PropTypes.func.isRequired,
|
||||
onPersist: PropTypes.func.isRequired,
|
||||
hasChanged: PropTypes.bool.isRequired,
|
||||
showDelete: PropTypes.bool.isRequired,
|
||||
onDelete: PropTypes.func.isRequired,
|
||||
onRemoveAsset: PropTypes.func.isRequired,
|
||||
|
@ -5,11 +5,12 @@ const EntryEditorToolbar = (
|
||||
{
|
||||
isPersisting,
|
||||
onPersist,
|
||||
hasChanged,
|
||||
showDelete,
|
||||
onDelete,
|
||||
onCancelEdit,
|
||||
}) => {
|
||||
const disabled = isPersisting;
|
||||
const disabled = !hasChanged || isPersisting;
|
||||
return (
|
||||
<div>
|
||||
<Button
|
||||
@ -37,6 +38,7 @@ const EntryEditorToolbar = (
|
||||
EntryEditorToolbar.propTypes = {
|
||||
isPersisting: PropTypes.bool,
|
||||
onPersist: PropTypes.func.isRequired,
|
||||
hasChanged: PropTypes.bool.isRequired,
|
||||
showDelete: PropTypes.bool.isRequired,
|
||||
onDelete: PropTypes.func.isRequired,
|
||||
onCancelEdit: PropTypes.func.isRequired,
|
||||
|
Reference in New Issue
Block a user