Handle case where docRangeFromPoint returns null
This commit is contained in:
parent
2edd4183a0
commit
c22f8252b9
@ -81,6 +81,9 @@ class Display {
|
|||||||
|
|
||||||
const clickedElement = $(e.target);
|
const clickedElement = $(e.target);
|
||||||
const textSource = docRangeFromPoint({x: e.clientX, y: e.clientY});
|
const textSource = docRangeFromPoint({x: e.clientX, y: e.clientY});
|
||||||
|
if (textSource === null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
textSource.setEndOffset(this.options.scanning.length);
|
textSource.setEndOffset(this.options.scanning.length);
|
||||||
|
|
||||||
const {definitions, length} = await apiTermsFind(textSource.text());
|
const {definitions, length} = await apiTermsFind(textSource.text());
|
||||||
|
Loading…
Reference in New Issue
Block a user