Skip to content

Commit

Permalink
Fix: Validate pendingThreadID when calling onSelectionChange() (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodsum committed Nov 16, 2017
1 parent 1f88d55 commit 10c1c98
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/doc/DocAnnotator.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ class DocAnnotator extends Annotator {
// Do nothing if in a text area or mobile dialog or mobile create dialog is already open
const isHidden = this.mobileDialogEl && this.mobileDialogEl.classList.contains(CLASS_HIDDEN);
const pointController = this.modeControllers[TYPES.point];
const isCreatingPoint = pointController && pointController.pendingThreadID !== null;
const isCreatingPoint = !!(pointController && pointController.pendingThreadID);
if (isCreatingPoint || !isHidden || document.activeElement.nodeName.toLowerCase() === 'textarea') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/doc/__tests__/DocAnnotator-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ describe('doc/DocAnnotator', () => {

annotator.highlighter = { removeAllHighlights: sandbox.stub() };
annotator.modeControllers = {
'point': { pendingThreadID: null }
'point': {}
};

stubs.getSelStub = sandbox.stub(window, 'getSelection');
Expand Down

0 comments on commit 10c1c98

Please sign in to comment.