diff --git a/src/components/KeyboardShortcuts.jsx b/src/components/KeyboardShortcuts.jsx index 25bb2804..b22fed13 100644 --- a/src/components/KeyboardShortcuts.jsx +++ b/src/components/KeyboardShortcuts.jsx @@ -13,7 +13,7 @@ const KeyboardShortcuts = () => { Toggle Previous Marks - Ctrl + N + Ctrl + A Toggle Navigate and Annotate diff --git a/src/components/SelectedAnnotation.jsx b/src/components/SelectedAnnotation.jsx index a306e26d..36e6aa4f 100644 --- a/src/components/SelectedAnnotation.jsx +++ b/src/components/SelectedAnnotation.jsx @@ -317,10 +317,13 @@ class SelectedAnnotation extends React.Component { handleKeyUp(e) { if (Utility.getKeyCode(e) === KEY_CODES.ESCAPE) { - this.props.onClose && this.props.onClose(); + this.cancelAnnotation(); } - if (Utility.getKeyCode(e) === KEY_CODES.ENTER && e.ctrlKey) { - this.saveText(); + if (Utility.getKeyCode(e) === KEY_CODES.ENTER) { + const wordCountMatchesDots = this.doesWordCountMatchDots(this.state.annotationText, this.props.selectedAnnotation.points.length); + if (wordCountMatchesDots) { + this.saveText(); + } } } @@ -345,6 +348,7 @@ SelectedAnnotation.defaultProps = { }, rotation: 0, scaling: 1, + selectedAnnotation: null, translationX: 0, translationY: 0, viewerSize: { @@ -362,6 +366,9 @@ SelectedAnnotation.propTypes = { onClose: PropTypes.func, rotation: PropTypes.number, scaling: PropTypes.number, + selectedAnnotation: PropTypes.shape({ + points: PropTypes.array, + }), selectedAnnotationIndex: PropTypes.number, translationX: PropTypes.number, translationY: PropTypes.number, diff --git a/src/containers/ClassifierContainer.jsx b/src/containers/ClassifierContainer.jsx index 2f3556b3..4d2f4871 100644 --- a/src/containers/ClassifierContainer.jsx +++ b/src/containers/ClassifierContainer.jsx @@ -288,7 +288,7 @@ class ClassifierContainer extends React.Component { } handleKeyUp(e) { - if (Utility.getKeyCode(e) === KEY_CODES.N && e.ctrlKey) { + if (Utility.getKeyCode(e) === KEY_CODES.A && e.ctrlKey) { if (this.props.viewerState === SUBJECTVIEWER_STATE.NAVIGATING && !this.props.selectedAnnotation) { this.props.dispatch(setViewerState(SUBJECTVIEWER_STATE.ANNOTATING)); } else {