aboutsummaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-11-18 20:15:30 -0500
committerGitHub <noreply@github.com>2020-11-18 20:15:30 -0500
commit1588f6210cb41c0a9d9defaa3e0ae71754337cd5 (patch)
tree0c6745e9c55cdc6562ac4cac2252a4da12e6c635 /ext/bg
parente9075e24e16e64b2116f66dab9cf59cb7ee01361 (diff)
Display and query parser layout (#1043)
* Update query parser text assignment * Update how padding is used * Hide query parser container by default
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/js/query-parser.js31
-rw-r--r--ext/bg/search.html2
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>