diff --git a/src/editor/Editor.jsx b/src/editor/Editor.jsx index 4ffc8c3..2991aaa 100644 --- a/src/editor/Editor.jsx +++ b/src/editor/Editor.jsx @@ -112,6 +112,9 @@ const Editor = props => { }) ); + const onCancel = () => + props.onCancel(currentAnnotation); + const onOk = _ => { // Removes the 'draft' flag from all bodies const undraft = annotation => annotation.clone({ @@ -124,7 +127,7 @@ const Editor = props => { // opened for editing) if (currentAnnotation.bodies.length === 0) { if (currentAnnotation.isSelection) - props.onCancel(); + onCancel(); else props.onAnnotationDeleted(props.annotation); } else { @@ -155,13 +158,13 @@ const Editor = props => {