From 64c163da37bf241ef74cde8ca849f4e012210925 Mon Sep 17 00:00:00 2001 From: Rainer Simon Date: Fri, 23 Sep 2022 09:13:16 +0200 Subject: [PATCH] PDFViewer now forwards RecogitoJS cancelSelected event --- src/pdf/PDFViewer.jsx | 10 ++++++++-- src/pdf/endless/AnnotatablePage.jsx | 1 + src/pdf/endless/EndlessViewer.jsx | 3 ++- src/pdf/paginated/AnnotatablePage.jsx | 1 + src/pdf/paginated/PaginatedViewer.jsx | 3 ++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/pdf/PDFViewer.jsx b/src/pdf/PDFViewer.jsx index c54e65d..9ebb0c8 100644 --- a/src/pdf/PDFViewer.jsx +++ b/src/pdf/PDFViewer.jsx @@ -50,6 +50,10 @@ const PDFViewer = props => { props.onDeleteAnnotation && props.onDeleteAnnotation(a); } + const onCancelSelected = a => { + console.log('cancel'); + } + return pdf ? props.mode === 'scrolling' ? { connections={connections} onCreateAnnotation={onCreateAnnotation} onUpdateAnnotation={onUpdateAnnotation} - onDeleteAnnotation={onDeleteAnnotation} /> : + onDeleteAnnotation={onDeleteAnnotation} + onCancelSelected={onCancelSelected} /> : { connections={connections} onCreateAnnotation={onCreateAnnotation} onUpdateAnnotation={onUpdateAnnotation} - onDeleteAnnotation={onDeleteAnnotation} /> + onDeleteAnnotation={onDeleteAnnotation} + onCancelSelected={onCancelSelected} /> : null; diff --git a/src/pdf/endless/AnnotatablePage.jsx b/src/pdf/endless/AnnotatablePage.jsx index 0774f14..a4e17e5 100644 --- a/src/pdf/endless/AnnotatablePage.jsx +++ b/src/pdf/endless/AnnotatablePage.jsx @@ -113,6 +113,7 @@ const AnnotatablePage = props => { r.on('createAnnotation', onCreateAnnotation); r.on('updateAnnotation', onUpdateAnnotation); r.on('deleteAnnotation', onDeleteAnnotation); + r.on('cancelSelected', a => props.onCancelSelected(a)); setRecogito(r); const anno = new Annotorious({ diff --git a/src/pdf/endless/EndlessViewer.jsx b/src/pdf/endless/EndlessViewer.jsx index 76df527..e14a98e 100644 --- a/src/pdf/endless/EndlessViewer.jsx +++ b/src/pdf/endless/EndlessViewer.jsx @@ -68,7 +68,8 @@ const EndlessViewer = props => { annotationMode={annotationMode} onCreateAnnotation={props.onCreateAnnotation} onUpdateAnnotation={props.onUpdateAnnotation} - onDeleteAnnotation={props.onDeleteAnnotation} /> + onDeleteAnnotation={props.onDeleteAnnotation} + onCancelSelected={props.onCancelSelected} /> )} diff --git a/src/pdf/paginated/AnnotatablePage.jsx b/src/pdf/paginated/AnnotatablePage.jsx index 1a106ad..9df50a6 100644 --- a/src/pdf/paginated/AnnotatablePage.jsx +++ b/src/pdf/paginated/AnnotatablePage.jsx @@ -69,6 +69,7 @@ const AnnotatablePage = props => { r.on('createAnnotation', a => props.onCreateAnnotation(a)); r.on('updateAnnotation', (a, p) => props.onUpdateAnnotation(a, p)); r.on('deleteAnnotation', a => props.onDeleteAnnotation(a)); + r.on('cancelSelected', a => props.onCancelSelected(a)); // TODO split: text annotations only r.setAnnotations(text); diff --git a/src/pdf/paginated/PaginatedViewer.jsx b/src/pdf/paginated/PaginatedViewer.jsx index 3d55991..4b335d3 100644 --- a/src/pdf/paginated/PaginatedViewer.jsx +++ b/src/pdf/paginated/PaginatedViewer.jsx @@ -113,7 +113,8 @@ const PaginatedViewer = props => { annotationMode={annotationMode} onCreateAnnotation={onCreateAnnotation} onUpdateAnnotation={onUpdateAnnotation} - onDeleteAnnotation={onDeleteAnnotation} /> + onDeleteAnnotation={onDeleteAnnotation} + onCancelSelected={props.onCancelSelected} />