diff options
Diffstat (limited to 'ext/bg')
-rw-r--r-- | ext/bg/js/query-parser.js | 31 | ||||
-rw-r--r-- | ext/bg/search.html | 2 |
2 files changed, 19 insertions, 14 deletions
diff --git a/ext/bg/js/query-parser.js b/ext/bg/js/query-parser.js index 3217316d..16af77b2 100644 --- a/ext/bg/js/query-parser.js +++ b/ext/bg/js/query-parser.js @@ -21,12 +21,13 @@ */ class QueryParser extends EventDispatcher { - constructor({getOptionsContext, progressIndicatorVisible, documentUtil}) { + constructor({getOptionsContext, documentUtil}) { super(); this._getOptionsContext = getOptionsContext; - this._progressIndicatorVisible = progressIndicatorVisible; - this._selectedParser = null; this._documentUtil = documentUtil; + this._text = ''; + this._setTextToken = null; + this._selectedParser = null; this._parseResults = []; this._queryParser = document.querySelector('#query-parser-content'); this._queryParserModeContainer = document.querySelector('#query-parser-mode-container'); @@ -43,6 +44,10 @@ class QueryParser extends EventDispatcher { }); } + get text() { + return this._text; + } + prepare() { this._textScanner.prepare(); this._textScanner.on('searched', this._onSearched.bind(this)); @@ -63,18 +68,18 @@ class QueryParser extends EventDispatcher { } async setText(text) { - const overrideToken = this._progressIndicatorVisible.setOverride(true); - try { - this._setPreview(text); + this._text = text; + this._setPreview(text); - this._parseResults = await api.textParse(text, this._getOptionsContext()); - this._refreshSelectedParser(); + const token = {}; + this._setTextToken = token; + this._parseResults = await api.textParse(text, this._getOptionsContext()); + if (this._setTextToken !== token) { return; } - this._renderParserSelect(); - this._renderParseResult(); - } finally { - this._progressIndicatorVisible.clearOverride(overrideToken); - } + this._refreshSelectedParser(); + + this._renderParserSelect(); + this._renderParseResult(); } // Private diff --git a/ext/bg/search.html b/ext/bg/search.html index 7ba479ba..caa9106f 100644 --- a/ext/bg/search.html +++ b/ext/bg/search.html @@ -47,7 +47,7 @@ </div> </div> - <div class="scan-disable" id="query-parser-container"> + <div class="scan-disable" id="query-parser-container" hidden> <div id="query-parser-content"></div> </div> |