Skip to content

Commit

Permalink
Chore: Migrating annotations code into repo
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodsum committed Oct 24, 2017
1 parent 12aaab4 commit b5efd2a
Show file tree
Hide file tree
Showing 36 changed files with 76 additions and 74 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "box-annotations",
"version": "0.0.0",
"version": "0.0.8",
"description": "Box Annotations",
"author": "Box (https://www.box.com/)",
"license": "SEE LICENSE IN LICENSE",
Expand Down
2 changes: 1 addition & 1 deletion src/AnnotationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import autobind from 'autobind-decorator';
import EventEmitter from 'events';
import * as annotatorUtil from './annotatorUtil';
import * as constants from './annotationConstants';
import { ICON_CLOSE, ICON_DELETE } from '../icons/icons';
import { ICON_CLOSE, ICON_DELETE } from './icons/icons';

const POINT_ANNOTATION_ICON_HEIGHT = 31;
const POINT_ANNOTATION_ICON_DOT_HEIGHT = 8;
Expand Down
2 changes: 1 addition & 1 deletion src/AnnotationThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import autobind from 'autobind-decorator';
import Annotation from './Annotation';
import AnnotationService from './AnnotationService';
import * as annotatorUtil from './annotatorUtil';
import { ICON_PLACED_ANNOTATION } from '../icons/icons';
import { ICON_PLACED_ANNOTATION } from './icons/icons';
import {
STATES,
TYPES,
Expand Down
2 changes: 1 addition & 1 deletion src/Annotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import EventEmitter from 'events';
import autobind from 'autobind-decorator';
import AnnotationService from './AnnotationService';
import * as annotatorUtil from './annotatorUtil';
import { ICON_CLOSE } from '../icons/icons';
import { ICON_CLOSE } from './icons/icons';
import './Annotator.scss';
import {
CLASS_ACTIVE,
Expand Down
5 changes: 4 additions & 1 deletion src/Annotator.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import '../boxuiVariables';
@import 'boxui';
@import 'boxuiVariables';

$highlight-yellow: #fed94e;
$highlight-yellow-active-hover: #ffc900;
Expand Down Expand Up @@ -450,6 +451,8 @@ $tablet: 'max-width: 768px';

&:hover {
color: $better-black;
padding: 8px;
padding-left: 4px;
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/BoxAnnotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import ImageAnnotator from './image/ImageAnnotator';
import DrawingModeController from './drawing/DrawingModeController';
import { TYPES } from './annotationConstants';
import { canLoadAnnotations } from './annotatorUtil';
import './Annotator.scss';

/**
* NAME: The name of the annotator.
Expand Down Expand Up @@ -130,5 +131,4 @@ class BoxAnnotations {
}
}

global.BoxAnnotations = BoxAnnotations;
export default BoxAnnotations;
2 changes: 1 addition & 1 deletion src/MobileAnnotator.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '../_boxuiVariables';
@import 'boxuiVariables';

$tablet: "(min-width: 768px)";

Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/AnnotationDialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ let dialog;
const sandbox = sinon.sandbox.create();
let stubs = {};

describe('lib/annotations/AnnotationDialog', () => {
describe('AnnotationDialog', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/__tests__/AnnotationDialog-test.html');
fixture.load('__tests__/AnnotationDialog-test.html');

dialog = new AnnotationDialog({
annotatedElement: document.querySelector('.annotated-element'),
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/AnnotationModeController-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let annotationModeController;
let stubs;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/AnnotationModeController', () => {
describe('AnnotationModeController', () => {
beforeEach(() => {
annotationModeController = new AnnotationModeController();
stubs = {};
Expand Down
3 changes: 1 addition & 2 deletions src/__tests__/AnnotationService-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable no-unused-expressions */
import fetchMock from 'fetch-mock';
import '../../polyfill';
import Annotation from '../Annotation';
import AnnotationService from '../AnnotationService';

Expand All @@ -9,7 +8,7 @@ const API_HOST = 'https://app.box.com/api';
let annotationService;
let sandbox;

describe('lib/annotations/AnnotationService', () => {
describe('AnnotationService', () => {
beforeEach(() => {
sandbox = sinon.sandbox.create();
annotationService = new AnnotationService({
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/AnnotationThread-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ let thread;
const sandbox = sinon.sandbox.create();
let stubs = {};

describe('lib/annotations/AnnotationThread', () => {
describe('AnnotationThread', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/__tests__/AnnotationThread-test.html');
fixture.load('__tests__/AnnotationThread-test.html');

thread = new AnnotationThread({
annotatedElement: document.querySelector('.annotated-element'),
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/Annotator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ let annotator;
let stubs = {};
const sandbox = sinon.sandbox.create();

describe('lib/annotations/Annotator', () => {
describe('Annotator', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/__tests__/Annotator-test.html');
fixture.load('__tests__/Annotator-test.html');

const options = {
annotator: {
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/BoxAnnotations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let loader;
let stubs;
const sandbox = sinon.sandbox.create();

describe('lib/annotators/BoxAnnotations', () => {
describe('BoxAnnotations', () => {
beforeEach(() => {
stubs = {};
loader = new BoxAnnotations();
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/CommentBox-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
SELECTOR_ANNOTATION_BUTTON_POST
} from '../annotationConstants';

describe('lib/annotations/CommentBox', () => {
describe('CommentBox', () => {
const sandbox = sinon.sandbox.create();
let commentBox;
let parentEl;
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/annotatorUtil-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,16 @@ const DIALOG_WIDTH = 81;
const sandbox = sinon.sandbox.create();
let stubs = {};

describe('lib/annotations/annotatorUtil', () => {
describe('annotatorUtil', () => {
let childEl;
let parentEl;

before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/__tests__/annotatorUtil-test.html');
fixture.load('__tests__/annotatorUtil-test.html');

childEl = document.querySelector('.child');
parentEl = document.querySelector('.parent');
Expand Down
2 changes: 1 addition & 1 deletion src/doc/CreateHighlightDialog.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import EventEmitter from 'events';
import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../../icons/icons';
import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../icons/icons';
import CommentBox from '../CommentBox';
import { hideElement, showElement, generateBtn } from '../annotatorUtil';
import * as constants from '../annotationConstants';
Expand Down
2 changes: 1 addition & 1 deletion src/doc/DocAnnotator.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import rangy from 'rangy';
/* eslint-disable no-unused-vars */
// Workaround for rangy npm issue: https://github.com/timdown/rangy/issues/342
// Workaround for rangy npm issue: https://github.com/timdown/rangy/lib/issues/342
import rangyClassApplier from 'rangy/lib/rangy-classapplier';
import rangyHighlight from 'rangy/lib/rangy-highlighter';
import rangySaveRestore from 'rangy/lib/rangy-selectionsaverestore';
Expand Down
2 changes: 1 addition & 1 deletion src/doc/DocDrawingDialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import AnnotationDialog from '../AnnotationDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as constants from '../annotationConstants';
import { ICON_DRAW_SAVE, ICON_DRAW_DELETE } from '../../icons/icons';
import { ICON_DRAW_SAVE, ICON_DRAW_DELETE } from '../icons/icons';

class DocDrawingDialog extends AnnotationDialog {
/** @property {boolean} Whether or not the dialog is visible */
Expand Down
2 changes: 1 addition & 1 deletion src/doc/DocHighlightDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import autobind from 'autobind-decorator';
import AnnotationDialog from '../AnnotationDialog';
import * as annotatorUtil from '../annotatorUtil';
import * as docAnnotatorUtil from './docAnnotatorUtil';
import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../../icons/icons';
import { ICON_HIGHLIGHT, ICON_HIGHLIGHT_COMMENT } from '../icons/icons';
import * as constants from '../annotationConstants';

const CLASS_HIGHLIGHT_DIALOG = 'bp-highlight-dialog';
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/CreateHighlightDialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import * as annotatorUtil from '../../annotatorUtil';

const CLASS_CREATE_DIALOG = 'bp-create-annotation-dialog';

describe('lib/annotations/doc/CreateHighlightDialog', () => {
describe('doc/CreateHighlightDialog', () => {
const sandbox = sinon.sandbox.create();
let dialog;
let parentEl;
Expand All @@ -21,11 +21,11 @@ describe('lib/annotations/doc/CreateHighlightDialog', () => {
};

before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/CreateHighlightDialog-test.html');
fixture.load('doc/__tests__/CreateHighlightDialog-test.html');

const parentEl = document.querySelector('.bp-create-highlight-dialog-container');
dialog = new CreateHighlightDialog(parentEl, { localized });
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/DocAnnotator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ const sandbox = sinon.sandbox.create();

const CLASS_DEFAULT_CURSOR = 'bp-use-default-cursor';

describe('lib/annotations/doc/DocAnnotator', () => {
describe('doc/DocAnnotator', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/DocAnnotator-test.html');
fixture.load('doc/__tests__/DocAnnotator-test.html');

const options = {
annotator: {
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/DocDrawingDialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ let dialog;
let stubs;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/doc/DocDrawingDialog', () => {
describe('doc/DocDrawingDialog', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/DocDrawingDialog-test.html');
fixture.load('doc/__tests__/DocDrawingDialog-test.html');
dialog = new DocDrawingDialog({
annotatedElement: document.querySelector('.annotated-element'),
location: {},
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/DocDrawingThread-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ let thread;
let stubs;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/doc/DocDrawingThread', () => {
describe('doc/DocDrawingThread', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/DocDrawingThread-test.html');
fixture.load('doc/__tests__/DocDrawingThread-test.html');
thread = new DocDrawingThread({
annotationService: {
user: {
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/DocHighlightDialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ const DATA_TYPE_HIGHLIGHT_BTN = 'highlight-btn';
const DATA_TYPE_ADD_HIGHLIGHT_COMMENT = 'add-highlight-comment-btn';
const PAGE_PADDING_TOP = 15;

describe('lib/annotations/doc/DocHighlightDialog', () => {
describe('doc/DocHighlightDialog', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/DocHighlightDialog-test.html');
fixture.load('doc/__tests__/DocHighlightDialog-test.html');

dialog = new DocHighlightDialog({
annotatedElement: document.querySelector('.annotated-element'),
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/DocHighlightThread-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import {
let thread;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/doc/DocHighlightThread', () => {
describe('doc/DocHighlightThread', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/DocHighlightThread-test.html');
fixture.load('doc/__tests__/DocHighlightThread-test.html');

thread = new DocHighlightThread({
annotatedElement: document.querySelector('.annotated-element'),
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/DocPointDialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import * as docAnnotatorUtil from '../docAnnotatorUtil';
let dialog;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/doc/DocPointDialog', () => {
describe('doc/DocPointDialog', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/DocPointDialog-test.html');
fixture.load('doc/__tests__/DocPointDialog-test.html');

dialog = new DocPointDialog({
annotatedElement: document.querySelector('.annotated-element'),
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/DocPointThread-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { STATES } from '../../annotationConstants';
let pointThread;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/doc/DocPointThread', () => {
describe('doc/DocPointThread', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/DocPointThread-test.html');
fixture.load('doc/__tests__/DocPointThread-test.html');

pointThread = new DocPointThread({
annotatedElement: document.querySelector('.annotated-element'),
Expand Down
6 changes: 3 additions & 3 deletions src/doc/__tests__/docAnnotatorUtil-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import * as annotatorUtil from '../../annotatorUtil';
const sandbox = sinon.sandbox.create();
let stubs = {};

describe('lib/annotations/doc/docAnnotatorUtil', () => {
describe('doc/docAnnotatorUtil', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
fixture.load('annotations/doc/__tests__/docAnnotatorUtil-test.html');
fixture.load('doc/__tests__/docAnnotatorUtil-test.html');
});

afterEach(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/drawing/__tests__/DrawingContainer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import DrawingContainer from '../DrawingContainer';
let drawingContainer;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/drawing/DrawingContainer', () => {
describe('drawing/DrawingContainer', () => {
before(() => {
fixture.setBase('src/lib');
fixture.setBase('src');
});

beforeEach(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/drawing/__tests__/DrawingModeController-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let drawingModeController;
let stubs;
const sandbox = sinon.sandbox.create();

describe('lib/annotations/drawing/DrawingModeController', () => {
describe('drawing/DrawingModeController', () => {
beforeEach(() => {
drawingModeController = new DrawingModeController();
stubs = {};
Expand Down
Loading

0 comments on commit b5efd2a

Please sign in to comment.