Editor Cancel event now returns annotation as payload

This commit is contained in:
Rainer Simon 2020-08-15 13:52:17 +02:00
parent f705cda635
commit 710bfc77af
1 changed files with 6 additions and 3 deletions

View File

@ -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 "