diff --git a/src/AnnotationThread.js b/src/AnnotationThread.js index 73ca7c076..5d0f66eec 100644 --- a/src/AnnotationThread.js +++ b/src/AnnotationThread.js @@ -155,6 +155,7 @@ class AnnotationThread extends EventEmitter { tempAnnotationData.modified = tempAnnotationData.created; const tempAnnotation = new Annotation(tempAnnotationData); this.saveAnnotationToThread(tempAnnotation); + this.state = STATES.inactive; // Save annotation on server return this.annotationService diff --git a/src/CommentBox.js b/src/CommentBox.js index dca0f64c3..b9bc8905b 100644 --- a/src/CommentBox.js +++ b/src/CommentBox.js @@ -87,11 +87,6 @@ class CommentBox extends EventEmitter { this.placeholderText = config.localized.addCommentPlaceholder; this.containerEl = this.createCommentBox(); - - // Explicit scope binding for event listeners - this.focus = this.focus.bind(this); - this.onCancel = this.onCancel.bind(this); - this.onPost = this.onPost.bind(this); } /** @@ -273,8 +268,12 @@ class CommentBox extends EventEmitter { this.cancelEl = containerEl.querySelector(constants.SELECTOR_ANNOTATION_BUTTON_CANCEL); this.postEl = containerEl.querySelector(constants.SELECTOR_ANNOTATION_BUTTON_POST); - // Add event listeners + // Explicit scope binding for event listeners + this.focus = this.focus.bind(this); + this.onCancel = this.onCancel.bind(this); + this.onPost = this.onPost.bind(this); + // Add event listeners if (this.hasTouch) { this.textAreaEl.addEventListener('focus', this.focus); containerEl.addEventListener('touchend', this.preventDefaultAndPropagation.bind(this));