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 &&
|
{ this.state.showRelationEditor &&
|
||||||
<RelationEditor
|
<RelationEditor
|
||||||
relation={this.state.selectedRelation}
|
relation={this.state.selectedRelation}
|
||||||
|
onRelationCreated={this.onCreateOrUpdateRelation}
|
||||||
onRelationUpdated={this.onCreateOrUpdateRelation}
|
onRelationUpdated={this.onCreateOrUpdateRelation}
|
||||||
onRelationDeleted={this.onDeleteRelation}
|
onRelationDeleted={this.onDeleteRelation}
|
||||||
onCancel={this.closeRelationsEditor}
|
onCancel={this.closeRelationsEditor}
|
||||||
|
|
|
@ -81,8 +81,11 @@ export default class RelationEditor extends Component {
|
||||||
|
|
||||||
const updatedRelation = { ...this.props.relation, annotation: updatedAnnotation };
|
const updatedRelation = { ...this.props.relation, annotation: updatedAnnotation };
|
||||||
|
|
||||||
// Return updated/before
|
// Fire create or update event
|
||||||
this.props.onRelationUpdated(updatedRelation, this.props.relation);
|
if (this.props.relation.annotation.bodies.length === 0)
|
||||||
|
this.props.onRelationCreated(updatedRelation);
|
||||||
|
else
|
||||||
|
this.props.onRelationUpdated(updatedRelation, this.props.relation);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDelete = () =>
|
onDelete = () =>
|
||||||
|
|
Loading…
Reference in New Issue