Replace typed token with selected dropdown token
This commit is contained in:
parent
f5719c2c48
commit
0c1c26c0bc
1 changed files with 8 additions and 1 deletions
|
@ -92,7 +92,14 @@
|
|||
}
|
||||
|
||||
static addWordToInput(word, addSpace) {
|
||||
const hasExistingValue = document.querySelector('.filtered-search').value.length !== 0;
|
||||
const filteredSearchValue = document.querySelector('.filtered-search').value;
|
||||
const hasExistingValue = filteredSearchValue.length !== 0;
|
||||
|
||||
const { lastToken } = gl.FilteredSearchTokenizer.processTokens(filteredSearchValue);
|
||||
if (lastToken.hasOwnProperty('key')) {
|
||||
document.querySelector('.filtered-search').value = filteredSearchValue.slice(0, -1 * (lastToken.value.length));
|
||||
}
|
||||
|
||||
document.querySelector('.filtered-search').value += hasExistingValue && addSpace ? ` ${word}` : word;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue