From cac185634d5cb6608b4a30060d05d98caf9fccdd Mon Sep 17 00:00:00 2001 From: Sli Date: Thu, 17 Oct 2024 18:21:51 +0200 Subject: [PATCH] Avoid keeping text after selecting item --- core/static/webpack/ajax-select-index.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/static/webpack/ajax-select-index.ts b/core/static/webpack/ajax-select-index.ts index b03ae32f..dc2389b5 100644 --- a/core/static/webpack/ajax-select-index.ts +++ b/core/static/webpack/ajax-select-index.ts @@ -80,9 +80,14 @@ export class AjaxSelect extends InheritedComponent<"select"> { }, }); + // Allow removing selected items by clicking on them this.widget.on("item_select", (item: TomItem) => { this.widget.removeItem(item); }); + // Remove typed text once an item has been selected + this.widget.on("item_add", () => { + this.widget.setTextboxValue(""); + }); } }