Skip to content

Commit

Permalink
fix: window.getSelection() can return null on Firefox
Browse files Browse the repository at this point in the history
  • Loading branch information
praschke committed Aug 17, 2023
1 parent bc8425e commit 660aa2a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ext/js/language/text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class TextScanner extends EventDispatcher {

if (value) {
this._hookEvents();
this._userHasNotSelectedAnythingManually = window.getSelection().isCollapsed;
const selection = window.getSelection();
this._userHasNotSelectedAnythingManually = (selection === null) ? true : selection.isCollapsed;
}
}

Expand Down

0 comments on commit 660aa2a

Please sign in to comment.