From 47cf61997e93f3d0dc946ca83cec920f868c3f39 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Tue, 28 Apr 2020 13:02:32 +0200 Subject: [PATCH] Minor behavior fix --- src/relations/editor/RelationEditor.jsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/relations/editor/RelationEditor.jsx b/src/relations/editor/RelationEditor.jsx index c83fc82..b39a2df 100644 --- a/src/relations/editor/RelationEditor.jsx +++ b/src/relations/editor/RelationEditor.jsx @@ -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 = () =>