diff options
author | praschke <stel@comfy.monster> | 2023-08-16 11:49:39 +0100 |
---|---|---|
committer | praschke <stel@comfy.monster> | 2023-08-17 14:17:26 +0100 |
commit | 660aa2a7cf3b5771d02114a454555cd9785e759e (patch) | |
tree | 39a338a098c8d89539ca14deaa9d43c981e66724 /ext/js | |
parent | bc8425ec6b82ac2c8aa761ee4a94e2b6afedcad2 (diff) |
fix: window.getSelection() can return null on Firefox
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/language/text-scanner.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js index 6fa7a454..af5cc8fe 100644 --- a/ext/js/language/text-scanner.js +++ b/ext/js/language/text-scanner.js @@ -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; } } |