aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display/display.js
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/display/display.js
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/display/display.js')
-rw-r--r--ext/js/display/display.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index cff87309..c7a2775d 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -29,6 +29,7 @@ import {clone, deepEqual, promiseTimeout} from '../core/utilities.js';
import {PopupMenu} from '../dom/popup-menu.js';
import {querySelectorNotNull} from '../dom/query-selector.js';
import {ScrollElement} from '../dom/scroll-element.js';
+import {TextSourceGenerator} from '../dom/text-source-generator.js';
import {HotkeyHelpController} from '../input/hotkey-help-controller.js';
import {TextScanner} from '../language/text-scanner.js';
import {yomitan} from '../yomitan.js';
@@ -126,9 +127,12 @@ export class Display extends EventDispatcher {
this._queryParserVisibleOverride = null;
/** @type {HTMLElement} */
this._queryParserContainer = querySelectorNotNull(document, '#query-parser-container');
+ /** @type {TextSourceGenerator} */
+ this._textSourceGenerator = new TextSourceGenerator();
/** @type {QueryParser} */
this._queryParser = new QueryParser({
- getSearchContext: this._getSearchContext.bind(this)
+ getSearchContext: this._getSearchContext.bind(this),
+ textSourceGenerator: this._textSourceGenerator
});
/** @type {HTMLElement} */
this._contentScrollElement = querySelectorNotNull(document, '#content-scroll');
@@ -1829,7 +1833,8 @@ export class Display extends EventDispatcher {
searchTerms: true,
searchKanji: false,
searchOnClick: true,
- searchOnClickOnly: true
+ searchOnClickOnly: true,
+ textSourceGenerator: this._textSourceGenerator
});
this._contentTextScanner.includeSelector = '.click-scannable,.click-scannable *';
this._contentTextScanner.excludeSelector = '.scan-disable,.scan-disable *';