diff options
Diffstat (limited to 'ext/js/display')
-rw-r--r-- | ext/js/display/display.js | 9 | ||||
-rw-r--r-- | ext/js/display/query-parser.js | 5 |
2 files changed, 10 insertions, 4 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 *'; diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js index eb053f38..178bb110 100644 --- a/ext/js/display/query-parser.js +++ b/ext/js/display/query-parser.js @@ -30,7 +30,7 @@ export class QueryParser extends EventDispatcher { /** * @param {import('display').QueryParserConstructorDetails} details */ - constructor({getSearchContext}) { + constructor({getSearchContext, textSourceGenerator}) { super(); /** @type {import('display').GetSearchContextCallback} */ this._getSearchContext = getSearchContext; @@ -62,7 +62,8 @@ export class QueryParser extends EventDispatcher { getSearchContext, searchTerms: true, searchKanji: false, - searchOnClick: true + searchOnClick: true, + textSourceGenerator }); /** @type {?(import('../language/japanese-wanakana.js'))} */ this._japaneseWanakanaModule = null; |