Commit 0c1c26c0 authored by Clement Ho's avatar Clement Ho

Replace typed token with selected dropdown token

parent f5719c2c
...@@ -92,7 +92,14 @@ ...@@ -92,7 +92,14 @@
} }
static addWordToInput(word, addSpace) { 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; document.querySelector('.filtered-search').value += hasExistingValue && addSpace ? ` ${word}` : word;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment