summaryrefslogtreecommitdiff
path: root/ext/js/language
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-01-31 08:40:57 -0500
committerGitHub <noreply@github.com>2024-01-31 13:40:57 +0000
commit2356223942a21d1683ac38eed8e7b9485f453d87 (patch)
tree4e97b53a9d4829378ebc60eb5b8e40b6f5b665ee /ext/js/language
parent87ed7c8affd3ade9d3cd2d9ed1a61dd5f224e473 (diff)
Document util + google docs util state refactor (#590)
* Remove static from GoogleDocsUtil since it has state * Create TextSourceGenerator * Remove DocumentUtil custom registrations * Use TextSourceGenerator
Diffstat (limited to 'ext/js/language')
-rw-r--r--ext/js/language/text-scanner.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/js/language/text-scanner.js b/ext/js/language/text-scanner.js
index accb53fd..6228a82c 100644
--- a/ext/js/language/text-scanner.js
+++ b/ext/js/language/text-scanner.js
@@ -39,7 +39,8 @@ export class TextScanner extends EventDispatcher {
searchTerms = false,
searchKanji = false,
searchOnClick = false,
- searchOnClickOnly = false
+ searchOnClickOnly = false,
+ textSourceGenerator
}) {
super();
/** @type {HTMLElement|Window} */
@@ -58,6 +59,8 @@ export class TextScanner extends EventDispatcher {
this._searchOnClick = searchOnClick;
/** @type {boolean} */
this._searchOnClickOnly = searchOnClickOnly;
+ /** @type {import('../dom/text-source-generator').TextSourceGenerator} */
+ this._textSourceGenerator = textSourceGenerator;
/** @type {boolean} */
this._isPrepared = false;
@@ -1274,7 +1277,7 @@ export class TextScanner extends EventDispatcher {
return;
}
- const textSource = DocumentUtil.getRangeFromPoint(x, y, {
+ const textSource = this._textSourceGenerator.getRangeFromPoint(x, y, {
deepContentScan: this._deepContentScan,
normalizeCssZoom: this._normalizeCssZoom
});