summaryrefslogtreecommitdiff
path: root/ext/js/language
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-09-27 19:07:28 -0400
committerGitHub <noreply@github.com>2021-09-27 19:07:28 -0400
commitb0f6c41f5dc7f498f2948f846dd273bcb1bc1f0b (patch)
tree09f17dd0c6d549528d680c6f982efeb55610858d /ext/js/language
parentb784e5b11a596a456eb8879d394fde64bc63aaef (diff)
Search query offset value (#1968)
* Add type property to TextSource* classes * Use type property rather than instanceof * Expose a sentence offset value * Use offset added to URL * Improve fallback sentence for Anki note context
Diffstat (limited to 'ext/js/language')
-rw-r--r--ext/js/language/text-scanner.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js
index c7cedd7e..5d37c84b 100644
--- a/ext/js/language/text-scanner.js
+++ b/ext/js/language/text-scanner.js
@@ -17,7 +17,6 @@
/* global
* DocumentUtil
- * TextSourceElement
*/
class TextScanner extends EventDispatcher {
@@ -345,7 +344,7 @@ class TextScanner extends EventDispatcher {
if (result !== null) {
({dictionaryEntries, sentence, type} = result);
valid = true;
- } else if (textSource instanceof TextSourceElement && await this._hasJapanese(textSource.fullContent)) {
+ } else if (textSource !== null && textSource.type === 'element' && await this._hasJapanese(textSource.fullContent)) {
dictionaryEntries = [];
sentence = {sentence: '', offset: 0};
type = 'terms';