summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/search-query-parser.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js
index caace34b..e1e37d1c 100644
--- a/ext/bg/js/search-query-parser.js
+++ b/ext/bg/js/search-query-parser.js
@@ -34,12 +34,12 @@ class QueryParser {
this._queryParser = document.querySelector('#query-parser-content');
this._queryParserSelect = document.querySelector('#query-parser-select-container');
this._queryParserGenerator = new QueryParserGenerator();
- this._textScanner = new TextScanner(
- this._queryParser,
- () => [],
- []
- );
- this._textScanner.onSearchSource = this._onSearchSource.bind(this);
+ this._textScanner = new TextScanner({
+ node: this._queryParser,
+ ignoreElements: () => [],
+ ignorePoint: null,
+ search: this._search.bind(this)
+ });
}
async prepare() {
@@ -74,11 +74,11 @@ class QueryParser {
this._textScanner.searchAt(e.clientX, e.clientY, 'click');
}
- async _onSearchSource(textSource, cause) {
+ async _search(textSource, cause) {
if (textSource === null) { return null; }
const searchText = this._textScanner.getTextSourceContent(textSource, this._options.scanning.length);
- if (searchText.length === 0) { return; }
+ if (searchText.length === 0) { return null; }
const {definitions, length} = await apiTermsFind(searchText, {}, this._getOptionsContext());
if (definitions.length === 0) { return null; }