New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

box-annotations

Package Overview
Dependencies
Maintainers
7
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

box-annotations - npm Package Compare versions

Comparing version 0.5.1 to 0.6.0

.github/ISSUE_TEMPLATE.md

18

CHANGELOG.md

@@ -1,5 +0,17 @@

<a name="0.5.1"></a>
## 0.5.1 (2017-11-30)
<a name="0.6.0"></a>
# 0.6.0 (2017-12-05)
* Fix: Iterate through dialog buttons NodeList in an IE compatible way (#54) ([f5a9985](https://github.com/box/box-annotations/commit/f5a9985))
* Update: packages (#60) ([dbb1b79](https://github.com/box/box-annotations/commit/dbb1b79))
* Create .vscode/settings.json ([df9fb5d](https://github.com/box/box-annotations/commit/df9fb5d))
* Create ISSUE_TEMPLATE.md ([e4334fc](https://github.com/box/box-annotations/commit/e4334fc))
* Update CONTRIBUTING.md ([f340c37](https://github.com/box/box-annotations/commit/f340c37))
* Update README.md ([4d53d04](https://github.com/box/box-annotations/commit/4d53d04))
* Fix: Clarify separation between plain and comment highlights (#58) ([496ceec](https://github.com/box/box-annotations/commit/496ceec))
* Fix: Don't collapse dialog text area when a comment is deleted (#53) ([f7fbad0](https://github.com/box/box-annotations/commit/f7fbad0))
* Fix: Ensure point annotations are set up even when highlights are disabled (#57) ([93681b5](https://github.com/box/box-annotations/commit/93681b5))
* Fix: Iterate through dialog buttons NodeList in an IE compatible way (#54) ([789d78b](https://github.com/box/box-annotations/commit/789d78b))
* Fix: Publish script to reset to latest tag instead of to master (#55) ([182233a](https://github.com/box/box-annotations/commit/182233a))
* Fix: Scrolling to bottom of flipped dialogs (#56) ([89b50e2](https://github.com/box/box-annotations/commit/89b50e2))
* Chore: Remove redundant point dialog positioning (#52) ([ce3538a](https://github.com/box/box-annotations/commit/ce3538a))
* Chore: Renaming annotator classes names to be more generic (#51) ([21cc74c](https://github.com/box/box-annotations/commit/21cc74c))

@@ -6,0 +18,0 @@

2

CONTRIBUTING.md

@@ -39,3 +39,3 @@ # Contributing

```
git remote add upstream git@github.com:box/box-content-preview.git
git remote add upstream git@github.com:box/box-annotations.git
```

@@ -42,0 +42,0 @@

@@ -10,4 +10,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import EventEmitter from 'events';
import * as annotatorUtil from './annotatorUtil';
import * as constants from './annotationConstants';
import * as util from './util';
import * as constants from './constants';
import { ICON_CLOSE, ICON_DELETE } from './icons/icons';

@@ -146,8 +146,27 @@

// Focus the textarea if visible
if (annotatorUtil.isElementInViewport(textAreaEl)) {
if (util.isElementInViewport(textAreaEl)) {
textAreaEl.focus();
}
this.scrollToLastComment();
}
/**
* Auto scroll annotations dialog to bottom where new comment was added
*
* @return {void}
*/
}, {
key: 'scrollToLastComment',
value: function scrollToLastComment() {
var annotationsEl = this.dialogEl.querySelector(constants.SELECTOR_ANNOTATION_CONTAINER);
if (annotationsEl) {
var isDialogFlipped = this.dialogEl.classList.contains(CLASS_FLIPPED_DIALOG);
var clientHeight = isDialogFlipped ? 0 : annotationsEl.clientHeight;
annotationsEl.scrollTop = annotationsEl.scrollHeight - clientHeight;
}
}
/**
* Shows the shared mobile dialog.

@@ -162,3 +181,3 @@ *

this.element = this.container.querySelector('.' + constants.CLASS_MOBILE_ANNOTATION_DIALOG);
annotatorUtil.showElement(this.element);
util.showElement(this.element);
this.element.appendChild(this.dialogEl);

@@ -210,3 +229,3 @@

annotatorUtil.hideElement(this.element);
util.hideElement(this.element);
this.unbindDOMListeners();

@@ -235,3 +254,3 @@

annotatorUtil.hideElement(this.element);
util.hideElement(this.element);
this.deactivateReply();

@@ -257,4 +276,4 @@

var showSectionEl = this.element.querySelector(constants.SECTION_SHOW);
annotatorUtil.hideElement(createSectionEl);
annotatorUtil.showElement(showSectionEl);
util.hideElement(createSectionEl);
util.showElement(showSectionEl);
this.hasAnnotations = true;

@@ -279,4 +298,8 @@ }

annotationEl.parentNode.removeChild(annotationEl);
this.deactivateReply(); // Deactivate reply area and focus
}
var replyTextEl = this.element.querySelector('.' + CLASS_REPLY_TEXTAREA);
if (replyTextEl) {
replyTextEl.focus();
}
}

@@ -303,2 +326,3 @@

annotationTextEl.value = '';
annotationTextEl.focus();
}

@@ -351,3 +375,3 @@

// Adding thread number to dialog
var firstAnnotation = annotatorUtil.getFirstAnnotation(annotations);
var firstAnnotation = util.getFirstAnnotation(annotations);
if (firstAnnotation) {

@@ -483,3 +507,3 @@ this.element.dataset.threadNumber = firstAnnotation.threadNumber;

if (this.element.classList.contains(constants.CLASS_HIDDEN)) {
annotatorUtil.showElement(this.element);
util.showElement(this.element);

@@ -573,7 +597,7 @@ var replyTextArea = this.element.querySelector('.' + CLASS_REPLY_TEXTAREA);

var key = annotatorUtil.decodeKeydown(event);
var key = util.decodeKeydown(event);
if (key === 'Escape') {
this.hide();
} else {
var dataType = annotatorUtil.findClosestDataType(event.target);
var dataType = util.findClosestDataType(event.target);
if (dataType === CLASS_REPLY_TEXTAREA) {

@@ -613,4 +637,4 @@ this.activateReply();

var eventTarget = event.target;
var dataType = annotatorUtil.findClosestDataType(eventTarget);
var annotationID = annotatorUtil.findClosestDataType(eventTarget, 'data-annotation-id');
var dataType = util.findClosestDataType(eventTarget);
var annotationID = util.findClosestDataType(eventTarget, 'data-annotation-id');

@@ -676,3 +700,3 @@ switch (dataType) {

value: function addAnnotationElement(annotation) {
var userId = annotatorUtil.htmlEscape(annotation.user.id || '0');
var userId = util.htmlEscape(annotation.user.id || '0');

@@ -684,7 +708,7 @@ // Temporary until annotation user API is available

} else {
userName = annotatorUtil.htmlEscape(annotation.user.name) || this.localized.anonymousUserName;
userName = util.htmlEscape(annotation.user.name) || this.localized.anonymousUserName;
}
var avatarUrl = annotatorUtil.htmlEscape(annotation.user.avatarUrl || '');
var avatarHtml = annotatorUtil.getAvatarHtml(avatarUrl, userId, userName, this.localized.profileAlt);
var avatarUrl = util.htmlEscape(annotation.user.avatarUrl || '');
var avatarHtml = util.getAvatarHtml(avatarUrl, userId, userName, this.localized.profileAlt);
var created = new Date(annotation.created).toLocaleString(this.locale, {

@@ -697,3 +721,3 @@ month: '2-digit',

});
var text = annotatorUtil.htmlEscape(annotation.text);
var text = util.htmlEscape(annotation.text);

@@ -739,3 +763,3 @@ var annotationEl = document.createElement('div');

var deleteBtn = annotatorUtil.generateBtn([constants.CLASS_BUTTON_PLAIN, CLASS_BUTTON_DELETE_COMMENT], this.localized.deleteButton, ICON_DELETE, constants.DATA_TYPE_DELETE);
var deleteBtn = util.generateBtn([constants.CLASS_BUTTON_PLAIN, CLASS_BUTTON_DELETE_COMMENT], this.localized.deleteButton, ICON_DELETE, constants.DATA_TYPE_DELETE);
annotationEl.appendChild(deleteBtn);

@@ -757,6 +781,6 @@

var cancelDeleteBtn = annotatorUtil.generateBtn([constants.CLASS_BUTTON, CLASS_CANCEL_DELETE], this.localized.cancelButton, this.localized.cancelButton, constants.DATA_TYPE_CANCEL_DELETE);
var cancelDeleteBtn = util.generateBtn([constants.CLASS_BUTTON, CLASS_CANCEL_DELETE], this.localized.cancelButton, this.localized.cancelButton, constants.DATA_TYPE_CANCEL_DELETE);
deleteBtnsEl.appendChild(cancelDeleteBtn);
var confirmDeleteBtn = annotatorUtil.generateBtn([constants.CLASS_BUTTON, CLASS_BUTTON_DELETE_CONFIRM, constants.CLASS_BUTTON_PRIMARY], this.localized.deleteButton, this.localized.deleteButton, constants.DATA_TYPE_CONFIRM_DELETE);
var confirmDeleteBtn = util.generateBtn([constants.CLASS_BUTTON, CLASS_BUTTON_DELETE_CONFIRM, constants.CLASS_BUTTON_PRIMARY], this.localized.deleteButton, this.localized.deleteButton, constants.DATA_TYPE_CONFIRM_DELETE);
deleteBtnsEl.appendChild(confirmDeleteBtn);

@@ -802,9 +826,5 @@ }

replyTextEl.classList.add(constants.CLASS_ACTIVE);
annotatorUtil.showElement(replyButtonEls);
util.showElement(replyButtonEls);
// Auto scroll annotations dialog to bottom where new comment was added
var annotationsEl = this.dialogEl.querySelector(constants.SELECTOR_ANNOTATION_CONTAINER);
if (annotationsEl) {
annotationsEl.scrollTop = annotationsEl.scrollHeight - annotationsEl.clientHeight;
}
this.scrollToLastComment();
}

@@ -830,15 +850,11 @@

var replyButtonEls = replyContainerEl.querySelector(constants.SELECTOR_BUTTON_CONTAINER);
annotatorUtil.resetTextarea(replyTextEl, clearText);
annotatorUtil.hideElement(replyButtonEls);
util.resetTextarea(replyTextEl, clearText);
util.hideElement(replyButtonEls);
// Only focus on textarea if dialog is visible
if (annotatorUtil.isElementInViewport(replyTextEl)) {
if (util.isElementInViewport(replyTextEl)) {
replyTextEl.focus();
}
// Auto scroll annotations dialog to bottom where new comment was added
var annotationsEl = this.dialogEl.querySelector(constants.SELECTOR_ANNOTATION_CONTAINER);
if (annotationsEl) {
annotationsEl.scrollTop = annotationsEl.scrollHeight - annotationsEl.clientHeight;
}
this.scrollToLastComment();
}

@@ -865,2 +881,3 @@

replyTextEl.value = '';
replyTextEl.focus();
}

@@ -883,4 +900,4 @@

var deleteButtonEl = annotationEl.querySelector(constants.SELECTOR_DELETE_COMMENT_BTN);
annotatorUtil.hideElement(deleteButtonEl);
annotatorUtil.showElement(deleteConfirmationEl);
util.hideElement(deleteButtonEl);
util.showElement(deleteConfirmationEl);
cancelDeleteButtonEl.focus();

@@ -903,4 +920,4 @@ }

var deleteButtonEl = annotationEl.querySelector(constants.SELECTOR_DELETE_COMMENT_BTN);
annotatorUtil.showElement(deleteButtonEl);
annotatorUtil.hideElement(deleteConfirmationEl);
util.showElement(deleteButtonEl);
util.hideElement(deleteConfirmationEl);
deleteButtonEl.focus();

@@ -907,0 +924,0 @@ }

@@ -12,3 +12,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import Annotation from './Annotation';
import { getHeaders } from './annotatorUtil';
import { getHeaders } from './util';

@@ -15,0 +15,0 @@ var AnnotationService = function (_EventEmitter) {

@@ -14,5 +14,5 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationService from './AnnotationService';
import * as annotatorUtil from './annotatorUtil';
import * as util from './util';
import { ICON_PLACED_ANNOTATION } from './icons/icons';
import { STATES, TYPES, CLASS_ANNOTATION_POINT_MARKER, DATA_TYPE_ANNOTATION_INDICATOR, THREAD_EVENT } from './annotationConstants';
import { STATES, TYPES, CLASS_ANNOTATION_POINT_MARKER, DATA_TYPE_ANNOTATION_INDICATOR, THREAD_EVENT } from './constants';

@@ -120,3 +120,3 @@ var AnnotationThread = function (_EventEmitter) {

value: function hide() {
annotatorUtil.hideElement(this.element);
util.hideElement(this.element);
}

@@ -249,9 +249,9 @@

// annotation, display the annotation as a plain highlight
var firstAnnotation = annotatorUtil.getFirstAnnotation(this.annotations);
var firstAnnotation = util.getFirstAnnotation(this.annotations);
var canDeleteAnnotation = firstAnnotation && firstAnnotation.permissions && firstAnnotation.permissions.can_delete;
if (annotatorUtil.isPlainHighlight(this.annotations) && !canDeleteAnnotation) {
if (util.isPlainHighlight(this.annotations) && !canDeleteAnnotation) {
this.cancelFirstComment();
// If this annotation was the last one in the thread, destroy the thread
} else if (!firstAnnotation || annotatorUtil.isPlainHighlight(this.annotations)) {
} else if (!firstAnnotation || util.isPlainHighlight(this.annotations)) {
if (this.isMobile && this.dialog) {

@@ -267,3 +267,3 @@ this.dialog.hideMobileDialog();

this.showDialog();
this.dialog.deactivateReply();
this.dialog.activateReply();
}

@@ -282,5 +282,5 @@

// the last comment on a highlight
firstAnnotation = annotatorUtil.getFirstAnnotation(_this3.annotations);
firstAnnotation = util.getFirstAnnotation(_this3.annotations);
canDeleteAnnotation = firstAnnotation && firstAnnotation.permissions && firstAnnotation.permissions.can_delete;
if (annotatorUtil.isPlainHighlight(_this3.annotations) && canDeleteAnnotation) {
if (util.isPlainHighlight(_this3.annotations) && canDeleteAnnotation) {
_this3.annotationService.delete(firstAnnotation.annotationID);

@@ -290,3 +290,3 @@ }

// Broadcast thread cleanup if needed
firstAnnotation = annotatorUtil.getFirstAnnotation(_this3.annotations);
firstAnnotation = util.getFirstAnnotation(_this3.annotations);
if (!firstAnnotation) {

@@ -357,3 +357,3 @@ _this3.emit(THREAD_EVENT.threadCleanup);

value: function setup() {
var firstAnnotation = annotatorUtil.getFirstAnnotation(this.annotations);
var firstAnnotation = util.getFirstAnnotation(this.annotations);
if (!firstAnnotation) {

@@ -487,3 +487,3 @@ this.state = STATES.pending;

value: function cancelUnsavedAnnotation() {
if (!annotatorUtil.isPending(this.state)) {
if (!util.isPending(this.state)) {
return;

@@ -632,5 +632,5 @@ }

var mouseInDialog = annotatorUtil.isInDialog(event, this.dialog.element);
var mouseInDialog = util.isInDialog(event, this.dialog.element);
var firstAnnotation = annotatorUtil.getFirstAnnotation(this.annotations);
var firstAnnotation = util.getFirstAnnotation(this.annotations);
if (firstAnnotation && !mouseInDialog) {

@@ -637,0 +637,0 @@ this.hideDialog();

@@ -13,6 +13,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationService from './AnnotationService';
import * as annotatorUtil from './annotatorUtil';
import * as util from './util';
import { ICON_CLOSE } from './icons/icons';
import { CLASS_HIDDEN, DATA_TYPE_ANNOTATION_DIALOG, CLASS_MOBILE_ANNOTATION_DIALOG, CLASS_ANNOTATION_DIALOG, CLASS_MOBILE_DIALOG_HEADER, CLASS_DIALOG_CLOSE, ID_MOBILE_ANNOTATION_DIALOG, TYPES, STATES, THREAD_EVENT, ANNOTATOR_EVENT, CONTROLLER_EVENT } from './annotationConstants';
import { CLASS_HIDDEN, DATA_TYPE_ANNOTATION_DIALOG, CLASS_MOBILE_ANNOTATION_DIALOG, CLASS_ANNOTATION_DIALOG, CLASS_MOBILE_DIALOG_HEADER, CLASS_DIALOG_CLOSE, ID_MOBILE_ANNOTATION_DIALOG, TYPES, STATES, THREAD_EVENT, ANNOTATOR_EVENT, CONTROLLER_EVENT } from './constants';

@@ -322,6 +322,2 @@ var Annotator = function (_EventEmitter) {

var _ref2 = this.options.annotator || {},
CONTROLLERS = _ref2.CONTROLLERS;
this.modeControllers = CONTROLLERS || {};
this.modeButtons = this.options.modeButtons || {};

@@ -346,3 +342,2 @@

_this5.handleControllerEvents = _this5.handleControllerEvents.bind(_this5);
controller.addListener('annotationcontrollerevent', _this5.handleControllerEvents);

@@ -435,4 +430,8 @@ });

var annotations = threadMap[threadID];
var firstAnnotation = annotatorUtil.getFirstAnnotation(annotations);
if (!firstAnnotation || !_this7.isModeAnnotatable(firstAnnotation.type)) {
// NOTE: Using the last annotation to evaluate if the annotation type
// is enabled because highlight comment annotations may have a plain
// highlight as the first annotation in the thread.
var lastAnnotation = util.getLastAnnotation(annotations);
if (!lastAnnotation || !_this7.isModeAnnotatable(lastAnnotation.type)) {
return;

@@ -442,2 +441,3 @@ }

// Bind events on valid annotation thread
var firstAnnotation = util.getLastAnnotation(annotations);
var thread = _this7.createAnnotationThread(annotations, firstAnnotation.location, firstAnnotation.type);

@@ -541,3 +541,3 @@ var controller = _this7.modeControllers[firstAnnotation.type];

// Set existing thread ID if created with annotations
var firstAnnotation = annotatorUtil.getFirstAnnotation(annotations);
var firstAnnotation = util.getFirstAnnotation(annotations);
if (firstAnnotation) {

@@ -654,9 +654,5 @@ params.threadID = firstAnnotation.threadID;

Object.keys(pageThreads).forEach(function (threadID) {
var thread = pageThreads[threadID];
if (!_this10.isModeAnnotatable(thread.type)) {
return;
}
// Sets the annotatedElement if the thread was fetched before the
// dependent document/viewer finished loading
var thread = pageThreads[threadID];
if (!thread.annotatedElement) {

@@ -704,5 +700,5 @@ thread.annotatedElement = _this10.annotatedElement;

if (rotationAngle !== 0) {
annotatorUtil.hideElement(pointAnnotateButton);
util.hideElement(pointAnnotateButton);
} else {
annotatorUtil.showElement(pointAnnotateButton);
util.showElement(pointAnnotateButton);
}

@@ -881,3 +877,3 @@ }

case CONTROLLER_EVENT.register:
opt = annotatorUtil.addThreadToMap(data.data, this.threads);
opt = util.addThreadToMap(data.data, this.threads);
this.threads[opt.page] = opt.pageThreads;

@@ -887,3 +883,3 @@ this.emit(data.event, data.data);

case CONTROLLER_EVENT.unregister:
opt = annotatorUtil.removeThreadFromMap(data.data, this.threads);
opt = util.removeThreadFromMap(data.data, this.threads);
this.threads[opt.page] = opt.pageThreads;

@@ -890,0 +886,0 @@ this.emit(data.event, data.data);

@@ -16,4 +16,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import HighlightModeController from './controllers/HighlightModeController';
import { TYPES } from './annotationConstants';
import { canLoadAnnotations } from './annotatorUtil';
import { TYPES } from './constants';
import { canLoadAnnotations } from './util';

@@ -20,0 +20,0 @@ /**

@@ -10,4 +10,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import EventEmitter from 'events';
import * as constants from './annotationConstants';
import { hideElement, showElement } from './annotatorUtil';
import * as constants from './constants';
import { hideElement, showElement } from './util';

@@ -14,0 +14,0 @@ var CommentBox = function (_EventEmitter) {

@@ -12,4 +12,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import EventEmitter from 'events';
import { insertTemplate, isPending, addThreadToMap, removeThreadFromMap } from '../annotatorUtil';
import { CLASS_HIDDEN, CLASS_ACTIVE, CLASS_ANNOTATION_MODE, ANNOTATOR_EVENT, THREAD_EVENT, CONTROLLER_EVENT } from '../annotationConstants';
import { insertTemplate, isPending, addThreadToMap, removeThreadFromMap } from '../util';
import { CLASS_HIDDEN, CLASS_ACTIVE, CLASS_ANNOTATION_MODE, ANNOTATOR_EVENT, THREAD_EVENT, CONTROLLER_EVENT } from '../constants';

@@ -423,9 +423,9 @@ var AnnotationModeController = function (_EventEmitter) {

/**
* Setups the header for the annotation mode
*
* @protected
* @param {HTMLElement} container - Container element
* @param {HTMLElement} header - Header to add to DOM
* @return {void}
*/
* Setups the header for the annotation mode
*
* @protected
* @param {HTMLElement} container - Container element
* @param {HTMLElement} header - Header to add to DOM
* @return {void}
*/

@@ -432,0 +432,0 @@ }, {

@@ -13,6 +13,6 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationModeController from './AnnotationModeController';
import annotationsShell from './../annotationsShell.html';
import shell from './../shell.html';
import DocDrawingThread from '../doc/DocDrawingThread';
import * as annotatorUtil from '../annotatorUtil';
import { TYPES, STATES, SELECTOR_ANNOTATION_BUTTON_DRAW_CANCEL, SELECTOR_ANNOTATION_BUTTON_DRAW_POST, SELECTOR_ANNOTATION_BUTTON_DRAW_UNDO, SELECTOR_ANNOTATION_BUTTON_DRAW_REDO, SELECTOR_BOX_PREVIEW_BASE_HEADER, SELECTOR_ANNOTATION_DRAWING_HEADER, CLASS_ANNNOTATION_DRAWING_BACKGROUND, DRAW_BORDER_OFFSET, CLASS_ACTIVE, CLASS_ANNOTATION_MODE, CONTROLLER_EVENT } from '../annotationConstants';
import * as util from '../util';
import { TYPES, STATES, SELECTOR_ANNOTATION_BUTTON_DRAW_CANCEL, SELECTOR_ANNOTATION_BUTTON_DRAW_POST, SELECTOR_ANNOTATION_BUTTON_DRAW_UNDO, SELECTOR_ANNOTATION_BUTTON_DRAW_REDO, SELECTOR_BOX_PREVIEW_BASE_HEADER, SELECTOR_ANNOTATION_DRAWING_HEADER, CLASS_ANNNOTATION_DRAWING_BACKGROUND, DRAW_BORDER_OFFSET, CLASS_ACTIVE, CLASS_ANNOTATION_MODE, CONTROLLER_EVENT } from '../constants';

@@ -53,3 +53,3 @@ var DrawingModeController = function (_AnnotationModeContro) {

if (data.options.header !== 'none') {
this.setupHeader(this.container, annotationsShell);
this.setupHeader(this.container, shell);
}

@@ -232,4 +232,4 @@

annotatorUtil.disableElement(this.undoButtonEl);
annotatorUtil.disableElement(this.redoButtonEl);
util.disableElement(this.undoButtonEl);
util.disableElement(this.redoButtonEl);
}

@@ -266,7 +266,7 @@

// Get handlers
this.pushElementHandler(this.annotatedElement, ['mousemove', 'touchmove'], annotatorUtil.eventToLocationHandler(locationFunction, this.currentThread.handleMove));
this.pushElementHandler(this.annotatedElement, ['mousemove', 'touchmove'], util.eventToLocationHandler(locationFunction, this.currentThread.handleMove));
this.pushElementHandler(this.annotatedElement, ['mousedown', 'touchstart'], annotatorUtil.eventToLocationHandler(locationFunction, this.currentThread.handleStart));
this.pushElementHandler(this.annotatedElement, ['mousedown', 'touchstart'], util.eventToLocationHandler(locationFunction, this.currentThread.handleStart));
this.pushElementHandler(this.annotatedElement, ['mouseup', 'touchcancel', 'touchend'], annotatorUtil.eventToLocationHandler(locationFunction, this.currentThread.handleStop));
this.pushElementHandler(this.annotatedElement, ['mouseup', 'touchcancel', 'touchend'], util.eventToLocationHandler(locationFunction, this.currentThread.handleStop));

@@ -446,5 +446,5 @@ this.pushElementHandler(this.cancelButtonEl, 'click', function () {

if (undoCount === 1) {
annotatorUtil.enableElement(this.undoButtonEl);
util.enableElement(this.undoButtonEl);
} else if (undoCount === 0) {
annotatorUtil.disableElement(this.undoButtonEl);
util.disableElement(this.undoButtonEl);
}

@@ -455,5 +455,5 @@ }

if (redoCount === 1) {
annotatorUtil.enableElement(this.redoButtonEl);
util.enableElement(this.redoButtonEl);
} else if (redoCount === 0) {
annotatorUtil.disableElement(this.redoButtonEl);
util.disableElement(this.redoButtonEl);
}

@@ -460,0 +460,0 @@ }

@@ -12,3 +12,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationModeController from './AnnotationModeController';
import { THREAD_EVENT, CONTROLLER_EVENT } from '../annotationConstants';
import { THREAD_EVENT, CONTROLLER_EVENT } from '../constants';

@@ -15,0 +15,0 @@ var HighlightModeController = function (_AnnotationModeContro) {

@@ -10,3 +10,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationModeController from './AnnotationModeController';
import { TYPES, THREAD_EVENT, CONTROLLER_EVENT, CREATE_EVENT } from '../annotationConstants';
import { TYPES, THREAD_EVENT, CONTROLLER_EVENT, CREATE_EVENT } from '../constants';
import CreateAnnotationDialog from '../CreateAnnotationDialog';

@@ -13,0 +13,0 @@

@@ -11,4 +11,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import CommentBox from './CommentBox';
import { hideElement, showElement } from './annotatorUtil';
import { CLASS_MOBILE_CREATE_ANNOTATION_DIALOG, CLASS_ANNOTATION_DIALOG, CREATE_EVENT } from './annotationConstants';
import { hideElement, showElement } from './util';
import { CLASS_MOBILE_CREATE_ANNOTATION_DIALOG, CLASS_ANNOTATION_DIALOG, CREATE_EVENT } from './constants';

@@ -15,0 +15,0 @@ var CreateAnnotationDialog = function (_EventEmitter) {

@@ -13,4 +13,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../icons/icons';
import { generateBtn, repositionCaret } from '../annotatorUtil';
import { CREATE_EVENT, CLASS_ANNOTATION_CARET, CLASS_HIGHLIGHT_BTNS, CLASS_ADD_HIGHLIGHT_BTN, CLASS_ADD_HIGHLIGHT_COMMENT_BTN, CLASS_ANNOTATION_HIGHLIGHT_DIALOG, SELECTOR_ANNOTATION_HIGHLIGHT_DIALOG, SELECTOR_HIGHLIGHT_BTNS, SELECTOR_ADD_HIGHLIGHT_BTN, SELECTOR_ADD_HIGHLIGHT_COMMENT_BTN, CLASS_MOBILE_ANNOTATION_DIALOG, CLASS_ANNOTATION_DIALOG, CLASS_BUTTON_PLAIN } from '../annotationConstants';
import { generateBtn, repositionCaret } from '../util';
import { CREATE_EVENT, CLASS_ANNOTATION_CARET, CLASS_HIGHLIGHT_BTNS, CLASS_ADD_HIGHLIGHT_BTN, CLASS_ADD_HIGHLIGHT_COMMENT_BTN, CLASS_ANNOTATION_HIGHLIGHT_DIALOG, SELECTOR_ANNOTATION_HIGHLIGHT_DIALOG, SELECTOR_HIGHLIGHT_BTNS, SELECTOR_ADD_HIGHLIGHT_BTN, SELECTOR_ADD_HIGHLIGHT_COMMENT_BTN, CLASS_MOBILE_ANNOTATION_DIALOG, CLASS_ANNOTATION_DIALOG, CLASS_BUTTON_PLAIN } from '../constants';

@@ -67,4 +67,4 @@ var CLASS_CREATE_DIALOG = 'bp-create-annotation-dialog';

_this.allowHighlight = !!config.allowHighlight || true;
_this.allowComment = !!config.allowComment || true;
_this.allowHighlight = config.allowHighlight || false;
_this.allowComment = config.allowComment || false;

@@ -81,2 +81,4 @@ // Explicit scope binding for event listeners

}
_this.createElement();
return _this;

@@ -241,7 +243,2 @@ }

if (this.allowComment) {
var commentEl = generateBtn([CLASS_BUTTON_PLAIN, CLASS_ADD_HIGHLIGHT_COMMENT_BTN], this.localized.highlightComment, ICON_HIGHLIGHT_COMMENT, DATA_TYPE_ADD_HIGHLIGHT_COMMENT);
buttonsEl.appendChild(commentEl);
}
var dialogEl = document.createElement('div');

@@ -279,4 +276,7 @@ dialogEl.classList.add(CLASS_ANNOTATION_HIGHLIGHT_DIALOG);

// Events for comment button
if (this.allowComment) {
var commentEl = generateBtn([CLASS_BUTTON_PLAIN, CLASS_ADD_HIGHLIGHT_COMMENT_BTN], this.localized.highlightComment, ICON_HIGHLIGHT_COMMENT, DATA_TYPE_ADD_HIGHLIGHT_COMMENT);
buttonsEl.appendChild(commentEl);
// Events for comment button
this.commentBox = this.setupCommentBox(highlightDialogEl);

@@ -283,0 +283,0 @@

@@ -25,5 +25,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import CreateHighlightDialog from './CreateHighlightDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as docAnnotatorUtil from './docAnnotatorUtil';
import { STATES, TYPES, DATA_TYPE_ANNOTATION_DIALOG, DATA_TYPE_ANNOTATION_INDICATOR, PAGE_PADDING_TOP, PAGE_PADDING_BOTTOM, CLASS_ANNOTATION_LAYER_HIGHLIGHT, CLASS_ANNOTATION_LAYER_DRAW, CLASS_HIDDEN, THREAD_EVENT, ANNOTATOR_EVENT, CONTROLLER_EVENT, CREATE_EVENT } from '../annotationConstants';
import * as util from '../util';
import * as docUtil from './docUtil';
import { STATES, TYPES, DATA_TYPE_ANNOTATION_DIALOG, DATA_TYPE_ANNOTATION_INDICATOR, PAGE_PADDING_TOP, PAGE_PADDING_BOTTOM, CLASS_ANNOTATION_LAYER_HIGHLIGHT, CLASS_ANNOTATION_LAYER_DRAW, CLASS_HIDDEN, THREAD_EVENT, ANNOTATOR_EVENT, CONTROLLER_EVENT, CREATE_EVENT } from '../constants';

@@ -177,3 +177,3 @@ var MOUSEMOVE_THROTTLE_MS = 50;

var location = null;
var zoomScale = annotatorUtil.getScale(this.annotatedElement);
var zoomScale = util.getScale(this.annotatedElement);

@@ -192,5 +192,5 @@ if (annotationType === TYPES.point) {

var _annotatorUtil$getPag = annotatorUtil.getPageInfo(eventTarget),
pageEl = _annotatorUtil$getPag.pageEl,
page = _annotatorUtil$getPag.page;
var _util$getPageInfo = util.getPageInfo(eventTarget),
pageEl = _util$getPageInfo.pageEl,
page = _util$getPageInfo.page;

@@ -202,3 +202,3 @@ if (!pageEl) {

// If there is a selection, ignore
if (docAnnotatorUtil.isSelectionPresent()) {
if (docUtil.isSelectionPresent()) {
return location;

@@ -208,3 +208,3 @@ }

// If click is inside an annotation dialog, ignore
var dataType = annotatorUtil.findClosestDataType(eventTarget);
var dataType = util.findClosestDataType(eventTarget);
if (dataType === DATA_TYPE_ANNOTATION_DIALOG || dataType === DATA_TYPE_ANNOTATION_INDICATOR) {

@@ -229,3 +229,3 @@ return location;

var pdfCoordinates = docAnnotatorUtil.convertDOMSpaceToPDFSpace(browserCoordinates, pageHeight, zoomScale);
var pdfCoordinates = docUtil.convertDOMSpaceToPDFSpace(browserCoordinates, pageHeight, zoomScale);

@@ -245,3 +245,3 @@ // We save the dimensions of the annotated element scaled to 100%

location = { x: x, y: y, page: page, dimensions: dimensions };
} else if (annotatorUtil.isHighlightAnnotation(annotationType)) {
} else if (util.isHighlightAnnotation(annotationType)) {
if (!this.highlighter || !this.highlighter.highlights.length) {

@@ -253,13 +253,13 @@ return location;

var _annotatorUtil$getPag2 = annotatorUtil.getPageInfo(window.getSelection().anchorNode),
_pageEl = _annotatorUtil$getPag2.pageEl,
_page = _annotatorUtil$getPag2.page;
var _util$getPageInfo2 = util.getPageInfo(window.getSelection().anchorNode),
_pageEl = _util$getPageInfo2.pageEl,
_page = _util$getPageInfo2.page;
if (!_pageEl) {
var _annotatorUtil$getPag3 = annotatorUtil.getPageInfo(this.annotatedElement.querySelector('.' + CLASS_RANGY_HIGHLIGHT));
var _util$getPageInfo3 = util.getPageInfo(this.annotatedElement.querySelector('.' + CLASS_RANGY_HIGHLIGHT));
// The ( .. ) around assignment is required syntax
_pageEl = _annotatorUtil$getPag3.pageEl;
_page = _annotatorUtil$getPag3.page;
_pageEl = _util$getPageInfo3.pageEl;
_page = _util$getPageInfo3.page;
}

@@ -269,4 +269,4 @@

var _docAnnotatorUtil$get = docAnnotatorUtil.getHighlightAndHighlightEls(this.highlighter, _pageEl),
highlightEls = _docAnnotatorUtil$get.highlightEls;
var _docUtil$getHighlight = docUtil.getHighlightAndHighlightEls(this.highlighter, _pageEl),
highlightEls = _docUtil$getHighlight.highlightEls;

@@ -282,3 +282,3 @@ // Do not create highlight annotation if no highlights are detected

highlightEls.forEach(function (element) {
quadPoints.push(docAnnotatorUtil.getQuadPoints(element, _pageEl, zoomScale));
quadPoints.push(docUtil.getQuadPoints(element, _pageEl, zoomScale));
});

@@ -318,3 +318,3 @@

var threadParams = this.getThreadParams(annotations, location, type);
if (!annotatorUtil.areThreadParamsValid(threadParams)) {
if (!util.areThreadParamsValid(threadParams)) {
this.handleValidationError();

@@ -324,3 +324,3 @@ return thread;

if (annotatorUtil.isHighlightAnnotation(type)) {
if (util.isHighlightAnnotation(type)) {
thread = new DocHighlightThread(threadParams);

@@ -376,3 +376,3 @@ } else if (type === TYPES.draw) {

highlightThreads.forEach(function (thread) {
if (annotatorUtil.isPending(thread.state)) {
if (util.isPending(thread.state)) {
/* eslint-disable no-console */

@@ -406,3 +406,3 @@ console.error('Pending annotation thread destroyed', thread.threadNumber);

if (annotationLayerEl) {
docAnnotatorUtil.scaleCanvas(pageEl, annotationLayerEl);
docUtil.scaleCanvas(pageEl, annotationLayerEl);
}

@@ -441,2 +441,3 @@ });

if (!this.plainHighlightEnabled && !this.commentHighlightEnabled) {
_get(DocAnnotator.prototype.__proto__ || Object.getPrototypeOf(DocAnnotator.prototype), 'setupAnnotations', this).call(this);
return;

@@ -461,3 +462,2 @@ }

});
this.createHighlightDialog.createElement();

@@ -504,3 +504,5 @@ this.createHighlightDialog.addListener(CREATE_EVENT.init, function () {

this.annotatedElement.addEventListener('mouseup', this.highlightMouseupHandler);
if (this.plainHighlightEnabled || this.commentHighlightEnabled) {
this.annotatedElement.addEventListener('mouseup', this.highlightMouseupHandler);
}

@@ -683,3 +685,3 @@ // Prevent all forms of highlight annotations if annotating (or plain AND comment highlights) is disabled

// Bail if mid highlight and tapping on the screen
if (!docAnnotatorUtil.isValidSelection(selection)) {
if (!docUtil.isValidSelection(selection)) {
this.lastSelection = null;

@@ -823,3 +825,3 @@ this.lastHighlightEvent = null;

var event = this.mouseMoveEvent;
if (docAnnotatorUtil.isDialogDataType(event.target)) {
if (docUtil.isDialogDataType(event.target)) {
return;

@@ -832,4 +834,4 @@ }

var _annotatorUtil$getPag4 = annotatorUtil.getPageInfo(event.target),
page = _annotatorUtil$getPag4.page;
var _util$getPageInfo4 = util.getPageInfo(event.target),
page = _util$getPageInfo4.page;

@@ -845,3 +847,3 @@ var delayThreads = [];

// and ignore hover events of any highlights below
if (!annotatorUtil.isHighlightAnnotation(thread.type) || thread.state === STATES.pending) {
if (!util.isHighlightAnnotation(thread.type) || thread.state === STATES.pending) {
return;

@@ -1007,3 +1009,3 @@ }

var selection = window.getSelection();
if (!docAnnotatorUtil.isValidSelection(selection)) {
if (!docUtil.isValidSelection(selection)) {
return;

@@ -1014,4 +1016,4 @@ }

var _annotatorUtil$getPag5 = annotatorUtil.getPageInfo(selection.anchorNode),
pageEl = _annotatorUtil$getPag5.pageEl;
var _util$getPageInfo5 = util.getPageInfo(selection.anchorNode),
pageEl = _util$getPageInfo5.pageEl;

@@ -1064,4 +1066,4 @@ if (!pageEl) {

var _annotatorUtil$getPag6 = annotatorUtil.getPageInfo(event.target),
page = _annotatorUtil$getPag6.page;
var _util$getPageInfo6 = util.getPageInfo(event.target),
page = _util$getPageInfo6.page;

@@ -1073,3 +1075,3 @@ var pageThreads = this.threads[page] || {};

if (annotatorUtil.isPending(thread.state)) {
if (util.isPending(thread.state)) {
// Destroy any pending highlights on click outside the highlight

@@ -1081,3 +1083,3 @@ if (thread.type === TYPES.point) {

}
} else if (annotatorUtil.isHighlightAnnotation(thread.type)) {
} else if (util.isHighlightAnnotation(thread.type)) {
// We use this to prevent a mousedown from activating two different

@@ -1146,3 +1148,3 @@ // highlights at the same time - this tracks whether a delegated

var thread = pageThreads[threadID];
if (annotatorUtil.isHighlightAnnotation(thread.type)) {
if (util.isHighlightAnnotation(thread.type)) {
threads.push(thread);

@@ -1149,0 +1151,0 @@ }

@@ -10,4 +10,4 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationDialog from '../AnnotationDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as constants from '../annotationConstants';
import * as util from '../util';
import * as constants from '../constants';
import { ICON_DRAW_SAVE, ICON_DRAW_DELETE } from '../icons/icons';

@@ -56,3 +56,3 @@

this.element.removeEventListener('click', annotatorUtil.prevDefAndStopProp);
this.element.removeEventListener('click', util.prevDefAndStopProp);
if (this.pageEl && this.pageEl.contains(this.element)) {

@@ -164,3 +164,3 @@ this.pageEl.removeChild(this.element);

this.element = document.createElement('div');
this.element.addEventListener('click', annotatorUtil.prevDefAndStopProp);
this.element.addEventListener('click', util.prevDefAndStopProp);
this.element.classList.add(constants.CLASS_ANNOTATION_DIALOG);

@@ -177,3 +177,3 @@

var firstAnnotation = annotatorUtil.getFirstAnnotation(annotations);
var firstAnnotation = util.getFirstAnnotation(annotations);
if (firstAnnotation) {

@@ -224,3 +224,3 @@ this.assignDrawingLabel(firstAnnotation);

value: function hide() {
annotatorUtil.hideElement(this.element);
util.hideElement(this.element);
this.visible = false;

@@ -239,3 +239,3 @@ }

value: function show() {
annotatorUtil.showElement(this.element);
util.showElement(this.element);
this.visible = true;

@@ -255,3 +255,3 @@ }

value: function generateDialogEl(annotations) {
var firstAnnotation = annotatorUtil.getFirstAnnotation(annotations);
var firstAnnotation = util.getFirstAnnotation(annotations);
var canCommit = !firstAnnotation;

@@ -269,3 +269,3 @@ var canDelete = canCommit || firstAnnotation && firstAnnotation.permissions && firstAnnotation.permissions.can_delete;

if (canCommit) {
var commitButton = annotatorUtil.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_ADD_DRAWING_BTN], this.localized.drawSave, ICON_DRAW_SAVE + ' ' + this.localized.saveButton);
var commitButton = util.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_ADD_DRAWING_BTN], this.localized.drawSave, ICON_DRAW_SAVE + ' ' + this.localized.saveButton);
drawingButtonsEl.appendChild(commitButton);

@@ -275,3 +275,3 @@ }

if (canDelete) {
var deleteButton = annotatorUtil.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_DELETE_DRAWING_BTN], this.localized.drawDelete, ICON_DRAW_DELETE + ' ' + this.localized.deleteButton);
var deleteButton = util.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_DELETE_DRAWING_BTN], this.localized.drawDelete, ICON_DRAW_DELETE + ' ' + this.localized.deleteButton);
drawingButtonsEl.appendChild(deleteButton);

@@ -305,5 +305,5 @@ }

var username = savedAnnotation.user ? savedAnnotation.user.name : constants.USER_ANONYMOUS;
drawingLabelEl.textContent = annotatorUtil.replacePlaceholders(this.localized.whoDrew, [username]);
drawingLabelEl.textContent = util.replacePlaceholders(this.localized.whoDrew, [username]);
annotatorUtil.showElement(drawingLabelEl);
util.showElement(drawingLabelEl);
}

@@ -310,0 +310,0 @@

@@ -16,5 +16,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import DocDrawingDialog from '../doc/DocDrawingDialog';
import { STATES, DRAW_STATES, CLASS_ANNOTATION_LAYER_DRAW, CLASS_ANNOTATION_LAYER_DRAW_IN_PROGRESS } from '../annotationConstants';
import { getBrowserCoordinatesFromLocation, getContext, getPageEl } from './docAnnotatorUtil';
import { createLocation, getScale } from '../annotatorUtil';
import { STATES, DRAW_STATES, CLASS_ANNOTATION_LAYER_DRAW, CLASS_ANNOTATION_LAYER_DRAW_IN_PROGRESS } from '../constants';
import { getBrowserCoordinatesFromLocation, getContext, getPageEl } from './docUtil';
import { createLocation, getScale } from '../util';

@@ -21,0 +21,0 @@ var DocDrawingThread = function (_DrawingThread) {

@@ -14,6 +14,6 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import AnnotationDialog from '../AnnotationDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as docAnnotatorUtil from './docAnnotatorUtil';
import * as util from '../util';
import * as docUtil from './docUtil';
import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../icons/icons';
import * as constants from '../annotationConstants';
import * as constants from '../constants';

@@ -66,4 +66,4 @@ var CLASS_HIGHLIGHT_DIALOG = 'bp-highlight-dialog';

var highlightLabelEl = this.highlightDialogEl.querySelector('.' + CLASS_HIGHLIGHT_LABEL);
highlightLabelEl.textContent = annotatorUtil.replacePlaceholders(this.localized.whoHighlighted, [annotation.user.name]);
annotatorUtil.showElement(highlightLabelEl);
highlightLabelEl.textContent = util.replacePlaceholders(this.localized.whoHighlighted, [annotation.user.name]);
util.showElement(highlightLabelEl);

@@ -137,6 +137,6 @@ // Only reposition if mouse is still hovering over the dialog and not mobile

annotatorUtil.hideElement(this.commentsDialogEl);
util.hideElement(this.commentsDialogEl);
this.element.classList.add(CLASS_HIGHLIGHT_DIALOG);
annotatorUtil.showElement(this.highlightDialogEl);
util.showElement(this.highlightDialogEl);
this.hasComments = false;

@@ -175,5 +175,5 @@ }

if (showPlain) {
annotatorUtil.showElement(plainButtonEl);
util.showElement(plainButtonEl);
} else {
annotatorUtil.hideElement(plainButtonEl);
util.hideElement(plainButtonEl);
}

@@ -185,5 +185,5 @@ }

if (showComment) {
annotatorUtil.showElement(commentButtonEl);
util.showElement(commentButtonEl);
} else {
annotatorUtil.hideElement(commentButtonEl);
util.hideElement(commentButtonEl);
}

@@ -236,3 +236,3 @@ }

// else we can do
dialogX = annotatorUtil.repositionCaret(this.element, dialogX, highlightDialogWidth, browserX, pageDimensions.width);
dialogX = util.repositionCaret(this.element, dialogX, highlightDialogWidth, browserX, pageDimensions.width);

@@ -248,3 +248,3 @@ if (dialogY < 0) {

this.fitDialogHeightInPage();
annotatorUtil.showElement(this.element);
util.showElement(this.element);
}

@@ -273,6 +273,6 @@

this.element.classList.remove(CLASS_HIGHLIGHT_DIALOG);
annotatorUtil.hideElement(this.highlightDialogEl);
util.hideElement(this.highlightDialogEl);
this.element.classList.add(constants.CLASS_ANNOTATION_DIALOG);
annotatorUtil.showElement(this.commentsDialogEl);
util.showElement(this.commentsDialogEl);
this.hasComments = true;

@@ -286,6 +286,6 @@ // Activate comments textarea

this.element.classList.remove(constants.CLASS_ANNOTATION_DIALOG);
annotatorUtil.hideElement(this.commentsDialogEl);
util.hideElement(this.commentsDialogEl);
this.element.classList.add(CLASS_HIGHLIGHT_DIALOG);
annotatorUtil.showElement(this.highlightDialogEl);
util.showElement(this.highlightDialogEl);
this.hasComments = false;

@@ -317,9 +317,9 @@ }

if (hasAnnotations) {
annotatorUtil.hideElement(replyTextEl);
annotatorUtil.showElement(commentTextEl);
util.hideElement(replyTextEl);
util.showElement(commentTextEl);
this.deactivateReply();
} else {
// Ensures that "Reply" text area is shown
annotatorUtil.hideElement(commentTextEl);
annotatorUtil.showElement(replyTextEl);
util.hideElement(commentTextEl);
util.showElement(replyTextEl);
this.activateReply();

@@ -355,3 +355,3 @@ }

// Determine if highlight buttons or comments dialog will display
var firstAnnotation = annotatorUtil.getFirstAnnotation(annotations);
var firstAnnotation = util.getFirstAnnotation(annotations);
if (firstAnnotation) {

@@ -399,6 +399,6 @@ this.hasComments = firstAnnotation.text !== '' || Object.keys(annotations).length > 1;

// be 'Some User'
if (annotatorUtil.isPlainHighlight(annotations) && firstAnnotation && firstAnnotation.user.id !== '0') {
if (util.isPlainHighlight(annotations) && firstAnnotation && firstAnnotation.user.id !== '0') {
var highlightLabelEl = this.highlightDialogEl.querySelector('.' + CLASS_HIGHLIGHT_LABEL);
highlightLabelEl.textContent = annotatorUtil.replacePlaceholders(this.localized.whoHighlighted, [firstAnnotation.user.name]);
annotatorUtil.showElement(highlightLabelEl);
highlightLabelEl.textContent = util.replacePlaceholders(this.localized.whoHighlighted, [firstAnnotation.user.name]);
util.showElement(highlightLabelEl);
}

@@ -498,3 +498,3 @@

event.stopPropagation();
if (annotatorUtil.decodeKeydown(event) === 'Enter') {
if (util.decodeKeydown(event) === 'Enter') {
this.mousedownHandler(event);

@@ -517,3 +517,3 @@ }

event.stopPropagation();
var dataType = annotatorUtil.findClosestDataType(event.target);
var dataType = util.findClosestDataType(event.target);

@@ -579,3 +579,3 @@ switch (dataType) {

var textAreaEl = this.dialogEl.querySelector(constants.SELECTOR_ANNOTATION_TEXTAREA);
if (annotatorUtil.isElementInViewport(textAreaEl)) {
if (util.isElementInViewport(textAreaEl)) {
textAreaEl.focus();

@@ -603,4 +603,4 @@ }

// DOM space while still being invisible
annotatorUtil.hideElementVisibility(this.element);
annotatorUtil.showElement(this.element);
util.hideElementVisibility(this.element);
util.showElement(this.element);

@@ -611,4 +611,4 @@ this.highlightDialogWidth = this.element.getBoundingClientRect().width;

// in the DOM while remaining hidden
annotatorUtil.hideElement(this.element);
annotatorUtil.showInvisibleElement(this.element);
util.hideElement(this.element);
util.showInvisibleElement(this.element);

@@ -635,8 +635,8 @@ // Reset dialog left positioning

value: function getScaledPDFCoordinates(pageDimensions, pageHeight) {
var zoomScale = annotatorUtil.getScale(this.annotatedElement);
var zoomScale = util.getScale(this.annotatedElement);
var _docAnnotatorUtil$get = docAnnotatorUtil.getLowerRightCornerOfLastQuadPoint(this.location.quadPoints),
_docAnnotatorUtil$get2 = _slicedToArray(_docAnnotatorUtil$get, 2),
x = _docAnnotatorUtil$get2[0],
y = _docAnnotatorUtil$get2[1];
var _docUtil$getLowerRigh = docUtil.getLowerRightCornerOfLastQuadPoint(this.location.quadPoints),
_docUtil$getLowerRigh2 = _slicedToArray(_docUtil$getLowerRigh, 2),
x = _docUtil$getLowerRigh2[0],
y = _docUtil$getLowerRigh2[1];

@@ -646,3 +646,3 @@ // If needed, scale coordinates comparing current dimensions with saved dimensions

var dimensionScale = annotatorUtil.getDimensionScale(this.location.dimensions, pageDimensions, zoomScale, PAGE_PADDING_TOP + PAGE_PADDING_BOTTOM);
var dimensionScale = util.getDimensionScale(this.location.dimensions, pageDimensions, zoomScale, PAGE_PADDING_TOP + PAGE_PADDING_BOTTOM);
if (dimensionScale) {

@@ -653,3 +653,3 @@ x *= dimensionScale.x;

return docAnnotatorUtil.convertPDFSpaceToDOMSpace([x, y], pageHeight, zoomScale);
return docUtil.convertPDFSpaceToDOMSpace([x, y], pageHeight, zoomScale);
}

@@ -704,7 +704,7 @@

if (canDeleteAnnotation) {
var addHighlightBtn = annotatorUtil.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_ADD_HIGHLIGHT_BTN], this.localized.highlightToggle, ICON_HIGHLIGHT, constants.DATA_TYPE_HIGHLIGHT);
var addHighlightBtn = util.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_ADD_HIGHLIGHT_BTN], this.localized.highlightToggle, ICON_HIGHLIGHT, constants.DATA_TYPE_HIGHLIGHT);
highlightButtons.appendChild(addHighlightBtn);
}
var addCommentBtn = annotatorUtil.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_ADD_HIGHLIGHT_COMMENT_BTN], this.localized.highlightComment, ICON_HIGHLIGHT_COMMENT, constants.DATA_TYPE_ADD_HIGHLIGHT_COMMENT);
var addCommentBtn = util.generateBtn([constants.CLASS_BUTTON_PLAIN, constants.CLASS_ADD_HIGHLIGHT_COMMENT_BTN], this.localized.highlightComment, ICON_HIGHLIGHT_COMMENT, constants.DATA_TYPE_ADD_HIGHLIGHT_COMMENT);
highlightButtons.appendChild(addCommentBtn);

@@ -711,0 +711,0 @@

@@ -17,5 +17,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import DocHighlightDialog from './DocHighlightDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as docAnnotatorUtil from './docAnnotatorUtil';
import { THREAD_EVENT, STATES, TYPES, SELECTOR_ADD_HIGHLIGHT_BTN, HIGHLIGHT_FILL, CLASS_ANNOTATION_LAYER_HIGHLIGHT, PAGE_PADDING_TOP, PAGE_PADDING_BOTTOM } from '../annotationConstants';
import * as util from '../util';
import * as docUtil from './docUtil';
import { THREAD_EVENT, STATES, TYPES, SELECTOR_ADD_HIGHLIGHT_BTN, HIGHLIGHT_FILL, CLASS_ANNOTATION_LAYER_HIGHLIGHT, PAGE_PADDING_TOP, PAGE_PADDING_BOTTOM } from '../constants';

@@ -47,3 +47,3 @@ var HOVER_TIMEOUT_MS = 75;

value: function cancelFirstComment() {
if (annotatorUtil.isPlainHighlight(this.annotations)) {
if (util.isPlainHighlight(this.annotations)) {
if (this.isMobile) {

@@ -152,3 +152,3 @@ this.dialog.hideCommentsDialog();

// permissions
var firstAnnotation = annotatorUtil.getFirstAnnotation(this.annotations);
var firstAnnotation = util.getFirstAnnotation(this.annotations);
if (!firstAnnotation) {

@@ -161,3 +161,3 @@ return;

var addHighlightBtn = this.dialog.element.querySelector(SELECTOR_ADD_HIGHLIGHT_BTN);
annotatorUtil.hideElement(addHighlightBtn);
util.hideElement(addHighlightBtn);
}

@@ -225,3 +225,3 @@ }

value: function isOnHighlight(event) {
return annotatorUtil.isInDialog(event, this.dialog.element) || this.isInHighlight(event);
return util.isInDialog(event, this.dialog.element) || this.isInHighlight(event);
}

@@ -265,3 +265,3 @@

// If mouse is in dialog, change state to hover or active-hover
if (annotatorUtil.isInDialog(event, this.dialog.element)) {
if (util.isInDialog(event, this.dialog.element)) {
// Keeps dialog open if comment is pending

@@ -373,3 +373,3 @@ if (this.state === STATES.pending_active) {

// Ensures that previously created annotations have the right type
var firstAnnotation = annotatorUtil.getFirstAnnotation(this.annotations);
var firstAnnotation = util.getFirstAnnotation(this.annotations);
if (!firstAnnotation) {

@@ -469,3 +469,3 @@ return;

var firstAnnotation = annotatorUtil.getFirstAnnotation(this.annotations);
var firstAnnotation = util.getFirstAnnotation(this.annotations);
if (firstAnnotation) {

@@ -536,5 +536,5 @@ this.deleteAnnotation(firstAnnotation.annotationID);

var _docAnnotatorUtil$get = docAnnotatorUtil.getLowerRightCornerOfLastQuadPoint(this.location.quadPoints),
_docAnnotatorUtil$get2 = _slicedToArray(_docAnnotatorUtil$get, 1),
yPos = _docAnnotatorUtil$get2[0];
var _docUtil$getLowerRigh = docUtil.getLowerRightCornerOfLastQuadPoint(this.location.quadPoints),
_docUtil$getLowerRigh2 = _slicedToArray(_docUtil$getLowerRigh, 1),
yPos = _docUtil$getLowerRigh2[0];

@@ -562,3 +562,3 @@ // Adjust scroll to highlight position

var pageEl = this.getPageEl();
var context = docAnnotatorUtil.getContext(pageEl, CLASS_ANNOTATION_LAYER_HIGHLIGHT);
var context = docUtil.getContext(pageEl, CLASS_ANNOTATION_LAYER_HIGHLIGHT);
if (!context) {

@@ -570,4 +570,4 @@ return;

var pageHeight = pageDimensions.height - PAGE_PADDING_TOP - PAGE_PADDING_BOTTOM;
var zoomScale = annotatorUtil.getScale(this.annotatedElement);
var dimensionScale = annotatorUtil.getDimensionScale(this.location.dimensions, pageDimensions, zoomScale, PAGE_PADDING_TOP + PAGE_PADDING_BOTTOM);
var zoomScale = util.getScale(this.annotatedElement);
var dimensionScale = util.getDimensionScale(this.location.dimensions, pageDimensions, zoomScale, PAGE_PADDING_TOP + PAGE_PADDING_BOTTOM);

@@ -583,3 +583,3 @@ this.location.quadPoints.forEach(function (quadPoint) {

var browserQuadPoint = docAnnotatorUtil.convertPDFSpaceToDOMSpace(scaledQuadPoint, pageHeight, zoomScale);
var browserQuadPoint = docUtil.convertPDFSpaceToDOMSpace(scaledQuadPoint, pageHeight, zoomScale);

@@ -641,4 +641,4 @@ var _browserQuadPoint = _slicedToArray(browserQuadPoint, 8),

var pageTop = pageDimensions.top + PAGE_PADDING_TOP;
var zoomScale = annotatorUtil.getScale(this.annotatedElement);
var dimensionScale = annotatorUtil.getDimensionScale(this.location.dimensions, pageDimensions, zoomScale, PAGE_PADDING_TOP + PAGE_PADDING_BOTTOM);
var zoomScale = util.getScale(this.annotatedElement);
var dimensionScale = util.getDimensionScale(this.location.dimensions, pageDimensions, zoomScale, PAGE_PADDING_TOP + PAGE_PADDING_BOTTOM);

@@ -678,3 +678,3 @@ /**

var browserQuadPoint = docAnnotatorUtil.convertPDFSpaceToDOMSpace(scaledQuadPoint, pageHeight, zoomScale);
var browserQuadPoint = docUtil.convertPDFSpaceToDOMSpace(scaledQuadPoint, pageHeight, zoomScale);

@@ -691,3 +691,3 @@ var _browserQuadPoint2 = _slicedToArray(browserQuadPoint, 8),

eventOccurredInHighlight = docAnnotatorUtil.isPointInPolyOpt([[x1, y1], [x2, y2], [x3, y3], [x4, y4]], x, y);
eventOccurredInHighlight = docUtil.isPointInPolyOpt([[x1, y1], [x2, y2], [x3, y3], [x4, y4]], x, y);

@@ -711,3 +711,3 @@ index += 1;

if (!this.pageEl) {
this.pageEl = docAnnotatorUtil.getPageEl(this.annotatedElement, this.location.page);
this.pageEl = docUtil.getPageEl(this.annotatedElement, this.location.page);
}

@@ -714,0 +714,0 @@ return this.pageEl;

@@ -10,3 +10,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationDialog from '../AnnotationDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as util from '../util';

@@ -44,3 +44,3 @@ var PAGE_PADDING_TOP = 15;

pageEl.appendChild(this.element);
annotatorUtil.showElement(this.element);
util.showElement(this.element);
var dialogDimensions = this.element.getBoundingClientRect();

@@ -60,3 +60,3 @@ var dialogWidth = dialogDimensions.width;

// else we can do
dialogLeftX = annotatorUtil.repositionCaret(this.element, dialogLeftX, dialogWidth, threadIconLeftX, pageDimensions.width);
dialogLeftX = util.repositionCaret(this.element, dialogLeftX, dialogWidth, threadIconLeftX, pageDimensions.width);

@@ -63,0 +63,0 @@ // Position the dialog

@@ -15,5 +15,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import DocPointDialog from './DocPointDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as docAnnotatorUtil from './docAnnotatorUtil';
import { STATES } from '../annotationConstants';
import * as util from '../util';
import * as docUtil from './docUtil';
import { STATES } from '../constants';

@@ -49,3 +49,3 @@ var PAGE_PADDING_TOP = 15;

// Don't show dialog if user can annotate and there is a current selection
if (this.permissions.canAnnotate && docAnnotatorUtil.isSelectionPresent()) {
if (this.permissions.canAnnotate && docUtil.isSelectionPresent()) {
return;

@@ -73,6 +73,6 @@ }

var _docAnnotatorUtil$get = docAnnotatorUtil.getBrowserCoordinatesFromLocation(this.location, this.annotatedElement),
_docAnnotatorUtil$get2 = _slicedToArray(_docAnnotatorUtil$get, 2),
browserX = _docAnnotatorUtil$get2[0],
browserY = _docAnnotatorUtil$get2[1];
var _docUtil$getBrowserCo = docUtil.getBrowserCoordinatesFromLocation(this.location, this.annotatedElement),
_docUtil$getBrowserCo2 = _slicedToArray(_docUtil$getBrowserCo, 2),
browserX = _docUtil$getBrowserCo2[0],
browserY = _docUtil$getBrowserCo2[1];

@@ -87,3 +87,3 @@ // Position and append to page

annotatorUtil.showElement(this.element);
util.showElement(this.element);

@@ -95,7 +95,2 @@ if (this.state !== STATES.pending || this.isMobile && Object.keys(this.annotations).length === 0) {

this.showDialog();
// Force dialogs to reposition on re-render
if (!this.isMobile) {
this.dialog.position();
}
}

@@ -102,0 +97,0 @@

@@ -5,3 +5,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import { createLocation, round } from '../annotatorUtil';
import { createLocation, round } from '../util';

@@ -8,0 +8,0 @@ var DrawingPath = function () {

@@ -16,4 +16,4 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import DrawingContainer from './DrawingContainer';
import { getFirstAnnotation } from '../annotatorUtil';
import { STATES, DRAW_STATES, DRAW_RENDER_THRESHOLD, DRAW_BASE_LINE_WIDTH, DRAW_BORDER_OFFSET, DRAW_DASHED_SPACING, THREAD_EVENT } from '../annotationConstants';
import { getFirstAnnotation } from '../util';
import { STATES, DRAW_STATES, DRAW_RENDER_THRESHOLD, DRAW_BASE_LINE_WIDTH, DRAW_BORDER_OFFSET, DRAW_DASHED_SPACING, THREAD_EVENT } from '../constants';

@@ -20,0 +20,0 @@ var DrawingThread = function (_AnnotationThread) {

@@ -13,5 +13,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import ImagePointThread from './ImagePointThread';
import * as annotatorUtil from '../annotatorUtil';
import * as imageAnnotatorUtil from './imageAnnotatorUtil';
import { ANNOTATOR_EVENT, TYPES } from '../annotationConstants';
import * as util from '../util';
import * as imageUtil from './imageUtil';
import { ANNOTATOR_EVENT, TYPES } from '../constants';

@@ -80,4 +80,4 @@ var IMAGE_NODE_NAME = 'img';

var _annotatorUtil$getPag = annotatorUtil.getPageInfo(imageEl),
page = _annotatorUtil$getPag.page;
var _util$getPageInfo = util.getPageInfo(imageEl),
page = _util$getPageInfo.page;

@@ -99,3 +99,3 @@ // Location based only on image position

// Scale location coordinates according to natural image size
var scale = annotatorUtil.getScale(this.annotatedElement);
var scale = util.getScale(this.annotatedElement);
var rotation = Number(imageEl.getAttribute('data-rotation-angle'));

@@ -105,8 +105,8 @@

// compare to the element being rendered on and scale as appropriate
var _imageAnnotatorUtil$g = imageAnnotatorUtil.getLocationWithoutRotation(x / scale, y / scale, rotation, imageDimensions, scale);
var _imageUtil$getLocatio = imageUtil.getLocationWithoutRotation(x / scale, y / scale, rotation, imageDimensions, scale);
var _imageAnnotatorUtil$g2 = _slicedToArray(_imageAnnotatorUtil$g, 2);
var _imageUtil$getLocatio2 = _slicedToArray(_imageUtil$getLocatio, 2);
x = _imageAnnotatorUtil$g2[0];
y = _imageAnnotatorUtil$g2[1];
x = _imageUtil$getLocatio2[0];
y = _imageUtil$getLocatio2[1];
var dimensions = {

@@ -151,3 +151,3 @@ x: imageDimensions.width / scale,

var threadParams = this.getThreadParams(annotations, location, type);
if (!annotatorUtil.areThreadParamsValid(threadParams)) {
if (!util.areThreadParamsValid(threadParams)) {
this.handleValidationError();

@@ -154,0 +154,0 @@ return thread;

@@ -10,3 +10,3 @@ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

import AnnotationDialog from '../AnnotationDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as util from '../util';

@@ -41,3 +41,3 @@ var POINT_ANNOTATION_ICON_HEIGHT = 31;

this.annotatedElement.appendChild(this.element);
annotatorUtil.showElement(this.element);
util.showElement(this.element);
var dialogDimensions = this.element.getBoundingClientRect();

@@ -60,3 +60,3 @@ var dialogWidth = dialogDimensions.width;

var pageWidth = imageEl.clientWidth > this.annotatedElement.clientWidth ? imageEl.clientWidth : this.annotatedElement.clientWidth;
dialogLeftX = annotatorUtil.repositionCaret(this.element, dialogLeftX, dialogWidth, threadIconLeftX, pageWidth);
dialogLeftX = util.repositionCaret(this.element, dialogLeftX, dialogWidth, threadIconLeftX, pageWidth);

@@ -63,0 +63,0 @@ // Position the dialog

@@ -13,5 +13,5 @@ var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();

import ImagePointDialog from './ImagePointDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as imageAnnotatorUtil from './imageAnnotatorUtil';
import { STATES } from '../annotationConstants';
import * as util from '../util';
import * as imageUtil from './imageUtil';
import { STATES } from '../constants';

@@ -45,6 +45,6 @@ var POINT_ANNOTATION_ICON_HEIGHT = 31;

value: function show() {
var _imageAnnotatorUtil$g = imageAnnotatorUtil.getBrowserCoordinatesFromLocation(this.location, this.annotatedElement),
_imageAnnotatorUtil$g2 = _slicedToArray(_imageAnnotatorUtil$g, 2),
browserX = _imageAnnotatorUtil$g2[0],
browserY = _imageAnnotatorUtil$g2[1];
var _imageUtil$getBrowser = imageUtil.getBrowserCoordinatesFromLocation(this.location, this.annotatedElement),
_imageUtil$getBrowser2 = _slicedToArray(_imageUtil$getBrowser, 2),
browserX = _imageUtil$getBrowser2[0],
browserY = _imageUtil$getBrowser2[1];

@@ -58,3 +58,3 @@ // Position and append to image

annotatorUtil.showElement(this.element);
util.showElement(this.element);

@@ -66,7 +66,2 @@ if (this.state !== STATES.pending || this.isMobile && Object.keys(this.annotations).length === 0) {

this.showDialog();
// Force dialogs to reposition on re-render
if (!this.isMobile) {
this.dialog.position();
}
}

@@ -73,0 +68,0 @@

{
"name": "box-annotations",
"version": "0.5.1",
"version": "0.6.0",
"description": "Box Annotations",

@@ -19,20 +19,20 @@ "author": "Box (https://www.box.com/)",

"devDependencies": {
"autoprefixer": "^7.1.6",
"autoprefixer": "^7.2.1",
"babel-cli": "^6.26.0",
"babel-core": "^6.25.0",
"babel-eslint": "^8.0.1",
"babel-core": "^6.26.0",
"babel-eslint": "^8.0.3",
"babel-loader": "^7.1.2",
"babel-plugin-istanbul": "^4.1.4",
"babel-plugin-transform-class-properties": "^6.23.0",
"babel-plugin-istanbul": "^4.1.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-plugin-transform-require-ignore": "0.1.1",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.0",
"babel-preset-es2016": "^6.22.0",
"babel-preset-react": "^6.23.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-plugin-transform-require-ignore": "^0.1.1",
"babel-polyfill": "^6.26.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-es2016": "^6.24.1",
"babel-preset-react": "^6.24.1",
"chai": "^4.1.2",
"chai-dom": "^1.5.0",
"commitlint": "^5.1.1",
"conventional-changelog-cli": "^1.3.2",
"chai-dom": "^1.6.0",
"commitlint": "^5.2.0",
"conventional-changelog-cli": "^1.3.5",
"conventional-github-releaser": "^2.0.0",

@@ -42,15 +42,15 @@ "cpx": "^1.5.0",

"cssnano-cli": "^1.0.5",
"eslint": "^4.12.0",
"eslint": "^4.12.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-config-prettier": "^2.9.0",
"eslint-import-resolver-webpack": "^0.8.3",
"eslint-plugin-babel": "^4.1.1",
"eslint-plugin-babel": "^4.1.2",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.2",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-react": "^7.5.1",
"extract-text-webpack-plugin": "^3.0.2",
"fetch-mock": "^5.12.1",
"fetch-mock": "^5.13.1",
"fetch-mock-forwarder": "^1.0.0",
"husky": "^0.14.3",
"karma": "^1.5.0",
"karma": "^1.7.1",
"karma-chai": "^0.1.0",

@@ -65,3 +65,3 @@ "karma-chai-dom": "^1.1.0",

"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.2",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.4",

@@ -71,3 +71,3 @@ "karma-sinon": "^1.0.5",

"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.4",
"karma-webpack": "^2.0.6",
"lint-staged": "^5.0.0",

@@ -79,8 +79,8 @@ "mocha": "^4.0.1",

"postcss-loader": "^2.0.9",
"prettier": "^1.5.3",
"prettier-eslint-cli": "^4.1.1",
"prettier": "^1.8.2",
"prettier-eslint-cli": "^4.4.2",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.6",
"sinon": "^4.1.2",
"sinon-chai": "^2.8.0",
"sinon-chai": "^2.14.0",
"sinon-stub-promise": "^4.0.0",

@@ -91,5 +91,5 @@ "style-loader": "^0.19.0",

"stylelint-order": "^0.7.0",
"stylelint-scss": "^2.1.0",
"webpack": "^3.8.1",
"webpack-bundle-analyzer": "^2.8.3",
"stylelint-scss": "^2.2.0",
"webpack": "^3.10.0",
"webpack-bundle-analyzer": "^2.9.1",
"whatwg-fetch": "^2.0.3"

@@ -96,0 +96,0 @@ },

[![Project Status](https://img.shields.io/badge/status-active-brightgreen.svg?style=flat-square)](http://opensource.box.com/badges/)
[![Styled With Prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
[![build status](https://img.shields.io/travis/box/box-content-preview/master.svg?style=flat-square)](https://travis-ci.org/box/box-annotations)
[![version](https://img.shields.io/badge/version-v0.5.1-blue.svg?style=flat-square)](https://github.com/box/box-annotations)
[![version](https://img.shields.io/badge/version-v0.6.0-blue.svg?style=flat-square)](https://github.com/box/box-annotations)
[![npm version](https://img.shields.io/npm/v/box-ui-elements.svg?style=flat-square)](https://www.npmjs.com/package/box-ui-elements)

@@ -23,3 +23,3 @@

-----------------
`en-AU`, `en-CA`, `en-GB`, `en-US`, `da-DK`, `de-DE`, `es-ES`, `fi-FI`, `fr-CA`, `fr-FR`, `it-IT`, `ja-JP`, `ko-KR`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `ru-RU`, `sv-SE`, `tr-TR`, `zh-CN`, `zh-TW`
`en-AU`, `en-CA`, `en-GB`, `en-US`, `bn-IN`, `da-DK`, `de-DE`, `es-419`, `es-ES`, `fi-FI`, `fr-CA`, `fr-FR`, `hi-IN`,`it-IT`, `ja-JP`, `ko-KR`, `nb-NO`, `nl-NL`, `pl-PL`, `pt-BR`, `ru-RU`, `sv-SE`, `tr-TR`, `zh-CN`, `zh-TW`

@@ -33,5 +33,7 @@ Usage

```javascript
/* global BoxAnnotations */
import BoxAnnotations from 'box-annotations/lib/BoxAnnotations.js'
import 'box-annotations/lib/Annotator.scss';
const boxAnnotations = new BoxAnnotations();
const annotatorConf = boxAnnotations.determineAnnotator(options, disabledAnnotationTypes);
const annotatorConf = boxAnnotations.determineAnnotator(options, viewerConfig, disabledAnnotationTypes);

@@ -43,3 +45,3 @@ // Construct and init annotator

```
Where `disabledAnnotationTypes` is a string of valid annotation types to disable. See [Enabling/Disabling Annotations and Annotation Types](#enablingdisabling-annotations-and-annotation-types) below for more details on viewer specific annotation configurations.
Where `viewerConfig` is an optional object of viewer-specific annotations options and `disabledAnnotationTypes` is an optional string array of valid annotation types to disable. See [Enabling/Disabling Annotations and Annotation Types](#enablingdisabling-annotations-and-annotation-types) below for more details on viewer specific annotation configurations.

@@ -205,5 +207,7 @@ Parameters & Options

```javascript
/* global BoxAnnotations */
import BoxAnnotations from 'box-annotations/lib/BoxAnnotations.js'
import 'box-annotations/lib/Annotator.scss';
const boxAnnotations = new BoxAnnotations();
const annotatorConf = boxAnnotations.determineAnnotator(options, disabledAnnotationTypes);
const annotatorConf = boxAnnotations.determineAnnotator(options, viewerConfig, disabledAnnotationTypes);

@@ -210,0 +214,0 @@ // Construct and init annotator

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc