Minor behavior fix

This commit is contained in:
Rainer Simon 2020-04-28 13:02:32 +02:00
parent b5517e54d1
commit 47cf61997e
1 changed files with 11 additions and 5 deletions

View File

@ -82,11 +82,17 @@ export default class RelationEditor extends Component {
const updatedRelation = { ...this.props.relation, annotation: updatedAnnotation };
// Fire create or update event
if (this.props.relation.annotation.bodies.length === 0)
this.props.onRelationCreated(updatedRelation, this.props.relation);
else
this.props.onRelationUpdated(updatedRelation, this.props.relation);
if (this.state.content) {
// Fire create or update event
if (this.props.relation.annotation.bodies.length === 0)
this.props.onRelationCreated(updatedRelation, this.props.relation);
else
this.props.onRelationUpdated(updatedRelation, this.props.relation);
} else {
// Leaving the tag empty and hitting Enter equals cancel
this.props.onCancel();
}
}
onDelete = () =>