Move selection to end of the selected term instead of the end of query

This commit is contained in:
KoloMl 2024-11-14 22:43:43 +04:00
parent 0523c0f400
commit 8e742b2549

View file

@ -25,6 +25,13 @@ function restoreOriginalValue() {
if (isSearchField(inputField) && originalQuery) { if (isSearchField(inputField) && originalQuery) {
inputField.value = originalQuery; inputField.value = originalQuery;
if (selectedTerm) {
const [, selectedTermEnd] = selectedTerm[0];
inputField.setSelectionRange(selectedTermEnd, selectedTermEnd);
}
return; return;
} }