mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: fix the problematic search stringify function
This commit is contained in:
6 files changed
+41
-6
No files matched your search
@@ -126,7 +126,6 @@
|
||||
"markdown-it-table-of-contents": "^0.6.0",
|
||||
"nunjucks": "^3.2.4",
|
||||
"schemastery-jsonschema": "^1.0.3",
|
||||
"search-query-parser": "^1.6.0",
|
||||
"streamsaver": "^2.0.6",
|
||||
"xss": "^1.0.14"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import parser, { SearchParserResult } from '@hydrooj/utils/lib/search';
|
||||
import $ from 'jquery';
|
||||
import _ from 'lodash';
|
||||
import parser from 'search-query-parser';
|
||||
import DomainSelectAutoComplete from 'vj/components/autocomplete/DomainSelectAutoComplete';
|
||||
import { ActionDialog, ConfirmDialog } from 'vj/components/dialog';
|
||||
import Dropdown from 'vj/components/dropdown/Dropdown';
|
||||
@@ -30,7 +30,7 @@ const parserOptions = {
|
||||
|
||||
function writeSelectionToInput() {
|
||||
const currentValue = $('[name="q"]').val() as string;
|
||||
const parsedCurrentValue = parser.parse(currentValue, parserOptions) as parser.SearchParserResult;
|
||||
const parsedCurrentValue = parser.parse(currentValue, parserOptions) as SearchParserResult;
|
||||
const q = parser.stringify({
|
||||
...parsedCurrentValue,
|
||||
category: selections,
|
||||
@@ -138,7 +138,7 @@ function buildCategoryFilter() {
|
||||
}
|
||||
|
||||
function parseCategorySelection() {
|
||||
const parsed = parser.parse($('[name="q"]').val() as string || '', parserOptions) as parser.SearchParserResult;
|
||||
const parsed = parser.parse($('[name="q"]').val() as string || '', parserOptions) as SearchParserResult;
|
||||
selections = _.uniq(parsed.category || []);
|
||||
updateSelection();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user