Editor Cancel event now returns annotation as payload
This commit is contained in:
parent
f705cda635
commit
710bfc77af
|
@ -112,6 +112,9 @@ const Editor = props => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const onCancel = () =>
|
||||||
|
props.onCancel(currentAnnotation);
|
||||||
|
|
||||||
const onOk = _ => {
|
const onOk = _ => {
|
||||||
// Removes the 'draft' flag from all bodies
|
// Removes the 'draft' flag from all bodies
|
||||||
const undraft = annotation => annotation.clone({
|
const undraft = annotation => annotation.clone({
|
||||||
|
@ -124,7 +127,7 @@ const Editor = props => {
|
||||||
// opened for editing)
|
// opened for editing)
|
||||||
if (currentAnnotation.bodies.length === 0) {
|
if (currentAnnotation.bodies.length === 0) {
|
||||||
if (currentAnnotation.isSelection)
|
if (currentAnnotation.isSelection)
|
||||||
props.onCancel();
|
onCancel();
|
||||||
else
|
else
|
||||||
props.onAnnotationDeleted(props.annotation);
|
props.onAnnotationDeleted(props.annotation);
|
||||||
} else {
|
} else {
|
||||||
|
@ -155,13 +158,13 @@ const Editor = props => {
|
||||||
<div className="footer">
|
<div className="footer">
|
||||||
<button
|
<button
|
||||||
className="r6o-btn"
|
className="r6o-btn"
|
||||||
onClick={props.onCancel}>{i18n.t('Close')}</button>
|
onClick={onCancel}>{i18n.t('Close')}</button>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<div className="footer">
|
<div className="footer">
|
||||||
<button
|
<button
|
||||||
className="r6o-btn outline"
|
className="r6o-btn outline"
|
||||||
onClick={props.onCancel}>{i18n.t('Cancel')}</button>
|
onClick={onCancel}>{i18n.t('Cancel')}</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="r6o-btn "
|
className="r6o-btn "
|
||||||
|
|
Loading…
Reference in New Issue