Skip to content

Commit

Permalink
Fix: Search preview container for mobile annotations dialog (#209)
Browse files Browse the repository at this point in the history
- The annotation dialog can't search this.annotatedElement for the mobile dialog as it lives next to the preview itself. This was only an issue on mobile devices however, it prevented any dialogs from properly opening.
  • Loading branch information
pramodsum authored Jul 11, 2017
1 parent 6eeb432 commit 56e026a
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib/annotations/AnnotationDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const CLASS_ANIMATE_DIALOG = 'bp-animate-show-dialog';
super();

this.annotatedElement = data.annotatedElement;
this.container = data.container;
this.location = data.location;
this.hasAnnotations = data.annotations.length > 0;
this.canAnnotate = data.canAnnotate;
Expand Down Expand Up @@ -68,7 +69,7 @@ const CLASS_ANIMATE_DIALOG = 'bp-animate-show-dialog';
show() {
// Populate mobile annotations dialog with annotations information
if (this.isMobile) {
this.element = this.annotatedElement.querySelector(`.${constants.CLASS_MOBILE_ANNOTATION_DIALOG}`);
this.element = this.container.querySelector(`.${constants.CLASS_MOBILE_ANNOTATION_DIALOG}`);
annotatorUtil.showElement(this.element);
this.element.appendChild(this.dialogEl);

Expand Down
1 change: 1 addition & 0 deletions src/lib/annotations/AnnotationThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { ICON_PLACED_ANNOTATION } from '../icons/icons';
this.annotatedElement = data.annotatedElement;
this.annotations = data.annotations || [];
this.annotationService = data.annotationService;
this.container = data.container;
this.fileVersionId = data.fileVersionId;
this.location = data.location;
this.threadID = data.threadID || AnnotationService.generateID();
Expand Down
1 change: 1 addition & 0 deletions src/lib/annotations/__tests__/AnnotationDialog-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe('lib/annotations/AnnotationDialog', () => {

dialog = new AnnotationDialog({
annotatedElement: document.querySelector('.annotated-element'),
container: document,
location: {},
annotations: [],
canAnnotate: true
Expand Down
1 change: 1 addition & 0 deletions src/lib/annotations/doc/DocAnnotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ function isThreadInHoverState(thread) {
annotatedElement: this.annotatedElement,
annotations,
annotationService: this.annotationService,
container: this.container,
fileVersionId: this.fileVersionId,
isMobile: this.isMobile,
locale: this.locale,
Expand Down
1 change: 1 addition & 0 deletions src/lib/annotations/doc/DocHighlightThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ const HOVER_TIMEOUT_MS = 75;
createDialog() {
this.dialog = new DocHighlightDialog({
annotatedElement: this.annotatedElement,
container: this.container,
annotations: this.annotations,
locale: this.locale,
location: this.location,
Expand Down
1 change: 1 addition & 0 deletions src/lib/annotations/doc/DocPointThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const POINT_ANNOTATION_ICON_WIDTH = 24;
createDialog() {
this.dialog = new DocPointDialog({
annotatedElement: this.annotatedElement,
container: this.container,
annotations: this.annotations,
locale: this.locale,
location: this.location,
Expand Down
1 change: 1 addition & 0 deletions src/lib/annotations/image/ImageAnnotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const ANNOTATED_ELEMENT_SELECTOR = '.bp-image, .bp-images-wrapper';
annotatedElement: this.annotatedElement,
annotations,
annotationService: this.annotationService,
container: this.container,
fileVersionId: this.fileVersionId,
isMobile: this.isMobile,
locale: this.locale,
Expand Down
1 change: 1 addition & 0 deletions src/lib/annotations/image/ImagePointThread.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const POINT_ANNOTATION_ICON_WIDTH = 24;
createDialog() {
this.dialog = new ImagePointDialog({
annotatedElement: this.annotatedElement,
container: this.container,
annotations: this.annotations,
location: this.location,
locale: this.locale,
Expand Down

0 comments on commit 56e026a

Please sign in to comment.