From c34b50da75648b08235f57114559ac172da11169 Mon Sep 17 00:00:00 2001 From: Justin Holdstock Date: Wed, 2 Aug 2017 15:19:15 -0700 Subject: [PATCH] Chore: more --- src/lib/annotations/doc/CreateHighlightDialog.js | 10 ++++++---- src/lib/annotations/doc/DocAnnotator.js | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lib/annotations/doc/CreateHighlightDialog.js b/src/lib/annotations/doc/CreateHighlightDialog.js index 86306e4b0..2ce0f4f6f 100644 --- a/src/lib/annotations/doc/CreateHighlightDialog.js +++ b/src/lib/annotations/doc/CreateHighlightDialog.js @@ -7,7 +7,7 @@ import * as constants from '../annotationConstants'; const CLASS_CREATE_DIALOG = 'bp-create-annotation-dialog'; const TITLE_HIGHLIGHT_TOGGLE = __('annotation_highlight_toggle'); const TITLE_HIGHLIGHT_COMMENT = __('annotation_highlight_comment'); -const DATA_TYPE_HIGHLIGHT = 'highlight-btn'; +const DATA_TYPE_HIGHLIGHT = 'add-highlight-btn'; const DATA_TYPE_ADD_HIGHLIGHT_COMMENT = 'add-highlight-comment-btn'; const CREATE_HIGHLIGHT_DIALOG_TEMPLATE = `
@@ -15,7 +15,7 @@ const CREATE_HIGHLIGHT_DIALOG_TEMPLATE = `
@@ -230,7 +230,8 @@ class CreateHighlightDialog extends EventEmitter { * * @return {void} */ - onHighlightClick() { + onHighlightClick(event) { + event.stopPropagation(); this.emit(CreateEvents.plain); } @@ -240,7 +241,8 @@ class CreateHighlightDialog extends EventEmitter { * * @return {void} */ - onCommentClick() { + onCommentClick(event) { + event.stopPropagation(); this.emit(CreateEvents.comment); this.commentBox.show(); diff --git a/src/lib/annotations/doc/DocAnnotator.js b/src/lib/annotations/doc/DocAnnotator.js index 68ebee84e..a1cdb0d84 100644 --- a/src/lib/annotations/doc/DocAnnotator.js +++ b/src/lib/annotations/doc/DocAnnotator.js @@ -331,6 +331,7 @@ class DocAnnotator extends Annotator { this.isCreatingHighlight = false; const location = this.getLocationFromEvent(this.lastHighlightEvent, TYPES.highlight); + this.highlighter.removeAllHighlights(); if (!location) { return null; } @@ -499,7 +500,7 @@ class DocAnnotator extends Annotator { // Do nothing if the selection is empty const selection = window.getSelection().toString(); // Bail if mid highlight and tapping on the screen - if (!selection || this.lastHighlightEvent) { + if (!selection) { this.lastSelection = null; this.lastHighlightEvent = null; this.createHighlightDialog.hide();