From 61e74154b6afe3961ba6eaba7b1e8cbfa58a52f9 Mon Sep 17 00:00:00 2001 From: Halfmai Date: Thu, 13 Oct 2022 11:44:17 +0800 Subject: [PATCH] fix missing dispatch event to gradio --- tagAutocomplete.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tagAutocomplete.js b/tagAutocomplete.js index b0a6fc7..92fe522 100644 --- a/tagAutocomplete.js +++ b/tagAutocomplete.js @@ -182,6 +182,10 @@ function insertTextAtCursor(text, tagword) { prompt = promptTextbox.value; promptTextbox.selectionEnd = promptTextbox.selectionStart; + // Since we've modified a Gradio Textbox component manually, we need to simulate an `input` DOM event to ensure its + // internal Svelte data binding remains in sync. + promptTextbox.dispatchEvent(new Event("input", { bubbles: true })); + // Hide results after inserting hideResults();