From 2356223942a21d1683ac38eed8e7b9485f453d87 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 31 Jan 2024 08:40:57 -0500 Subject: Document util + google docs util state refactor (#590) * Remove static from GoogleDocsUtil since it has state * Create TextSourceGenerator * Remove DocumentUtil custom registrations * Use TextSourceGenerator --- ext/js/language/text-scanner.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ext/js/language') 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 }); -- cgit v1.2.3