aboutsummaryrefslogtreecommitdiff
path: root/ext/js/display/query-parser.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/display/query-parser.js')
-rw-r--r--ext/js/display/query-parser.js10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js
index 178bb110..daa298d2 100644
--- a/ext/js/display/query-parser.js
+++ b/ext/js/display/query-parser.js
@@ -21,7 +21,6 @@ import {log} from '../core/logger.js';
import {querySelectorNotNull} from '../dom/query-selector.js';
import {convertHiraganaToKatakana, convertKatakanaToHiragana, isStringEntirelyKana} from '../language/japanese.js';
import {TextScanner} from '../language/text-scanner.js';
-import {yomitan} from '../yomitan.js';
/**
* @augments EventDispatcher<import('query-parser').Events>
@@ -30,8 +29,10 @@ export class QueryParser extends EventDispatcher {
/**
* @param {import('display').QueryParserConstructorDetails} details
*/
- constructor({getSearchContext, textSourceGenerator}) {
+ constructor({api, getSearchContext, textSourceGenerator}) {
super();
+ /** @type {import('../comm/api.js').API} */
+ this._api = api;
/** @type {import('display').GetSearchContextCallback} */
this._getSearchContext = getSearchContext;
/** @type {string} */
@@ -58,6 +59,7 @@ export class QueryParser extends EventDispatcher {
this._queryParserModeSelect = querySelectorNotNull(document, '#query-parser-mode-select');
/** @type {TextScanner} */
this._textScanner = new TextScanner({
+ api,
node: this._queryParser,
getSearchContext,
searchTerms: true,
@@ -128,7 +130,7 @@ export class QueryParser extends EventDispatcher {
/** @type {?import('core').TokenObject} */
const token = {};
this._setTextToken = token;
- this._parseResults = await yomitan.api.parseText(text, this._getOptionsContext(), this._scanLength, this._useInternalParser, this._useMecabParser);
+ this._parseResults = await this._api.parseText(text, this._getOptionsContext(), this._scanLength, this._useInternalParser, this._useMecabParser);
if (this._setTextToken !== token) { return; }
this._refreshSelectedParser();
@@ -214,7 +216,7 @@ export class QueryParser extends EventDispatcher {
scope: 'profile',
optionsContext
};
- yomitan.api.modifySettings([modification], 'search');
+ this._api.modifySettings([modification], 'search');
}
/**