diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-01-31 08:40:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-31 13:40:57 +0000 |
commit | 2356223942a21d1683ac38eed8e7b9485f453d87 (patch) | |
tree | 4e97b53a9d4829378ebc60eb5b8e40b6f5b665ee /ext/js/language | |
parent | 87ed7c8affd3ade9d3cd2d9ed1a61dd5f224e473 (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.js | 7 |
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 }); |