From 5c8ae5f54b5458264774a2ecbe5bb170ae0ce2f6 Mon Sep 17 00:00:00 2001 From: KoloMl Date: Sat, 14 Dec 2024 23:48:16 +0400 Subject: [PATCH] Restore `-` prefix when sending autocomplete from mouse clicks --- assets/js/autocomplete.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/assets/js/autocomplete.ts b/assets/js/autocomplete.ts index f027e0d2..c26140c0 100644 --- a/assets/js/autocomplete.ts +++ b/assets/js/autocomplete.ts @@ -232,8 +232,12 @@ function listenAutocomplete() { const originalSuggestion = event.detail; applySelectedValue(originalSuggestion.value); + if (originalTerm?.startsWith('-')) { + originalSuggestion.value = `-${originalSuggestion.value}`; + } + inputField.dispatchEvent( - new CustomEvent('autocomplete', { + new CustomEvent('autocomplete', { detail: Object.assign( { type: 'click',