Skip to content

Commit

Permalink
Chore: more
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Holdstock committed Aug 2, 2017
1 parent 8e719f2 commit c34b50d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/lib/annotations/doc/CreateHighlightDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ 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 = `
<div class="${constants.CLASS_ANNOTATION_CARET}" style="left: 50%;"></div>
<div>
<div class="${constants.CLASS_ANNOTATION_HIGHLIGHT_DIALOG}">
<span class="${constants.CLASS_HIGHLIGHT_BTNS}">
<button class="bp-btn-plain ${constants.CLASS_ADD_HIGHLIGHT_BTN}"
data-type="${DATA_TYPE_HIGHLIGHT}""
// data-type="${DATA_TYPE_HIGHLIGHT}""
title="${TITLE_HIGHLIGHT_TOGGLE}">
${ICON_HIGHLIGHT}
</button>
Expand Down Expand Up @@ -230,7 +230,8 @@ class CreateHighlightDialog extends EventEmitter {
*
* @return {void}
*/
onHighlightClick() {
onHighlightClick(event) {
event.stopPropagation();
this.emit(CreateEvents.plain);
}

Expand All @@ -240,7 +241,8 @@ class CreateHighlightDialog extends EventEmitter {
*
* @return {void}
*/
onCommentClick() {
onCommentClick(event) {
event.stopPropagation();
this.emit(CreateEvents.comment);

this.commentBox.show();
Expand Down
3 changes: 2 additions & 1 deletion src/lib/annotations/doc/DocAnnotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit c34b50d

Please sign in to comment.