summaryrefslogtreecommitdiff
path: root/ext/bg/js/search-query-parser.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-05-06 19:32:28 -0400
committerGitHub <noreply@github.com>2020-05-06 19:32:28 -0400
commitbb2d9501afc0e406b0dacf5675cd90985238be98 (patch)
treee6b3a32b93ea4a3485fcb0e91d95277b9c435b3c /ext/bg/js/search-query-parser.js
parent021ccb5ac3038f63d07ccc9575ee56480031a251 (diff)
Add apiModifySettings (#501)
* Update getProfile/getProfileFromContext to store this.options in a variable * Add useSchema parameter to options getter functions * Add apiModifySettings * Use apiModifySettings instead of apiOptionsSet * Remove apiOptionsSet * Fix incorrect deleteCount check * Require explicit scope for options * Throw on invalid scope
Diffstat (limited to 'ext/bg/js/search-query-parser.js')
-rw-r--r--ext/bg/js/search-query-parser.js22
1 files changed, 17 insertions, 5 deletions
diff --git a/ext/bg/js/search-query-parser.js b/ext/bg/js/search-query-parser.js
index 935f01f2..1c89583f 100644
--- a/ext/bg/js/search-query-parser.js
+++ b/ext/bg/js/search-query-parser.js
@@ -18,7 +18,7 @@
/* global
* QueryParserGenerator
* TextScanner
- * apiOptionsSet
+ * apiModifySettings
* apiTermsFind
* apiTextParse
* docSentenceExtract
@@ -72,8 +72,14 @@ class QueryParser extends TextScanner {
}
onParserChange(e) {
- const selectedParser = e.target.value;
- apiOptionsSet({parsing: {selectedParser}}, this.getOptionsContext());
+ const value = e.target.value;
+ apiModifySettings([{
+ action: 'set',
+ path: 'parsing.selectedParser',
+ value,
+ scope: 'profile',
+ optionsContext: this.getOptionsContext()
+ }], 'search');
}
getMouseEventListeners() {
@@ -92,8 +98,14 @@ class QueryParser extends TextScanner {
refreshSelectedParser() {
if (this.parseResults.length > 0) {
if (!this.getParseResult()) {
- const selectedParser = this.parseResults[0].id;
- apiOptionsSet({parsing: {selectedParser}}, this.getOptionsContext());
+ const value = this.parseResults[0].id;
+ apiModifySettings([{
+ action: 'set',
+ path: 'parsing.selectedParser',
+ value,
+ scope: 'profile',
+ optionsContext: this.getOptionsContext()
+ }], 'search');
}
}
}