Fixes to relation CRUD event behavior
This commit is contained in:
parent
11c1c224a0
commit
d491c402af
|
@ -216,6 +216,7 @@ export default class TextAnnotator extends Component {
|
|||
{ this.state.showRelationEditor &&
|
||||
<RelationEditor
|
||||
relation={this.state.selectedRelation}
|
||||
onRelationCreated={this.onCreateOrUpdateRelation}
|
||||
onRelationUpdated={this.onCreateOrUpdateRelation}
|
||||
onRelationDeleted={this.onDeleteRelation}
|
||||
onCancel={this.closeRelationsEditor}
|
||||
|
|
|
@ -81,8 +81,11 @@ export default class RelationEditor extends Component {
|
|||
|
||||
const updatedRelation = { ...this.props.relation, annotation: updatedAnnotation };
|
||||
|
||||
// Return updated/before
|
||||
this.props.onRelationUpdated(updatedRelation, this.props.relation);
|
||||
// Fire create or update event
|
||||
if (this.props.relation.annotation.bodies.length === 0)
|
||||
this.props.onRelationCreated(updatedRelation);
|
||||
else
|
||||
this.props.onRelationUpdated(updatedRelation, this.props.relation);
|
||||
}
|
||||
|
||||
onDelete = () =>
|
||||
|
|
Loading…
Reference in New Issue